net.sourceforge.chaperon.model.lexicon
Class Lexeme

java.lang.Object
  extended by net.sourceforge.chaperon.model.lexicon.Lexeme

public class Lexeme
extends java.lang.Object

This class represents a lexeme within a lexicon. The lexeme associates a terminal symbol to a pattern.

Version:
CVS $Id: Lexeme.java,v 1.4 2003/12/09 19:55:52 benedikta Exp $
Author:
Stephan Michels

Constructor Summary
Lexeme()
          Create a lexeme.
Lexeme(Symbol symbol)
          Create a lexeme.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this lexeme.
 Pattern getDefinition()
          Return the definition.
 java.lang.String getLocation()
          Returns the location from the input source.
 Symbol getSymbol()
          Return the symbol for this lexeme.
 void setDefinition(Pattern definition)
          Set a pattern as definition for this lexeme.
 void setLocation(java.lang.String location)
          Set the location from the input source.
 void setSymbol(Symbol symbol)
          Set the terminal symbol for this lexeme.
 java.lang.String toString()
          Return a string representation of the lexeme.
 Violations validate()
          Validate the lexeme.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lexeme

public Lexeme()
Create a lexeme.


Lexeme

public Lexeme(Symbol symbol)
Create a lexeme.

Parameters:
symbol - Terminal symbol for this lexeme.
Method Detail

setSymbol

public void setSymbol(Symbol symbol)
Set the terminal symbol for this lexeme.

Parameters:
symbol - Terminal symbol.

getSymbol

public Symbol getSymbol()
Return the symbol for this lexeme.

Returns:
Terminal symbol.

setDefinition

public void setDefinition(Pattern definition)
Set a pattern as definition for this lexeme.

Parameters:
definition - Definition of the lexeme.

getDefinition

public Pattern getDefinition()
Return the definition.

Returns:
Definition of the lexeme.

setLocation

public void setLocation(java.lang.String location)
Set the location from the input source.

Parameters:
location - Location in the input source.

getLocation

public java.lang.String getLocation()
Returns the location from the input source.

Returns:
Location in the input source.

validate

public Violations validate()
Validate the lexeme.

Returns:
Return a list of violations, if this object isn't valid.

toString

public java.lang.String toString()
Return a string representation of the lexeme.

Overrides:
toString in class java.lang.Object
Returns:
String representation.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a clone of this lexeme.

Overrides:
clone in class java.lang.Object
Returns:
Clone of this lexeme.
Throws:
java.lang.CloneNotSupportedException - If an exception occurs during the cloning.


Copyright ? 2003 Chaperon project. All Rights Reserved.