Package net.emustudio.edigen.nodes
Class Decoder
- java.lang.Object
-
- net.emustudio.edigen.nodes.TreeNode
-
- net.emustudio.edigen.nodes.Decoder
-
public class Decoder extends TreeNode
The root node of the instruction decoder subtree.
-
-
Field Summary
Fields Modifier and Type Field Description static intUNIT_SIZE_BITSSize (in bits) of one unit which decoder can read at once
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Accepts the visitor.RulegetRootRule()Returns the first starting rule.java.util.Set<java.lang.String>getRootRuleNames()Returns the starting rules names.java.util.Set<Rule>getRootRules()Returns all starting rule variants.voidsetRootRules(java.util.Set<Rule> rootRules)Set starting rules.TreeNodeshallowCopy()java.lang.StringtoString()Returns a string representation of the object.-
Methods inherited from class net.emustudio.edigen.nodes.TreeNode
acceptChildren, addChild, addChildren, addChildren, childCount, copy, dump, getChild, getChildren, getLine, getParent, hashCode, remove, setLine
-
-
-
-
Field Detail
-
UNIT_SIZE_BITS
public static final int UNIT_SIZE_BITS
Size (in bits) of one unit which decoder can read at once- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Decoder
public Decoder(java.util.Set<java.lang.String> declaredRootRuleNames)
Creates new decoder.- Parameters:
declaredRootRuleNames- explicitly define root rules of the decoder.
-
Decoder
public Decoder(java.lang.String... declaredRootRuleNames)
Creates new decoder.- Parameters:
declaredRootRuleNames- explicitly define root rules of the decoder.
-
Decoder
public Decoder()
Creates new decoder. Root rule will be the first child
-
-
Method Detail
-
getRootRuleNames
public java.util.Set<java.lang.String> getRootRuleNames()
Returns the starting rules names.- Returns:
- the root rules names
-
getRootRules
public java.util.Set<Rule> getRootRules()
Returns all starting rule variants. Note root rules must be explicitly set; having only declared root rule names is not enough.- Returns:
- root rules
-
getRootRule
public Rule getRootRule()
Returns the first starting rule.- Returns:
- the first root rule object
-
setRootRules
public void setRootRules(java.util.Set<Rule> rootRules)
Set starting rules. Size of declared root rules and root rules objects must be the same.- Parameters:
rootRules- root rule objects
-
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 a string representation of the object.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-
shallowCopy
public TreeNode shallowCopy()
- Specified by:
shallowCopyin classTreeNode
-
-