net.sf.eos.analyzer
Class AbstractToken

java.lang.Object
  extended by net.sf.eos.analyzer.AbstractToken
All Implemented Interfaces:
Token, Metadata

public abstract class AbstractToken
extends Object
implements Token

Simple implementation for reuse.

Author:
Sascha Kohlmann

Field Summary
 
Fields inherited from interface net.sf.eos.analyzer.Token
DEFAULT_TYPE
 
Constructor Summary
AbstractToken(CharSequence tokenSequence)
          Creates a new token for the given sequence.
AbstractToken(CharSequence tokenSequence, Map<String,List<String>> metadata)
           
AbstractToken(CharSequence tokenSequence, String type)
           
AbstractToken(CharSequence tokenSequence, String type, Map<String,List<String>> metadata)
          Creates a new token for the given sequence for a special type.
AbstractToken(Token t)
          Copy constuctor.
 
Method Summary
 Map<String,List<String>> getMeta()
          Returns simple metadata.
 CharSequence getTokenText()
          Returns the text of a token.
 String getType()
          Returns the type of the token.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractToken

public AbstractToken(CharSequence tokenSequence)
Creates a new token for the given sequence. getType() returns the Token.DEFAULT_TYPE.

Parameters:
tokenSequence - the char sequence of the token. May not be null.
Throws:
IllegalArgumentException - if tokenSequence is null

AbstractToken

public AbstractToken(CharSequence tokenSequence,
                     Map<String,List<String>> metadata)

AbstractToken

public AbstractToken(CharSequence tokenSequence,
                     String type)

AbstractToken

public AbstractToken(Token t)
Copy constuctor.

Parameters:
t - the token to copy.

AbstractToken

public AbstractToken(CharSequence tokenSequence,
                     String type,
                     Map<String,List<String>> metadata)
Creates a new token for the given sequence for a special type.

Parameters:
tokenSequence - the char sequence of the token. May not be null.
type - the type of the token. May not be null.
Throws:
IllegalArgumentException - if tokenSequence or type are null
Method Detail

getTokenText

public CharSequence getTokenText()
Description copied from interface: Token
Returns the text of a token. The text may be a single word or a sequence of words, e.g. a sentence.

Specified by:
getTokenText in interface Token
Returns:
the character sequence of the token
See Also:
Token.getTokenText()

getType

public String getType()
Description copied from interface: Token
Returns the type of the token.

Specified by:
getType in interface Token
Returns:
the type of a token.
See Also:
Token.getType()

getMeta

public Map<String,List<String>> getMeta()
Description copied from interface: Metadata
Returns simple metadata. The content of the metadata depends on the implementation.

Specified by:
getMeta in interface Metadata
Returns:
implementation dependend metadata. Maybe null.
See Also:
Metadata.getMeta()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008. All Rights Reserved.