Android Open Source - final_year_frontend Notification






From Project

Back to project page final_year_frontend.

License

The source code is released under:

MIT License

If you think the Android project final_year_frontend 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.james.erebus.core;
/*from   w  w  w  . j  ava2  s  .  c  om*/
/**
 * Class that represents a notification
 * @author james
 *
 */

public class Notification {

  String text;
  Match m;
  Tournament t;
  
  public Notification(String text, Match m)
  {
    this.text = text;
    this.m = m;
  }
  
  public Notification(String text, Tournament t)
  {
    this.text = text;
    this.t = t;
  }
  
  /**
   * 
   * @return 0 if this notification holds a {@link com.james.erebus.core.Match}, 1 if a 
   * {@link com.james.erebus.core.Tournament}, and 2 if nothing
   */
  public int tournyOrMatch()
  {
    if(m != null)
      return 0;
    else if(t != null)
      return 1;
    return 2;
  }
  
  /**
   * 
   * @return The tournament in this notification, if there is one
   */
  public Tournament getTournament()
  {
    if(t != null)
      return t;
    return null;
  }
  
  /**
   * 
   * @return The match in this notification, if there is one
   */
  public Match getMatch()
  {
    if(m != null)
      return m;
    return null;
  }
  
  /**
   * 
   * @return The text in this notification
   */
  public String getText()
  {
    return text;
  }
  
  /**
   * 
   * @param text The text to set the notification text to
   */
  public void setText(String text)
  {
    this.text = text;
  }
  
  /**
   * 
   * @param n The {@link com.james.erebus.core.Notification} to compare to
   * @return True if the notification is equal to this Notification, else false
   */
  public boolean equalsNotification(Notification n)
  {
    if(m != null)
    {
      if(n.getMatch() != null)
      {
        if(m.equalsMatch(n.getMatch()))
        {
          if(n.getText().equals(text))
            return true;
        }
      }
    }
    else if(t != null)
    {
      if(n.getTournament() != null)
      {
        if(t.equalsTournament(n.getTournament()))
        {
          if(n.getText().equals(text))
            return true;
        }
      }
    }
    return false;
  }

}




Java Source Code List

com.james.erebus.GCMIntentService.java
com.james.erebus.JSONJava.CDL.java
com.james.erebus.JSONJava.CookieList.java
com.james.erebus.JSONJava.Cookie.java
com.james.erebus.JSONJava.HTTPTokener.java
com.james.erebus.JSONJava.HTTP.java
com.james.erebus.JSONJava.JSONArray.java
com.james.erebus.JSONJava.JSONException.java
com.james.erebus.JSONJava.JSONML.java
com.james.erebus.JSONJava.JSONObject.java
com.james.erebus.JSONJava.JSONString.java
com.james.erebus.JSONJava.JSONStringer.java
com.james.erebus.JSONJava.JSONTokener.java
com.james.erebus.JSONJava.JSONWriter.java
com.james.erebus.JSONJava.XMLTokener.java
com.james.erebus.JSONJava.XML.java
com.james.erebus.core.C2DMRegistrationReceiver.java
com.james.erebus.core.CustomOnItemSelectedListener.java
com.james.erebus.core.MainActivity.java
com.james.erebus.core.MatchActivity.java
com.james.erebus.core.MatchButtonActivity.java
com.james.erebus.core.MatchOptions.java
com.james.erebus.core.MatchPreferencesFragment.java
com.james.erebus.core.Match.java
com.james.erebus.core.NotificationActivity.java
com.james.erebus.core.Notification.java
com.james.erebus.core.ParentPreferencesFragment.java
com.james.erebus.core.TournamentActivity.java
com.james.erebus.core.TournamentButtonActivity.java
com.james.erebus.core.TournamentFactory.java
com.james.erebus.core.TournamentPreferencesFragment.java
com.james.erebus.core.Tournament.java
com.james.erebus.core.TournyMatchOptions.java
com.james.erebus.misc.AppConsts.java
com.james.erebus.misc.MiscJsonHelpers.java
com.james.erebus.misc.misc.java
com.james.erebus.networking.AddDeviceTask.java
com.james.erebus.networking.AddMatchSubscriptionTask.java
com.james.erebus.networking.AddTournamentSubscriptionToServerTask.java
com.james.erebus.networking.GcmRegisterDeviceTask.java
com.james.erebus.networking.GetMatchesTask.java
com.james.erebus.networking.GetTournamentsTask.java
com.james.erebus.networking.MatchRetriever.java
com.james.erebus.networking.MatchSubscriptionManager.java
com.james.erebus.networking.MiscNetworkingHelpers.java
com.james.erebus.networking.NotificationManager.java
com.james.erebus.networking.RemoveMatchSubscriptionFromServerTask.java
com.james.erebus.networking.RemoveTournamentSubscriptionFromServerTask.java
com.james.erebus.networking.Retriever.java
com.james.erebus.networking.SubscriptionManager.java
com.james.erebus.networking.SubscriptionRetriever.java
com.james.erebus.networking.TournamentRetriever.java
com.james.erebus.networking.TournamentSubscriptionManager.java