Poi.java :  » Map » swp-dv-ws2010-osm-2 » de » fuberlin » osm2 » data » dao » Android Open Source

Android Open Source » Map » swp dv ws2010 osm 2 
swp dv ws2010 osm 2 » de » fuberlin » osm2 » data » dao » Poi.java
package de.fuberlin.osm2.data.dao;

import android.content.Context;
import android.os.Bundle;
import de.fuberlin.osm2.data.DataBaseConnectorImpl;

/**
 * Object that represents a POI in the database schema.
 * 
 */
// value constraints.
public class Poi extends Point {

  /**
   * Internal ID of the POI.
   */
  public long poiId;

  /**
   * The attributes of this POI.
   */
  public Bundle values;

  /**
   * Constructor.
   * 
   * @param poiId data base id of the poi
   * @param pointId data base id of the point
   * @param lng longitude of point
   * @param lat latitude of the point
   * @param timestamp time the point was recorded
   * @param values Bundle of the tags of the poi
   */
  public Poi(long poiId, long pointId, double lng, double lat, long timestamp, Bundle values) {
    super(pointId, lng, lat, timestamp);
    this.poiId = poiId;
    this.values = values;
  }

  /**
   * adds a String value to the bundle of this poi.
   * 
   * @param k - key, under which the value should be saved
   * @param string value to be put into the string, may be null.
   */
  public void putValue(String k, String string) {
    values.putString(k, string);
  }

  /**
   * adds a boolean value to the bundle of this poi.
   * 
   * @param k - key, under which the value should be saved
   * @param b - the boolean value
   */
  public void putValue(String k, boolean b) {
    values.putBoolean(k, b);
  }

  /**
   * adds a long value to the bundle of this poi.
   * 
   * @param k - key, under which the value should be saved
   * @param l - the long value
   */
  public void putValue(String k, long l) {
    values.putLong(k, l);
  }

  /**
   * adds a String value to the bundle of this poi.
   * 
   * @param k - key, under which the value should be saved
   * @param d - the double value
   */
  public void putValue(String k, double d) {
    values.putDouble(k, d);
  }

  /**
   * Overwrite the attributes of this POI.
   * 
   * @param b set a bundle to represent the tags of the poi
   */
  public void setValues(Bundle b) {
    this.values = b;
  }

  /**
   * 
   * @return the attributes of this poi.
   */
  public Bundle getValues() {
    return values;
  }

  /**
   * 
   * @return the id of the poi.
   */
  public long getPoiId() {
    return poiId;
  }

  /**
   * 
   * @return the id of the point associated with this poi.
   */
  public long getPointId() {
    return pointId;
  }

  /**
   * the poi removes itself from the database.
   * 
   * @param context - the context of the calling instance
   */
  public void remove(Context context) {
    new DataBaseConnectorImpl(context).removePoi(poiId);
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.