Record Class Item
java.lang.Object
java.lang.Record
org.libxmq.imp.ixml.earley.Item
- Record Components:
production- the production being matcheddot- how many symbols of the production have been matchedorigin- the input position where the production started
An Earley item: a production with a dot showing how much of it has been
matched, and the origin, the input position where the match started.
The item (S → S · '+' M, 0) in set 1 means: starting at position 0, the
input up to position 1 matches S, and now a '+' is expected.
-
Constructor Summary
ConstructorsConstructorDescriptionItem(Grammar.Production production, int dot, int origin) Creates an instance of aItemrecord class. -
Method Summary
Modifier and TypeMethodDescriptionadvance()The same item with the dot moved over the next symbol.intdot()Returns the value of thedotrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns true if all symbols have been matched.next()The symbol after the dot, the one expected next.intorigin()Returns the value of theoriginrecord component.Returns the value of theproductionrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Item
Creates an instance of aItemrecord class.- Parameters:
production- the value for theproductionrecord componentdot- the value for thedotrecord componentorigin- the value for theoriginrecord component
-
-
Method Details
-
isComplete
public boolean isComplete()Returns true if all symbols have been matched.- Returns:
- true if the dot is at the end
-
next
The symbol after the dot, the one expected next.- Returns:
- the symbol, or null if the item is complete
-
advance
The same item with the dot moved over the next symbol.- Returns:
- the advanced item
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
production
Returns the value of theproductionrecord component.- Returns:
- the value of the
productionrecord component
-
dot
-
origin
-