Class FixedWidthLongListLabel
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.labelling.AbstractLabel
-
- it.unimi.dsi.big.webgraph.labelling.AbstractLongListLabel
-
- it.unimi.dsi.big.webgraph.labelling.FixedWidthLongListLabel
-
public class FixedWidthLongListLabel extends AbstractLongListLabel
A list of longs represented in fixed width. The provided width must be smaller than 64. Each list is prefixed by its length written in γ coding.
-
-
Field Summary
-
Fields inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractLongListLabel
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 FixedWidthLongListLabel(java.lang.String... arg)
Creates a new fixed-width long label using the given key and width with an empty list.FixedWidthLongListLabel(java.lang.String key, int width)
Creates a new fixed-width label with an empty list.FixedWidthLongListLabel(java.lang.String key, int width, long[] value)
Creates a new fixed-width long label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Label
copy()
Returns a copy of this label.int
fixedWidth()
Returns -1 (the fixed width refers to a single long, not to the entire list).int
fromBitStream(it.unimi.dsi.io.InputBitStream inputBitStream, long sourceUnused)
Fills this label with data from the given input bit stream, knowing the source node of the arc.int
toBitStream(it.unimi.dsi.io.OutputBitStream outputBitStream, long sourceUnused)
Writes out this label to the given input bit stream, in self-delimiting form, knowing the source node of the arc.java.lang.String
toSpec()
Returns a string representing the specification of this label.java.lang.String
toString()
-
Methods inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractLongListLabel
attributeKeys, attributeTypes, equals, get, get, hashCode, wellKnownAttributeKey
-
Methods inherited from class it.unimi.dsi.big.webgraph.labelling.AbstractLabel
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort
-
-
-
-
Constructor Detail
-
FixedWidthLongListLabel
public FixedWidthLongListLabel(java.lang.String key, int width, long[] value)
Creates a new fixed-width long label.- Parameters:
key
- the (only) key of this label.width
- the label width (in bits).value
- the value of this label.
-
FixedWidthLongListLabel
public FixedWidthLongListLabel(java.lang.String key, int width)
Creates a new fixed-width label with an empty list.- Parameters:
key
- the (only) key of this label.width
- the label width (in bits).
-
FixedWidthLongListLabel
public FixedWidthLongListLabel(java.lang.String... arg)
Creates a new fixed-width long label using the given key and width with an empty list.- Parameters:
arg
- two strings containing the key and the width of this label.
-
-
Method Detail
-
copy
public Label copy()
Description copied from interface:Label
Returns 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.IOException
Description copied from interface:Label
Fills this label with data from the given input bit stream, knowing the source node of the arc. IfLabel.fixedWidth()
is not negative, the value returned must coincide withLabel.fixedWidth()
. This method is optional.- Parameters:
inputBitStream
- an input bit stream offering a label.sourceUnused
- the source node.- Returns:
- the number of bits read to fill this label.
- Throws:
java.io.IOException
-
toBitStream
public int toBitStream(it.unimi.dsi.io.OutputBitStream outputBitStream, long sourceUnused) throws java.io.IOException
Description copied from interface:Label
Writes out this label to the given input bit stream, in self-delimiting form, knowing the source node of the arc. IfLabel.fixedWidth()
is not negative, the value returned must coincide withLabel.fixedWidth()
. This method is optional.- Parameters:
outputBitStream
- an output bit stream where the label will be written.sourceUnused
- the source node.- Returns:
- the number of bits written.
- Throws:
java.io.IOException
-
fixedWidth
public int fixedWidth()
Returns -1 (the fixed width refers to a single long, not to the entire list).- Returns:
- -1;
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractLongListLabel
-
toSpec
public java.lang.String toSpec()
Description copied from interface:Label
Returns a string representing the specification of this label.Each label class can be instantiated in several ways (e.g.,
FixedWidthIntLabel
requires a name for the well-known attribute and a number of bits). This method must return a representation that can be used byObjectParser
to 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)
-
-