Esempio n. 1
0
 public void syncPanel() {
   panelPat.syncPanel();
   regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A);
   regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B);
   regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C);
   elevBox.setText(dlg.panelMain.mark.getElevation());
   heightBox.setText(dlg.panelMain.mark.getObjectHeight());
   sourceBox.setText(dlg.panelMain.mark.getSource());
   infoBox.setText(dlg.panelMain.mark.getInfo());
   for (Sts sts : statuses.keySet()) {
     int item = statuses.get(sts);
     if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item);
   }
   for (Cns cns : constructions.keySet()) {
     int item = constructions.get(cns);
     if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item);
   }
   for (Con con : conspicuities.keySet()) {
     int item = conspicuities.get(con);
     if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item);
   }
   for (Con con : reflectivities.keySet()) {
     int item = reflectivities.get(con);
     if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item);
   }
 }
Esempio n. 2
0
 @Override
 public void actionPerformed(ActionEvent e) {
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (button.isSelected()) {
       SmedAction.panelMain.mark.setShape(shp);
       SmedAction.panelMain.mark.setObject(objects.get(shp));
       button.setBorderPainted(true);
     } else {
       button.setBorderPainted(false);
     }
   }
   if (SmedAction.panelMain.mark.testValid()) {
     SmedAction.panelMain.panelChan.topmarkButton.setVisible(true);
     SmedAction.panelMain.panelChan.lightButton.setVisible(true);
     if (SmedAction.panelMain.mark.getCategory() == Cat.LAM_PORT) {
       switch (SmedAction.panelMain.mark.getRegion()) {
         case A:
           SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           break;
         case B:
           SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
           SmedAction.panelMain.mark.setObjColour(Col.GREEN);
           break;
         case C:
           SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP);
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.WHITE);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.WHITE);
           break;
       }
     } else {
       SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP);
       switch (SmedAction.panelMain.mark.getRegion()) {
         case A:
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           break;
         case B:
           SmedAction.panelMain.mark.setObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           break;
         case C:
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           break;
       }
     }
     SmedAction.panelMain.panelMore.syncPanel();
   } else {
     SmedAction.panelMain.panelChan.topmarkButton.setVisible(false);
     SmedAction.panelMain.panelChan.lightButton.setVisible(false);
   }
 }
Esempio n. 3
0
 /**
  * Helper method that can be used to dynamically figure out enumeration type of given {@link
  * EnumSet}, without having access to its declaration. Code is needed to work around design flaw
  * in JDK.
  *
  * @since 1.5
  */
 public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> m) {
   if (!m.isEmpty()) {
     return findEnumType(m.keySet().iterator().next());
   }
   // Otherwise need to locate using an internal field
   return EnumTypeLocator.instance.enumTypeFor(m);
 }
Esempio n. 4
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cns cns : constructions.keySet()) {
     int idx = constructions.get(cns);
     if (dlg.panelMain.mark != null && (idx == constrBox.getSelectedIndex()))
       dlg.panelMain.mark.setConstr(cns);
   }
 }
Esempio n. 5
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Sts sts : statuses.keySet()) {
     int idx = statuses.get(sts);
     if (dlg.panelMain.mark != null && (idx == statusBox.getSelectedIndex()))
       dlg.panelMain.mark.setStatus(sts);
   }
 }
Esempio n. 6
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   if ((dlg.panelMain.mark.getObject() != Obj.MORFAC)
       || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) {
     for (Shp shp : shapes.keySet()) {
       JRadioButton button = shapes.get(shp);
       if (button.isSelected()) {
         dlg.panelMain.mark.setShape(shp);
         if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) {
           dlg.panelMain.mark.setObject(objects.get(shp));
           if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) {
             dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
             dlg.panelMain.mark.setObjColour(Col.YELLOW);
           }
           if (button == cairnButton) {
             dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
             dlg.panelMain.mark.setObjColour(Col.UNKCOL);
           }
           topmarkButton.setVisible(dlg.panelMain.mark.testValid());
         }
         button.setBorderPainted(true);
       } else button.setBorderPainted(false);
     }
     dlg.panelMain.panelMore.syncPanel();
   }
 }
Esempio n. 7
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Con con : reflectivities.keySet()) {
     int idx = reflectivities.get(con);
     if (dlg.panelMain.mark != null && (idx == reflBox.getSelectedIndex()))
       dlg.panelMain.mark.setRefl(con);
   }
 }
Esempio n. 8
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : categories.keySet()) {
     int idx = categories.get(cat);
     if (dlg.node != null && (idx == categoryBox.getSelectedIndex()))
       dlg.panelMain.mark.setCategory(cat);
   }
 }
Esempio n. 9
0
 public void syncPanel() {
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (SmedAction.panelMain.mark.getShape() == shp) {
       button.setBorderPainted(true);
     } else button.setBorderPainted(false);
   }
 }
Esempio n. 10
0
 private static String XMLCIT(EnumMap<CIT, Boolean> em) {
   StringBuilder result = new StringBuilder();
   result.append("<cit");
   if (em != null)
     for (CIT key : em.keySet()) result.append(" " + key.toString() + "=\"" + em.get(key) + "\"");
   result.append("/>");
   return result.toString();
 }
Esempio n. 11
0
 public void syncPanel() {
   if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) == Ent.MOORING) {
     mooringButton.setBorderPainted(true);
     categoryBox.setVisible(false);
     mooringBox.setVisible(true);
     pillarButton.setEnabled(false);
     sparButton.setEnabled(false);
     beaconButton.setEnabled(false);
     towerButton.setEnabled(false);
     stakeButton.setEnabled(false);
     cairnButton.setEnabled(false);
     noticeButton.setEnabled(false);
     topmarkButton.setVisible(false);
     for (Cat cat : moorings.keySet()) {
       int item = moorings.get(cat);
       if (dlg.panelMain.mark.getCategory() == cat) mooringBox.setSelectedIndex(item);
     }
   } else {
     mooringButton.setBorderPainted(false);
     mooringBox.setVisible(false);
     categoryBox.setVisible(true);
     pillarButton.setEnabled(true);
     sparButton.setEnabled(true);
     beaconButton.setEnabled(true);
     towerButton.setEnabled(true);
     stakeButton.setEnabled(true);
     cairnButton.setEnabled(true);
     noticeButton.setEnabled(true);
     topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
     topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
     topmarkButton.setVisible(dlg.panelMain.mark.testValid());
     for (Cat cat : categories.keySet()) {
       int item = categories.get(cat);
       if (dlg.panelMain.mark.getCategory() == cat) categoryBox.setSelectedIndex(item);
     }
   }
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (dlg.panelMain.mark.getShape() == shp) {
       button.setBorderPainted(true);
     } else button.setBorderPainted(false);
   }
   noticeButton.setBorderPainted(false);
   dlg.panelMain.mark.testValid();
 }
Esempio n. 12
0
 /** Converts a CITMap into a human readable String */
 public static String CITInfo(EnumMap<CIT, Boolean> hp) {
   StringBuilder result = new StringBuilder();
   result.append("[");
   if (hp != null) {
     for (CIT key : hp.keySet()) result.append(key.toString() + ":" + hp.get(key) + ", ");
     result.delete(result.length() - 2, result.length());
   }
   result.append("]");
   return result.toString();
 }
Esempio n. 13
0
 public Part clone() {
   if (_type == InstrumentType.NONE) {
     return NULL_PART;
   }
   Part copy = new Part(_type);
   copy.setInstrument(_instrument);
   copy.setCloneNum(_cloneNum);
   for (PlayLevel level : _playLevel.keySet()) {
     copy.setPlayLevel(level, _playLevel.get(level));
   }
   for (int i = 0; i < _noteList.size(); i++) {
     copy.addNote(_noteList.get(i).clone());
   }
   copy.setPartVolume(_partVolume);
   copy.setPan(_pan);
   for (StepValue<Integer> sv : _volume) {
     copy.addVolume(sv.getStep(), sv.getValue());
   }
   if (_type == InstrumentType.SINGLE) {
     for (StepValue<Integer> sv : _bass) {
       copy.addBass(sv.getStep(), sv.getValue());
     }
     for (StepValue<Integer> sv : _button) {
       copy.addButton(sv.getStep(), sv.getValue());
     }
     // clef
     List<StepValue<Clef>> clef = new ArrayList<StepValue<Clef>>();
     for (StepValue<Clef> sv : _clef) {
       clef.add(sv.clone());
     }
     copy.setClef(clef);
   }
   if (_type == InstrumentType.GUITAR || _type == InstrumentType.PIANO) {
     for (StepValue<List<Chord>> sv : _chordSetList) {
       copy.addChordSet(sv.getStep(), sv.getValue());
     }
   }
   if (_type == InstrumentType.PIANO) {
     for (StepValue<Voicing> sv : _voicing) {
       copy.addVoicing(sv.getStep(), sv.getValue());
     }
   }
   copy.setToneAttack(_attack);
   copy.setToneDecay(_decay);
   copy.setToneSustain(_sustain);
   copy.setToneRelease(_release);
   copy.setVibratoShape(_shape);
   copy.setVibratoHold(_hold);
   copy.setVibratoDelay(_delay);
   copy.setVibratoDepth(_depth);
   copy.setVibratoSpeed(_speed);
   copy.setToneEffectType(_effectType);
   copy.setToneEffectValue(_effectValue);
   return copy;
 }
Esempio n. 14
0
  public EnumMap<Planet, EphData> getEphData() {

    calcPlanetaryPosition();
    EnumMap<Planet, EphData> planetEphData = new EnumMap<Planet, EphData>(Planet.class);

    for (Planet planet : planetPos.keySet()) {

      EphData ephData = new EphData(planetPos.get(planet), isReverse.get(planet));
      planetEphData.put(planet, ephData);
    }
    return planetEphData;
  }
  public EnrollmentDialog(
      Frame owner,
      int maxCount,
      final String reasonToFail,
      EnumMap<DPFPFingerIndex, DPFPTemplate> templates) {
    super(owner, true);
    this.templates = templates;

    setTitle("Fingerprint Enrollment");

    DPFPEnrollmentControl enrollmentControl = new DPFPEnrollmentControl();

    EnumSet<DPFPFingerIndex> fingers = EnumSet.noneOf(DPFPFingerIndex.class);
    fingers.addAll(templates.keySet());
    enrollmentControl.setEnrolledFingers(fingers);
    enrollmentControl.setMaxEnrollFingerCount(maxCount);

    enrollmentControl.addEnrollmentListener(
        new DPFPEnrollmentListener() {
          public void fingerDeleted(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else {
              EnrollmentDialog.this.templates.remove(e.getFingerIndex());
            }
          }

          public void fingerEnrolled(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              //                  e.setStopCapture(false);
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else EnrollmentDialog.this.templates.put(e.getFingerIndex(), e.getTemplate());
          }
        });

    getContentPane().setLayout(new BorderLayout());

    JButton closeButton = new JButton("Close");
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false); // End Dialog
          }
        });

    JPanel bottom = new JPanel();
    bottom.add(closeButton);
    add(enrollmentControl, BorderLayout.CENTER);
    add(bottom, BorderLayout.PAGE_END);

    pack();
    setLocationRelativeTo(null);
  }
Esempio n. 16
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : moorings.keySet()) {
     int idx = moorings.get(cat);
     if (dlg.node != null && (idx == mooringBox.getSelectedIndex())) {
       dlg.panelMain.mark.setCategory(cat);
       if ((cat == Cat.INB_CALM) || (cat == Cat.INB_SBM)) {
         dlg.panelMain.mark.setObject(Obj.BOYINB);
         dlg.panelMain.mark.setShape(Shp.UNKSHP);
       } else {
         dlg.panelMain.mark.setObject(Obj.MORFAC);
         if (cat != Cat.MOR_BUOY) dlg.panelMain.mark.setShape(Shp.UNKSHP);
       }
     }
   }
   if (dlg.node != null) syncPanel();
 }
 public boolean reconfigureStorageProcessor(
     EnumMap<VmwareStorageProcessorConfigurableFields, Object> params) {
   VmwareStorageProcessor processor = (VmwareStorageProcessor) this.processor;
   for (VmwareStorageProcessorConfigurableFields key : params.keySet()) {
     switch (key) {
       case NFS_VERSION:
         Integer nfsVersion = (Integer) params.get(key);
         processor.setNfsVersion(nfsVersion);
         this._nfsVersion = nfsVersion;
         break;
       case FULL_CLONE_FLAG:
         boolean fullClone = (boolean) params.get(key);
         processor.setFullCloneFlag(fullClone);
         break;
       default:
         s_logger.error(
             "Unknown reconfigurable field " + key.getName() + " for VmwareStorageProcessor");
         return false;
     }
   }
   return true;
 }
Esempio n. 18
0
  private void validateTargets(File outputBase) throws Exception {
    EnumMap<CompileTarget, String> compileTargets =
        new EnumMap<CompileTarget, String>(CompileTarget.class);

    for (CompileTarget target : targets) {
      File outputFile = outputBase;

      switch (target) {
        case java:
          {
            outputFile = new File(outputBase, "java");
            break;
          }
        case neko:
          {
            outputFile = new File(outputBase, "neko.n");
            break;
          }
        case swf:
          {
            outputFile = new File(outputBase, "flash.swf");
            break;
          }
        case swc:
          {
            outputFile = new File(outputBase, "flash.swc");
            break;
          }
        case js:
          {
            outputFile = new File(outputBase, "js");
            break;
          }
      }

      compileTargets.put(target, outputFile.getAbsolutePath());
    }

    List<String> additionalArgs = new LinkedList<String>();

    // Add flash args
    if (targets.contains(CompileTarget.swf) || targets.contains(CompileTarget.swc)) {
      if (flashStrict) additionalArgs.add("--flash-strict");

      additionalArgs.add("-swf-version");
      additionalArgs.add(swfVersion);
    }

    // Create macro command which add all classes
    // from compile classpath to haxe compiler.
    String sourcePaths =
        StringUtils.join(project.getCompileSourceRoots().iterator(), "','").replace("\\", "\\\\");

    String ignoreClassesJoined = "";
    if (ignoreClasses != null) {
      ignoreClassesJoined = StringUtils.join(ignoreClasses.iterator(), "','");
      if (ignoreClasses.size() > 0) {
        ignoreClassesJoined = "'" + ignoreClassesJoined + "'";
      }
    }

    additionalArgs.add("--macro");
    additionalArgs.add(
        "haxe.macro.Compiler.include('', true, ["
            + ignoreClassesJoined
            + "], [ '"
            + sourcePaths
            + "' ])");
    additionalArgs.addAll(getCommonAdditionalArgs());

    getLog()
        .info(
            String.format(
                "Validating targets: %s",
                StringUtils.join(compileTargets.keySet().iterator(), ", ")));

    compiler.compile(
        project, compileTargets, null, false, false, ArtifactFilterHelper.COMPILE, additionalArgs);
  }
  private XYSeriesCollection createDataset() {
    dataset = new XYSeriesCollection();
    // for (int series = 0; series < res.length; series++) {
    // one for each frame

    baselist = "";
    flowlist = "";
    EnumMap<ResultType, WellFlowDataResult> subresults = null;
    if (subtract > -1) {
      subresults = flowmap.get(subtract);
    }
    p("Creating dataset for flows " + flows);
    for (int flow : flows) {
      EnumMap<ResultType, WellFlowDataResult> results = flowmap.get(flow);
      boolean done = false;
      p("processing flow " + flow);
      if (results != null) {
        for (ResultType key : results.keySet()) {
          // p("got "+key.getName());
          if (key.isShow()) {
            String base = null;
            WellFlowDataResult dataresult = results.get(key);
            if (!done) {
              done = true;
              flowlist += flow + " ";
              if (dataresult.isPrerun()) {
                baselist = " prerun";
              } else if (dataresult.isBfPost()) {
                baselist = " bf post ";
              } else if (dataresult.isBfPre()) {
                baselist = " bf pre";
              }
              if (dataresult.isAcq()) {
                base = "" + context.getBase(flow);
                baselist += base;
              }
            }

            WellFlowDataResult subresult = null;
            if (subresults != null) {
              subresult = subresults.get(key);
            }
            //   p("adding to series " + dataresult.getName() + ":" +
            // Arrays.toString(dataresult.getData()));
            double[] nframedata = dataresult.getData();
            double[] ndata = new double[nframedata.length];
            double[] sdata = null;
            if (subresult != null) {
              p("SUBTRACTING FLOW " + subtract);
              sdata = subresult.getData();
            }
            String serieskey = dataresult.getName() + " flow " + dataresult.getFlow();
            if (base != null) {
              serieskey += " " + base;
            }
            XYSeries seriesres = new XYSeries(serieskey);
            seriesres.setKey(serieskey);
            for (int f = 0; f < nframedata.length; f++) {
              long ts = dataresult.getTimestamps()[f];
              ndata[f] = nframedata[f] - nframedata[0];
              if (sdata != null) {
                ndata[f] = ndata[f] - (sdata[f] - sdata[0]);
              }
              seriesres.add(ts, ndata[f]);
            }
            dataset.addSeries(seriesres);
          }
        }
        //  else p("Not showing "+key.getName());

      } else p("NO results for flow " + flow);
    }

    //   }
    return dataset;
  }
Esempio n. 20
0
  public int getPathDistanceFromA2B(int a, int b, MOVE lastMoveMade) {
    // not going anywhere
    if (a == b) return 0;

    // find nearest junction (there is only one since we can't reverse)

    // first, go to closest junction
    JunctionData fromJunction = nodes[a].getNearestJunction(lastMoveMade);

    // if target is on the way to junction, then we are done
    for (int i = 0; i < fromJunction.path.length; i++) if (fromJunction.path[i] == b) return i + 1;

    // we have reached a junction, fromJunction, which we entered with moveEnteredJunction
    int junctionFrom = fromJunction.nodeID;
    MOVE moveEnteredJunction =
        fromJunction.lastMove.equals(MOVE.NEUTRAL)
            ? lastMoveMade
            : fromJunction.lastMove; // if we are at a junction, consider last move instead

    // now we need to get the 1 or 2 target junctions that enclose the target point
    ArrayList<JunctionData> junctionsTo = nodes[b].closestJunctions;

    int minDist = Integer.MAX_VALUE;
    int closestJunction = -1;

    int junctionFromId = junctionIndexConverter.get(junctionFrom);

    for (int q = 0; q < junctionsTo.size(); q++) {
      int junctionToId = junctionIndexConverter.get(junctionsTo.get(q).nodeID);

      // we are already on the right junction. If the target is in position so that no reversal is
      // required, we are done
      if (junctionFrom == junctionsTo.get(q).nodeID) {
        if (!game.getMoveToMakeToReachDirectNeighbour(
                junctionFrom, junctionsTo.get(q).reversePath[0])
            .equals(moveEnteredJunction.opposite())) {
          closestJunction = q;
          minDist = junctionsTo.get(closestJunction).path.length;
          break;
        }
      }

      EnumMap<MOVE, int[]> paths = junctions[junctionFromId].paths[junctionToId];
      Set<MOVE> set = paths.keySet();

      for (MOVE move : set) {
        if (!move.opposite().equals(moveEnteredJunction) && !move.equals(MOVE.NEUTRAL)) {
          int[] path = paths.get(move);

          if (path.length + junctionsTo.get(q).path.length
              < minDist) // need to take distance from toJunction to target into account
          {
            minDist = path.length + junctionsTo.get(q).path.length;
            closestJunction = q;
          }
        }
      }
    }

    return fromJunction.path.length + minDist;
  }
Esempio n. 21
0
 public Set<E> getUsedGroups() {
   return groupIndexes.keySet();
 }
Esempio n. 22
0
  public int[] getPathFromA2B(int a, int b, MOVE lastMoveMade) {
    // not going anywhere
    if (a == b) return new int[] {};

    // first, go to closest junction (there is only one since we can't reverse)
    JunctionData fromJunction = nodes[a].getNearestJunction(lastMoveMade);

    // if target is on the way to junction, then we are done
    for (int i = 0; i < fromJunction.path.length; i++)
      if (fromJunction.path[i] == b) return Arrays.copyOf(fromJunction.path, i + 1);

    // we have reached a junction, fromJunction, which we entered with moveEnteredJunction
    int junctionFrom = fromJunction.nodeID;
    int junctionFromId = junctionIndexConverter.get(junctionFrom);
    MOVE moveEnteredJunction =
        fromJunction.lastMove.equals(MOVE.NEUTRAL)
            ? lastMoveMade
            : fromJunction.lastMove; // if we are at a junction, consider last move instead

    // now we need to get the 1 or 2 target junctions that enclose the target point
    ArrayList<JunctionData> junctionsTo = nodes[b].closestJunctions;

    int minDist = Integer.MAX_VALUE;
    int[] shortestPath = null;
    int closestJunction = -1;

    boolean onTheWay = false;

    for (int q = 0; q < junctionsTo.size(); q++) {
      int junctionToId = junctionIndexConverter.get(junctionsTo.get(q).nodeID);

      if (junctionFromId == junctionToId) {
        if (!game.getMoveToMakeToReachDirectNeighbour(
                junctionFrom, junctionsTo.get(q).reversePath[0])
            .equals(moveEnteredJunction.opposite())) {
          int[] reversepath = junctionsTo.get(q).reversePath;
          int cutoff = -1;

          for (int w = 0; w < reversepath.length; w++) if (reversepath[w] == b) cutoff = w;

          shortestPath = Arrays.copyOf(reversepath, cutoff + 1);
          minDist = shortestPath.length;
          closestJunction = q;
          onTheWay = true;
        }
      } else {
        EnumMap<MOVE, int[]> paths = junctions[junctionFromId].paths[junctionToId];
        Set<MOVE> set = paths.keySet();

        for (MOVE move : set) {
          if (!move.opposite().equals(moveEnteredJunction) && !move.equals(MOVE.NEUTRAL)) {
            int[] path = paths.get(move);

            if (path.length + junctionsTo.get(q).path.length
                < minDist) // need to take distance from toJunction to target into account
            {
              minDist = path.length + junctionsTo.get(q).path.length;
              shortestPath = path;
              closestJunction = q;
              onTheWay = false;
            }
          }
        }
      }
    }

    if (!onTheWay)
      return concat(fromJunction.path, shortestPath, junctionsTo.get(closestJunction).reversePath);
    else return concat(fromJunction.path, shortestPath);
    //			return concat(fromJunction.path, junctionsTo.get(closestJunction).reversePath);
  }