|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.itc.irst.tcc.sre.util.FeatureIndex
public class FeatureIndex
An object that maps features to indexes.
A FeatureIndex
cannot contain duplicate
features; each feature can map to at most one index.
FeatureIndex
Field Summary | |
---|---|
private int |
count
to do. |
(package private) static org.apache.log4j.Logger |
logger
Define a static logger variable so that it references the Logger instance named FeatureIndex . |
private java.util.SortedMap |
map
to do. |
private boolean |
readOnly
to do. |
Constructor Summary | |
---|---|
FeatureIndex(boolean readOnly)
Constructs a FeatureIndex object. |
|
FeatureIndex(boolean readOnly,
int count)
Constructs a FeatureIndex object. |
Method Summary | |
---|---|
void |
clear()
|
java.util.Set |
featureSet()
|
int |
getIndex(java.lang.String feature)
Returns the index of the specified feature and adds the feature to the index if it is not present yet. |
int |
put(java.lang.String feature)
Returns the index of the specified feature and adds the feature to the index if it is not present yet. |
void |
read(java.io.Reader in)
Reads the feature index from the specified input stream. |
int |
size()
|
java.lang.String |
toString()
Returns a String object representing this
Word . |
void |
write(java.io.Writer out)
Writes the feature index into the specified output stream in a format suitable for loading into a Map using the
write method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger logger
FeatureIndex
.
private java.util.SortedMap map
private int count
private boolean readOnly
Constructor Detail |
---|
public FeatureIndex(boolean readOnly)
FeatureIndex
object.
public FeatureIndex(boolean readOnly, int count)
FeatureIndex
object.
Method Detail |
---|
public int put(java.lang.String feature)
feature
- the feature.
public int size()
public int getIndex(java.lang.String feature)
feature
- the feature.
public java.util.Set featureSet()
public void clear()
public java.lang.String toString()
String
object representing this
Word
.
toString
in class java.lang.Object
public void write(java.io.Writer out) throws java.io.IOException
Map
using the
write
method.
out
- a Writer
object to
provide the underlying stream.
java.io.IOException
- if writing this feature index
to the specified output stream
throws an IOException
.public void read(java.io.Reader in) throws java.io.IOException
This method processes input in features of lines. A natural line of input is terminated either by a set of line terminator characters (\n or \r or \r\n) or by the end of the file. A natural line may be either a blank line, a comment line, or hold some part of a id-feature pair. Lines are read from the input stream until end of file is reached.
A natural line that contains only white space characters is considered blank and is ignored. A comment line has an ASCII '#' as its first non-white space character; comment lines are also ignored and do not encode id-feature information.
The id contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first '\t'. All remaining characters on the line become part of the associated feature string; if there are no remaining characters, the feature is the empty string "".
in
- a Reader
object to
provide the underlying stream.
java.io.IOException
- if reading this feature index
from the specified input stream
throws an IOException
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |