org.apache.hadoop.mapred
Class Counters.Group

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

public class Counters.Group
extends Object
implements Writable, Iterable<Counters.Counter>

Group of counters, comprising of counters from a particular counter Enum class.

Grouphandles localization of the class name and the counter names.


Method Summary
 boolean equals(Object obj)
          Checks for (content) equality of Groups
 Counters.Counter getCounter(int id, String name)
          Deprecated. use getCounter(String) instead
 long getCounter(String counterName)
          Returns the value of the specified counter, or 0 if the counter does not exist.
 Counters.Counter getCounterForName(String name)
          Get the counter for the given name and create it if it doesn't exist.
 String getDisplayName()
          Returns localized name of the group.
 String getName()
          Returns raw name of the group.
 int hashCode()
           
 Iterator<Counters.Counter> iterator()
           
 String makeEscapedCompactString()
          Returns the compact stringified version of the group in the format {(actual-name)(display-name)(value)[][][]} where [] are compact strings for the counters within.
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 void setDisplayName(String displayName)
          Set the display name
 int size()
          Returns the number of counters in this group.
 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
 

Method Detail

getName

public String getName()
Returns raw name of the group. This is the name of the enum class for this group of counters.


getDisplayName

public String getDisplayName()
Returns localized name of the group. This is the same as getName() by default, but different if an appropriate ResourceBundle is found.


setDisplayName

public void setDisplayName(String displayName)
Set the display name


makeEscapedCompactString

public String makeEscapedCompactString()
Returns the compact stringified version of the group in the format {(actual-name)(display-name)(value)[][][]} where [] are compact strings for the counters within.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Checks for (content) equality of Groups

Overrides:
equals in class Object

getCounter

public long getCounter(String counterName)
Returns the value of the specified counter, or 0 if the counter does not exist.


getCounter

@Deprecated
public Counters.Counter getCounter(int id,
                                              String name)
Deprecated. use getCounter(String) instead

Get the counter for the given id and create it if it doesn't exist.

Parameters:
id - the numeric id of the counter within the group
name - the internal counter name
Returns:
the counter

getCounterForName

public Counters.Counter getCounterForName(String name)
Get the counter for the given name and create it if it doesn't exist.

Parameters:
name - the internal counter name
Returns:
the counter

size

public int size()
Returns the number of counters in this group.


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

iterator

public Iterator<Counters.Counter> iterator()
Specified by:
iterator in interface Iterable<Counters.Counter>


Copyright © 2009 The Apache Software Foundation