Android Open Source - keepmoving Timetable Model

From Project

Back to project page keepmoving.


The source code is released under:

GNU General Public License

If you think the Android project keepmoving 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 it.rainbowbreeze.keepmoving.logic;
/* ww  w .  j  ava  2s  .co m*/
 * This file is part of KeepMoving. KeepMoving is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, version 2.
 * <p/>
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * <p/>
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * <p/>
 * Copyright Alfredo Morresi
 * <p/>
 * Created by Alfredo Morresi on 16/07/14.

import java.util.ArrayList;

import it.rainbowbreeze.keepmoving.common.Utils;
import it.rainbowbreeze.keepmoving.domain.Route;

 * Model class with the data
public class TimetableModel {

    private int mFirstRouteLeavingTimestamp;

    private final ArrayList<Route> mRoutes;
    public ArrayList<Route> getRoutes() {
        return mRoutes;
    public TimetableModel setRoutes(ArrayList<Route> newRoutes) {
        mFirstRouteLeavingTimestamp = mRoutes.isEmpty()
                ? Utils.INVALID_TIMESTAMP
                : mRoutes.get(0).getLeavingTimestamp();
        return this;

    public TimetableModel() {
        mFirstRouteLeavingTimestamp = Utils.INVALID_TIMESTAMP;
        mRoutes = new ArrayList<Route>();

    public boolean hasNoRoutes() {
        return mRoutes.isEmpty();

    public boolean hasInvalidLeavingTimestamp() {
        return Utils.isTimestampInvalid(mFirstRouteLeavingTimestamp);

    public boolean isOutdated(int currentTimestamp) {
        return (hasInvalidLeavingTimestamp())
                || mFirstRouteLeavingTimestamp < currentTimestamp;

Java Source Code List