Android Open Source - MabLidsAndroid Essay






From Project

Back to project page MabLidsAndroid.

License

The source code is released under:

MIT License

If you think the Android project MabLidsAndroid 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.mikerandrup.essaycomposable;
//  w w w . j a va2 s  .c  o m
import com.mikerandrup.essaycomposable.components.BaseComponent;
import java.util.ArrayList;
import java.util.List;

public class Essay {

    public Essay(String title) {
        components = new ArrayList<BaseComponent>();
        _essayTitle = title;
    }
    private List<BaseComponent> components;

    private String _essayTitle;
    public String getEssayTitle() {
        return _essayTitle;
    }

    public Essay append(BaseComponent comp) {
        components.add(comp);
        return this;
    }

    public boolean hasUnansweredComponent() {
        for (BaseComponent c : components) {
            if (c.isNotAnswered()) {
                return true;
            }
        }
        return false;
    }

    public BaseComponent getNextUnansweredComponent() {
        for (BaseComponent c : components) {
            if (c.isNotAnswered()) {
                return c;
            }
        }
        return null;
    }

    public int getUnansweredCount() {
        int unansweredCount = 0;
        for (BaseComponent c : components) {
            if (c.isNotAnswered()) {
                unansweredCount++;
            }
        }
        if (unansweredCount > _maxUnanswered)
            _maxUnanswered = unansweredCount;

        return unansweredCount;
    }

    private int _maxUnanswered = 0;
    public int getMaxUnansweredCount() {
        if (_maxUnanswered == 0)
            getUnansweredCount();

        return _maxUnanswered;
    }

    @Override
    public String toString(){
        StringBuilder sb = new StringBuilder();

        sb.append("This Essay is titled '" + getEssayTitle() + "':\n\n");

        for (BaseComponent c : components) {
            sb.append(c.toString());
        }

        return sb.toString();
    }
}




Java Source Code List

com.mikerandrup.android.mablids.ApplicationTest.java
com.mikerandrup.android.mablids.EssayActivity.java
com.mikerandrup.android.mablids.SplashActivity.java
com.mikerandrup.essaybuilder.AppReviewEssayBuilder.java
com.mikerandrup.essaycomposable.Essay.java
com.mikerandrup.essaycomposable.components.BaseComponent.java
com.mikerandrup.essaycomposable.components.StaticComponent.java
com.mikerandrup.essaycomposable.components.dynamicwords.Adjective.java
com.mikerandrup.essaycomposable.components.dynamicwords.Adverb.java
com.mikerandrup.essaycomposable.components.dynamicwords.DynamicWordComponent.java
com.mikerandrup.essaycomposable.components.dynamicwords.Noun.java
com.mikerandrup.essaycomposable.components.dynamicwords.Number.java
com.mikerandrup.essaycomposable.components.dynamicwords.Preposition.java
com.mikerandrup.essaycomposable.components.dynamicwords.Pronoun.java
com.mikerandrup.essaycomposable.components.dynamicwords.Verb.java