dk.brics.grammar
Class Entity

java.lang.Object
  extended by dk.brics.grammar.Entity
Direct Known Subclasses:
NonterminalEntity, TerminalEntity

public abstract class Entity
extends Object

Grammar production entity.


Constructor Summary
protected Entity(String label, String example)
          Constructs a new entity.
 
Method Summary
 String getExample()
          Returns the example string
 String getLabel()
          Returns the label of this entity.
 boolean isExplicitlyLabeled()
          Checks whether the label is explicit or auto-generated.
 boolean isLabeled()
          Returns true if this entity is labeled.
 void setLabel(String label)
          Sets the label.
abstract
<T> T
visitBy(EntityVisitor<T> v)
          Visits this entity with the given visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entity

protected Entity(String label,
                 String example)
          throws GrammarException
Constructs a new entity.

Parameters:
label - entity label, null if ignorable
example - example string, null if absent
Throws:
GrammarException - if example string does not match the entity
Method Detail

getExample

public String getExample()
Returns the example string

Returns:
example string, null if absent

getLabel

public String getLabel()
Returns the label of this entity.

Returns:
label, null if absent

isExplicitlyLabeled

public boolean isExplicitlyLabeled()
Checks whether the label is explicit or auto-generated.

Returns:
true if explicit
See Also:
isLabeled()

isLabeled

public boolean isLabeled()
Returns true if this entity is labeled.

Returns:
true if this entity is labeled
See Also:
isExplicitlyLabeled()

setLabel

public void setLabel(String label)
Sets the label.

Parameters:
label - new label

visitBy

public abstract <T> T visitBy(EntityVisitor<T> v)
Visits this entity with the given visitor.

Parameters:
v - entity visitor


Copyright © 2005-2008 Anders Møller.