Android Open Source - morpho Route






From Project

Back to project page morpho.

License

The source code is released under:

Apache License

If you think the Android project morpho 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.morpho.android.data;
//from  w w  w  .j ava  2  s .c o m
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.Objects;

public class Route implements JSONable, Serializable {

    private static final long serialVersionUID = -6167527654076731481L;

    private Long id;
    private Station station;
    private String name;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Station getStation() {
        return station;
    }

    public void setStation(Station station) {
        this.station = station;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toJSON() {
        return toString();
    }

    @Override
    public void fromJSON(String json) {
        try {
            JSONObject src = new JSONObject(json);
            id = src.isNull("id") ? null : src.getLong("id");
            name = src.optString("name", null);
            if (!src.isNull("station")) {
                station = new Station();
                station.fromJSON(src.getJSONObject("station").toString());
            }
        } catch (JSONException ex) {
            throw new RuntimeException(ex);
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, station);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        Route other = (Route) obj;
        if (id == null) {
            if (other.id != null) return false;
        } else if (!id.equals(other.id)) return false;
        if (name == null) {
            if (other.name != null) return false;
        } else if (!name.equals(other.name)) return false;
        if (station == null) {
            if (other.station != null) return false;
        } else if (!station.equals(other.station)) return false;
        return true;
    }

    @Override
    public String toString() {
        return new StringBuilder()
            .append('{')
            .append("\"id\": ").append(id).append(", ")
            .append("\"name\": ").append('\"').append(name).append('\"').append(", ")
            .append("\"station\": ").append(station)
            .append('}')
            .toString();
    }
}




Java Source Code List

com.morpho.android.activity.MainActivity.java
com.morpho.android.data.GeoArea.java
com.morpho.android.data.GeoPoint.java
com.morpho.android.data.JSONable.java
com.morpho.android.data.Route.java
com.morpho.android.data.Schedule.java
com.morpho.android.data.Station.java
com.morpho.android.intent.ReceiveTransitionsIntentService.java
com.morpho.android.receiver.VoiceReplyReceiver.java
com.morpho.android.util.Strings.java
com.morpho.android.ws.AsyncTaskAdapter.java
com.morpho.android.ws.Buses.java
com.morpho.android.ws.MorphoRequest.java
com.morpho.android.ws.Schedules.java
com.morpho.android.ws.Stations.java
com.morpho.android.ws.impl.MorphoClientFactory.java
com.morpho.android.ws.impl.sqlite.BusesSQLite.java
com.morpho.android.ws.impl.sqlite.MorphoSQLiteOpenHelper.java
com.morpho.android.ws.impl.sqlite.SQLFileParser.java
com.morpho.android.ws.impl.sqlite.SQLiteTemplate.java
com.morpho.android.ws.impl.sqlite.SQLiteUtils.java
com.morpho.android.ws.impl.sqlite.SchedulesSQLite.java
com.morpho.android.ws.impl.sqlite.StationsSQLite.java