|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodeblocks.BlockConnector
public class BlockConnector
BlockConnector
is a light class that describes the socket/plug information for each socket or plug of a particular Block.
Each socket has a kind (i.e. number, String, boolean, etc.), a label, and the block id of the block at that socket (not to be
confused with the block that hold the socket information - socket does not have a reference to that parent
block).
Nested Class Summary | |
---|---|
static class |
BlockConnector.PositionType
|
Constructor Summary | |
---|---|
BlockConnector(BlockConnector con)
Constucts a new BlockConnector by copying the connector information
from the specified con. |
|
BlockConnector(java.lang.String kind,
BlockConnector.PositionType positionType,
java.lang.String label,
boolean isLabelEditable,
boolean isExpandable,
java.lang.Long connBlockID)
Constructs a new BlockConnector |
|
BlockConnector(java.lang.String kind,
BlockConnector.PositionType positionType,
java.lang.String label,
boolean isLabelEditable,
boolean isExpandable,
java.lang.String expandGroup,
java.lang.Long connBlockID)
Constructs a new BlockConnector |
|
BlockConnector(java.lang.String label,
java.lang.String kind,
boolean isLabelEditable,
boolean isExpandable)
Constructs a new BlockConnector with the specified label and kind. |
|
BlockConnector(java.lang.String kind,
java.lang.String label,
java.lang.Long socketBlockID)
Constructs a new BlockConnector with a single position |
Method Summary | |
---|---|
java.lang.Long |
getBlockID()
Returns the block id attached (in) this socket |
java.lang.String |
getExpandGroup()
Returns the expand group of this connector, or an empty string ("") if the connector is not part of a group. |
java.lang.String |
getKind()
Returns the kind of this |
java.lang.String |
getLabel()
Returns the label of this |
BlockConnector.PositionType |
getPositionType()
Returns the PositionType of this |
java.lang.String |
getSaveString(java.lang.String conKind)
Returns the save string of this. |
java.lang.Object |
getState()
|
boolean |
hasBlock()
Returns true iff a block is attached to this socket; false otherwise |
boolean |
hasDefArg()
Returns true is this connector has a default argument; false otherwise |
java.lang.String |
initKind()
Returns the initial kind of this |
static BlockConnector |
instantiateFromState(java.lang.Object memento)
This is a way of generating a BlockConnector from a memento. |
boolean |
isExpandable()
Returns true iff this connector is expandable, meaning if a block is connected to it, it may cause another empty connector just like this to appear. |
boolean |
isLabelEditable()
Returns true iff this socket's label is editable. |
java.lang.Long |
linkDefArgument()
Connects this connector with its default argument, if it has any, and returns the block ID of the connected default argument or Block.NULL if there is none. |
static BlockConnector |
loadBlockConnector(org.w3c.dom.Node node,
java.util.HashMap<java.lang.Long,java.lang.Long> idMapping)
Loads information for a single BlockConnector and returns an instance of BlockConnector with the loaded information |
void |
loadState(java.lang.Object memento)
|
void |
setConnectorBlockID(java.lang.Long id)
Sets the socket block attached to this connector |
void |
setDefaultArgument(java.lang.String genusName,
java.lang.String label)
Sets this connector's default argument to the specified genus and initial label. |
void |
setKind(java.lang.String kind)
Sets the socket kind of this to the specified kind |
void |
setLabel(java.lang.String label)
Sets the socket label of this to specified label |
void |
setPositionType(BlockConnector.PositionType pos)
Sets the position type of this connector |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BlockConnector(java.lang.String kind, BlockConnector.PositionType positionType, java.lang.String label, boolean isLabelEditable, boolean isExpandable, java.lang.String expandGroup, java.lang.Long connBlockID)
BlockConnector
kind
- the kind of this socketpositionType
- the PositionType of connectorlabel
- the String label of this socketisLabelEditable
- is true iff this BlockConnector can have its labels edited.isExpandable
- whether this socket can expand into another connector when a block is connectedexpandGroup
- the expand socket group of this connectorconnBlockID
- the ID of the block connected to thispublic BlockConnector(java.lang.String kind, BlockConnector.PositionType positionType, java.lang.String label, boolean isLabelEditable, boolean isExpandable, java.lang.Long connBlockID)
BlockConnector
label
- the String label of this socketkind
- the kind of this socketisLabelEditable
- is true iff this BlockConnector can have its labels edited.isExpandable
- true if this socket can expand into another connector when a block is connected to thispositionType
- specifies the PositionType of connectorpublic BlockConnector(java.lang.String kind, java.lang.String label, java.lang.Long socketBlockID)
BlockConnector
with a single position
label
- the String label of this socketkind
- the kind of this socketsocketBlockID
- the block id attached to this socketpublic BlockConnector(java.lang.String label, java.lang.String kind, boolean isLabelEditable, boolean isExpandable)
BlockConnector
with the specified label and kind.
This new socket does not have an attached block.
label
- the String label of this socketisLabelEditable
- is true iff this BlockConnector can have its labels edited.kind
- the kind of this socketpublic BlockConnector(BlockConnector con)
BlockConnector
by copying the connector information
from the specified con. Copies the con's connector label and kind.
con
- the BlockConnector to copy fromMethod Detail |
---|
public java.lang.String getLabel()
public java.lang.String getKind()
public java.lang.String initKind()
public BlockConnector.PositionType getPositionType()
public java.lang.Long getBlockID()
public boolean hasBlock()
public boolean isExpandable()
public java.lang.String getExpandGroup()
public void setLabel(java.lang.String label)
label
- the desired labelpublic boolean isLabelEditable()
public void setKind(java.lang.String kind)
kind
- the desired kindpublic void setConnectorBlockID(java.lang.Long id)
id
- the block id of the desired block to attachpublic void setPositionType(BlockConnector.PositionType pos)
pos
- the desired PositionType for thispublic boolean hasDefArg()
public void setDefaultArgument(java.lang.String genusName, java.lang.String label)
genusName
- the desired BLockGenus name of the default agrumentlabel
- the initial label of the default argumentpublic java.lang.Long linkDefArgument()
public java.lang.String toString()
toString
in class java.lang.Object
public static BlockConnector loadBlockConnector(org.w3c.dom.Node node, java.util.HashMap<java.lang.Long,java.lang.Long> idMapping)
node
- the Node containing the desired information
public java.lang.String getSaveString(java.lang.String conKind)
conKind
- String containing if this is a socket or plug
public java.lang.Object getState()
getState
in interface ISupportMemento
public void loadState(java.lang.Object memento)
loadState
in interface ISupportMemento
public static BlockConnector instantiateFromState(java.lang.Object memento)
memento
- The state to load
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |