test_class.declarator: context = new Mockery()
test_class.modifier: private static final
test_class.original_string: private static final Mockery context = new Mockery();
test_class.type: Mockery
test_class.var_name: context
test_class.file: decoder/src/test/java/openlr/decoder/worker/DecoderUtilsTest.java
test_class.identifier: DecoderUtilsTest
test_case.body: @Test
      public void testCandidatePairOrder() {
          final Line l24 = context.mock(Line.class, "l24");
          context.checking(new Expectations() {
              {
                  allowing(l24).getID();
                  will(returnValue(24l));
              }
          });
          final Line l21 = context.mock(Line.class, "l21");
          context.checking(new Expectations() {
              {
                  allowing(l21).getID();
                  will(returnValue(21l));
              }
          });
          final Line l33 = context.mock(Line.class, "l33");
          context.checking(new Expectations() {
              {
                  allowing(l33).getID();
                  will(returnValue(33l));
              }
          });
          final LocationReferencePoint lrp1 = context
                  .mock(LocationReferencePoint.class, "lrp1");
          context.checking(new Expectations() {
              {
                  allowing(lrp1).getSequenceNumber();
                  will(returnValue(1));
              }
          });
          List<CandidateLine> candidates1 = new ArrayList<CandidateLine>();
          candidates1.add(new CandidateLine(l24, 1197));
          candidates1.add(new CandidateLine(l21, 1110));
          candidates1.add(new CandidateLine(l33, 855));
          CandidateLinesResultSet clrs = new CandidateLinesResultSet();
          clrs.putCandidateLines(lrp1, candidates1);
  
          final LocationReferencePoint lrp2 = context
                  .mock(LocationReferencePoint.class, "lrp2");
          context.checking(new Expectations() {
              {
                  allowing(lrp2).getSequenceNumber();
                  will(returnValue(2));
              }
          });
          context.checking(new Expectations() {
              {
                  allowing(lrp2).isLastLRP();
                  will(returnValue(false));
              }
          });
          List<CandidateLine> candidates2 = new ArrayList<CandidateLine>();
          candidates2.add(new CandidateLine(l24, 1164));
          candidates2.add(new CandidateLine(l21, 1149));
          candidates2.add(new CandidateLine(l33, 821));
          clrs.putCandidateLines(lrp2, candidates2);
  
          final LocationReferencePoint lrp3 = context
                  .mock(LocationReferencePoint.class, "lrp3");
          context.checking(new Expectations() {
              {
                  allowing(lrp3).getSequenceNumber();
                  will(returnValue(3));
              }
          });
          context.checking(new Expectations() {
              {
                  allowing(lrp3).isLastLRP();
                  will(returnValue(true));
              }
          });
          List<CandidateLine> candidates3 = new ArrayList<CandidateLine>();
          candidates3.add(new CandidateLine(l24, 1194));
          candidates3.add(new CandidateLine(l33, 821));
          clrs.putCandidateLines(lrp3, candidates3);
  
          try {
              List<CandidateLinePair> order = DecoderUtils
                      .resolveCandidatesOrder(lrp1, lrp2, clrs, null,
                              new OpenLRDecoderProperties(null),
                              LocationType.LINE_LOCATION);
              //System.out.println(order);
          } catch (OpenLRProcessingException e) {
              e.printStackTrace();
              Assert.fail("Unexpected exception");
          }
  
      }
test_case.class_method_signature: DecoderUtilsTest.testCandidatePairOrder()
test_case.full_signature: @Test public void testCandidatePairOrder()
test_case.identifier: testCandidatePairOrder
test_case.invocations: mock checking getID allowing will returnValue mock checking getID allowing will returnValue mock checking getID allowing will returnValue mock checking getSequenceNumber allowing will returnValue add add add putCandidateLines mock checking getSequenceNumber allowing will returnValue checking isLastLRP allowing will returnValue add add add putCandidateLines mock checking getSequenceNumber allowing will returnValue checking isLastLRP allowing will returnValue add add putCandidateLines resolveCandidatesOrder printStackTrace fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCandidatePairOrder()
focal_class.declarator: LOG = Logger.getLogger(DecoderUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = Logger.getLogger(DecoderUtils.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: decoder/src/main/java/openlr/decoder/worker/DecoderUtils.java
focal_class.identifier: DecoderUtils
focal_class.class_method_signature: DecoderUtils.DecoderUtils()
focal_class.full_signature: private  DecoderUtils()
focal_class.identifier: DecoderUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  DecoderUtils()
focal_class.class_method_signature: DecoderUtils.resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_class.full_signature: public static List<CandidateLinePair> resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_class.identifier: resolveCandidatesOrder
focal_class.modifiers: public static
focal_class.parameters: (
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_class.return: List<CandidateLinePair>
focal_class.signature: List<CandidateLinePair> resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_class.class_method_signature: DecoderUtils.determineRouteLength(final RouteSearch rs,
                                             final CandidateLine destCandidate)
focal_class.full_signature: public static int determineRouteLength(final RouteSearch rs,
                                             final CandidateLine destCandidate)
focal_class.identifier: determineRouteLength
focal_class.modifiers: public static
focal_class.parameters: (final RouteSearch rs,
                                             final CandidateLine destCandidate)
focal_class.return: int
focal_class.signature: int determineRouteLength(final RouteSearch rs,
                                             final CandidateLine destCandidate)
focal_class.class_method_signature: DecoderUtils.calculateMaxLength(final LocationReferencePoint p,
                                           final CandidateLine candP, final CandidateLine candNext,
                                           final OpenLRDecoderProperties properties)
focal_class.full_signature: public static int calculateMaxLength(final LocationReferencePoint p,
                                           final CandidateLine candP, final CandidateLine candNext,
                                           final OpenLRDecoderProperties properties)
focal_class.identifier: calculateMaxLength
focal_class.modifiers: public static
focal_class.parameters: (final LocationReferencePoint p,
                                           final CandidateLine candP, final CandidateLine candNext,
                                           final OpenLRDecoderProperties properties)
focal_class.return: int
focal_class.signature: int calculateMaxLength(final LocationReferencePoint p,
                                           final CandidateLine candP, final CandidateLine candNext,
                                           final OpenLRDecoderProperties properties)
focal_class.class_method_signature: DecoderUtils.getMaxDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.full_signature: public static int getMaxDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.identifier: getMaxDistanceNP
focal_class.modifiers: public static
focal_class.parameters: (final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.return: int
focal_class.signature: int getMaxDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.class_method_signature: DecoderUtils.getMinDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.full_signature: public static int getMinDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.identifier: getMinDistanceNP
focal_class.modifiers: public static
focal_class.parameters: (final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_class.return: int
focal_class.signature: int getMinDistanceNP(final LocationReferencePoint lrp,
                                         final OpenLRDecoderProperties properties)
focal_method.body: public static List<CandidateLinePair> resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
              throws OpenLRProcessingException {
          if (LOG.isDebugEnabled()) {
              LOG.debug("resolve candidates order with ConnectedRouteIncrease: "
                      + properties.getConnectedRouteIncrease()
                      + " and MaxNrRetries: " + properties.getMaxNumberRetries());
          }
          List<CandidateLinePair> pairs = new ArrayList<CandidateLinePair>();
          List<CandidateLine> p1List = candidateLines.getCandidateLines(p1);
          List<CandidateLine> p2List = candidateLines.getCandidateLines(p2);
          for (int i = 0; i < p1List.size(); ++i) {
              int p1Score = p1List.get(i).getRating();
              CandidateLine cl = p1List.get(i);
              // check connection with previously calculated path
              if (lastUsed != null && cl.hasSameLine(lastUsed)) {
                  p1Score += (properties.getConnectedRouteIncrease() * p1Score);
              }
              for (int j = 0; j < p2List.size(); ++j) {
                  int p2Score = p2List.get(j).getRating();
                  CandidateLinePair candidate = new CandidateLinePair(i, j,
                          p1Score * p2Score);
                  pairs.add(candidate);
              }
          }
          Collections.sort(pairs,
                  new CandidateLinePair.CandidateLinePairComparator());
          int returnSize = Math.min(properties.getMaxNumberRetries() + 1,
                  pairs.size());
          List<CandidateLinePair> subList = pairs.subList(0, returnSize);
          if (LOG.isDebugEnabled()) {
              LOG.debug("Candidate pair list for " + p1.getSequenceNumber()
                      + " and " + p2.getSequenceNumber());
              for (CandidateLinePair clp : subList) {
                  LOG.debug("startIdx[" + clp.getStartIndex() + "] - destIdx["
                          + clp.getDestIndex() + "], score: " + clp.getScore());
              }
          }
          return subList;
      }
focal_method.class_method_signature: DecoderUtils.resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_method.full_signature: public static List<CandidateLinePair> resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_method.identifier: resolveCandidatesOrder
focal_method.invocations: isDebugEnabled debug getConnectedRouteIncrease getMaxNumberRetries getCandidateLines getCandidateLines size getRating get get hasSameLine getConnectedRouteIncrease size getRating get add sort min getMaxNumberRetries size subList isDebugEnabled debug getSequenceNumber getSequenceNumber debug getStartIndex getDestIndex getScore
focal_method.modifiers: public static
focal_method.parameters: (
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)
focal_method.return: List<CandidateLinePair>
focal_method.signature: List<CandidateLinePair> resolveCandidatesOrder(
              final LocationReferencePoint p1, final LocationReferencePoint p2,
              final CandidateLinesResultSet candidateLines,
              final CandidateLine lastUsed,
              final OpenLRDecoderProperties properties, final LocationType locType)