Android Open Source - EulerSolutions Problem Summary

From Project

Back to project page EulerSolutions.


The source code is released under:

MIT License

If you think the Android project EulerSolutions 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.eulersolutions.model;
//from   w w w.  ja  v a 2 s  .  c  o  m
import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

public class ProblemSummary implements Parcelable{
  private static final String TAG = "EulerSolutions-ProblemSummary";
  private ArrayList<String> mTextStrings;
  private ProblemCalculator mCalculator;
  private int mNumberOfInputs;
  private int mId;
  public final static int NAME_INDEX = 0;
  public final static int DESCRIPTION_INDEX = 1;
  public final static int EXAMPLE_INDEX = 2;
  public final static int SOLUTION_INDEX = 3;
  public final static int SOLUTION_EULER_INDEX = 4;
  public final static int FIRST_INPUT_INDEX = 5;
  public ProblemSummary(String name, String description, String example, 
      String solution, String eulerSolution, ArrayList<String> inputStrings, ProblemCalculator calculator,
      int numberOfInputs, int id)
    Log.i(TAG, "Creating Object");
    mTextStrings = new ArrayList<String>();
    mCalculator = calculator;
    mNumberOfInputs = numberOfInputs;
    mId = id;
  public ProblemSummary(Parcel source)
    mTextStrings = (ArrayList<String>) source.readSerializable();
    mCalculator = source.readParcelable(ProblemCalculator.class.getClassLoader());
    mNumberOfInputs = source.readInt();
    mId = source.readInt();
  public String getName()
    return mTextStrings.get(NAME_INDEX);
  public String getDescription()
    return mTextStrings.get(DESCRIPTION_INDEX);
  public String getExample()
    return mTextStrings.get(EXAMPLE_INDEX);
  public String getSolution()
    return mTextStrings.get(SOLUTION_INDEX);
  public String getEulerSolution()
    return mTextStrings.get(SOLUTION_EULER_INDEX);
  public ArrayList<String> getInputStrings()
    return new ArrayList<String>(mTextStrings.subList(
        FIRST_INPUT_INDEX, mTextStrings.size()));
  public ProblemCalculator getCalculator()
    return mCalculator;
  public int getNumberOfInputs()
    return mNumberOfInputs;
  public int getId()
    return mId;

  public int describeContents() {
    return this.hashCode();

  public void writeToParcel(Parcel destination, int flags) {
    destination.writeParcelable(mCalculator, flags);
  public static final Parcelable.Creator<ProblemSummary> CREATOR = 
      new Parcelable.Creator<ProblemSummary>() {
    public ProblemSummary createFromParcel(Parcel in) {
      return new ProblemSummary(in);

    public ProblemSummary[] newArray(int size) {
      return new ProblemSummary[size];

Java Source Code List