Jacson

de.spieleck.app.ngramj
Class CountedNGram

java.lang.Object
  extended by de.spieleck.app.ngramj.CountedNGram
All Implemented Interfaces:
NGram, java.lang.Comparable

public class CountedNGram
extends java.lang.Object
implements java.lang.Comparable, NGram

An n-gram attached with a counter.

Version:
$Revision: 2 $ $Date: 2006-03-27 23:00:21 +0200 (Mo, 27 Mrz 2006) $ $Author: nestefan $
Author:
Frank S. Nestel, $Author: nestefan $

Field Summary
protected  int count
           
protected  NGram gram
           
 
Constructor Summary
CountedNGram(byte[] ba, int start, int len)
           
CountedNGram(NGram ng)
           
 
Method Summary
 int compareTo(java.lang.Object e1)
           
 boolean equals(byte[] bytes, int start, int length)
          Compare a ngram to a bunch of bytes
 boolean equals(java.lang.Object e1)
           
 int getByte(int pos)
          Return a single byte of the NGram.
 int getCount()
           
 NGram getNGram()
           
 NGramImpl getNGramImpl()
          Hand out a special representation of yourself
 int getSize()
          Returns the size of an ngram in bytes.
 int hashCode()
           
 void inc()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

count

protected int count

gram

protected NGram gram
Constructor Detail

CountedNGram

public CountedNGram(NGram ng)

CountedNGram

public CountedNGram(byte[] ba,
                    int start,
                    int len)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getCount

public int getCount()

inc

public void inc()

getNGram

public NGram getNGram()

compareTo

public int compareTo(java.lang.Object e1)
Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object e1)
Overrides:
equals in class java.lang.Object

toString

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

getSize

public int getSize()
Description copied from interface: NGram
Returns the size of an ngram in bytes.

Specified by:
getSize in interface NGram

getByte

public int getByte(int pos)
Return a single byte of the NGram.

Specified by:
getByte in interface NGram
Throws:
ArrayIndexOutOfBoundException - (implicitly)

equals

public boolean equals(byte[] bytes,
                      int start,
                      int length)
Compare a ngram to a bunch of bytes

Specified by:
equals in interface NGram

getNGramImpl

public NGramImpl getNGramImpl()
Hand out a special representation of yourself

Specified by:
getNGramImpl in interface NGram

spieleck.de