org.knime.core.data.vector.bytevector
Interface ByteVectorValue

All Superinterfaces:
DataValue
All Known Implementing Classes:
DenseByteVectorCell, SparseByteVectorCell

public interface ByteVectorValue
extends DataValue

Implementations are vectors of fixed length storing byte counts at specific positions. Only positive values of counts are supported. Each index can store a number between 0 and 255 (both inclusive).

Author:
ohl, University of Konstanz

Nested Class Summary
static class ByteVectorValue.ByteVectorUtilityFactory
          Implementations of the meta information of this value class.
 
Nested classes/interfaces inherited from interface org.knime.core.data.DataValue
DataValue.UtilityFactory
 
Field Summary
static DataValue.UtilityFactory UTILITY
          Meta information to byte vector values.
 
Method Summary
 int cardinality()
          Returns the number of counts larger than zero stored in this vector.
 int get(long index)
          Returns the count stored at the specified position.
 boolean isEmpty()
          Checks all counts and returns true if they are all zero.
 long length()
          Returns the length of the byte vector.
 long nextCountIndex(long startIdx)
          Finds the next count not equal to zero on or after the specified index.
 long nextZeroIndex(long startIdx)
          Finds the next index whose value is zero on or after the specified index.
 long sumOfAllCounts()
          Calculates the checksum, the sum of all counts stored.
 

Field Detail

UTILITY

static final DataValue.UtilityFactory UTILITY
Meta information to byte vector values.

See Also:
DataValue.UTILITY
Method Detail

length

long length()
Returns the length of the byte vector. The number of stored counts.

Returns:
the number of bytes stored in the vector

sumOfAllCounts

long sumOfAllCounts()
Calculates the checksum, the sum of all counts stored.

Returns:
the sum of all counts in this vector.

cardinality

int cardinality()
Returns the number of counts larger than zero stored in this vector.

Returns:
the number of elements not equal to zero in this vector.

get

int get(long index)
Returns the count stored at the specified position.

Parameters:
index - the index of the count to return
Returns:
the count stored at the specified index.
Throws:
ArrayIndexOutOfBoundsException - if the specified index is negative or too large.

isEmpty

boolean isEmpty()
Checks all counts and returns true if they are all zero.

Returns:
true if all counts are zero.

nextZeroIndex

long nextZeroIndex(long startIdx)
Finds the next index whose value is zero on or after the specified index. Returns an index larger than or equal to the provided index, or -1 if no such index exists. It is okay to pass an index larger than the length of the vector.

Parameters:
startIdx - the first index to look for zero values.
Returns:
the index of the next index with value zero, which is on or after the provided startIdx. Or -1 if the vector contains no zeros there after.
Throws:
ArrayIndexOutOfBoundsException - if the specified startIdx negative

nextCountIndex

long nextCountIndex(long startIdx)
Finds the next count not equal to zero on or after the specified index. Returns an index larger than or equal to the provided index, or -1 if no count larger than zero exists after the startIdx. It is okay to pass an index larger than the length of the vector.

Parameters:
startIdx - the first index to look for non-zero counts. (It is allowed to pass an index larger then the vector's length.)
Returns:
the index of the next count larger than zero, which is on or after the provided startIdx, or -1 if there isn't any
Throws:
ArrayIndexOutOfBoundsException - if the specified startIdx is negative


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.