org.jlab.hipo.data
Class HipoNode
- java.lang.Object
-
- org.jlab.hipo.data.HipoNode
-
public class HipoNode extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description HipoNode(byte[] buffer)Initialize HipoNode from a byte array.HipoNode(int group, int item, double[] value)HipoNode(int group, int item, float[] value)HipoNode(int group, int item, HipoNodeType type, int length)HipoNode(int group, int item, java.lang.String value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcreateNode(int group, int item, HipoNodeType type, int length)Creates a node for given typevoidcreateNode(int group, int item, java.lang.String value)byte[]getBufferData()returns the byte[] array of the bufferintgetBufferSize()returns the size of the buffer, including the header.byte[]getByte()bytegetByte(int index)returns a byte element from the array.intgetDataSize()returns number of elements in the data array.java.lang.StringgetDataString()returns string representation of the data.double[]getDouble()returns a float array containing the data from the node.doublegetDouble(int index)float[]getFloat()returns a float array containing the data from the node.floatgetFloat(int index)returns a float number of the element with given indexintgetGroup()returns the group id of the node.java.lang.StringgetHeaderString()returns a String with header information.int[]getInt()intgetInt(int index)intgetItem()returns the item id of the nodelonggetLong(int index)short[]getShort()shortgetShort(int index)returns the value of the short array for given index.java.lang.StringgetString()returns a String object from the node.HipoNodeTypegetType()returns type of the elements stored in the buffer.floatgetVectorX(int index)Get X component of the vector from the node with TYPE VECTOR3FfloatgetVectorY(int index)Get Y component of the vector from the node with TYPE VECTOR3FfloatgetVectorZ(int index)Get Z component of the vector from the node with TYPE VECTOR3Fstatic voidmain(java.lang.String[] args)main program for testsvoidsetByte(int index, byte value)Set content of the node with type BYTE, for element indexvoidsetDouble(int index, double value)voidsetFloat(int index, float value)voidsetInt(int index, int value)set integer value to the element of the nodevoidsetLong(int index, long value)voidsetShort(int index, short value)voidsetVector(int index, float x, float y, float z)sets all components for the vector with indexvoidsetVectorX(int index, float value)sets X component of the vector with indexvoidsetVectorY(int index, float value)sets X component of the vector with indexvoidsetVectorZ(int index, float value)sets X component of the vector with index
-
-
-
Constructor Detail
-
HipoNode
public HipoNode(int group, int item, HipoNodeType type, int length)
-
HipoNode
public HipoNode(int group, int item, java.lang.String value)
-
HipoNode
public HipoNode(int group, int item, float[] value)
-
HipoNode
public HipoNode(int group, int item, double[] value)
-
HipoNode
public HipoNode(byte[] buffer)
Initialize HipoNode from a byte array.- Parameters:
buffer- byte array with the data
-
-
Method Detail
-
createNode
public final void createNode(int group, int item, java.lang.String value)
-
createNode
public final void createNode(int group, int item, HipoNodeType type, int length)Creates a node for given type- Parameters:
group- group iditem- item idtype- type of the nodelength- number of elements in the node
-
getDataSize
public int getDataSize()
returns number of elements in the data array. This is not the buffer length.- Returns:
- n elements of the array if the node is a primitive data.
-
getBufferSize
public int getBufferSize()
returns the size of the buffer, including the header.- Returns:
- internal ByteBuffer size
-
getBufferData
public byte[] getBufferData()
returns the byte[] array of the buffer- Returns:
- array of bytes
-
getGroup
public int getGroup()
returns the group id of the node.- Returns:
- group id
-
getItem
public int getItem()
returns the item id of the node- Returns:
- item id
-
getDataString
public java.lang.String getDataString()
returns string representation of the data.- Returns:
- data string
-
getHeaderString
public java.lang.String getHeaderString()
returns a String with header information.- Returns:
- string representation of the header.
-
getType
public final HipoNodeType getType()
returns type of the elements stored in the buffer.- Returns:
-
getString
public java.lang.String getString()
returns a String object from the node. Strings are stored as byte[]. The data is copied into String.- Returns:
- String representation of byte array.
-
getByte
public byte getByte(int index)
returns a byte element from the array.- Parameters:
index- index of the element- Returns:
-
getByte
public byte[] getByte()
-
getFloat
public float[] getFloat()
returns a float array containing the data from the node. needs to be optimized with ArrayCopy !- Returns:
- float[] array of the node.
-
getDouble
public double[] getDouble()
returns a float array containing the data from the node. needs to be optimized with ArrayCopy !- Returns:
- float[] array of the node.
-
getFloat
public float getFloat(int index)
returns a float number of the element with given index- Parameters:
index- index of the element.- Returns:
-
getVectorX
public float getVectorX(int index)
Get X component of the vector from the node with TYPE VECTOR3F- Parameters:
index- index of the vector- Returns:
- X component
-
getVectorY
public float getVectorY(int index)
Get Y component of the vector from the node with TYPE VECTOR3F- Parameters:
index- index of the vector- Returns:
- Y component
-
getVectorZ
public float getVectorZ(int index)
Get Z component of the vector from the node with TYPE VECTOR3F- Parameters:
index- index of the vector- Returns:
- Z component
-
getShort
public short getShort(int index)
returns the value of the short array for given index.- Parameters:
index- index of the array- Returns:
- the value
-
getInt
public int getInt(int index)
-
getInt
public int[] getInt()
-
getShort
public short[] getShort()
-
getLong
public long getLong(int index)
-
getDouble
public double getDouble(int index)
-
setByte
public void setByte(int index, byte value)Set content of the node with type BYTE, for element index- Parameters:
index- element indexvalue- byte value to set
-
setShort
public void setShort(int index, short value)
-
setInt
public void setInt(int index, int value)set integer value to the element of the node- Parameters:
index- order of the arrayvalue- value to set
-
setLong
public void setLong(int index, long value)
-
setFloat
public void setFloat(int index, float value)
-
setDouble
public void setDouble(int index, double value)
-
setVector
public void setVector(int index, float x, float y, float z)sets all components for the vector with index- Parameters:
index- order of the vectorx- x-component of the vectory- y-component of the vectorz- z-component of the vector
-
setVectorX
public void setVectorX(int index, float value)sets X component of the vector with index- Parameters:
index- index of the vectorvalue- X component value to set
-
setVectorY
public void setVectorY(int index, float value)sets X component of the vector with index- Parameters:
index- index of the vectorvalue- X component value to set
-
setVectorZ
public void setVectorZ(int index, float value)sets X component of the vector with index- Parameters:
index- index of the vectorvalue- X component value to set
-
main
public static void main(java.lang.String[] args)
main program for tests- Parameters:
args-
-
-
DMelt 3.0 © DataMelt by jWork.ORG