Class AbstractIntLabel
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.labelling.AbstractLabel
-
- it.unimi.dsi.big.webgraph.labelling.AbstractIntLabel
-
- Direct Known Subclasses:
FixedWidthIntLabel,GammaCodedIntLabel
public abstract class AbstractIntLabel extends AbstractLabel implements Label
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 overridetoString().
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringkeyThe key of the attribute represented by this label.intvalueThe 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
Constructors Constructor Description AbstractIntLabel(java.lang.String key, int value)Creates an int label with given key and value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]attributeKeys()All attribute keys (in arbitrary order).java.lang.Class<?>[]attributeTypes()The types of all attributes in the same order as they are returned byLabel.attributeKeys().booleanequals(java.lang.Object x)java.lang.Objectget()The value associated to the well-known attribute.java.lang.Objectget(java.lang.String key)The value associated to the attribute with given key.doublegetDouble()The value associated to the well-known attribute, provided that the latter has a type that fits a double.doublegetDouble(java.lang.String key)The value associated to the attribute with given key, provided that the latter has a type that fits a double.floatgetFloat()The value associated to the well-known attribute, provided that the latter has a type that fits a float.floatgetFloat(java.lang.String key)The value associated to the attribute with given key, provided that the latter has a type that fits a float.intgetInt()The value associated to the well-known attribute, provided that the latter has a type that fits a int.intgetInt(java.lang.String key)The value associated to the attribute with given key, provided that the latter has a type that fits a int.longgetLong()The value associated to the well-known attribute, provided that the latter has a type that fits a long.longgetLong(java.lang.String key)The value associated to the attribute with given key, provided that the latter has a type that fits a long.inthashCode()java.lang.StringtoString()java.lang.StringwellKnownAttributeKey()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
-
-
-
-
Method Detail
-
wellKnownAttributeKey
public java.lang.String wellKnownAttributeKey()
Description copied from interface:LabelReturns the well-known attribute key.- Specified by:
wellKnownAttributeKeyin interfaceLabel- Returns:
- the well-known attribute key.
-
attributeKeys
public java.lang.String[] attributeKeys()
Description copied from interface:LabelAll attribute keys (in arbitrary order).- Specified by:
attributeKeysin interfaceLabel- Returns:
- the keys of all attributes.
-
attributeTypes
public java.lang.Class<?>[] attributeTypes()
Description copied from interface:LabelThe types of all attributes in the same order as they are returned byLabel.attributeKeys().- Specified by:
attributeTypesin interfaceLabel- Returns:
- the type of all attributes.
-
get
public java.lang.Object get(java.lang.String key)
Description copied from interface:LabelThe value associated to the attribute with given key.
-
getInt
public int getInt(java.lang.String key)
Description copied from interface:LabelThe value associated to the attribute with given key, provided that the latter has a type that fits a int. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getIntin interfaceLabel- Overrides:
getIntin classAbstractLabel- Parameters:
key- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getLong
public long getLong(java.lang.String key)
Description copied from interface:LabelThe value associated to the attribute with given key, provided that the latter has a type that fits a long. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getLongin interfaceLabel- Overrides:
getLongin classAbstractLabel- Parameters:
key- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getFloat
public float getFloat(java.lang.String key)
Description copied from interface:LabelThe value associated to the attribute with given key, provided that the latter has a type that fits a float. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getFloatin interfaceLabel- Overrides:
getFloatin classAbstractLabel- Parameters:
key- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getDouble
public double getDouble(java.lang.String key)
Description copied from interface:LabelThe value associated to the attribute with given key, provided that the latter has a type that fits a double. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getDoublein interfaceLabel- Overrides:
getDoublein classAbstractLabel- Parameters:
key- the attribute key.- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
get
public java.lang.Object get()
Description copied from interface:LabelThe value associated to the well-known attribute.
-
getInt
public int getInt()
Description copied from interface:LabelThe value associated to the well-known attribute, provided that the latter has a type that fits a int. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getIntin interfaceLabel- Overrides:
getIntin classAbstractLabel- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getLong
public long getLong()
Description copied from interface:LabelThe value associated to the well-known attribute, provided that the latter has a type that fits a long. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getLongin interfaceLabel- Overrides:
getLongin classAbstractLabel- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getFloat
public float getFloat()
Description copied from interface:LabelThe value associated to the well-known attribute, provided that the latter has a type that fits a float.- Specified by:
getFloatin interfaceLabel- Overrides:
getFloatin classAbstractLabel- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
getDouble
public double getDouble()
Description copied from interface:LabelThe value associated to the well-known attribute, provided that the latter has a type that fits a double. Otherwise, anIllegalArgumentExceptionis thrown.- Specified by:
getDoublein interfaceLabel- Overrides:
getDoublein classAbstractLabel- Returns:
- the attribute value; if the attribute type is primitive, it is wrapped suitably.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-