Package com.storedobject.chart
Class GraphData.XYNode
java.lang.Object
com.storedobject.chart.GraphData.Node
com.storedobject.chart.GraphData.XYNode
- All Implemented Interfaces:
ComponentPart
,ComponentProperty
- Enclosing class:
GraphData<N extends GraphData.Node>
A concrete implementation of the
GraphData.Node
class representing a node in a 2D space.
This class extends the base functionality of GraphData.Node
to include x and y coordinates
for spatial positioning and provides methods to manipulate and retrieve these coordinates.- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.chart.GraphData.Node
name
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anXYNode
with the specified name.Creates anXYNode
instance with the specified name, x and y coordinates.XYNode
(String name, double x, double y, GraphData.Category category) Constructs an instance of XYNode with the given name, x and y coordinates, and an optional category.XYNode
(String name, GraphData.Category category) Constructs anXYNode
with the specified name and category. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Encode the JSON string with the properties of this.double
getX()
Retrieves the x-coordinate of this node.double
getY()
Retrieves the Y-coordinate value of this node.void
setX
(double x) Sets the x-coordinate for the node.void
setY
(double y) Sets the y-coordinate value.x
(double x) Sets the x-coordinate of this node and returns the current instance.y
(double y) Sets the y-coordinate value for the node and returns the node instance.Methods inherited from class com.storedobject.chart.GraphData.Node
connectTo, getCategory, getId, getName, getSerial, setCategory, setName, setSerial, streamEdges, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.chart.ComponentPart
className, getRenderingIndex, setRenderingIndex
-
Constructor Details
-
XYNode
Constructs anXYNode
with the specified name. The node is initialized withnull
as its category.- Parameters:
name
- the name of the node
-
XYNode
Constructs anXYNode
with the specified name and category. The x and y coordinates of the node are initialized to 0.- Parameters:
name
- The name of the node.category
- The category of the node. It can be null.
-
XYNode
Creates anXYNode
instance with the specified name, x and y coordinates.- Parameters:
name
- The name of the node.x
- The x-coordinate of the node.y
- The y-coordinate of the node.
-
XYNode
Constructs an instance of XYNode with the given name, x and y coordinates, and an optional category.- Parameters:
name
- The name of the node.x
- The x-coordinate of the node's position in 2D space.y
- The y-coordinate of the node's position in 2D space.category
- The category associated with this node. Can be null if no category is specified.
-
-
Method Details
-
getX
public double getX()Retrieves the x-coordinate of this node.- Returns:
- The x-coordinate as a double value.
-
x
Sets the x-coordinate of this node and returns the current instance.- Parameters:
x
- The x-coordinate to set.- Returns:
- The current instance of the node with the updated x-coordinate.
-
setX
public void setX(double x) Sets the x-coordinate for the node.- Parameters:
x
- The x-coordinate to set.
-
getY
public double getY()Retrieves the Y-coordinate value of this node.- Returns:
- the Y-coordinate as a double.
-
y
Sets the y-coordinate value for the node and returns the node instance.- Parameters:
y
- The y-coordinate value to set.- Returns:
- The updated instance of the node with the new y-coordinate value.
-
setY
public void setY(double y) Sets the y-coordinate value.- Parameters:
y
- The y-coordinate to set.
-
encodeJSON
Description copied from interface:ComponentProperty
Encode the JSON string with the properties of this.- Specified by:
encodeJSON
in interfaceComponentProperty
- Overrides:
encodeJSON
in classGraphData.Node
- Parameters:
sb
- Encoded JSON string to be appended to this.
-