Class GammaCodedIntLabel
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.labelling.AbstractLabel
-
- it.unimi.dsi.big.webgraph.labelling.AbstractIntLabel
-
- it.unimi.dsi.big.webgraph.labelling.GammaCodedIntLabel
-
public class GammaCodedIntLabel extends AbstractIntLabel
A natural number represented in γ coding.
-
-
Field Summary
-
Fields inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractIntLabel
key, value
-
Fields inherited from interface it.unimi.dsi.big.webgraph.labelling.Label
EMPTY_LABEL_ARRAY, EMPTY_LABEL_BIG_ARRAY
-
-
Constructor Summary
Constructors Constructor Description GammaCodedIntLabel(java.lang.String... key)Creates a new γ-coded label using the given key and value 0.GammaCodedIntLabel(java.lang.String key, int value)Creates a new label with given key and value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GammaCodedIntLabelcopy()Returns a copy of this label.intfixedWidth()Returns -1 (as this label has not a fixed width).intfromBitStream(it.unimi.dsi.io.InputBitStream inputBitStream, long sourceUnused)Fills this label reading a γ-coded natural number from the given input bit stream.inttoBitStream(it.unimi.dsi.io.OutputBitStream outputBitStream, long sourceUnused)Writes this label as a γ-coded natural number to the given output bit stream.java.lang.StringtoSpec()Returns a string representing the specification of this label.java.lang.StringtoString()-
Methods inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractIntLabel
attributeKeys, attributeTypes, equals, get, get, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, hashCode, wellKnownAttributeKey
-
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
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShort
-
-
-
-
Constructor Detail
-
GammaCodedIntLabel
public GammaCodedIntLabel(java.lang.String key, int value)Creates a new label with given key and value.- Parameters:
key- the (only) key.value- the value of this label.
-
GammaCodedIntLabel
public GammaCodedIntLabel(java.lang.String... key)
Creates a new γ-coded label using the given key and value 0.- Parameters:
key- one string containing the key of this label.
-
-
Method Detail
-
copy
public GammaCodedIntLabel copy()
Description copied from interface:LabelReturns a copy of this label.- Returns:
- a new label that copies this one.
-
fromBitStream
public int fromBitStream(it.unimi.dsi.io.InputBitStream inputBitStream, long sourceUnused) throws java.io.IOExceptionFills this label reading a γ-coded natural number from the given input bit stream.- Parameters:
inputBitStream- an input bit stream.sourceUnused- the source node.- Returns:
- the number of bits read to fill this lbael.
- Throws:
java.io.IOException
-
toBitStream
public int toBitStream(it.unimi.dsi.io.OutputBitStream outputBitStream, long sourceUnused) throws java.io.IOExceptionWrites this label as a γ-coded natural number to the given output bit stream.- Parameters:
outputBitStream- an output bit stream.sourceUnused- the source node.- Returns:
- the number of bits written.
- Throws:
java.io.IOException
-
fixedWidth
public int fixedWidth()
Returns -1 (as this label has not a fixed width).- Returns:
- -1.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractIntLabel
-
toSpec
public java.lang.String toSpec()
Description copied from interface:LabelReturns a string representing the specification of this label.Each label class can be instantiated in several ways (e.g.,
FixedWidthIntLabelrequires a name for the well-known attribute and a number of bits). This method must return a representation that can be used byObjectParserto instantiate the class, and consequently there must exist a matching constructor whose arguments are strings.There is an equation that must be always satisfied:
ObjectParser.fromSpec(x.toSpec()).toSpec().equals(x.toSpec())
- Returns:
- a string representing the specification of this label.
- See Also:
ObjectParser.fromSpec(String, Class)
-
-