org.apache.mahout.common
Class IntegerTuple

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

public final class IntegerTuple
extends Object
implements org.apache.hadoop.io.WritableComparable<IntegerTuple>

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


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

Constructor Detail

IntegerTuple

public IntegerTuple()

IntegerTuple

public IntegerTuple(Integer firstEntry)

IntegerTuple

public IntegerTuple(Iterable<Integer> entries)

IntegerTuple

public IntegerTuple(Integer[] entries)
Method Detail

add

public boolean add(Integer entry)
add an entry to the end of the list

Parameters:
entry -
Returns:
true if the items get added

integerAt

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

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

replaceAt

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

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

getEntries

public List<Integer> 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

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

readFields

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

write

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

compareTo

public int compareTo(IntegerTuple otherTuple)
Specified by:
compareTo in interface Comparable<IntegerTuple>


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.