org.apache.hadoop.mapred
Class Counters.Counter

java.lang.Object
  extended by org.apache.hadoop.mapred.Counters.Counter
All Implemented Interfaces:
Writable, Counter
Enclosing class:
Counters

@InterfaceAudience.Public
@InterfaceStability.Stable
public static class Counters.Counter
extends Object
implements Counter

A counter record, comprising its name and value.


Constructor Summary
Counters.Counter()
           
 
Method Summary
 boolean contentEquals(Counters.Counter counter)
          Deprecated.  
 boolean equals(Object genericRight)
           
 long getCounter()
           
 String getDisplayName()
          Get the display name of the counter.
 String getName()
           
 Counter getUnderlyingCounter()
           
 long getValue()
          What is the current value of this counter?
 int hashCode()
           
 void increment(long incr)
          Increment this counter by the given value
 String makeEscapedCompactString()
          Returns the compact stringified version of the counter in the format [(actual-name)(display-name)(value)]
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 void setDisplayName(String displayName)
          Set the display name of the counter
 void setValue(long value)
          Set this counter by the given value
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counters.Counter

public Counters.Counter()
Method Detail

setDisplayName

public void setDisplayName(String displayName)
Description copied from interface: Counter
Set the display name of the counter

Specified by:
setDisplayName in interface Counter
Parameters:
displayName - of the counter

getName

public String getName()
Specified by:
getName in interface Counter
Returns:
the name of the counter

getDisplayName

public String getDisplayName()
Description copied from interface: Counter
Get the display name of the counter.

Specified by:
getDisplayName in interface Counter
Returns:
the user facing name of the counter

getValue

public long getValue()
Description copied from interface: Counter
What is the current value of this counter?

Specified by:
getValue in interface Counter
Returns:
the current value

setValue

public void setValue(long value)
Description copied from interface: Counter
Set this counter by the given value

Specified by:
setValue in interface Counter
Parameters:
value - the value to set

increment

public void increment(long incr)
Description copied from interface: Counter
Increment this counter by the given value

Specified by:
increment in interface Counter
Parameters:
incr - the value to increase this counter by

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from interface: Writable
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

makeEscapedCompactString

public String makeEscapedCompactString()
Returns the compact stringified version of the counter in the format [(actual-name)(display-name)(value)]

Returns:
the stringified result

contentEquals

@Deprecated
public boolean contentEquals(Counters.Counter counter)
Deprecated. 

Checks for (content) equality of two (basic) counters

Parameters:
counter - to compare
Returns:
true if content equals

getCounter

public long getCounter()
Returns:
the value of the counter

getUnderlyingCounter

public Counter getUnderlyingCounter()
Specified by:
getUnderlyingCounter in interface Counter

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2014 Apache Software Foundation. All Rights Reserved.