|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.webgraph.labelling.AbstractLabel
it.unimi.dsi.webgraph.labelling.AbstractIntLabel
it.unimi.dsi.webgraph.labelling.FixedWidthIntLabel
public class FixedWidthIntLabel
An integer represented in fixed width. The provided width must be smaller than 32.
Field Summary | |
---|---|
protected int |
width
The bit width used to represent the value of this label. |
Fields inherited from class it.unimi.dsi.webgraph.labelling.AbstractIntLabel |
---|
key, value |
Constructor Summary | |
---|---|
FixedWidthIntLabel(String... arg)
Creates a new fixed-width integer label using the given key and width with value 0. |
|
FixedWidthIntLabel(String key,
int width)
Creates a new fixed-width int label of value 0. |
|
FixedWidthIntLabel(String key,
int width,
int value)
Creates a new fixed-width int label. |
Method Summary | |
---|---|
Label |
copy()
Returns a copy of this label. |
int |
fixedWidth()
Returns the width of this label (as provided at construction time). |
int |
fromBitStream(InputBitStream inputBitStream,
int sourceUnused)
Fills this label with data from the given input bit stream, knowing the source node of the arc. |
int |
toBitStream(OutputBitStream outputBitStream,
int sourceUnused)
Writes out this label to the given input bit stream, in self-delimiting form, knowing the source node of the arc. |
String |
toSpec()
Returns a string representing the specification of this label. |
String |
toString()
|
Methods inherited from class it.unimi.dsi.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.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.webgraph.labelling.Label |
---|
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShort |
Field Detail |
---|
protected final int width
Constructor Detail |
---|
public FixedWidthIntLabel(String key, int width, int value)
key
- the (only) key of this label.width
- the label width (in bits).value
- the value of this label.public FixedWidthIntLabel(String key, int width)
key
- the (only) key of this label.width
- the label width (in bits).public FixedWidthIntLabel(String... arg)
arg
- two strings containing the key and the width of this label.Method Detail |
---|
public Label copy()
Label
public int fromBitStream(InputBitStream inputBitStream, int sourceUnused) throws IOException
Label
Label.fixedWidth()
is not negative, the value returned must coincide with Label.fixedWidth()
.
This method is optional.
inputBitStream
- an input bit stream offering a label.sourceUnused
- the source node.
IOException
public int toBitStream(OutputBitStream outputBitStream, int sourceUnused) throws IOException
Label
Label.fixedWidth()
is not negative, the value returned must coincide with Label.fixedWidth()
.
This method is optional.
outputBitStream
- an output bit stream where the label will be written.sourceUnused
- the source node.
IOException
public int fixedWidth()
public String toString()
toString
in class AbstractIntLabel
public String toSpec()
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 by ObjectParser
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() )
ObjectParser.fromSpec(String, Class)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |