Android Open Source - Archeology Status Tracker






From Project

Back to project page Archeology.

License

The source code is released under:

GNU General Public License

If you think the Android project Archeology 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

/*
 * Chipotle Software (c) GPLv3 2013 //  ww w.java 2 s .  c  om
 */

package com.chipotle.archeology.util;

import java.util.*;

public class StatusTracker {
  private Map<String, String> mStatusMap;
  private List<String> mMethodList;
  private static StatusTracker ourInstance = new StatusTracker();
  private static final String STATUS_SUFFIX = "ed";

  public static StatusTracker getInstance() 
  {
    return ourInstance;
  }

  private StatusTracker() 
  {
    mStatusMap = new LinkedHashMap<String, String>();
    mMethodList = new ArrayList<String>();
  }

  public List<String> getMethodList() {
    return mMethodList;
  }

  public void clear() {
    mMethodList.clear();
    mStatusMap.clear();
  }

  /**
   * Adds the status value for the given activityName into the Map.
   *
   * @param activityName
   * @param status
   */
  public void setStatus(String activityName, String status) {
    mMethodList.add(activityName + "." + status + "()");
    if (mStatusMap.containsKey(activityName)) mStatusMap.remove(activityName);
    mStatusMap.put(activityName, status);
  }

  /**
   * Gets the status value for the given activityName.
   *
   * @param activityName
   * @return
   */
  public String getStatus(String activityName) {
    String status = mStatusMap.get(activityName);
    status = status.substring(2, status.length());

    // String manipulation to ensure the status value is spelled correctly.
    if (status.endsWith("e")) {
      status = status.substring(0, status.length() - 1);
    }
    if (status.endsWith("p")) {
      status = status + "p";
    }
    status = status + STATUS_SUFFIX;
    return status;
  }

  public Set<String> keySet() {
    return mStatusMap.keySet();
  }
}




Java Source Code List

com.chipotle.archeology.ActivityB.java
com.chipotle.archeology.ActivityC.java
com.chipotle.archeology.DialogActivity.java
com.chipotle.archeology.DisplayMessageActivity.java
com.chipotle.archeology.MainActivity.java
com.chipotle.archeology.util.StatusTracker.java
com.chipotle.archeology.util.Utils.java