de.unikassel.android.sdcframework.data.independent
Class BasicSample

Package class diagram package BasicSample
java.lang.Object
  extended by de.unikassel.android.sdcframework.data.independent.BasicSample
All Implemented Interfaces:
SerializableData
Direct Known Subclasses:
Sample

public class BasicSample
extends Object
implements SerializableData

This is the framework independent serializable sample representation, which can be used in pure Java projects for deserialization.

A sensor device sample has


See Also:
Sample

Field Summary
static String ACTION
          Our custom sample intent action
private  SampleData data
          The device specific sensor data
protected  String deviceIdentifier
          the sample device identifier
private  GeoLocation location
          The associated location
private  int priority
          the sample priority for transmission
protected  long timeStamp
          the sample time stamp
private  Boolean timeSynced
          flag if the sample time stamp is taken while time provider was in sync with NTP time.
 
Constructor Summary
BasicSample()
          Constructor
 
Method Summary
 boolean equals(Object o)
           
static boolean equals(Object o1, Object o2)
          Test method for equivalence of two objects, allowing both being null as well
 SampleData getData()
          Getter for the sample data
 String getDeviceIdentifier()
          Getter for the device identifier ( string representation of the sensors identifier )
 GeoLocation getLocation()
          Getter for the location
 int getPriority()
          Getter for the priority ( ordinal value of a priority level )
 long getTimeStamp()
          Getter for the time stamp ( the number of milliseconds since January 1, 1970, 00:00:00 GMT )
 Boolean isTimeSynced()
          Getter for the timeSynced
 void setData(SampleData data)
          Setter for the sample data
 boolean setDataFromXML(String dataType, String xml)
          Method to create data from XML
 void setDeviceIdentifier(String deviceIdentifier)
          Setter for the device identifier ( string representation of the sensors identifier )
 void setLocation(GeoLocation location)
          Setter for the location
 boolean setLocationFromXML(String xml)
          Method to create location from XML representation
 void setPriority(int priority)
          Setter for the priority ( ordinal value of a priority level )
 void setTimeStamp(long timeStamp)
          Setter for the time stamp ( the number of milliseconds since January 1, 1970, 00:00:00 GMT )
 void setTimeSynced(Boolean timeSynced)
          Setter for the timeSynced
 String toString()
           
 String toXML()
          Serialization from the type to it's XML representation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION

public static final String ACTION
Our custom sample intent action

See Also:
Constant Field Values

deviceIdentifier

protected String deviceIdentifier
the sample device identifier


timeStamp

protected long timeStamp
the sample time stamp


priority

private int priority
the sample priority for transmission


timeSynced

private Boolean timeSynced
flag if the sample time stamp is taken while time provider was in sync with NTP time.


data

private SampleData data
The device specific sensor data


location

private GeoLocation location
The associated location

Constructor Detail

BasicSample

public BasicSample()
Constructor

Method Detail

setLocationFromXML

public final boolean setLocationFromXML(String xml)
Method to create location from XML representation

Parameters:
xml - the XML representation of the location
Returns:
true if successful, false otherwise

setDataFromXML

public final boolean setDataFromXML(String dataType,
                                    String xml)
Method to create data from XML

Parameters:
dataType - the data type class name
xml - the XML representation of the data
Returns:
true if successful, false otherwise

equals

public static final boolean equals(Object o1,
                                   Object o2)
Test method for equivalence of two objects, allowing both being null as well

Parameters:
o1 - first object
o2 - second object
Returns:
true if equal pointers or equal values

equals

public final boolean equals(Object o)
Overrides:
equals in class Object

setTimeStamp

public final void setTimeStamp(long timeStamp)
Setter for the time stamp ( the number of milliseconds since January 1, 1970, 00:00:00 GMT )

Parameters:
timeStamp - the time stamp to set

getTimeStamp

public final long getTimeStamp()
Getter for the time stamp ( the number of milliseconds since January 1, 1970, 00:00:00 GMT )

Returns:
the time stamp

isTimeSynced

public Boolean isTimeSynced()
Getter for the timeSynced

Returns:
the timeSynced

setTimeSynced

public void setTimeSynced(Boolean timeSynced)
Setter for the timeSynced

Parameters:
timeSynced - the timeSynced to set

setPriority

public final void setPriority(int priority)
Setter for the priority ( ordinal value of a priority level )

Parameters:
priority - the priority to set

getPriority

public final int getPriority()
Getter for the priority ( ordinal value of a priority level )

Returns:
the priority

getData

public final SampleData getData()
Getter for the sample data

Returns:
the sample data

setData

public final void setData(SampleData data)
Setter for the sample data

Parameters:
data - the sample data to set

setDeviceIdentifier

public final void setDeviceIdentifier(String deviceIdentifier)
Setter for the device identifier ( string representation of the sensors identifier )

Parameters:
deviceIdentifier - the device identifier to set

getDeviceIdentifier

public final String getDeviceIdentifier()
Getter for the device identifier ( string representation of the sensors identifier )

Returns:
the device identifier

setLocation

public void setLocation(GeoLocation location)
Setter for the location

Parameters:
location - the location to set

getLocation

public GeoLocation getLocation()
Getter for the location

Returns:
the location

toString

public final String toString()
Overrides:
toString in class Object

toXML

public final String toXML()
                   throws Exception
Description copied from interface: SerializableData
Serialization from the type to it's XML representation

Specified by:
toXML in interface SerializableData
Returns:
the XML representation of the type if successful, null otherwise
Throws:
Exception - if the schema for the object is not valid