org.snapscript.tree.ModifierList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree;
import org.snapscript.core.ModifierType;
import org.snapscript.core.error.InternalStateException;
public class ModifierList extends ModifierData {
private final Modifier[] modifiers;
public ModifierList(Modifier... modifiers){
this.modifiers = modifiers;
}
@Override
public int getModifiers() {
int mask = 0;
for(Modifier modifier : modifiers) {
ModifierType type = modifier.getType();
if(type != null) {
if((mask & type.mask) == type.mask) {
throw new InternalStateException("Modifier '" + type + "' declared twice");
}
mask |= type.mask;
}
}
return mask;
}
}