Example #1
0
 public void setupOk() {
   Error.assertNotNull(satellite);
   Error.assertNotNull(sensorType);
   Error.assertNotNull(availableTimeline);
   Error.assertNotNull(slewMotor);
   Error.assertTrue(number > 0);
 }
  /** Sets up all parameters with target Graph target */
  public MoleculeParameters(Molecule target) {
    // automatically set initial individuals size range
    int vertices = target.getVerticesSize();
    verticesInterval.set(Math.max(2, vertices / 2), vertices * 2);
    cyclesInterval.set(0, target.getNumberOfCycles() * 2);

    // insure that all possible vertex and edge types are in initial population in roughly equal
    // quantities
    java.util.Hashtable elements = new java.util.Hashtable();
    for (VertexIterator v = target.getVertexIterator(); v.more(); v.next()) {
      String s = v.vertex().toString();
      if (!elements.containsKey(s)) {
        elements.put(s, s);
        try {
          provider.add((Vertex) v.vertex().clone());
        } catch (CloneNotSupportedException e) {
          Error.fatal("can't clone vertex: " + e);
        }
      }
    }
    for (EdgeIterator e = target.getEdgeIterator(); e.more(); e.next()) {
      String s = e.edge().toString();
      if (!elements.containsKey(s)) {
        elements.put(s, s);
        try {
          provider.add((Edge) e.edge().clone());
        } catch (CloneNotSupportedException ee) {
          Error.fatal("can't clone edge: " + ee);
        }
      }
    }
    setParameters(target);
  }
Example #3
0
 private static void buildAtomicNumberTable() {
   elementHashtable = new Hashtable(223); // 223 is a nice prime number
   if (elementAr == null) {
     System.out.println("Error! elementAr has not been initialized!");
     Error.fatal("Element: elementAr has not been initialized!");
   }
   for (int i = 0; i < symbolAr.length; i++) {
     elementHashtable.put(symbolAr[i], new Element(i));
   }
 }
 public ContentionStatistics(TaskList inTaskList) {
   Error.assertTrue(inTaskList != null);
   taskList = inTaskList;
   gatherData();
 }