org.apache.mahout.common
Class IntTuple

java.lang.Object
  extended by org.apache.mahout.common.IntTuple
All Implemented Interfaces:
java.lang.Comparable<IntTuple>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<IntTuple>

public final class IntTuple
extends java.lang.Object
implements org.apache.hadoop.io.WritableComparable<IntTuple>

An Ordered List of Integers which can be used in a Hadoop Map/Reduce Job


Constructor Summary
IntTuple()
           
IntTuple(int firstEntry)
           
IntTuple(int[] entries)
           
IntTuple(java.lang.Iterable<java.lang.Integer> entries)
           
 
Method Summary
 void add(int entry)
          add an entry to the end of the list
 int at(int index)
          Fetches the string at the given location
 int compareTo(IntTuple otherTuple)
           
 boolean equals(java.lang.Object obj)
           
 org.apache.mahout.math.list.IntArrayList getEntries()
          Fetch the list of entries from the tuple
 int hashCode()
           
 int length()
          Returns the length of the tuple
 void readFields(java.io.DataInput in)
           
 int replaceAt(int index, int newInteger)
          Replaces the string at the given index with the given newInteger
 void write(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntTuple

public IntTuple()

IntTuple

public IntTuple(int firstEntry)

IntTuple

public IntTuple(java.lang.Iterable<java.lang.Integer> entries)

IntTuple

public IntTuple(int[] entries)
Method Detail

add

public void add(int entry)
add an entry to the end of the list

Parameters:
entry -

at

public int at(int index)
Fetches the string at the given location

Parameters:
index -
Returns:
Integer value at the given location in the tuple list

replaceAt

public int replaceAt(int index,
                     int newInteger)
Replaces the string at the given index with the given newInteger

Parameters:
index -
newInteger -
Returns:
The previous value at that location

getEntries

public org.apache.mahout.math.list.IntArrayList getEntries()
Fetch the list of entries from the tuple

Returns:
a List containing the strings in the order of insertion

length

public int length()
Returns the length of the tuple

Returns:
length

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

readFields

public void readFields(java.io.DataInput in)
                throws java.io.IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

compareTo

public int compareTo(IntTuple otherTuple)
Specified by:
compareTo in interface java.lang.Comparable<IntTuple>


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.