public class SyntacticNode extends ComponentEntity implements SyntacticTerm
Inheriting classes should use protected methods for constructing representation from existing elements.
Modifier and Type | Class and Description |
---|---|
static class |
SyntacticNode.NodeType
Internal enum representing the types of nodes and
how they are ordered, compared, and categorized.
|
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.LinkedList<SyntacticPort> |
_inputs
List of references to ports syntactically marked as inputs.
|
protected java.util.LinkedList<SyntacticPort> |
_outputs
List of references to ports syntactically marked as outputs.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
SyntacticNode()
Create new instance of SyntacticNode with no connections.
|
SyntacticNode(CompositeEntity container,
java.lang.String name)
Construct an entity with the given name contained by the specified
entity.
|
SyntacticNode(Workspace workspace)
Create new instance of SyntacticNode with no connections.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
_makeMediatorIcon()
Generate icon for mediator node.
|
protected java.lang.String |
_makePermutationIcon(int[] permutation)
Generate icon for permutation node.
|
protected SyntacticPort |
_mapInputPort(Port port,
int offset)
Get the SyntacticPort corresponding to a channel of a represented
input port.
|
protected SyntacticPort |
_mapOutputPort(Port port,
int offset)
Get the SyntacticPort corresponding to a channel of a represented
output port.
|
int |
addPorts(Port port,
boolean isin)
Add a port node with a directionality.
|
java.lang.String |
boundaryCode()
Generate a string signifying the boundary of a node.
|
java.lang.String |
description(java.lang.String prefix,
java.lang.String suffix)
Print description of Node.
|
java.lang.String |
generateCode()
Generate code for node.
|
java.util.List<SyntacticNode> |
getConnectedNode(java.util.List<SyntacticPort> ports)
Get a unique list of connected nodes from a given list of ports.
|
SyntacticNode |
getConnectedNode(SyntacticPort port)
Get the connected node from a given port.
|
java.util.List<SyntacticNode> |
getDownstreamNodes()
Get a list of nodes immediately downstream from outgoing connections.
|
Port |
getExteriorPort()
Get the exterior Port syntactically represented by the node.
|
SyntacticPort |
getFirstInput()
Get the first input or return null.
|
SyntacticPort |
getFirstOutput()
Get the first output or return null.
|
java.lang.String |
getIdentifier()
Get string identifier (non-unique) for node.
|
java.util.List<SyntacticPort> |
getInputs()
Get the list of ordered inputs.
|
java.lang.String |
getLabel()
Get the label of the node.
|
double |
getLayoutVerticalSpace()
Get the vertical offset for visually representing node.
|
SyntacticNode.NodeType |
getNodeType()
Get the NodeType.
|
int |
getOrder()
Get the relative order of the node by types.
... which order?
|
java.util.List<SyntacticPort> |
getOutputs()
Get the list of ordered outputs.
|
Entity |
getRepresented()
Get the Entity syntactically represented by the node.
|
java.util.List<SyntacticNode> |
getUpstreamNodes()
Get a list of nodes immediately upstream from outgoing connections.
|
boolean |
hasCode()
Determine whether or not code should be generated.
|
java.lang.Integer |
inputIndex(SyntacticPort port)
Get index represented by the first channel of given port.
|
java.lang.Integer |
inputPortIndex(Port port)
Get index represented by the first channel of given port.
|
boolean |
isCap()
Determine whether node is a cap.
|
boolean |
isExterior()
Determine whether node represents an exterior port.
|
boolean |
isFeedback()
Determine whether node represents feedback.
|
boolean |
isIdentity()
Determine whether node represents an identity.
|
boolean |
isIncoming()
Determine whether node is incoming to the expression.
|
boolean |
isInitial()
Determine whether node is initial, having no inputs.
|
boolean |
isIsolated()
Determine whether node is isolated from the network.
|
boolean |
isMarked()
Get whether the node has been marked.
|
boolean |
isMediator()
Determine whether node represents a mediator.
|
boolean |
isOutgoing()
Determine whether node is outgoing to the expression.
|
boolean |
isPermutation()
Determine whether node is a permutation.
|
boolean |
isRepresentative()
Determine whether node represents an Entity or is purely syntactic.
|
boolean |
isTerminal()
Determine whether node is terminal, having no outputs.
|
boolean |
isVisited()
Get whether the node has been visited.
|
java.lang.Integer |
outputIndex(SyntacticPort port)
Get index represented by the first channel of given port.
|
java.lang.Integer |
outputPortIndex(Port port)
Get index represented by the first channel of given port.
|
SyntacticRank |
rank()
Get the Syntactic rank of the node.
|
void |
remark()
Recalculate properties of node.
|
boolean |
representEntity(Entity entity)
Represent an Entity and its ports for use in a SyntacticGraph.
|
void |
representExteriorPort(Port port)
Represent an exterior port with a purely syntactic Node.
|
void |
setCap(boolean direction)
Set node as a initial or terminal node in specified direction, true being out.
|
void |
setFeedback(boolean direction)
Set node as a feedback node in specified direction, true being feed out.
|
void |
setIdentity()
Set node as an identity.
|
void |
setLabel(java.lang.String label)
Set the label used to lexically represent the node.
|
void |
setLocation(double x,
double y)
Set the location of the node in layout.
|
void |
setMarked(boolean b)
Set the marked marker.
|
void |
setMediator(boolean direction,
int valence)
Set node as a mediator node in specified direction.
|
void |
setPermutation(int[] permutation)
Set node as a bijective permutation node with a specified permutation.
|
void |
setSyntactic(int inputs,
int outputs)
Set node as purely syntactic, not representing any Entity.
|
void |
setVisited(boolean b)
Set the visited marker.
|
int |
sizeInputs()
Get the number of inputs to the node.
|
int |
sizeOutputs()
Get the number of outputs to the node.
|
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setContainer, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, connectionsChanged, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDerivedLevel, getDerivedList, propagateValue
description, getDisplayName, getFullName, getName, getName
protected java.util.LinkedList<SyntacticPort> _inputs
protected java.util.LinkedList<SyntacticPort> _outputs
public SyntacticNode()
public SyntacticNode(Workspace workspace)
workspace
- Workspace in which to create the node.public SyntacticNode(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container entity.name
- The name of the entity.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the name coincides with
an entity already in the container.public boolean representEntity(Entity entity) throws IllegalActionException, NameDuplicationException
entity
- The Entity to be represented with the SyntacticNodeIllegalActionException
- If the entity is already represented,
if there is a problem getting the width or creating a port or attribute.NameDuplicationException
- If there is a problem
creating a port or attribute.public int addPorts(Port port, boolean isin) throws IllegalActionException, NameDuplicationException
port
- Port to addisin
- True if input, False if output.IllegalActionException
- If thrown while getting
the port width, creating a new port, creating a new
StringAttribute or setting the expression.NameDuplicationException
- If thrown while
creating a new port.public void representExteriorPort(Port port) throws IllegalActionException, NameDuplicationException
port
- The port to represent on the node.IllegalActionException
- If thrown while
creating a new port, creating a new cardinal attribute
or setting the cardinal expression.NameDuplicationException
- If thrown while
creating a new port or creating a new cardinal attribute.public void setSyntactic(int inputs, int outputs) throws IllegalActionException, NameDuplicationException
inputs
- Number of inputs.outputs
- Number of outputs.IllegalActionException
- If thrown while
creating a new port, creating a new cardinal attribute
or setting the cardinality.NameDuplicationException
- If thrown while
creating a new port or creating a new cardinal attribute.public void setIdentity() throws IllegalActionException, NameDuplicationException
IllegalActionException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.NameDuplicationException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.public void setFeedback(boolean direction) throws IllegalActionException, NameDuplicationException
direction
- The direction to make the feedback node.IllegalActionException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.NameDuplicationException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.public void setMediator(boolean direction, int valence) throws IllegalActionException, NameDuplicationException
direction
- The direction to make the mediator node.valence
- The amount of endpoints on the opposite side.IllegalActionException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.NameDuplicationException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.public void setCap(boolean direction) throws IllegalActionException, NameDuplicationException
direction
- The direction to make the cap node.IllegalActionException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.NameDuplicationException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.public void setPermutation(int[] permutation) throws IllegalActionException, NameDuplicationException
permutation
- The permutation to represent as the node.IllegalActionException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.NameDuplicationException
- If thrown while
setting the node as purely syntactic, not representing
any Entity.public SyntacticNode getConnectedNode(SyntacticPort port)
port
- The port to look out from.public java.util.List<SyntacticNode> getConnectedNode(java.util.List<SyntacticPort> ports)
ports
- The list of ports to look out from.public java.util.List<SyntacticNode> getDownstreamNodes()
public java.util.List<SyntacticNode> getUpstreamNodes()
public void remark()
public void setVisited(boolean b)
b
- State of the visited flag.public void setMarked(boolean b)
b
- State of the marked flag.public void setLabel(java.lang.String label)
label
- Label to set for node.getLabel()
public void setLocation(double x, double y) throws IllegalActionException, NameDuplicationException
x
- The x-coordinatey
- The y-coordinateIllegalActionException
- If thrown while
creating a new location or setting the coordinates
of the location.NameDuplicationException
- If thrown
while creating a new location.public double getLayoutVerticalSpace()
public java.lang.String getIdentifier()
public boolean isVisited()
public boolean isMarked()
public java.lang.Integer outputPortIndex(Port port)
port
- The Port represented in the node.public java.lang.Integer inputPortIndex(Port port)
port
- The Port represented in the node.public java.lang.Integer outputIndex(SyntacticPort port)
outputIndex
in interface SyntacticTerm
port
- The Port represented in the node.public java.lang.Integer inputIndex(SyntacticPort port)
inputIndex
in interface SyntacticTerm
port
- The Port represented in the node.public java.util.List<SyntacticPort> getInputs()
getInputs
in interface SyntacticTerm
public java.util.List<SyntacticPort> getOutputs()
getOutputs
in interface SyntacticTerm
public int sizeInputs()
sizeInputs
in interface SyntacticTerm
public int sizeOutputs()
sizeOutputs
in interface SyntacticTerm
public SyntacticRank rank()
rank
in interface SyntacticTerm
public java.lang.String boundaryCode()
public SyntacticPort getFirstInput()
public SyntacticPort getFirstOutput()
public int getOrder()
getOrder
in interface SyntacticTerm
public boolean isFeedback()
public boolean isIdentity()
public boolean isExterior()
public boolean isMediator()
public boolean isInitial()
public boolean isTerminal()
public boolean isIsolated()
public boolean isCap()
public boolean isPermutation()
public boolean isIncoming()
public boolean isOutgoing()
public boolean hasCode()
hasCode
in interface SyntacticTerm
public Entity getRepresented()
public Port getExteriorPort()
public SyntacticNode.NodeType getNodeType()
public java.lang.String getLabel()
setLabel(java.lang.String)
public boolean isRepresentative()
public java.lang.String generateCode()
generateCode
in interface SyntacticTerm
public java.lang.String description(java.lang.String prefix, java.lang.String suffix)
prefix
- Line prefix for embedding descriptionsuffix
- Line suffix for embedding descriptionprotected SyntacticPort _mapInputPort(Port port, int offset)
port
- Port represented.offset
- Offset channel of port, 0 if single port.protected SyntacticPort _mapOutputPort(Port port, int offset)
port
- Port represented.offset
- Offset channel of port, 0 if single port.protected java.lang.String _makePermutationIcon(int[] permutation) throws IllegalActionException, NameDuplicationException
permutation
- Array of permutation values.IllegalActionException
- If thrown while creating
a new variable with the name "_portSpread".NameDuplicationException
- If thrown while creating
a new variable with the name "_portSpread".*shprotected java.lang.String _makeMediatorIcon()