Android Open Source - dnd5spellbook Class Level Constraint






From Project

Back to project page dnd5spellbook.

License

The source code is released under:

MIT License

If you think the Android project dnd5spellbook 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 org.dnd5spellbook.domain;
/*from   www. j av a2s .co  m*/
/**
 * This class holds pair of values - the name of the caster's class and the level. It
 * defines a limitation for a spell, that is, that spell can be cast by a member of
 * that class at that level.
 */
public class ClassLevelConstraint {
    public ClassName className;
    public int level;

    /**
     * @return name of the casters class that can use the constrained spell
     */
    public ClassName getClassName() {
        return className;
    }

    /**
     * @return level required for a member of a class to cast the constrained spell
     */
    public int getLevel() {
        return level;
    }

    /**
     * Creates a class-level constraint for a spell.
     *
     * @param className name of the casters class that can use the constrained spell
     * @param level     level required for a member of a class to cast the constrained spell
     */
    public ClassLevelConstraint(ClassName className, int level) {
        this.className = className;
        this.level = level;
    }

    @Override
    public String toString() {
        return "ClassLevelConstraint{" +
                "className='" + className + '\'' +
                ", level=" + level +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ClassLevelConstraint that = (ClassLevelConstraint) o;

        if (level != that.level) return false;
        if (className != that.className) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = className.hashCode();
        result = 31 * result + level;
        return result;
    }
}




Java Source Code List

org.dnd5spellbook.ApplicationTest.java
org.dnd5spellbook.Constants.java
org.dnd5spellbook.SpellActivity.java
org.dnd5spellbook.SpellAdapter.java
org.dnd5spellbook.SpellBackgroundFactory.java
org.dnd5spellbook.SpellListActivity.java
org.dnd5spellbook.SpellLoaderTest.java
org.dnd5spellbook.SpellLoader.java
org.dnd5spellbook.SwipeListViewTouchListener.java
org.dnd5spellbook.domain.ClassLevelConstraint.java
org.dnd5spellbook.domain.ClassName.java
org.dnd5spellbook.domain.Spell.java