fri.patterns.interpreter.parsergenerator.lexer
Class Strategy.Item

java.lang.Object
  |
  +--fri.patterns.interpreter.parsergenerator.lexer.Strategy.Item
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable
Enclosing class:
Strategy

public static class Strategy.Item
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

The List item wrapper for toplevel consumers. Items can be sorted by their relevance. They encapsulate a consumer, its token symbol and the consumed lexer result.

See Also:
Serialized Form

Constructor Summary
Strategy.Item(java.lang.String symbol, fri.patterns.interpreter.parsergenerator.lexer.Consumer consumer)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Implements Comparable: delegates to character consumer.
 ResultTree consume(fri.patterns.interpreter.parsergenerator.lexer.InputText input)
          Consumes from input by delegating to contained consumer, stores the result.
 boolean equals(java.lang.Object o)
          Compares the contained consumer with other via "==".
 ResultTree getResultTree()
           
 java.lang.String getSymbol()
          Returns the lexer item symbol, enclosed in `backquotes` when not a literal.
 java.lang.String getTokenIdentifier()
          Returns the token symbol, always enclosed in some quotes.
 int hashCode()
          Returns the consumers hashcode.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Strategy.Item

public Strategy.Item(java.lang.String symbol,
                     fri.patterns.interpreter.parsergenerator.lexer.Consumer consumer)
Method Detail

consume

public ResultTree consume(fri.patterns.interpreter.parsergenerator.lexer.InputText input)
                   throws java.io.IOException
Consumes from input by delegating to contained consumer, stores the result.

java.io.IOException

getSymbol

public java.lang.String getSymbol()
Returns the lexer item symbol, enclosed in `backquotes` when not a literal.


getTokenIdentifier

public java.lang.String getTokenIdentifier()
Returns the token symbol, always enclosed in some quotes.


getResultTree

public ResultTree getResultTree()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Implements Comparable: delegates to character consumer. If they are equal, "terminals" are preferred.

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object o)
Compares the contained consumer with other via "==".

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the consumers hashcode.

Overrides:
hashCode in class java.lang.Object