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

org.snapscript.tree.ModifierData Maven / Gradle / Ivy

package org.snapscript.tree;

import org.snapscript.core.ModifierType;
import org.snapscript.core.error.InternalStateException;

public class ModifierData {
   
   private final ModifierType[] types;
   
   public ModifierData(ModifierType... types) {
      this.types = types;
   }
   
   public int getModifiers(){
      int mask = 0;
      
      for(ModifierType type : types) {        
         if(type != null) {
            if((mask & type.mask) == type.mask) {
               throw new InternalStateException("Modifier '" + type + "' declared twice");
            }
            mask |= type.mask;
         }
      }
      return mask;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy