es.ucm.look.data.local.contentprovider
Class LookContentProvider

java.lang.Object
  extended by es.ucm.look.data.local.contentprovider.LookContentProvider
All Implemented Interfaces:
DataGetter, DataHandler, DataSetter

public class LookContentProvider
extends java.lang.Object
implements DataHandler

Data handler for a local data base


Method Summary
 void addEntity(EntityData data)
          Adds an entity to the world
 java.util.List<java.lang.Integer> getAllIds(java.lang.String type)
          Returns all the entity's id for the given type
 java.util.Map<java.lang.String,java.lang.String> getAllProperties(int id)
           
 java.util.List<EntityData> getElementsUpdated(float x, float y, float z, float radius, java.util.Date date)
          Returns all elements near the given point with the given radius that changed since last update
 int getId(java.lang.String property, java.lang.String value)
           
 int getIDfromUri(Uri uri)
           
static LookContentProvider getInstance()
           
static LookContentProvider getInstance(Context context)
           
 java.util.Map<java.lang.String,java.lang.String> getPropertiesValue(int id, java.util.List<java.lang.String> propertiesName)
          Returns all the properties for a given id
 java.lang.String getPropertyValue(int id, java.lang.String propertyName)
           
 void updateOrAddProperty(int id, java.lang.String propertyName, java.lang.String propertyValue)
           
 void updatePosition(EntityData data, float x, float y, float z)
          Modifies the position for an entity
 void updateProperty(EntityData data, java.lang.String propertyName, java.lang.String propertyValue)
          Updates the value from a entity data property
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addEntity

public void addEntity(EntityData data)
Description copied from interface: DataSetter
Adds an entity to the world

Specified by:
addEntity in interface DataSetter

getAllIds

public java.util.List<java.lang.Integer> getAllIds(java.lang.String type)
Returns all the entity's id for the given type

Parameters:
type - the type
Returns:
the ids list

getAllProperties

public java.util.Map<java.lang.String,java.lang.String> getAllProperties(int id)

getElementsUpdated

public java.util.List<EntityData> getElementsUpdated(float x,
                                                     float y,
                                                     float z,
                                                     float radius,
                                                     java.util.Date date)
Description copied from interface: DataGetter
Returns all elements near the given point with the given radius that changed since last update

Specified by:
getElementsUpdated in interface DataGetter
Parameters:
x - x coordinate
y - y coordinate
z - z coordinate
radius - radius to be checked. If radius is -1, is considered as infinitum
date - time of the last update. If date is null, all elements will be returned
Returns:
the list with the ids

getId

public int getId(java.lang.String property,
                 java.lang.String value)

getIDfromUri

public int getIDfromUri(Uri uri)

getInstance

public static LookContentProvider getInstance()

getInstance

public static LookContentProvider getInstance(Context context)

getPropertiesValue

public java.util.Map<java.lang.String,java.lang.String> getPropertiesValue(int id,
                                                                           java.util.List<java.lang.String> propertiesName)
Returns all the properties for a given id

Parameters:
id - the id
propertiesName - the list of properties
Returns:
a map with the properties mapped to their values

getPropertyValue

public java.lang.String getPropertyValue(int id,
                                         java.lang.String propertyName)

updateOrAddProperty

public void updateOrAddProperty(int id,
                                java.lang.String propertyName,
                                java.lang.String propertyValue)

updatePosition

public void updatePosition(EntityData data,
                           float x,
                           float y,
                           float z)
Description copied from interface: DataSetter
Modifies the position for an entity

Specified by:
updatePosition in interface DataSetter
Parameters:
data - data representing the entity
x - x coordinate
y - y coordinate
z - z coordinate

updateProperty

public void updateProperty(EntityData data,
                           java.lang.String propertyName,
                           java.lang.String propertyValue)
Description copied from interface: DataSetter
Updates the value from a entity data property

Specified by:
updateProperty in interface DataSetter
Parameters:
data - entity data
propertyName - the property name
propertyValue - the nuew value for the property