Android Open Source - spotastop Bus Stop

From Project

Back to project page spotastop.


The source code is released under:

MIT License

If you think the Android project spotastop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cipciop.spotastop.domain;
/*from   w  ww  .j a  va  2s  .c o m*/
import java.lang.reflect.Type;
import java.util.ArrayList;

import requests.Link;
import resources.Resource;
import rest.RestApi;
import android.annotation.SuppressLint;

import com.cipciop.spotastop.StopSpotApp;

public class BusStop extends Resource implements Comparable<Object> {

  private String code;

  private Line line;

  private GeoPos position;

  public BusStop() {

  public BusStop(String code) {

  public BusStop(String code, double latitude, double longitude) {
    this.code = code;
    this.position = new GeoPos(latitude, longitude);


  public void setCode(String code) {
    this.code = code;

  public String getCode() {
    return this.code;

  public void setPosition(GeoPos position) {
    this.position = position;

  public GeoPos getPosition() {
    return this.position;

  public void store() {
    ArrayList<Resource> resources = new ArrayList<Resource>();
    ArrayList<Link> links=new ArrayList<Link>();
    links.add(new Link(this, this.line,"line"));
    links.add(new Link(this,StopSpotApp.getInstance().getLoggedUser(),"creator"));

  public int compareTo(Object another) {

    return this.code.toLowerCase().compareTo(
        ((BusStop) another).code.toLowerCase());

  public JsonElement serialize(Resource arg0, Type arg1,
      JsonSerializationContext arg2) {
    JsonObject obj = new JsonObject();
    obj.addProperty("name", this.code);
    obj.addProperty("latitudine", this.position.getLatitude());
    obj.addProperty("longitudine", this.position.getLongitude());
    obj.addProperty("resourceClassifier", this.resourceClassifier);
    return obj;

  public Line getLine() {
    return line;

  public void setLine(Line line) {
    this.line = line;

Java Source Code List