de.ls5.jlearn.algorithms.packs
Class CWord

java.lang.Object
  extended by de.ls5.jlearn.algorithms.packs.CWord
All Implemented Interfaces:
Word, Serializable, Comparable<Word>

public final class CWord
extends Object
implements Word

Author:
fh
See Also:
Serialized Form

Constructor Summary
CWord(Word prefix, Symbol a)
           
 
Method Summary
 void addSymbol(Symbol symbol)
          add Symbol to word
 int compareTo(Word w)
           
 boolean equals(Object o)
           
 Symbol[] getSymbolArray()
          Assemble an array of symbols in this word
 Symbol getSymbolByIndex(int i)
          Return symbol that is at the supplied position
 List<Symbol> getSymbolList()
          Assemble a list of symbols in this word
 int hashCode()
           
 boolean isPrefixOf(Word w)
          Checks if this word is a prefix of the supplied word.
 int size()
          Determine number of symbols in this word
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CWord

public CWord(Word prefix,
             Symbol a)
Method Detail

addSymbol

public void addSymbol(Symbol symbol)
Description copied from interface: Word
add Symbol to word

Specified by:
addSymbol in interface Word

getSymbolArray

public Symbol[] getSymbolArray()
Description copied from interface: Word
Assemble an array of symbols in this word

Specified by:
getSymbolArray in interface Word
Returns:
array of symbols

getSymbolList

public List<Symbol> getSymbolList()
Description copied from interface: Word
Assemble a list of symbols in this word

Specified by:
getSymbolList in interface Word
Returns:
list of symbols

isPrefixOf

public boolean isPrefixOf(Word w)
Description copied from interface: Word
Checks if this word is a prefix of the supplied word.

Specified by:
isPrefixOf in interface Word
Returns:
true if this word is prefix, false otherwise

size

public int size()
Description copied from interface: Word
Determine number of symbols in this word

Specified by:
size in interface Word
Returns:
number of symbols in word

getSymbolByIndex

public Symbol getSymbolByIndex(int i)
Description copied from interface: Word
Return symbol that is at the supplied position

Specified by:
getSymbolByIndex in interface Word
Returns:
symbol at position i, null if no such symbol exists

compareTo

public int compareTo(Word w)
Specified by:
compareTo in interface Comparable<Word>

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2011. All Rights Reserved.