Class AbstractIntLabel
java.lang.Object
it.unimi.dsi.big.webgraph.labelling.AbstractLabel
it.unimi.dsi.big.webgraph.labelling.AbstractIntLabel
- All Implemented Interfaces:
Label
,FlyweightPrototype<Label>
- Direct Known Subclasses:
FixedWidthIntLabel
,GammaCodedIntLabel
An abstract (single-attribute) integer label.
This class provides basic methods for a label holding an integer. Concrete implementations may impose further requirements on the integer.
Implementing subclasses must provide constructors, Label.copy()
,
Label.fromBitStream(it.unimi.dsi.io.InputBitStream, long)
, Label.toBitStream(it.unimi.dsi.io.OutputBitStream, long)
and possibly override toString()
.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
The key of the attribute represented by this label.int
The value of the attribute represented by this label.Fields inherited from interface it.unimi.dsi.big.webgraph.labelling.Label
EMPTY_LABEL_ARRAY, EMPTY_LABEL_BIG_ARRAY
-
Constructor Summary
ConstructorDescriptionAbstractIntLabel
(String key, int value) Creates an int label with given key and value. -
Method Summary
Modifier and TypeMethodDescriptionString[]
All attribute keys (in arbitrary order).Class<?>[]
The types of all attributes in the same order as they are returned byLabel.attributeKeys()
.boolean
get()
The value associated to the well-known attribute.The value associated to the attribute with given key.double
The value associated to the well-known attribute, provided that the latter has a type that fits a double.double
The value associated to the attribute with given key, provided that the latter has a type that fits a double.float
getFloat()
The value associated to the well-known attribute, provided that the latter has a type that fits a float.float
The value associated to the attribute with given key, provided that the latter has a type that fits a float.int
getInt()
The value associated to the well-known attribute, provided that the latter has a type that fits a int.int
The value associated to the attribute with given key, provided that the latter has a type that fits a int.long
getLong()
The value associated to the well-known attribute, provided that the latter has a type that fits a long.long
The value associated to the attribute with given key, provided that the latter has a type that fits a long.int
hashCode()
toString()
Returns the well-known attribute key.Methods inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractLabel
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShort
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface it.unimi.dsi.big.webgraph.labelling.Label
copy, fixedWidth, fromBitStream, getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShort, toBitStream, toSpec
-
Field Details
-
key
The key of the attribute represented by this label. -
value
public int valueThe value of the attribute represented by this label.
-
-
Constructor Details
-
AbstractIntLabel
Creates an int label with given key and value.- Parameters:
key
- the (only) key of this label.value
- the value of this label.
-
-
Method Details
-
wellKnownAttributeKey
Description copied from interface:Label
Returns the well-known attribute key.- Specified by:
wellKnownAttributeKey
in interfaceLabel
- Returns:
- the well-known attribute key.
-
attributeKeys
Description copied from interface:Label
All attribute keys (in arbitrary order).- Specified by:
attributeKeys
in interfaceLabel
- Returns:
- the keys of all attributes.
-
attributeTypes
Description copied from interface:Label
The types of all attributes in the same order as they are returned byLabel.attributeKeys()
.- Specified by:
attributeTypes
in interfaceLabel
- Returns:
- the type of all attributes.
-
get
Description copied from interface:Label
The value associated to the attribute with given key. -
getInt
Description copied from interface:Label
The value associated to the attribute with given key, provided that the latter has a type that fits a int. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getInt
in interfaceLabel
- Overrides:
getInt
in classAbstractLabel
- Parameters:
key
- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getLong
Description copied from interface:Label
The value associated to the attribute with given key, provided that the latter has a type that fits a long. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getLong
in interfaceLabel
- Overrides:
getLong
in classAbstractLabel
- Parameters:
key
- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getFloat
Description copied from interface:Label
The value associated to the attribute with given key, provided that the latter has a type that fits a float. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getFloat
in interfaceLabel
- Overrides:
getFloat
in classAbstractLabel
- Parameters:
key
- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getDouble
Description copied from interface:Label
The value associated to the attribute with given key, provided that the latter has a type that fits a double. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getDouble
in interfaceLabel
- Overrides:
getDouble
in classAbstractLabel
- Parameters:
key
- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
get
Description copied from interface:Label
The value associated to the well-known attribute. -
getInt
public int getInt()Description copied from interface:Label
The value associated to the well-known attribute, provided that the latter has a type that fits a int. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getInt
in interfaceLabel
- Overrides:
getInt
in classAbstractLabel
- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getLong
public long getLong()Description copied from interface:Label
The value associated to the well-known attribute, provided that the latter has a type that fits a long. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getLong
in interfaceLabel
- Overrides:
getLong
in classAbstractLabel
- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getFloat
public float getFloat()Description copied from interface:Label
The value associated to the well-known attribute, provided that the latter has a type that fits a float.- Specified by:
getFloat
in interfaceLabel
- Overrides:
getFloat
in classAbstractLabel
- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getDouble
public double getDouble()Description copied from interface:Label
The value associated to the well-known attribute, provided that the latter has a type that fits a double. Otherwise, anIllegalArgumentException
is thrown.- Specified by:
getDouble
in interfaceLabel
- Overrides:
getDouble
in classAbstractLabel
- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
toString
-
equals
-
hashCode
public int hashCode()
-