public class CounterIndex
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap |
hashOnName |
| Constructor and Description |
|---|
CounterIndex()
Create a new CounterIndex
|
| Modifier and Type | Method and Description |
|---|---|
int |
add(java.lang.String name)
Add a name-MOFID pair to the MofidIndex.
|
protected void |
addObj(java.lang.String name,
java.lang.Object id)
Add a name-Object pair to the NameIndex.
|
void |
clear()
Remove all name-Object pairs from the NameIndex.
|
int |
get(java.lang.String name)
get an integer by its name.
|
java.lang.Integer |
getIf(java.lang.String name)
get an integer by its name.
|
protected java.lang.Object |
getObj(java.lang.String name)
get an object by its name.
|
protected java.lang.Object |
getObjIf(java.lang.String name)
get an object by its name.
|
java.util.Iterator |
iterator()
iterate over entries
|
java.lang.String[] |
listNames()
return the names of all objects in the NameIndex, in no particular
order.
|
void |
read(java.io.DataInputStream dstrm)
read from a DataOutputStream
|
void |
read(java.io.InputStream strm)
deserialize the NameIndex from a stream.
|
protected java.lang.Object |
readObjectFromStream(java.io.DataInputStream strm)
read object from stream.
|
void |
remove(java.lang.String name)
Remove a name-Object pair from the NameIndex.
|
void |
setName(java.lang.String nm)
give object a name
|
java.lang.String |
toString()
return name set with setName
|
void |
write(java.io.DataOutputStream dstrm)
write to a DataOutputStream
|
void |
write(java.io.OutputStream strm)
serialize the NameIndex to a stream.
|
protected void |
writeObjectToStream(java.lang.Object obj,
java.io.DataOutputStream strm)
write object to stream.
|
public int get(java.lang.String name)
throws StorageException
name - the name associated with the integerStorageExceptionpublic java.lang.Integer getIf(java.lang.String name)
throws StorageException
name - the name associated with the integerStorageExceptionpublic int add(java.lang.String name)
throws StorageException
name - name of object to add to indexid - MOFID of object to addStorageExceptionpublic void write(java.io.DataOutputStream dstrm)
throws StorageException
StorageExceptionpublic void read(java.io.DataInputStream dstrm)
throws StorageException
StorageExceptionprotected void writeObjectToStream(java.lang.Object obj,
java.io.DataOutputStream strm)
throws StorageException
obj - object to writestrm - stream to write it toStorageExceptionprotected java.lang.Object readObjectFromStream(java.io.DataInputStream strm)
throws StorageException
strm - stream to read fromStorageExceptionpublic void setName(java.lang.String nm)
nm - name of NameIndexpublic java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.Object getObj(java.lang.String name)
throws StorageException
name - the name associated with the objectStorageExceptionprotected java.lang.Object getObjIf(java.lang.String name)
throws StorageException
name - the name associated with the objectStorageExceptionprotected void addObj(java.lang.String name,
java.lang.Object id)
throws StorageException
name - name of object to add to indexid - object to addStorageExceptionpublic void remove(java.lang.String name)
throws StorageException
name - name of object to rmove from indexStorageExceptionpublic void clear()
public java.lang.String[] listNames()
public java.util.Iterator iterator()
public void write(java.io.OutputStream strm)
throws StorageException
number of pairs
name of object 1 (in UTF-8)
Representation of object 1
... name of object N (in UTF-8)
Representation of object N
write in interface Streamablestrm - stream to serialize toStorageExceptionpublic void read(java.io.InputStream strm)
throws StorageException
read in interface Streamablestrm - stream to deserialize fromStorageExceptionCopyright © 2005-2012 Apache Software Foundation. All Rights Reserved.