Ejemplo n.º 1
0
 public void setGenome(String key, Genome genome) {
   if (!genome.getID().equals(key)) {
     throw new IllegalStateException();
   }
   keyedGenomes_.put(genome.getID(), genome);
   return;
 }
Ejemplo n.º 2
0
 public void install(DBGenome genome, List<Genome> keyedGenomes) {
   rootGenome_ = genome;
   keyedGenomes_ = new HashMap<String, Genome>();
   if (genome != null) {
     keyedGenomes_.put(genome.getID(), genome);
   }
   if (keyedGenomes != null) {
     int numkg = keyedGenomes.size();
     for (int i = 0; i < numkg; i++) {
       Genome keyedGenome = keyedGenomes.get(i);
       keyedGenomes_.put(keyedGenome.getID(), keyedGenome);
     }
   }
   Iterator<Genome> vals = this.keyedGenomes_.values().iterator();
   while (vals.hasNext()) {
     AbstractGenome keyedCopy = (AbstractGenome) vals.next();
     keyedCopy.setGenomeSource(this);
   }
   return;
 }
Ejemplo n.º 3
0
 /**
  * ************************************************************************* * * Reduce the genome
  * to hold just our results
  */
 public LocalGenomeSource reduceToResult(
     AllPathsResult apr, String redID, Map<String, String> grpIDMap) {
   // Transfer of genome source is occurring here:
   LocalGenomeSource retval = new LocalGenomeSource(this, grpIDMap);
   Genome reduced = retval.getGenome(redID);
   Genome sourceGenome = getGenome(redID);
   Set<String> lst = apr.getLinkSet();
   Iterator<Linkage> tlit = sourceGenome.getLinkageIterator();
   while (tlit.hasNext()) {
     Linkage link = tlit.next();
     String linkID = link.getID();
     if (!lst.contains(linkID)) {
       reduced.removeLinkage(linkID);
     }
   }
   Set<String> nst = apr.getNodeSet();
   Iterator<Node> nlit = sourceGenome.getAllNodeIterator();
   while (nlit.hasNext()) {
     Node node = nlit.next();
     String nodeID = node.getID();
     if (!nst.contains(nodeID)) {
       reduced.removeNode(nodeID);
     }
   }
   return (retval);
 }
  /** ************************************************************************* * * Constructor */
  public HaloLayoutSetupPanel(
      BTState appState,
      Genome genome,
      String selectedID,
      HaloLayout halo,
      HaloLayout.HaloLayoutParams params) {
    appState_ = appState;
    haveResult_ = false;
    params_ = (HaloLayout.HaloLayoutParams) params.clone();
    params_.selected = selectedID;

    ResourceManager rMan = appState_.getRMan();
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    if ((params_.selected != null) && !halo.selectionIsValid(genome, params_.selected)) {
      params_.selected = null;
    }

    JLabel strategyLabel = new JLabel(rMan.getString("haloLayout.strategyType"));
    strategyCombo_ =
        new JComboBox(HaloLayout.StartSeed.getChoices(appState_, params_.selected != null));

    UiUtil.gbcSet(gbc, 0, 0, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0);
    add(strategyLabel, gbc);
    UiUtil.gbcSet(gbc, 1, 0, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0);
    add(strategyCombo_, gbc);

    JLabel overlayLabel = new JLabel(rMan.getString("haloLayout.overlayOptions"));
    Vector<ChoiceContent> relayoutChoices = NetOverlayProperties.getRelayoutOptions(appState);
    overlayOptionCombo_ = new JComboBox(relayoutChoices);

    boolean activate = (genome == null) || (genome.getNetworkOverlayCount() > 0);
    if (!activate) {
      overlayLabel.setEnabled(false);
      overlayOptionCombo_.setEnabled(false);
    }

    UiUtil.gbcSet(gbc, 0, 1, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0);
    add(overlayLabel, gbc);
    UiUtil.gbcSet(gbc, 1, 1, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0);
    add(overlayOptionCombo_, gbc);
  }
Ejemplo n.º 5
0
 public void setGenome(Genome genome) {
   rootGenome_ = (DBGenome) genome;
   keyedGenomes_.put(genome.getID(), genome);
   return;
 }