Constructor
new GraphBuilderHost(graphBuilder, hostNum)
Constructs a GraphBuilder host with the provided number associated
with the provided graph builder.
Parameters:
Name | Type | Description |
---|---|---|
graphBuilder |
GraphBuilder | |
hostNum |
Number | The host number. The graph builder host with hostNum = i should be the ith host in the graphBuilder. |
- Source:
Methods
addNode(y, tmp) → {GraphBuilderNode}
Creates a GraphBuilderNode and adds it to this host.
Parameters:
Name | Type | Description |
---|---|---|
y |
Number | The y-coordinate of the node |
tmp |
Boolean | Whether the created node is temporary (i.e. user has not yet completed drawing action) |
- Source:
Returns:
the newly created and added node
- Type
- GraphBuilderNode
getColor() → {String}
Gets this hosts' own color
- Source:
Returns:
The color
- Type
- String
getConstraint() → {String}
Gets the constraint associated with this graphBuilderHost
- Source:
Returns:
- Type
- String
getConstraintSVG() → {svg.Element}
Gets the svg text element for showing a graph builder host has a constraint
- Source:
Returns:
The constraint text svg element
- Type
- svg.Element
getHostNum() → {Number}
Gets the host number associated with this graphBuilderHost
- Source:
Returns:
- Type
- Number
getHostSquare() → {svg.Element}
Gets the rectangle SVG associated with this graphBuilderHost
- Source:
Returns:
The rectangle svg
- Type
- svg.Element
getName() → {String}
Gets the name of this host that acts as an ID for this host.
- Source:
Returns:
the name of this host
- Type
- String
getNodes() → {Array.<GraphBuilderNode>}
Gets the nodes this host contains as an array.
- Source:
Returns:
the nodes as an array
- Type
- Array.<GraphBuilderNode>
getNodesSorted() → {Array.<GraphBuilderNode>}
Gets the nodes this host contains as an array sorted by the nodes' y values
in ascending order
- Source:
Returns:
the nodes as a sorted array
- Type
- Array.<GraphBuilderNode>
getX() → {svg.Element}
Gets the rectangle SVG associated with this graphBuilderHost
- Source:
Returns:
The rectangle svg
- Type
- svg.Element
removeAllNodes()
Removes all nodes from this host
- Source:
removeNode(node)
Removes the provided node from this host
Parameters:
Name | Type | Description |
---|---|---|
node |
GraphBuilderNode | the node to remove |
- Source:
setConstraint(constraint)
Sets the constraint associated with this graphBuilderHost
Parameters:
Name | Type | Description |
---|---|---|
constraint |
- Source:
setHostNum(hostNum)
Updates the host number associated with this graphBuilderHost
Parameters:
Name | Type | Description |
---|---|---|
hostNum |
Number |
- Source:
setLineYCoordinates(y1, y2)
Sets the y coordinates for the line segment of this host
Parameters:
Name | Type | Description |
---|---|---|
y1 |
Number | The top coordinate for the line |
y2 |
Number | The bottom coordinate for the line |
- Source: