org.unlaxer.sample.calc.model.CharacterAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of calculator Show documentation
Show all versions of calculator Show documentation
a simple parser combinator inspired by RelaxNG
package org.unlaxer.sample.calc.model;
public class CharacterAttributes{
public int attributres;
public void setAttributes(CharacterAttribute...characterAttributes){
for (CharacterAttribute characterAttribute : characterAttributes) {
if(has(characterAttribute)){
continue;
}
attributres += characterAttribute.code;
}
}
public void resetAttributes(CharacterAttribute...characterAttributes){
for (CharacterAttribute characterAttribute : characterAttributes) {
if(has(characterAttribute)){
attributres -= characterAttribute.code;
}
}
}
public boolean has(CharacterAttribute characterAttribute){
return (attributres & characterAttribute.code) != 0;
}
}