コード例 #1
0
  public static void main(String[] args) {
    String[] infos = IdentifierExpertSystem.instance().getKernelInformations();
    String[] titles = IdentifierExpertSystem.instance().getKernelTitles();
    Hashtable attributes = new Hashtable();
    int kernelHash = IdentifierExpertSystem.instance().getKernelHash();
    StringBuffer buffer = new StringBuffer(10000);
    String title;
    String delimiterHuge =
        "===========================================================================\n";
    String delimiterSmall =
        "---------------------------------------------------------------------------\n";

    buffer.append(delimiterHuge);
    buffer.append(("Date: " + (new Date()).toGMTString()) + "\n");
    buffer.append("JOELib2 chemistry kernel (expert systems) ID: " + kernelHash + "\n");
    buffer.append("The following expert systems are used:\n");
    buffer.append(delimiterSmall);

    for (int i = 0; i < infos.length; i++) {
      attributes.clear();
      title = IdentifierExpertSystem.CML_KERNEL_REFERENCE_PREFIX + kernelHash + ":" + titles[i];

      //            if (i < (infos.length - 1))
      //            {
      //                buffer.append(", ");
      //            }

      buffer.append(title + " (" + infos[i].hashCode() + ") \n");
      buffer.append(infos[i] + "\n");
    }

    buffer.append(delimiterHuge);

    String[] asList = IdentifierExpertSystem.getDependencyTreeClassNames();

    for (int i = 0; i < asList.length; i++) {
      buffer.append("dependency class is: \t\t\t\t" + asList[i] + "\n");
      buffer.append(
          "dependency version hash code is: \t\t"
              + IdentifierExpertSystem.getDependencyTreeHash(asList[i])
              + " (including chemistry kernel hash: "
              + kernelHash
              + ")\n");
      buffer.append(
          "dependency algorithm complexity is at least: \t"
              + IdentifierExpertSystem.getDependencyTreeComplexity(asList[i])
              + " (+ basic user input graph, + cyclic dependencies, + data structure , + forgotten dependencies)\n");
      buffer.append("\n" + IdentifierExpertSystem.getDependencyTree(asList[i]) + "\n");

      if (i < (asList.length - 1)) {
        buffer.append(delimiterSmall);
      }
    }

    buffer.append(delimiterHuge);

    System.out.println(buffer.toString());
  }
コード例 #2
0
  /** Constructor for the JOETypeTable object */
  private BasicResidueData() {
    initialized = false;

    Properties prop = BasicPropertyHolder.instance().getProperties();
    resourceFile = prop.getProperty(this.getClass().getName() + ".resourceFile", DEFAULT_RESOURCE);

    _resname = new Vector();
    _resatoms = new Vector();
    _resbonds = new Vector();

    _vatmtmp = new Vector();
    _vtmp = new Vector();

    vendor = VENDOR;
    releaseVersion = IdentifierExpertSystem.transformCVStag(RELEASE_VERSION);
    releaseDate = IdentifierExpertSystem.transformCVStag(RELEASE_DATE);

    IdentifierExpertSystem.instance().addHardCodedKernel(this);
    init();
    IdentifierExpertSystem.instance().addSoftCodedKernel(this);
  }
コード例 #3
0
ファイル: LogP.java プロジェクト: bioclipse/bioclipse.joelib
 public static String getVendor() {
   return IdentifierExpertSystem.transformCVStag(RELEASE_DATE);
 }
コード例 #4
0
ファイル: LogP.java プロジェクト: bioclipse/bioclipse.joelib
 public static String getReleaseVersion() {
   return IdentifierExpertSystem.transformCVStag(RELEASE_VERSION);
 }
コード例 #5
0
ファイル: LogP.java プロジェクト: bioclipse/bioclipse.joelib
 public int hashedDependencyTreeVersion() {
   return IdentifierExpertSystem.getDependencyTreeHash(getName());
 }
コード例 #6
0
  /**
   * @param class1
   * @param buffer
   * @param i
   */
  private static int recurseInto(
      Class class1, StringBuffer buffer, int tabs, Vector<String> results) {
    Method dependencies = null;
    Method releaseVersion = null;

    try {
      dependencies = class1.getMethod("getDependencies", null);
      releaseVersion = class1.getMethod("getReleaseVersion", null);
    } catch (SecurityException e) {
      // ignore all exceptions
    } catch (NoSuchMethodException e) {
      // ignore all exceptions
    }

    int dependsOn = 0;

    if (dependencies != null) {
      Object dependsOnVal = null;
      Object releaseVal = null;

      //            if (releaseVersion != null) {
      //                System.out.println(classes[c].getName() + " "
      //                        + releaseVersion + " isAccessible="
      //                        + releaseVersion.isAccessible() + " isStatic="
      //                        + Modifier.isStatic(releaseVersion.getModifiers())
      //                        + " isPublic="
      //                        + Modifier.isPublic(releaseVersion.getModifiers()));
      //            }
      try {
        int modifier = dependencies.getModifiers();

        if (Modifier.isStatic(modifier) && Modifier.isPublic(modifier)) {
          dependsOnVal = dependencies.invoke(null, null);
        }

        if (releaseVersion != null) {
          modifier = releaseVersion.getModifiers();

          if (Modifier.isStatic(modifier) && Modifier.isPublic(modifier)) {
            releaseVal = releaseVersion.invoke(null, null);
          }
        }
      } catch (IllegalArgumentException e2) {
        // ignore all exceptions
      } catch (IllegalAccessException e2) {
        // ignore all exceptions
      } catch (InvocationTargetException e2) {
        // ignore all exceptions
      } catch (NullPointerException e2) {
        // ignore all exceptions
      }

      if ((dependsOnVal != null) && (dependsOnVal instanceof Class[])) {
        Class[] dependson = (Class[]) dependsOnVal;

        for (int j = 0; j < tabs; j++) {
          buffer.append(DELIMITER);
        }

        buffer.append(class1 + "(");

        if ((releaseVal != null) && (releaseVal instanceof String)) {
          String release = (String) releaseVal;
          buffer.append("version ");
          buffer.append(release);
        } else {
          buffer.append("no version available");
        }

        buffer.append(")");

        if (dependson.length != 0) {
          if (class1 != SMARTSParser.class) {
            buffer.append(" depends on");
          } else {
            buffer.append(" depends on (WARNING: cyclic dependencies)");
          }

          for (int i = 0; i < dependson.length; i++) {
            if (class1 != SMARTSParser.class) {
              buffer.append('\n');

              // System.out.println("dependson["+i+"]:"+dependson[i]);
              dependsOn += recurseInto(dependson[i], buffer, tabs + 1, results);
              dependsOn++;
            } else {
              if ((i % 7) == 0) {
                buffer.append('\n');

                for (int j = 0; j < (tabs + 1); j++) {
                  buffer.append(DELIMITER);
                }
              }

              int index = dependson[i].getName().lastIndexOf(".");

              if (index == -1) {
                index = 0;
              } else {
                index = index + 1;
              }

              buffer.append(dependson[i].getName().substring(index));

              if (i < (dependson.length - 1)) {
                buffer.append(", ");
              }
            }
          }
        }

        if (tabs == 0) {
          String finalDT = buffer.toString();
          results.add(finalDT);

          int dthash = IdentifierExpertSystem.instance().getKernelHash();
          dthash = (31 * dthash) + finalDT.hashCode();
          dependencyVersionHash.put(
              class1.getName(), new int[] {dthash, results.size() - 1, dependsOn});
        }
      }
    }

    return dependsOn;
  }