public abstract class TypeMgr
extends java.lang.Object
A node or edge type manager manages integer numbers that are used to encode the type/attribute/label of a node or an edge. Such a type consists of a base type (30 bits) and flags (2 bits) that indicate a wildcard type and a special type. For wildcards and specials the base type may still be used to distinguish the actual types (e.g. distinguish different types of wildcards).
Modifier and Type | Field and Description |
---|---|
static int |
BASEMASK
the mask for the base type
|
static int |
FLAGMASK
the mask for the type flags
|
static int |
SPECIAL
the flag for a special type
|
static int |
WILDCARD
the flag for a wildcard type
|
Constructor and Description |
---|
TypeMgr() |
Modifier and Type | Method and Description |
---|---|
abstract int |
add(java.lang.String name)
Add a type to the type manager.
|
static int |
getBase(int code)
Get the base type (remove flags).
|
abstract int |
getCode(java.lang.String name)
Map a type name to the corresponding type code.
|
abstract java.lang.String |
getName(int code)
Map a type code to the corresponding type name.
|
abstract boolean |
isFixed()
Check whether a type manager is fixed (is not extendable).
|
static boolean |
isSpecial(int code)
Check whether a type code specifies a special type.
|
static boolean |
isWildcard(int code)
Check whether a type code specifies a wildcard.
|
public static final int BASEMASK
public static final int FLAGMASK
public static final int WILDCARD
public static final int SPECIAL
public abstract boolean isFixed()
public abstract int add(java.lang.String name)
If the name is already present, no new mapping is added, but the code already associated with the name is returned, thus automatically avoiding duplicate entries.
If the type manager does not allow for adding types and
the name is not present, this function should return
-1
.
name
- the name of the type-1
if the name does
not exist in this type manager and adding is not possibleisFixed()
public abstract int getCode(java.lang.String name)
name
- the name of the typepublic abstract java.lang.String getName(int code)
code
- the code of the typepublic static int getBase(int code)
code
- the code from which to get the base typepublic static boolean isWildcard(int code)
code
- the code of the type to checkpublic static boolean isSpecial(int code)
code
- the code of the type to check