Package net.emustudio.edigen.nodes
Class Variant
- java.lang.Object
-
- net.emustudio.edigen.nodes.TreeNode
-
- net.emustudio.edigen.nodes.Variant
-
public class Variant extends TreeNode
Rule variant node.One of the instruction decoder's task is to find out which variant of the particular rule matches against the part of the decoded instruction.
-
-
Constructor Summary
Constructors Constructor Description Variant()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Accepts the visitor.booleanequals(java.lang.Object o)java.lang.StringgetFieldName()Returns the generated field name if the variant returns a string.java.lang.StringgetReturnString()Returns the string which this variant returns.SubrulegetReturnSubrule()Returns the subrule which this variant returns.booleanreturns()Returns true if the variant returns a string or a subrule.voidsetReturnString(java.lang.String returnString)Tells the variant to return the string on match.voidsetReturnSubrule(Subrule returnRule)Tells the variant to return the value of the specified subrule.TreeNodeshallowCopy()java.lang.StringtoString()Returns the mask as a string in binary notation.-
Methods inherited from class net.emustudio.edigen.nodes.TreeNode
acceptChildren, addChild, addChildren, addChildren, childCount, copy, dump, getChild, getChildren, getLine, getParent, hashCode, remove, setLine
-
-
-
-
Method Detail
-
getReturnString
public java.lang.String getReturnString()
Returns the string which this variant returns.- Returns:
- the string, or null if the variant returns a subrule or nothing
-
setReturnString
public void setReturnString(java.lang.String returnString)
Tells the variant to return the string on match.- Parameters:
returnString- the string to return
-
getReturnSubrule
public Subrule getReturnSubrule()
Returns the subrule which this variant returns.- Returns:
- the subrule, or null if the variant returns a string or nothing
-
setReturnSubrule
public void setReturnSubrule(Subrule returnRule)
Tells the variant to return the value of the specified subrule.- Parameters:
returnRule- the subrule, must be contained in the pattern
-
returns
public boolean returns()
Returns true if the variant returns a string or a subrule.- Returns:
- true if the variant returns, false otherwise
-
getFieldName
public java.lang.String getFieldName()
Returns the generated field name if the variant returns a string.- Returns:
- the field name, or null if the variant does not return a string
-
accept
public void accept(Visitor visitor) throws SemanticException
Accepts the visitor.- Overrides:
acceptin classTreeNode- Parameters:
visitor- the visitor object- Throws:
SemanticException- depends on the specific visitor
-
toString
public java.lang.String toString()
Returns the mask as a string in binary notation.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
shallowCopy
public TreeNode shallowCopy()
- Specified by:
shallowCopyin classTreeNode
-
-