Package net.emustudio.edigen.nodes
Class Mask
- java.lang.Object
-
- net.emustudio.edigen.nodes.TreeNode
-
- net.emustudio.edigen.nodes.Mask
-
public class Mask extends TreeNode
Mask node - a sequence of bits used to filter another sequence during binary pattern matching.
-
-
Constructor Summary
Constructors Constructor Description Mask(BitSequence bits)Constructs the mask.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Accepts the visitor.Maskand(Mask other)Returns a mask ANDed with an another mask.booleanequals(java.lang.Object o)BitSequencegetBits()Returns the bit sequence.java.lang.IntegergetStart()Returns the starting offset relative to the variant start.inthashCode()voidsetStart(int start)Sets the starting offset relative to the variant start.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, remove, setLine
-
-
-
-
Constructor Detail
-
Mask
public Mask(BitSequence bits)
Constructs the mask.- Parameters:
bits- the bit sequence
-
-
Method Detail
-
getBits
public BitSequence getBits()
Returns the bit sequence.- Returns:
- the bit sequence
-
getStart
public java.lang.Integer getStart()
Returns the starting offset relative to the variant start. The result is null if it is not yet determined.- Returns:
- the starting offset, in bits
-
setStart
public void setStart(int start)
Sets the starting offset relative to the variant start.- Parameters:
start- the starting offset, in bits
-
and
public Mask and(Mask other)
Returns a mask ANDed with an another mask.- Parameters:
other- the second mask- Returns:
- the resulting mask
-
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
-
-