public class Dictionary extends Object implements Iterable<StringList>, SerializableArtifact
Constructor and Description |
---|
Dictionary()
Initializes an empty
Dictionary . |
Dictionary(boolean caseSensitive) |
Dictionary(InputStream in)
Initializes the
Dictionary from an existing dictionary resource. |
Modifier and Type | Method and Description |
---|---|
Set<String> |
asStringSet()
Gets this dictionary as a
Set<String> . |
boolean |
contains(StringList tokens)
Checks if this dictionary has the given entry.
|
boolean |
equals(Object obj) |
Class<?> |
getArtifactSerializerClass()
Gets the Serializer Class for
Dictionary |
int |
getMaxTokenCount() |
int |
getMinTokenCount() |
int |
hashCode() |
Iterator<StringList> |
iterator()
Retrieves an Iterator over all tokens.
|
static Dictionary |
parseOneEntryPerLine(Reader in)
Reads a dictionary which has one entry per line.
|
void |
put(StringList tokens)
Adds the tokens to the dictionary as one new entry.
|
void |
remove(StringList tokens)
Removes the given tokens form the current instance.
|
void |
serialize(OutputStream out)
Writes the current instance to the given
OutputStream . |
int |
size()
Retrieves the number of tokens in the current instance.
|
String |
toString() |
forEach, spliterator
public Dictionary()
Dictionary
.public Dictionary(boolean caseSensitive)
public Dictionary(InputStream in) throws IOException
Dictionary
from an existing dictionary resource.in
- InputStream
IOException
public void put(StringList tokens)
tokens
- the new entrypublic int getMinTokenCount()
public int getMaxTokenCount()
public boolean contains(StringList tokens)
tokens
- querypublic void remove(StringList tokens)
tokens
- filter tokenspublic Iterator<StringList> iterator()
iterator
in interface Iterable<StringList>
Iterator
public int size()
public void serialize(OutputStream out) throws IOException
OutputStream
.out
- OutputStream
IOException
public static Dictionary parseOneEntryPerLine(Reader in) throws IOException
in
- Reader
IOException
public Set<String> asStringSet()
Set<String>
. Only iterator()
,
size()
and contains(Object)
methods are implemented.
If this dictionary entries are multi tokens only the first token of the
entry will be part of the Set.public Class<?> getArtifactSerializerClass()
Dictionary
getArtifactSerializerClass
in interface SerializableArtifact
DictionarySerializer
Copyright © 2017 The Apache Software Foundation. All rights reserved.