com.android.ddmlib.log
Class EventContainer

java.lang.Object
  extended by com.android.ddmlib.log.EventContainer

public class EventContainer
extends Object

Represents an event and its data.


Nested Class Summary
static class EventContainer.CompareMethod
          Comparison method for testValue(int, Object, com.android.ddmlib.log.EventContainer.CompareMethod)
static class EventContainer.EventValueType
          Type for event data.
 
Field Summary
 int mTag
           
 int nsec
           
 int pid
           
 int sec
           
 int tid
           
 
Method Summary
 Integer getInt()
          Returns the data as an int.
 Long getLong()
          Returns the data as a long.
 String getString()
          Returns the data as a String.
 EventContainer.EventValueType getType()
          Returns the type of the data.
 EventContainer.EventValueType getType(Object data)
          Returns the type of an object.
 Object getValue(int valueIndex)
          Returns a value by index.
 double getValueAsDouble(int valueIndex)
          Returns a value by index as a double.
 String getValueAsString(int valueIndex)
          Returns a value by index as a String.
 boolean testValue(int index, Object value, EventContainer.CompareMethod compareMethod)
          Checks that the index-th value of this event against a provided value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mTag

public int mTag

pid

public int pid

tid

public int tid

sec

public int sec

nsec

public int nsec
Method Detail

getInt

public final Integer getInt()
                     throws InvalidTypeException
Returns the data as an int.

Throws:
InvalidTypeException - if the data type is not EventContainer.EventValueType.INT.
See Also:
getType()

getLong

public final Long getLong()
                   throws InvalidTypeException
Returns the data as a long.

Throws:
InvalidTypeException - if the data type is not EventContainer.EventValueType.LONG.
See Also:
getType()

getString

public final String getString()
                       throws InvalidTypeException
Returns the data as a String.

Throws:
InvalidTypeException - if the data type is not EventContainer.EventValueType.STRING.
See Also:
getType()

getValue

public Object getValue(int valueIndex)
Returns a value by index. The return type is defined by its type.

Parameters:
valueIndex - the index of the value. If the data is not a list, this is ignored.

getValueAsDouble

public double getValueAsDouble(int valueIndex)
                        throws InvalidTypeException
Returns a value by index as a double.

Parameters:
valueIndex - the index of the value. If the data is not a list, this is ignored.
Throws:
InvalidTypeException - if the data type is not EventContainer.EventValueType.INT, EventContainer.EventValueType.LONG, EventContainer.EventValueType.LIST, or if the item in the list at index valueIndex is not of type EventContainer.EventValueType.INT or EventContainer.EventValueType.LONG.
See Also:
getType()

getValueAsString

public String getValueAsString(int valueIndex)
                        throws InvalidTypeException
Returns a value by index as a String.

Parameters:
valueIndex - the index of the value. If the data is not a list, this is ignored.
Throws:
InvalidTypeException - if the data type is not EventContainer.EventValueType.INT, EventContainer.EventValueType.LONG, EventContainer.EventValueType.STRING, EventContainer.EventValueType.LIST, or if the item in the list at index valueIndex is not of type EventContainer.EventValueType.INT, EventContainer.EventValueType.LONG, or EventContainer.EventValueType.STRING
See Also:
getType()

getType

public EventContainer.EventValueType getType()
Returns the type of the data.


getType

public final EventContainer.EventValueType getType(Object data)
Returns the type of an object.


testValue

public boolean testValue(int index,
                         Object value,
                         EventContainer.CompareMethod compareMethod)
                  throws InvalidTypeException
Checks that the index-th value of this event against a provided value.

Parameters:
index - the index of the value to test
value - the value to test against
compareMethod - the method of testing
Returns:
true if the test passed.
Throws:
InvalidTypeException - in case of type mismatch between the value to test and the value to test against, or if the compare method is incompatible with the type of the values.
See Also:
EventContainer.CompareMethod


Copyright © 2008-2012. All Rights Reserved.