|
Jacson | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.spieleck.app.ngramj.NGramImpl
public class NGramImpl
Class to modell a concrete and simple NGram.
To make it slightly more interestion (and efficient), those NGrams follow a Flyweight pattern! I.e. of each different NGram there will only be one instance in the System. This is a bit technical, but one can safely ignore this and just deliberately call newNGram().
Field Summary | |
---|---|
protected byte[] |
bytes
|
protected static NGramImpl[] |
known
|
protected static int |
knownCount
|
protected static int |
knownStep
|
protected int |
size
|
Constructor Summary | |
---|---|
protected |
NGramImpl()
|
Method Summary | |
---|---|
static int |
appendCode(int h,
byte b)
scrambler for hashcodes... |
static int |
code(byte[] bytes,
int start,
int length)
Encode a byte sequence. |
boolean |
equals(byte[] bytes,
int start,
int length)
Compare a ngram to a bunch of bytes |
int |
getByte(int pos)
Return a single byte of the NGram. |
static int |
getKnownCount()
|
NGramImpl |
getNGramImpl()
Hand out a special representation of yourself |
static int |
getNGramImplCount()
|
int |
getSize()
Return the size of the ngram. |
int |
hashCode()
Override the hashCode by s.th. that allows to hash NGrams against tiny byte sequences. |
static NGram |
newNGram(byte[] bytes,
int start)
QuasiConstructor. |
static NGram |
newNGram(byte[] bytes,
int start,
int length)
QuasiConstructor. |
static NGram |
newNGram(byte[] bytes,
int start,
int length,
boolean cacheObject)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected byte[] bytes
protected int size
protected static NGramImpl[] known
protected static int knownCount
protected static int knownStep
Constructor Detail |
---|
protected NGramImpl()
Method Detail |
---|
public static NGram newNGram(byte[] bytes, int start)
public static NGram newNGram(byte[] bytes, int start, int length)
public static NGram newNGram(byte[] bytes, int start, int length, boolean cacheObject)
public int getSize()
getSize
in interface NGram
public int getByte(int pos)
getByte
in interface NGram
ArrayIndexOutOfBoundException
- ...public static int getKnownCount()
public boolean equals(byte[] bytes, int start, int length)
NGram
equals
in interface NGram
public int hashCode()
hashCode
in class java.lang.Object
public static int code(byte[] bytes, int start, int length)
public static final int appendCode(int h, byte b)
public java.lang.String toString()
toString
in class java.lang.Object
public NGramImpl getNGramImpl()
NGram
getNGramImpl
in interface NGram
public static int getNGramImplCount()
|
spieleck.de | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |