|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.Numberer
public class Numberer
Gives unique integer serial numbers to a family of objects, identified
by a name space. A Numberer is like a collection of Index
es,
and for
many purposes it is more straightforward to use an Index, but
Numberer can be useful precisely because it maintains a global name
space for numbered object families, and provides facilities for mapping
across numberings within that space. At any rate, it's widely used in
some existing packages.
This implementation is not thread-safe and should be externally synchronised if a Numberer is being accessed from multiple threads.
Constructor Summary | |
---|---|
Numberer()
|
|
Numberer(Numberer numb)
Initialize a new Numberer with a copy of the contents of an existing Numberer. |
Method Summary | |
---|---|
static void |
clearGlobalNumberers()
|
static Numberer |
getGlobalNumberer(String type)
|
static Map<String,Numberer> |
getNumberers()
|
boolean |
hasSeen(Object o)
|
void |
lock()
|
int |
number(Object o)
|
static int |
number(String type,
Object o)
Get a number for an object in namespace type. |
Object |
object(int n)
|
static Object |
object(String type,
int n)
|
Set<Object> |
objects()
|
static void |
setGlobalNumberer(String key,
Numberer numb)
|
static void |
setNumberers(Map<String,Numberer> numbs)
You need to call this after deserializing Numberer objects to restore the global namespace, since static objects aren't serialized. |
String |
toString()
|
int |
total()
|
static int |
translate(String sourceType,
String targetType,
int n)
For an Object o that occurs in Numberers of type sourceType and targetType, translates the serial number n of o in the sourceType Numberer to the serial number in the targetType Numberer. |
void |
unlock()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Numberer()
public Numberer(Numberer numb)
Method Detail |
---|
public static Map<String,Numberer> getNumberers()
public static void clearGlobalNumberers()
public static void setNumberers(Map<String,Numberer> numbs)
public static void setGlobalNumberer(String key, Numberer numb)
public static Numberer getGlobalNumberer(String type)
public static int number(String type, Object o)
type
in the global
namespace map (creating it if none previously existed), and then
returns the appropriate number for the key.
public static Object object(String type, int n)
public static int translate(String sourceType, String targetType, int n)
public int total()
public void lock()
public void unlock()
public boolean hasSeen(Object o)
public Set<Object> objects()
public int number(Object o)
public Object object(int n)
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |