Android Open Source - utexas-utilities U T Class






From Project

Back to project page utexas-utilities.

License

The source code is released under:

Apache License

If you think the Android project utexas-utilities 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.nasageek.utexasutilities.model;
/*from w  w w.  j a  v  a  2 s  .  co  m*/
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import java.io.Serializable;
import java.util.ArrayList;

public class UTClass implements Parcelable, Serializable {

    private static final long serialVersionUID = 1L;

    private String courseId, unique, name, semId, color;

    private ArrayList<Classtime> classtimes;

    public static Parcelable.Creator<UTClass> CREATOR = new Parcelable.Creator<UTClass>() {

        @Override
        public UTClass createFromParcel(Parcel source) {
            return new UTClass(source);
        }

        @Override
        public UTClass[] newArray(int size) {
            return new UTClass[size];
        }

    };

    private UTClass(Parcel in) {
        unique = in.readString();
        courseId = in.readString();
        name = in.readString();

        classtimes = new ArrayList<Classtime>();
        in.readTypedList(classtimes, Classtime.CREATOR);
        semId = in.readString();
        color = in.readString();
    }

    public UTClass(String unique, String courseId, String name, String[] buildingIds,
            String[] buildingRooms, String[] days, String[] times, String semId, String color) {
        this.unique = unique;
        this.courseId = courseId;
        this.name = name;

        if (buildingIds.length != buildingRooms.length) {
            Log.e("UTClass creation", "building/room size inconsistency: b" + buildingIds.length
                    + " r" + buildingRooms.length);
        }

        ArrayList<Building> buildings = new ArrayList<Building>();
        for (int i = 0; i < buildingIds.length; i++) {
            buildings.add(new Building(buildingIds[i], buildingRooms[i]));
        }

        /* Class Listing page leaves out building info if there are multiple sections in the same
           location at different times. See Chris Roberts Fall 2014 Class Listing. Here we check
           to see if location info was absent from a row.
        */
        if (buildings.size() < days.length) {
            buildings.add(new Building(buildings.get(0)));
        }

        classtimes = new ArrayList<Classtime>();
        if (!(days.length == times.length && days.length == buildings.size() && buildings.size() == times.length)) {
            Log.e("UTClass creation", "building/day/time size inconsistency: b" + buildings.size()
                    + " d" + days.length + " t" + times.length);
        }
        for (int i = 0; i < days.length && i < times.length && i < buildings.size(); i++) {
            String[] dayArray = days[i].split("");

            for (int k = 1; k < dayArray.length; k++) {
                classtimes.add(new Classtime(dayArray[k], times[i], buildings.get(i), color,
                        courseId, name, unique));
            }
        }
        this.semId = semId;
        this.color = color;
    }

    @Override
    public String toString() {
        String out = courseId + " in ";
        for (int i = 0; i < classtimes.size(); i++) {
            Classtime classtime = classtimes.get(i);

            out += classtime.getBuilding().getId() + " in room "
                    + classtime.getBuilding().getRoom() + " at "
                    + classtime.getStartTime() + "-" + classtime.getEndTime()
                    + " on " + classtime.getDay();
            if (i != classtimes.size() - 1) {
                out += " and in ";
            }
        }
        return out;
    }

    public ArrayList<Classtime> getClassTimes() {
        return classtimes;
    }

    public String getName() {
        return name;
    }

    public String getId() {
        return courseId;
    }

    public String getUnique() {
        return unique;
    }

    public String getSemId() {
        return semId;
    }

    public String getColor() {
        return color;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(unique);
        out.writeString(courseId);
        out.writeString(name);
        out.writeTypedList(classtimes);
        out.writeString(semId);
        out.writeString(color);
    }
}




Java Source Code List

com.google.maps.android.ui.MyIconGenerator.java
com.mapsaurus.paneslayout.ActivityDelegate.java
com.mapsaurus.paneslayout.FragmentLauncher.java
com.mapsaurus.paneslayout.MenuItemWrapper.java
com.mapsaurus.paneslayout.MySlidingPaneLayout.java
com.mapsaurus.paneslayout.PanesActivity.java
com.mapsaurus.paneslayout.PanesLayout.java
com.mapsaurus.paneslayout.PanesSizer.java
com.mapsaurus.paneslayout.PhoneDelegate.java
com.mapsaurus.paneslayout.SimpleScrollView.java
com.mapsaurus.paneslayout.TabletDelegate.java
com.nasageek.utexasutilities.AsyncTask.java
com.nasageek.utexasutilities.AttachmentDownloadService.java
com.nasageek.utexasutilities.AuthCookie.java
com.nasageek.utexasutilities.BlackboardDashboardXmlParser.java
com.nasageek.utexasutilities.BuildingDatabase.java
com.nasageek.utexasutilities.BuildingProvider.java
com.nasageek.utexasutilities.BuildingSaxHandler.java
com.nasageek.utexasutilities.ChangeLog.java
com.nasageek.utexasutilities.ChangeableContextTask.java
com.nasageek.utexasutilities.CourseMapSaxHandler.java
com.nasageek.utexasutilities.FixedListPreference.java
com.nasageek.utexasutilities.LoginWebViewClient.java
com.nasageek.utexasutilities.MarkerManager.java
com.nasageek.utexasutilities.MyPair.java
com.nasageek.utexasutilities.MyScrollView.java
com.nasageek.utexasutilities.PlacemarkSaxHandler.java
com.nasageek.utexasutilities.PnaAuthCookie.java
com.nasageek.utexasutilities.RouteSaxHandler.java
com.nasageek.utexasutilities.SecurePreferences.java
com.nasageek.utexasutilities.TempLoginException.java
com.nasageek.utexasutilities.UTilitiesApplication.java
com.nasageek.utexasutilities.UtdAuthCookie.java
com.nasageek.utexasutilities.Utility.java
com.nasageek.utexasutilities.WrappedViewPager.java
com.nasageek.utexasutilities.WrappingSlidingDrawer.java
com.nasageek.utexasutilities.activities.AboutMeActivity.java
com.nasageek.utexasutilities.activities.BalanceActivity.java
com.nasageek.utexasutilities.activities.BlackboardPanesActivity.java
com.nasageek.utexasutilities.activities.CampusMapActivity.java
com.nasageek.utexasutilities.activities.DataUsageActivity.java
com.nasageek.utexasutilities.activities.LoginActivity.java
com.nasageek.utexasutilities.activities.MenuActivity.java
com.nasageek.utexasutilities.activities.NutritionInfoActivity.java
com.nasageek.utexasutilities.activities.Preferences.java
com.nasageek.utexasutilities.activities.ScheduleActivity.java
com.nasageek.utexasutilities.activities.UTilitiesActivity.java
com.nasageek.utexasutilities.adapters.BBClassAdapter.java
com.nasageek.utexasutilities.adapters.CourseMapAdapter.java
com.nasageek.utexasutilities.adapters.MultiPanePagerAdapter.java
com.nasageek.utexasutilities.adapters.MyFragmentPagerAdapter.java
com.nasageek.utexasutilities.adapters.ScheduleClassAdapter.java
com.nasageek.utexasutilities.adapters.TransactionAdapter.java
com.nasageek.utexasutilities.fragments.ActionModeFragment.java
com.nasageek.utexasutilities.fragments.BlackboardAnnouncementsFragment.java
com.nasageek.utexasutilities.fragments.BlackboardCourseListFragment.java
com.nasageek.utexasutilities.fragments.BlackboardCourseMapFragment.java
com.nasageek.utexasutilities.fragments.BlackboardDashboardFragment.java
com.nasageek.utexasutilities.fragments.BlackboardDownloadableItemFragment.java
com.nasageek.utexasutilities.fragments.BlackboardExternalItemFragment.java
com.nasageek.utexasutilities.fragments.BlackboardFragment.java
com.nasageek.utexasutilities.fragments.BlackboardGradesFragment.java
com.nasageek.utexasutilities.fragments.BlackboardPagerFragment.java
com.nasageek.utexasutilities.fragments.CourseScheduleFragment.java
com.nasageek.utexasutilities.fragments.DatePickerFragment.java
com.nasageek.utexasutilities.fragments.DoubleDatePickerDialogFragment.java
com.nasageek.utexasutilities.fragments.ExamScheduleFragment.java
com.nasageek.utexasutilities.fragments.MenuFragment.java
com.nasageek.utexasutilities.fragments.NutritionInfoFragment.java
com.nasageek.utexasutilities.fragments.PickCalendarDialogFragment.java
com.nasageek.utexasutilities.fragments.TransactionsFragment.java
com.nasageek.utexasutilities.model.BBClass.java
com.nasageek.utexasutilities.model.Building.java
com.nasageek.utexasutilities.model.Classtime.java
com.nasageek.utexasutilities.model.CourseMapItem.java
com.nasageek.utexasutilities.model.FeedItem.java
com.nasageek.utexasutilities.model.Placemark.java
com.nasageek.utexasutilities.model.Transaction.java
com.nasageek.utexasutilities.model.UTClass.java
com.viewpagerindicator.MyTabPageIndicator.java