private List<TypeSymbol> resolveInterfaces(
     final JavacNode annotationNode,
     final Class<? extends java.lang.annotation.Annotation> annotationType,
     final List<Object> listenerInterfaces) {
   List<TypeSymbol> resolvedInterfaces = new ArrayList<TypeSymbol>();
   for (Object listenerInterface : listenerInterfaces) {
     if (listenerInterface instanceof JCFieldAccess) {
       JCFieldAccess interfaze = (JCFieldAccess) listenerInterface;
       if ("class".equals(As.string(interfaze.name))) {
         Type interfaceType = CLASS.resolveMember(annotationNode, interfaze.selected);
         if (interfaceType == null) continue;
         if (interfaceType.isInterface()) {
           TypeSymbol interfaceSymbol = interfaceType.asElement();
           if (interfaceSymbol != null) resolvedInterfaces.add(interfaceSymbol);
         } else {
           annotationNode.addWarning(
               String.format(
                   "@%s works only with interfaces. %s was skipped",
                   annotationType.getName(), listenerInterface));
         }
       }
     }
   }
   return resolvedInterfaces;
 }
 /**
  * get the right enum value for this file extension, or null
  *
  * @param extension
  * @return
  */
 public static FileType getTypeFromExtension(String extension) {
   if (extension != null) {
     if (extension.equalsIgnoreCase(TML.getExtension())) {
       return TML;
     }
     if (extension.equalsIgnoreCase(JAVA.getExtension())) {
       return JAVA;
     }
     if (extension.equalsIgnoreCase(CLASS.getExtension())) {
       return CLASS;
     }
     if (extension.equalsIgnoreCase(PROPERTY.getExtension())) {
       return PROPERTY;
     }
   }
   return null;
 }
  public Set<OWLAxiom> write(OWLClass cls) {
    Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
    axioms.addAll(writeEntityStart(CLASS, cls));

    if (!isFiltered(AxiomType.EQUIVALENT_CLASSES)) {
      for (OWLOntology ontology : getOntologies()) {
        SectionMap equivalentClasses = new SectionMap();
        for (OWLEquivalentClassesAxiom ax : ontology.getEquivalentClassesAxioms(cls)) {
          if (ax.getClassExpressions().size() == 2) {
            if (isDisplayed(ax)) {
              for (OWLClassExpression equivCls : ax.getClassExpressionsMinus(cls)) {
                equivalentClasses.add(equivCls, ax);
              }
              axioms.add(ax);
            }
          }
        }
        equivalentClasses.remove(cls);
        writeSection(EQUIVALENT_TO, equivalentClasses, ",", true, ontology);
      }
    }

    if (!isFiltered(AxiomType.SUBCLASS_OF)) {
      for (OWLOntology ontology : getOntologies()) {
        SectionMap superclasses = new SectionMap();
        for (OWLSubClassOfAxiom ax : ontology.getSubClassAxiomsForSubClass(cls)) {
          if (isDisplayed(ax)) {
            superclasses.add(ax.getSuperClass(), ax);
            axioms.add(ax);
          }
        }
        writeSection(SUBCLASS_OF, superclasses, ",", true, ontology);
      }
      if (renderExtensions) {
        for (OWLOntology ont : getOntologies()) {
          SectionMap subClasses = new SectionMap();
          for (OWLSubClassOfAxiom ax : ont.getSubClassAxiomsForSuperClass(cls)) {
            if (isDisplayed(ax)) {
              subClasses.add(ax.getSubClass(), ax);
              axioms.add(ax);
            }
          }
          writeSection(SUPERCLASS_OF, subClasses, ",", true, ont);
        }
      }
    }
    if (!isFiltered(AxiomType.DISJOINT_CLASSES)) {
      for (OWLOntology ontology : getOntologies()) {
        Set<OWLAxiom> pairwiseDisjointClassesAxioms = new HashSet<OWLAxiom>();
        SectionMap disjointClasses = new SectionMap();
        for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) {
          if (isDisplayed(ax)) {
            if (ax.getClassExpressions().size() == 2) {
              pairwiseDisjointClassesAxioms.add(ax);
              OWLClassExpression disjointWith = ax.getClassExpressionsMinus(cls).iterator().next();
              disjointClasses.add(disjointWith, ax);
            }
            axioms.add(ax);
          }
        }
        writeSection(DISJOINT_WITH, disjointClasses, ", ", false, ontology);
        if (renderExtensions) {
          // Handling of nary in frame style
          for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) {
            if (isDisplayed(ax)) {
              if (ax.getClassExpressions().size() > 2) {
                Set<OWLClassExpression> allDisjointClasses =
                    new TreeSet<OWLClassExpression>(ax.getClassExpressions());
                allDisjointClasses.remove(cls);
                axioms.add(ax);
                writeSection(DISJOINT_CLASSES, allDisjointClasses, ", ", false, ontology);
              }
            }
          }
        }
      }
    }
    if (!isFiltered(AxiomType.HAS_KEY)) {
      for (OWLOntology ontology : getOntologies()) {
        for (OWLHasKeyAxiom ax : ontology.getHasKeyAxioms(cls)) {
          if (isDisplayed(ax)) {
            SectionMap map = new SectionMap();
            map.add(ax.getPropertyExpressions(), ax);
            writeSection(HAS_KEY, map, ", ", true, ontology);
          }
        }
      }
    }
    if (!isFiltered(AxiomType.CLASS_ASSERTION)) {
      for (OWLOntology ontology : getOntologies()) {
        SectionMap individuals = new SectionMap();
        for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(cls)) {
          if (isDisplayed(ax)) {
            if (renderExtensions || ax.getIndividual().isAnonymous()) {
              individuals.add(ax.getIndividual(), ax);
              axioms.add(ax);
            }
          }
        }
        writeSection(INDIVIDUALS, individuals, ",", true, ontology);
      }
    }
    if (!isFiltered(AxiomType.SWRL_RULE)) {
      for (OWLOntology ontology : getOntologies()) {
        Set<OWLAxiom> rules = new HashSet<OWLAxiom>();
        for (SWRLRule rule : ontology.getAxioms(AxiomType.SWRL_RULE)) {
          if (isDisplayed(rule)) {
            for (SWRLAtom atom : rule.getHead()) {
              if (atom.getPredicate().equals(cls)) {
                writeSection(RULE, rules, ", ", true, ontology);
                break;
              }
            }
          }
        }
      }
    }
    writeEntitySectionEnd(CLASS.toString());
    return axioms;
  }
Exemple #4
0
 public static Enemy initEnemy(World world, JSONObject jEnemy) throws JSONException {
   Vector3 position =
       new Vector3((float) jEnemy.getDouble("posx"), (float) jEnemy.getDouble("posy"), 0);
   String enemyClassString = jEnemy.getString("enemy_class");
   Vector2 size =
       new Vector2((float) jEnemy.getDouble("width"), (float) jEnemy.getDouble("height"));
   CLASS enemyClass = CLASS.fromString(enemyClassString);
   Enemy enemy = null;
   switch (enemyClass) {
     case eato:
       enemy = new Eato(world, size, position, jEnemy.optString("direction"));
       break;
     case flyon:
       enemy =
           new Flyon(
               world,
               size,
               position,
               (float) jEnemy.getDouble("max_distance"),
               (float) jEnemy.getDouble("speed"),
               jEnemy.optString("direction", "up"));
       break;
     case furball:
       position.z = Furball.POS_Z;
       enemy = new Furball(world, size, position, jEnemy.optInt("max_downgrade_count"));
       break;
     case turtle:
       position.z = Turtle.POS_Z;
       enemy = new Turtle(world, size, position, jEnemy.optString("color"));
       break;
     case gee:
       enemy =
           new Gee(
               world,
               size,
               position,
               (float) jEnemy.getDouble("fly_distance"),
               jEnemy.getString("color"),
               jEnemy.getString("direction"),
               (float) jEnemy.getDouble("wait_time"));
       break;
     case krush:
       enemy = new Krush(world, size, position);
       break;
     case thromp:
       enemy =
           new Thromp(
               world,
               size,
               position,
               (float) jEnemy.getDouble("max_distance"),
               (float) jEnemy.getDouble("speed"),
               jEnemy.optString("direction", "up"));
       break;
     case spika:
       enemy = new Spika(world, size, position, jEnemy.optString("color"));
       break;
     case rokko:
       enemy = new Rokko(world, size, position, jEnemy.optString("direction"));
       world.screen.game.assets.manager.load("data/sounds/enemy/rokko/hit.mp3", Sound.class);
       break;
     case _static:
       enemy =
           new Static(
               world,
               size,
               position,
               jEnemy.optInt("rotation_speed"),
               jEnemy.optInt("fire_resistance"),
               jEnemy.optInt("ice_resistance"));
       break;
     case spikeball:
       enemy = new Spikeball(world, size, position);
       break;
   }
   return enemy;
 }
Exemple #5
0
 public static CLASS fromString(String string) {
   for (CLASS cls : values()) {
     if (cls.toString().equals(string)) return cls;
   }
   throw new GdxRuntimeException("Unknown enemy class: '" + string + "'");
 }
Exemple #6
0
/**
 * @version $Revision: 1.7 $
 * @author Philippe Le Hégaret
 */
public interface KOMLConstants {

  //    public static final String VERSION = "30, Jun 1998";
  public static final String KOML_DTD = "http://www.inria.fr/koala/XML/koml12.dtd";
  public static final String OLD_VERSION = "24, September 1998";
  public static final int MAJOR_VERSION = 1;
  public static final int MINOR_VERSION = 2;

  public static final String KOML = "koml";
  public static final String OBJECT = "object";
  public static final String OBJECT_CLASS = "object-class";
  public static final String CLASSES = "classes";
  public static final String CLASS = "class";
  public static final String ARRAY = "array";
  public static final String NULL = "null";
  public static final String REFERENCE = "reference";
  public static final String THIS = "this";
  public static final String SUPER = "super";
  public static final String FIELD = "field";
  public static final String ROW = "row";
  public static final String VALUE = "value";

  // attributes names
  public static final String A_VERSION = "version";
  public static final String A_CLASS = "class";
  public static final String A_TYPE = "type";
  public static final String A_NAME = "name";
  public static final String A_UID = "uid";
  public static final String A_ID = "id";
  public static final String A_REF = "ref";
  public static final String A_LENGTH = "length";
  public static final String A_SIZE = "size";
  public static final String A_OBJECT = "object";
  public static final String A_SUPER = "super";
  public static final String A_WRITEMETHOD = "writemethod";
  public static final String A_IMPLEMENTS = "implements";
  public static final String A_TRANSIENT = "transient";

  // values
  public static final String V_BYTE = "byte";
  public static final String V_SHORT = "short";
  public static final String V_INT = "int";
  public static final String V_LONG = "long";
  public static final String V_FLOAT = "float";
  public static final String V_DOUBLE = "double";
  public static final String V_CHAR = "char";
  public static final String V_BOOLEAN = "boolean";
  public static final String V_STRING = "java.lang.String";
  public static final String V_TRUE = "true";
  public static final String V_FALSE = "false";
  public static final String V_SERIALIZABLE = "serializable";
  public static final String V_EXTERNALIZABLE = "externalizable";

  /* HASH CODES */

  public static final int H_KOML = KOML.hashCode();
  public static final int H_OBJECT = OBJECT.hashCode();
  public static final int H_OBJECT_CLASS = OBJECT_CLASS.hashCode();
  public static final int H_CLASSES = CLASSES.hashCode();
  public static final int H_CLASS = CLASS.hashCode();
  public static final int H_ARRAY = ARRAY.hashCode();
  public static final int H_NULL = NULL.hashCode();
  public static final int H_REFERENCE = REFERENCE.hashCode();
  public static final int H_THIS = THIS.hashCode();
  public static final int H_SUPER = SUPER.hashCode();
  public static final int H_FIELD = FIELD.hashCode();
  public static final int H_ROW = ROW.hashCode();
  public static final int H_VALUE = VALUE.hashCode();

  // primitive type
  public static final int H_V_BYTE = V_BYTE.hashCode();
  public static final int H_V_SHORT = V_SHORT.hashCode();
  public static final int H_V_INT = V_INT.hashCode();
  public static final int H_V_LONG = V_LONG.hashCode();
  public static final int H_V_FLOAT = V_FLOAT.hashCode();
  public static final int H_V_DOUBLE = V_DOUBLE.hashCode();
  public static final int H_V_CHAR = V_CHAR.hashCode();
  public static final int H_V_BOOLEAN = V_BOOLEAN.hashCode();
  public static final int H_V_STRING = V_STRING.hashCode();

  public static final int H_V_TRUE = V_TRUE.hashCode();
  public static final int H_V_FALSE = V_FALSE.hashCode();
  public static final int H_V_SERIALIZABLE = V_SERIALIZABLE.hashCode();
  public static final int H_V_EXTERNALIZABLE = V_EXTERNALIZABLE.hashCode();
}
Exemple #7
0
 @Override
 public String classId() {
   return cls.classId();
 }