medusa.graph
Class Node
- java.lang.Object
-
- medusa.graph.Node
-
- All Implemented Interfaces:
- java.io.Serializable
public class Node extends java.lang.Object implements java.io.SerializableThe Node object- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Node()Empty constructorNode(java.lang.String name)ConstructorNode(java.lang.String name, double x, double y)ConstructorNode(java.lang.String name, double x, double y, int shape)ConstructorNode(java.lang.String name, java.lang.Double x, java.lang.Double y, java.lang.Integer shape, java.awt.Color color)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcopyPosition(Node n)Copies x and y parameters from node n.booleanequals(java.lang.Object o)Compare two nodesjava.lang.StringgetAnnotation()Gets the current annotationjava.lang.StringgetAppletColorEntry()intgetCLuster()java.awt.ColorgetClusteringColor()java.awt.ColorgetColor()get primary colorjava.awt.ColorgetColor(int i)java.awt.ColorgetColor2()Secondary color.java.lang.StringgetColor2Entry()java.awt.ColorgetColor3()Get tertiary colorjava.lang.StringgetColor3Entry()java.lang.StringgetColor4Entry()java.lang.StringgetColorEntry()intgetConnections()Get number of nodes connected to this nodeintgetDataSpace1()Gets the optional datadoublegetDX()Get delta x.doublegetDY()Get y velocityjava.lang.StringgetLabel()Get node labelintgetShape()Get the current shape integer of the nodejava.lang.StringgetURL()doublegetX()Get x positiondoublegetY()Get y positioninthashCode()booleanisFixed()voidmanipulateChannel(int channel, int value)voidmanipulateColorElement(int a, int b, boolean doSwitch)Changes the color channels.java.lang.Stringreport()Reports the label, colors and annotation.voidrescale(int scale)Rescales the x and y positions.voidrescale(int xScale, int yScale)voidsetAnnotation(java.lang.String ann)Sets the annotation stringvoidsetCluster(java.lang.String ann)voidsetClusteringColor(java.awt.Color color)Set secondary colorvoidsetColor(java.awt.Color color)Set primary colorvoidsetColor(int i, java.awt.Color color)voidsetColor2(java.awt.Color color)Set secondary colorvoidsetColor3(java.awt.Color color)Set tertiary color.voidsetDataSpace1(int space)Additional data.voidsetDX(double dx)Sets velocityvoidsetDY(double dy)Set velocityvoidsetFixed(boolean fixed)voidsetLabel(java.lang.String lbl)Sets the node label.voidsetShape(int shape)Sets the shapevoidsetURL(java.lang.String ann)voidsetX(double x)Sets x positionvoidsetXY(double x, double y)voidsetY(double y)Sets y positionjava.lang.StringtoString()String representation of node
-
-
-
Constructor Detail
-
Node
public Node()
Empty constructor
-
Node
public Node(java.lang.String name)
Constructor- Parameters:
name- Label of node
-
Node
public Node(java.lang.String name, double x, double y)Constructor- Parameters:
name- labelx- x position (0.0-1.0)y- y position (0.0-1.0)
-
Node
public Node(java.lang.String name, double x, double y, int shape)Constructor- Parameters:
name-x-y-shape- Shape of node
-
Node
public Node(java.lang.String name, java.lang.Double x, java.lang.Double y, java.lang.Integer shape, java.awt.Color color)
-
-
Method Detail
-
toString
public java.lang.String toString()
String representation of node- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation of node
-
report
public java.lang.String report()
Reports the label, colors and annotation. Mostly for debugging- Returns:
- debug info
-
getX
public double getX()
Get x position- Returns:
- x position
-
rescale
public void rescale(int scale)
Rescales the x and y positions.- Parameters:
scale- the scaling factor
-
rescale
public void rescale(int xScale, int yScale)
-
setX
public void setX(double x)
Sets x position- Parameters:
x- position
-
getY
public double getY()
Get y position- Returns:
- y position
-
setY
public void setY(double y)
Sets y position- Parameters:
y- position
-
getDX
public double getDX()
Get delta x. This is the current velocity of the node- Returns:
- dX
-
setDX
public void setDX(double dx)
Sets velocity- Parameters:
dx- velocity
-
getDY
public double getDY()
Get y velocity- Returns:
- velocity
-
setDY
public void setDY(double dy)
Set velocity- Parameters:
dy- y velocity
-
getColor
public java.awt.Color getColor()
get primary color- Returns:
- Color
-
getColor
public java.awt.Color getColor(int i)
-
setColor
public void setColor(java.awt.Color color)
Set primary color- Parameters:
color- primary color
-
setColor
public void setColor(int i, java.awt.Color color)
-
getColor2
public java.awt.Color getColor2()
Secondary color. To make use of this color, you have to extend the node drawing method of the BasicGraphPanel. You can set the secondary and tertiary color by the switchesc2andc3in the graph data file- Returns:
- secondary color
-
setColor2
public void setColor2(java.awt.Color color)
Set secondary color- Parameters:
color- seconday color
-
getClusteringColor
public java.awt.Color getClusteringColor()
-
setClusteringColor
public void setClusteringColor(java.awt.Color color)
Set secondary color- Parameters:
color- seconday color
-
getColor3
public java.awt.Color getColor3()
Get tertiary color- Returns:
- tertiary color
-
setColor3
public void setColor3(java.awt.Color color)
Set tertiary color. SeegetColor2for details on how to use this color
-
isFixed
public boolean isFixed()
-
setFixed
public void setFixed(boolean fixed)
-
getShape
public int getShape()
Get the current shape integer of the node- Returns:
-
setShape
public void setShape(int shape)
Sets the shape- Parameters:
shape-
-
manipulateColorElement
public void manipulateColorElement(int a, int b, boolean doSwitch)Changes the color channels. Channels are R, G and B, channels can be copied or switched- Parameters:
a- channel to copy to. 0: red 1: green 2: blueb- channel to copy from.doSwitch- select true to switch channels a and b, false to copy intensity from channel b to channel a.
-
manipulateChannel
public void manipulateChannel(int channel, int value)- Parameters:
channel-value-
-
equals
public boolean equals(java.lang.Object o)
Compare two nodes- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object node- Returns:
- true if nodes are equal
-
getLabel
public java.lang.String getLabel()
Get node label- Returns:
- current label
-
setLabel
public void setLabel(java.lang.String lbl)
Sets the node label. This should not be used directly on nodes that are connected in a graph. Use the methods in Graph to rename nodes.- Parameters:
lbl- new label
-
setXY
public void setXY(double x, double y)
-
getConnections
public int getConnections()
Get number of nodes connected to this node- Returns:
- number of nodes
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
copyPosition
public void copyPosition(Node n)
Copies x and y parameters from node n.- Parameters:
n- node position to copy
-
getColorEntry
public java.lang.String getColorEntry()
-
getAppletColorEntry
public java.lang.String getAppletColorEntry()
-
getColor2Entry
public java.lang.String getColor2Entry()
-
getColor3Entry
public java.lang.String getColor3Entry()
-
getColor4Entry
public java.lang.String getColor4Entry()
-
setDataSpace1
public void setDataSpace1(int space)
Additional data. Should be overridden if you need more data- Parameters:
space- any integer
-
getDataSpace1
public int getDataSpace1()
Gets the optional data- Returns:
- data integer
-
setAnnotation
public void setAnnotation(java.lang.String ann)
Sets the annotation string- Parameters:
ann- annotation
-
getAnnotation
public java.lang.String getAnnotation()
Gets the current annotation- Returns:
- annotation
-
setURL
public void setURL(java.lang.String ann)
-
getURL
public java.lang.String getURL()
-
setCluster
public void setCluster(java.lang.String ann)
-
getCLuster
public int getCLuster()
-
-
DMelt 3.0 © DataMelt by jWork.ORG