Android Open Source - keepmoving Timetable Model






From Project

Back to project page keepmoving.

License

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) {
        mRoutes.clear();
        mRoutes.addAll(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

it.rainbowbreeze.keepmoving.ApplicationTest.java
it.rainbowbreeze.keepmoving.common.Config.java
it.rainbowbreeze.keepmoving.common.DaggerModule.java
it.rainbowbreeze.keepmoving.common.ILogManager.java
it.rainbowbreeze.keepmoving.common.LogManager.java
it.rainbowbreeze.keepmoving.common.MyApp.java
it.rainbowbreeze.keepmoving.common.Utils.java
it.rainbowbreeze.keepmoving.data.GeoPointDao.java
it.rainbowbreeze.keepmoving.data.GeoPointFixedRepository.java
it.rainbowbreeze.keepmoving.data.IGeoPointRepository.java
it.rainbowbreeze.keepmoving.domain.Coord.java
it.rainbowbreeze.keepmoving.domain.GeoPointTypes.java
it.rainbowbreeze.keepmoving.domain.GeoPoint.java
it.rainbowbreeze.keepmoving.domain.Route.java
it.rainbowbreeze.keepmoving.domain.Weekdays.java
it.rainbowbreeze.keepmoving.logic.PositionManager.java
it.rainbowbreeze.keepmoving.logic.RouteManager.java
it.rainbowbreeze.keepmoving.logic.TimetableController.java
it.rainbowbreeze.keepmoving.logic.TimetableModel.java
it.rainbowbreeze.keepmoving.ui.SpannableHelper.java
it.rainbowbreeze.keepmoving.ui.StepsArrayAdapter.java
it.rainbowbreeze.keepmoving.ui.TimetableActivity.java
it.rainbowbreeze.keepmoving.ui.TimetableActivity.java
it.rainbowbreeze.keepmoving.ui.TimetableFragment.java