public void save(File f) throws IOException {
    PrintStream ps = new PrintStream(new FileOutputStream(f));
    String[] genes = genes();

    Vector<Map<String, Double>> maps = new Vector<Map<String, Double>>();
    for (int j = 0; j < coefs.size(); j++) {
      maps.add(coefs.get(j).geneValues(args.compare));
    }

    ps.print("gene");
    for (int i = 0; i < coefs.size(); i++) {
      ps.print(" " + keys.get(i));
    }
    ps.println();

    for (int i = 0; i < genes.length; i++) {
      ps.print(String.format("%s", genes[i]));

      for (int j = 0; j < coefs.size(); j++) {
        Map<String, Double> map = maps.get(j);
        Double value = map.containsKey(genes[i]) ? map.get(genes[i]) : null;

        ps.print(String.format(" %s", value != null ? String.format("%.2f", value) : "N/A"));
      }

      ps.println();
    }

    ps.println();
    ps.close();
  }
Beispiel #2
0
  public void normalize() {
    for (int i = 0; i < samples.size(); i++) {
      TreeSet<Column.Entry> entries = new TreeSet<Column.Entry>();
      for (int j = 0; j < cols.size(); j++) {
        Column c = cols.get(j);
        if (c.values.get(i) != null) {
          entries.add(c.entry(i));
        }
      }

      int ns = entries.size();
      int j = 0;
      for (Column.Entry e : entries) {
        int cidx = ids.get(e.id());
        float ff = (float) j / (float) ns;
        cols.get(cidx).values.set(i, ff);
      }

      if (i > 0) {
        if (i % 100 == 0) {
          System.out.print(".");
          System.out.flush();
        }
      }
    }
    System.out.println();
  }
Beispiel #3
0
  public void saveFile(File f) throws IOException {
    PrintStream ps = new PrintStream(new FileOutputStream(f));
    ps.print("ID");
    for (Column c : cols) {
      ps.print(String.format("\t%s", c.id));
    }
    ps.println();
    for (int i = 0; i < samples.size(); i++) {
      ps.print(samples.get(i));
      for (int j = 0; j < cols.size(); j++) {
        Float ff = cols.get(j).values.get(i);
        if (ff == null) {
          ps.print("\tnull");
        } else {
          ps.print(String.format("\t%.2f", ff));
        }
      }
      ps.println();

      if (i > 0) {
        if (i % 100 == 0) {
          System.out.print(".");
          System.out.flush();
        }
      }
    }
    System.out.println();
    ps.close();
  }
Beispiel #4
0
 Woman ExtractMax() {
   Woman maxV = A.get(1);
   A.set(1, A.get(BinaryHeapSize));
   BinaryHeapSize--; // virtual decrease
   shiftDown(1);
   return maxV;
 }
 // keyboard discovery code
 private void _mapKey(char charCode, int keyindex, boolean shift, boolean altgraph) {
   log("_mapKey: " + charCode);
   // if character is not in map, add it
   if (!charMap.containsKey(new Integer(charCode))) {
     log("Notified: " + (char) charCode);
     KeyEvent event =
         new KeyEvent(
             applet(),
             0,
             0,
             (shift ? KeyEvent.SHIFT_MASK : 0) + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0),
             ((Integer) vkKeys.get(keyindex)).intValue(),
             (char) charCode);
     charMap.put(new Integer(charCode), event);
     log("Mapped char " + (char) charCode + " to KeyEvent " + event);
     if (((char) charCode) >= 'a' && ((char) charCode) <= 'z') {
       // put shifted version of a-z in automatically
       int uppercharCode = (int) Character.toUpperCase((char) charCode);
       event =
           new KeyEvent(
               applet(),
               0,
               0,
               KeyEvent.SHIFT_MASK + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0),
               ((Integer) vkKeys.get(keyindex)).intValue(),
               (char) uppercharCode);
       charMap.put(new Integer(uppercharCode), event);
       log("Mapped char " + (char) uppercharCode + " to KeyEvent " + event);
     }
   }
 }
Beispiel #6
0
 /**
  * Gets a list of all the devices found on the bus matching the specified serial number. Only
  * devices exactly matching the specified serial number will be returned. In theory, there ought
  * to be only one device matching a given serial number, but this method returns a vector in order
  * to be consistent with the other search methods, and in unlikely event that multiple devices do
  * share the same serial number.
  *
  * @param serialNumber the serial number to search for.
  * @return An array of all the devices found. If no devices were found matching the specified
  *     serial number, the array will be empty (i.e. contain zero items).
  */
 public USBDevice[] getDeviceBySerialNumber(long serialNumber) {
   Vector<USBDevice> devices = new Vector<USBDevice>();
   for (int index = 0; index < deviceList.size(); index++) {
     if (deviceList.get(index).getSerialNumber() == serialNumber)
       devices.add(deviceList.get(index));
   } // for( int index ...
   return devices.toArray(new USBDevice[0]);
 } // getDeviceBySerialNumber()
Beispiel #7
0
  // ParserListener methods
  public void noteEvent(Note note) {
    if (layer >= staves) {
      return;
    }
    // System.out.println(note.getMusicString() + " " + note.getMillisDuration() + " " +
    // note.getDecimalDuration());
    Vector<Chord> currChords = chords[layer];
    Iterator<NotePanel> currNote = currNotes[layer];

    if (!currNote.hasNext()) {
      System.err.println("Received noteEvent, but no PostScript notes are left");
      return;
    }

    if (note.getMillisDuration() > 0) {
      NotePanel notePanel = currNote.next();
      // time the last chord ended
      long tempTime = 0;
      for (int i = currChords.size() - 1; i >= 0; --i) {
        if (!currChords.get(i).isTie()) {
          tempTime = currChords.get(i).getTime() + currChords.get(i).getDuration();
          break;
        }
      }

      if (notePanel.isTie) {
        Chord chord = new Chord();
        // for each note in the last chord, set the next note as a tied note
        for (int i = 0; i < currChords.lastElement().size(); ++i) {
          notePanel.setTie(true).setTime(Math.min(tempTime, time - 1)).setTempo(tempo);
          chord.addNote(notePanel);
          notePanel = currNote.next();
        }
        currChords.add(chord);
      }

      while (notePanel.isRest) {
        notePanel
            .setTime(Math.min(tempTime, time - 1)) // hack, in case the rest should be trimmed
            .setTempo(tempo);
        tempTime += notePanel.getDuration();
        Chord chord = new Chord(notePanel);
        currChords.add(chord);
        // System.out.println("REST: " + notePanel.getMusicString() + " " +
        // notePanel.getDuration());
        notePanel = currNote.next();
      }

      notePanel.setNote(note).setTime(time).setTempo(tempo);
      if (currChords.isEmpty() || currChords.lastElement().getTime() != time) {
        Chord chord = new Chord(notePanel);
        currChords.add(chord);
      } else {
        currChords.lastElement().addNote(notePanel);
      }
    }
  }
Beispiel #8
0
  /**
   * Show a dialog for printing the current drawing.
   *
   * @param fff the parent frame which will be used for dialogs and message boxes.
   * @param CCr the CircuitPanel containing the drawing to be exported.
   */
  public void printDrawing(JFrame fff, CircuitPanel CCr) {
    cc = CCr;
    DialogPrint dp = new DialogPrint(fff);
    dp.setMirror(printMirror);
    dp.setFit(printFitToPage);
    dp.setBW(printBlackWhite);
    dp.setLandscape(printLandscape);
    dp.setVisible(true);

    // Get some information about the printing options.
    printMirror = dp.getMirror();
    printFitToPage = dp.getFit();
    printLandscape = dp.getLandscape();
    printBlackWhite = dp.getBW();

    Vector<LayerDesc> ol = cc.dmp.getLayers();
    if (dp.shouldPrint()) {
      if (printBlackWhite) {
        Vector<LayerDesc> v = new Vector<LayerDesc>();

        // Here we create an alternative array of layers in
        // which all colors are pitch black. This may be
        // useful for PCB's.

        for (int i = 0; i < LayerDesc.MAX_LAYERS; ++i)
          v.add(
              new LayerDesc(
                  new ColorSwing(Color.black),
                  ((LayerDesc) ol.get(i)).getVisible(),
                  "B/W",
                  ((LayerDesc) ol.get(i)).getAlpha()));
        cc.dmp.setLayers(v);
      }
      PrinterJob job = PrinterJob.getPrinterJob();
      job.setPrintable(this);
      boolean ok = job.printDialog();
      if (ok) {
        try {
          PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
          // Set the correct printing orientation.
          if (printLandscape) {
            aset.add(OrientationRequested.LANDSCAPE);
          } else {
            aset.add(OrientationRequested.PORTRAIT);
          }
          job.print(aset);
        } catch (PrinterException ex) {
          // The job did not successfully complete
          JOptionPane.showMessageDialog(fff, Globals.messages.getString("Print_uncomplete"));
        }
      }
      cc.dmp.setLayers(ol);
    }
  }
Beispiel #9
0
 void Update(Woman mother) {
   Woman temp;
   int i = getNameIndex(mother.name);
   temp = A.get(i);
   temp.dilation = A.get(i).dilation + mother.dilation;
   temp.name = A.get(i).name;
   temp.order = A.get(i).order;
   A.set(i, temp);
   shiftUp(i);
   shiftDown(i);
 }
Beispiel #10
0
  public static void main(String[] args) throws Exception {
    int V, E, s, a, b, w;

    File f = new File("in_06.txt");
    Scanner sc = new Scanner(f);

    V = sc.nextInt();
    E = sc.nextInt();
    s = sc.nextInt();

    AdjList.clear();
    for (int i = 0; i < V; i++) {
      Vector<IntegerPair> Neighbor = new Vector<IntegerPair>();
      AdjList.add(Neighbor); // add neighbor list to Adjacency List
    }

    for (int i = 0; i < E; i++) {
      a = sc.nextInt();
      b = sc.nextInt();
      w = sc.nextInt();
      AdjList.get(a).add(new IntegerPair(b, w)); // first time using weight
    }

    // as an example, we start from this source (see Figure 1.15)
    Vector<Integer> dist = new Vector<Integer>();
    dist.addAll(Collections.nCopies(V, INF));
    dist.set(s, 0);

    // Bellman Ford routine
    for (int i = 0; i < V - 1; i++) // relax all E edges V-1 times, O(V)
    for (int u = 0; u < V; u++) { // these two loops = O(E)
        Iterator it = AdjList.get(u).iterator();
        while (it.hasNext()) { // relax these edges
          IntegerPair v = (IntegerPair) it.next();
          dist.set(v.first(), Math.min(dist.get(v.first()), dist.get(u) + v.second()));
        }
      }

    boolean negative_cycle_exist = false;
    for (int u = 0; u < V; u++) { // one more pass to check
      Iterator it = AdjList.get(u).iterator();
      while (it.hasNext()) { // relax these edges
        IntegerPair v = (IntegerPair) it.next();
        if (dist.get(v.first()) > dist.get(u) + v.second()) // should be false, but if possible
        negative_cycle_exist = true; // then negative cycle exists!
      }
    }
    System.out.printf("Negative Cycle Exist? %s\n", negative_cycle_exist ? "Yes" : "No");

    if (!negative_cycle_exist)
      for (int i = 0; i < V; i++) System.out.printf("SSSP(%d, %d) = %d\n", s, i, dist.get(i));
  }
  public static int find(
      Vector<String> fileNames, String name, Vector<String> fileTypes, String type) {

    int pos = -1;
    // necessario procurar um por um porque pode ter arquivos
    // com o mesmo nome mas com tipo diferentes
    for (int i = 0; i < fileNames.size(); i++) {
      if (fileNames.get(i).equals(name) && fileTypes.get(i).equals(type)) {
        pos = i;
      }
    }
    return pos;
  }
Beispiel #12
0
 /**
  * Gets a list of all the devices found on the bus matching the specified product ID range. Any
  * device with a product ID greater than or equal to <i>minProductID</i> and less than or equal to
  * <i>maxProductID</i> will be returned. You can obtain the entire list of devices detected by
  * passing a value of 0 for <i>minProductID</i> and a value of 0xffff for <i>maxProductID</i>.
  * Then you can search the list obtained using your own search criteria.
  *
  * @param minProductID the minimum product ID to search for.
  * @param maxProductID the maximum product ID to search for.
  * @return An array of all the devices found. If no devices were found matching the specified
  *     product ID range, the array will be empty (i.e. contain zero items).
  * @throws IllegalArgumentException
  */
 public USBDevice[] getDeviceByProductID(int minProductID, int maxProductID) {
   if (minProductID < MIN_PRODUCT_ID
       || minProductID > MAX_PRODUCT_ID
       || maxProductID < minProductID
       || maxProductID > MAX_PRODUCT_ID)
     throw new IllegalArgumentException(
         "Invalid product IDs: " + minProductID + ", " + maxProductID);
   Vector<USBDevice> devices = new Vector<USBDevice>();
   for (int index = 0; index < deviceList.size(); index++) {
     final int productID = deviceList.get(index).getProductID();
     if (productID >= minProductID && productID <= maxProductID)
       devices.add(deviceList.get(index));
   } // for( int index ...
   return devices.toArray(new USBDevice[0]);
 } // getDeviceByProductID()
Beispiel #13
0
  public void outputBinary(DataOutputStream dos) throws IOException {
    dos.writeUTF(id);
    dos.writeInt(values.size());

    int i = 0, j = 0;
    while (i < values.size()) {
      for (j = i; j < values.size() && values.get(j) != null; j++) {}
      int count = j - i - 1;
      dos.writeInt(count);
      for (j = 1; j <= count && i + j < values.size(); j++) {
        dos.writeFloat(values.get(i + j));
      }
      i = j + 1;
    }
  }
Beispiel #14
0
  public void nick_name(String msg) {
    try {
      String name = msg.substring(13);
      this.setName(name);
      Vector v = father.onlineList;
      boolean isRepeatedName = false;
      int size = v.size();
      for (int i = 0; i < size; i++) {
        ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
        if (tempSat.getName().equals(name)) {
          isRepeatedName = true;
          break;
        }
      }
      if (isRepeatedName == true) {
        dout.writeUTF("<#NAME_REPEATED#>");
        din.close();
        dout.close();
        sc.close();
        flag = false;
      } else {
        v.add(this);
        father.refreshList();
        String nickListMsg = "";
        StringBuilder nickListMsgSb = new StringBuilder();
        size = v.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
          nickListMsgSb.append("!");
          nickListMsgSb.append(tempSat.getName());
        }
        nickListMsgSb.append("<#NICK_LIST#>");
        nickListMsg = nickListMsgSb.toString();
        Vector tempv = father.onlineList;
        size = tempv.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) tempv.get(i);
          tempSat.dout.writeUTF(nickListMsg);
          if (tempSat != this) {
            tempSat.dout.writeUTF("<#MSG#>" + this.getName() + "is now online....");
          }
        }
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Beispiel #15
0
 /**
  * Gets a list of all the devices found on the bus matching the specified set of product IDs. Any
  * device with a product ID equal to one of the products listed in <i>productIDs[]</i> will be
  * returned. You can search for devices by product name using {@link #productNameToID( String[]
  * productName ) productNameToID()}, like so:
  *
  * <pre>USBDevice[] devices = deviceManager.getDeviceByProductID(
  *  deviceManager.productNameToID( new String[] { "USB-AO16-16A", "USB-AO16-16" } ) );</pre>
  *
  * @param productIDs an array containing one or more product IDs to search for.
  * @return An array of all the devices found. If no devices were found matching the specified set
  *     of product IDs, the array will be empty (i.e. contain zero items).
  * @throws IllegalArgumentException
  */
 public USBDevice[] getDeviceByProductID(int[] productIDs) {
   if (productIDs == null || productIDs.length < 1)
     throw new IllegalArgumentException("Invalid product ID array");
   for (int index = 0; index < productIDs.length; index++) {
     if (productIDs[index] < MIN_PRODUCT_ID || productIDs[index] > MAX_PRODUCT_ID)
       throw new IllegalArgumentException("Invalid product ID: " + productIDs[index]);
   } // for( int index ...
   int[] sortedProductIDs = productIDs.clone();
   Arrays.sort(sortedProductIDs);
   Vector<USBDevice> devices = new Vector<USBDevice>();
   for (int index = 0; index < deviceList.size(); index++) {
     final int productID = deviceList.get(index).getProductID();
     if (Arrays.binarySearch(sortedProductIDs, productID) >= 0) devices.add(deviceList.get(index));
   } // for( int index ...
   return devices.toArray(new USBDevice[0]);
 } // getDeviceByProductID()
 private MultipleAlignment(Vector<String> ord, String[] seqs) {
   this();
   for (int i = 0; i < ord.size(); i++) {
     GappedAlignmentString gap = new GappedAlignmentString(seqs[i].toCharArray());
     addGappedAlignment(ord.get(i), gap);
   }
 }
Beispiel #17
0
 /**
  * Gets the urlClassLoader that enables to access to the objects jar files.
  *
  * @return an URLClassLoader
  */
 public URLClassLoader getObjectsClassLoader() {
   if (objectsClassLoader == null) {
     try {
       if (isExecutionMode()) {
         URL[] listUrl = new URL[1];
         listUrl[0] = instance.getTangaraPath().toURI().toURL();
         objectsClassLoader = new URLClassLoader(listUrl);
       } else {
         File f = new File(instance.getTangaraPath().getParentFile(), "objects");
         File[] list = f.listFiles();
         Vector<URL> vector = new Vector<URL>();
         for (int i = 0; i < list.length; i++) {
           if (list[i].getName().endsWith(".jar")) vector.add(list[i].toURI().toURL());
         }
         File flib =
             new File(
                 instance.getTangaraPath().getParentFile().getAbsolutePath().replace("\\", "/")
                     + "/objects/lib");
         File[] listflib = flib.listFiles();
         for (int j = 0; j < listflib.length; j++) {
           if (listflib[j].getName().endsWith(".jar")) vector.add(listflib[j].toURI().toURL());
         }
         URL[] listUrl = new URL[vector.size()];
         for (int j = 0; j < vector.size(); j++) listUrl[j] = vector.get(j);
         objectsClassLoader = new URLClassLoader(listUrl);
       }
     } catch (Exception e1) {
       displayError("URL MAL FORMED " + e1);
       return null;
     }
   }
   return objectsClassLoader;
 }
Beispiel #18
0
 private void addLine(TableLine l) {
   for (int i = 0; i < l.values.length; i++) {
     cols.get(i).values.add(l.values[i]);
   }
   samples.add(l.id);
   sampleIndices.put(l.id, samples.size() - 1);
 }
Beispiel #19
0
 /**
  * Registers a reaction on this tuple space.
  *
  * @param rxn The reaction to register
  * @param listener The reaction callback function
  */
 public void registerReaction(Reaction rxn, ReactionListener listener) {
   reactions.add(new RegisteredReaction(rxn, listener));
   for (int i = 0; i < ts.size(); i++) {
     Tuple t = (Tuple) ts.get(i);
     if (rxn.getTemplate().matches(t)) listener.reactionFired(t);
   }
 }
Beispiel #20
0
 public Tuple rdp(Tuple template) {
   for (int i = 0; i < ts.size(); i++) {
     Tuple tuple = (Tuple) ts.get(i);
     if (template.matches(tuple)) return tuple;
   }
   return null;
 }
  public Matrix matrix(boolean centered) {
    String[] genes = genes();
    Matrix matrix = new Matrix(genes.length, coefs.size());

    for (int j = 0; j < coefs.size(); j++) {
      Map<String, Double> values = coefs.get(j).geneValues(args.compare);
      double sum = 0.0;

      for (int i = 0; i < genes.length; i++) {
        Double value = values.get(genes[i]);
        if (value != null) {
          matrix.set(i, j, value);
          sum += value;
        } else {
          matrix.set(i, j, 0.0);
        }
      }

      if (centered) {
        sum /= (double) genes.length;
        for (int i = 0; i < genes.length; i++) {
          matrix.set(i, j, matrix.get(i, j) - sum);
        }
      }
    }

    return matrix;
  }
  /*................................................................................................*/
  private TreeVector fillBlock(Taxa taxa) { // TODO: fill in
    TreeVector filledVector = new TreeVector(taxa);
    int vectorTreeCount = 0;
    for (int fillers = 0; fillers < fillerTasks.size(); fillers++) {
      if (fillerTasks.get(fillers) instanceof SampleOneTreeFromFile) {
        ((SampleOneTreeFromFile) fillerTasks.get(fillers))
            .resetTreesToSample(); // One unnecessary resetting of bits on first call
        TreeVector tempTreeVector = new TreeVector(taxa);
        ((TreeBlockFiller) fillerTasks.get(fillers)).fillTreeBlock(tempTreeVector, 1);
        if (tempTreeVector.getNumberOfTrees() < 1) {
          logln(
              "Not enough trees were supplied by "
                  + ((TreeBlockFiller) fillerTasks.get(fillers)).getName()
                  + "; "
                  + tempTreeVector.getNumberOfTrees()
                  + " provided, one requested.");
          ;
        }
        if (tempTreeVector.getNumberOfTrees() > 0) {
          int treeCount = 0;
          while (treeCount < 1
              && treeCount
                  < tempTreeVector
                      .getNumberOfTrees()) { // Check so we don't ask for more trees that are there.
            filledVector.addElement(tempTreeVector.getTree(treeCount), false);
            if (filledVector != null && tempTreeVector != null) {
              if (filledVector.getTree(vectorTreeCount) != null
                  && tempTreeVector.getName() != null) {
                if (filledVector.getTree(vectorTreeCount).getName() != null)
                  logln(
                      filledVector.getTree(vectorTreeCount).getName()
                          + " added from "
                          + tempTreeVector.getName());
              }
            }
            treeCount++;
            vectorTreeCount++;
          }
        }
        tempTreeVector.dispose(); // disposed to reduce memory demands

        //				(fillerTask.get(fillers)).
      }
    }
    return filledVector;
  }
Beispiel #23
0
 /**
  * Generates XML description of the OD.<br>
  * If the print stream is specified, then XML buffer is written to the stream.
  *
  * @param out print stream.
  * @throws IOException
  */
 public void xmlDump(PrintStream out) throws IOException {
   if (out == null) out = System.out;
   out.print("<od begin=\"" + origin.getId() + "\" end=\"" + destination.getId() + "\">\n");
   out.print("<PathList>\n");
   for (int i = 0; i < pathList.size(); i++) pathList.get(i).xmlDump(out);
   out.print("</PathList>\n</od>\n");
   return;
 }
Beispiel #24
0
 private static void printpath(int u) {
   if (u == s) {
     System.out.printf("%d", u);
     return;
   }
   printpath(p.get(u));
   System.out.printf(" %d", u);
 }
Beispiel #25
0
 private void checkRxns(Tuple t) {
   for (int i = 0; i < reactions.size(); i++) {
     RegisteredReaction rr = (RegisteredReaction) reactions.get(i);
     if (rr.getReaction().getTemplate().matches(t)) {
       rr.getListener().reactionFired(t);
     }
   }
 }
 /**
  * @param j The ungapped index into the multiple alignment.
  * @return An array of characters, corresponding to a particular column from the multiple
  *     alignment.
  */
 public char[] alignedChars(int j) {
   char[] array = new char[ordering.size()];
   for (int i = 0; i < ordering.size(); i++) {
     String species = ordering.get(i);
     array[i] = gappedAlignments.get(species).gappedChar(j);
   }
   return array;
 }
Beispiel #27
0
  void print() {
    System.out.println();
    System.out.println();
    System.out.println("PRINTING MAP ELEMENTS");
    for (Map.Entry<String, Woman> entry : B.entrySet()) {
      System.out.println(entry.getKey() + "/" + entry.getValue().index);
    }
    System.out.println();

    System.out.println("PRINTING VECTOR ELEMENTS");
    for (int i = 0; i < A.size(); i++) {
      System.out.println(i + " " + A.get(i).name + " " + A.get(i).index + " " + A.get(i).dilation);
    }

    System.out.println();
    System.out.println();
  }
 /**
  * Checks if there is a gap in position <tt>gi</tt> in at least one of the aligned sequences
  *
  * @param gi Position to be queried for the presence of a gap
  * @return <tt>true</tt> if there is no gap in any of the aligned sequences</br> <tt>false</tt> if
  *     there is at least one.
  */
 public boolean isPresent(int gi) {
   for (int i = 0; i < ordering.size(); i++) {
     if (gappedAlignments.get(ordering.get(i)).isGap(gi)) {
       return false;
     }
   }
   return true;
 }
Beispiel #29
0
 public Tuple[] rdgp(Tuple template) {
   Vector matchingTuples = new Vector();
   for (int i = 0; i < ts.size(); i++) {
     Tuple tuple = (Tuple) ts.get(i);
     if (template.matches(tuple)) matchingTuples.add(tuple);
   }
   if (matchingTuples.size() == 0) return null;
   return (Tuple[]) matchingTuples.toArray(new Tuple[0]);
 }
Beispiel #30
0
 /**
  * Deregisters a reaction.
  *
  * @param r The reaction to register.
  * @return true if successful, false otherwise.
  */
 public boolean deregisterReaction(Reaction r) {
   for (int i = 0; i < reactions.size(); i++) {
     RegisteredReaction rxn = (RegisteredReaction) reactions.get(i);
     if (rxn.rxn.equals(r)) {
       reactions.remove(i);
       return true;
     }
   }
   return false;
 }