All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.rpgframework.genericrpg.chargen.RuleInterpretation Maven / Gradle / Ivy

package de.rpgframework.genericrpg.chargen;

import java.util.ArrayList;
import java.util.List;

import org.prelle.simplepersist.AttribConvert;
import org.prelle.simplepersist.Attribute;
import org.prelle.simplepersist.ElementList;
import org.prelle.simplepersist.Root;

import de.rpgframework.genericrpg.data.DataItem;
import de.rpgframework.genericrpg.data.DataItemTypeKey;
import de.rpgframework.genericrpg.persist.StringListConverter;

/**
 * @author prelle
 *
 */
@Root(name="interpretation")
@DataItemTypeKey(id="interpretation")
public class RuleInterpretation extends DataItem {
	
	@Attribute(name="restrict")
	@AttribConvert(value =StringListConverter.class)
	private List restrictGenTo;
	
	@ElementList(entry = "set", type=RuleConfiguration.class)
	private List rules;

	//-------------------------------------------------------------------
	public RuleInterpretation() {
		rules = new ArrayList();
	}

	//-------------------------------------------------------------------
	/**
	 * @return the restrictGenTo
	 */
	public List getRestrictGenTo() {
		return restrictGenTo;
	}

	//-------------------------------------------------------------------
	/**
	 * @param restrictGenTo the restrictGenTo to set
	 */
	public void setRestrictGenTo(List restrictGenTo) {
		this.restrictGenTo = restrictGenTo;
	}

	//-------------------------------------------------------------------
	/**
	 * @return the rules
	 */
	public List getRules() {
		return rules;
	}

	//-------------------------------------------------------------------
	/**
	 * @param rules the rules to set
	 */
	public void setRules(List rules) {
		this.rules = rules;
	}

	//-------------------------------------------------------------------
	public boolean defines(Rule rule) {
		for (RuleConfiguration conf : rules) {
			if (conf.getRuleId().equals(rule.getID()))
				return true;
		}
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy