Esempio n. 1
0
 /**
  * @param name modifier name to parse
  * @param kinds if not empty, returns only a modifier that matches all of the kinds
  * @return Modifier that matches any of the kinds constraints
  */
 public static Modifier parseModifier(String name, ModifierKind... kinds) {
   try {
     // Modifier modifier = Modifier.valueOf(name);
     Modifier modifier = mods.get(name);
     if (kinds.length == 0 || modifier == null) return modifier;
     for (ModifierKind kind : kinds) if (modifier.isA(kind)) return modifier;
     return kinds.length > 0 ? null : modifier;
   } catch (IllegalArgumentException ex) {
     return null;
   }
 }
Esempio n. 2
0
 public boolean isContainedBy(Collection<Modifier> modifiers) {
   Modifier alias = resolveAlias();
   for (Modifier modifier : modifiers) if (modifier.resolveAlias().equals(alias)) return true;
   return false;
 }
Esempio n. 3
0
 public int countIn(Collection<Modifier> modifiers) {
   Modifier alias = resolveAlias();
   int c = 0;
   for (Modifier modifier : modifiers) if (modifier.resolveAlias().equals(alias)) c++;
   return c;
 }
Esempio n. 4
0
 public Modifier resolveAlias() {
   if (alias == null) return this;
   return alias.resolveAlias();
 }