test_class.declarator: pointAlongLineEncoder = new PointAlongLineEncoder(new LocationReferencePointEncoder())
test_class.original_string: PointAlongLineEncoder pointAlongLineEncoder = new PointAlongLineEncoder(new LocationReferencePointEncoder());
test_class.type: PointAlongLineEncoder
test_class.var_name: pointAlongLineEncoder
test_class.file: proto/src/test/java/openlr/proto/encoder/PointAlongLineEncoderTest.java
test_class.identifier: PointAlongLineEncoderTest
test_case.body: @Test
      public void testEncodeLine() throws OpenLRProtoException {
          LocationReferencePointProtoImpl first = new LocationReferencePointProtoImpl(
                  1,
                  5.7,
                  53.5,
                  15.5,
                  FunctionalRoadClass.FRC_3,
                  FormOfWay.MULTIPLE_CARRIAGEWAY,
                  200,
                  FunctionalRoadClass.FRC_4);
  
          LocationReferencePointProtoImpl last = new LocationReferencePointProtoImpl(
                  2,
                  5.6,
                  53.6,
                  165,
                  FunctionalRoadClass.FRC_4,
                  FormOfWay.MULTIPLE_CARRIAGEWAY);
  
          Offsets offsets = new OffsetsProtoImpl(20);
  
          RawLocationReference rawLocationReference = new RawPointAlongLocRef("1", first, last, offsets, SideOfRoad.LEFT, Orientation.AGAINST_LINE_DIRECTION);
  
          LocationReference locationReference = pointAlongLineEncoder.encode(rawLocationReference);
  
          assertNotNull(locationReference);
          assertEquals(locationReference.getID(), "1");
          assertEquals(locationReference.getLocationType(), LocationType.POINT_ALONG_LINE);
          assertTrue(locationReference.isValid());
          assertEquals(locationReference.getDataClass(), LocationReferenceData.class);
  
          Object locationReferenceData = locationReference.getLocationReferenceData();
  
          assertNotNull(locationReferenceData);
          assertTrue(locationReferenceData instanceof LocationReferenceData);
  
          LocationReferenceData data = (LocationReferenceData) locationReferenceData;
  
          assertTrue(data.hasPointAlongLineLocationReference());
  
          PointAlongLineLocationReference pointAlongLineLocationReference = data.getPointAlongLineLocationReference();
  
          assertTrue(pointAlongLineLocationReference.hasFirst());
  
          openlr.proto.schema.LocationReferencePoint firstLrp = pointAlongLineLocationReference.getFirst();
  
          assertTrue(firstLrp.hasCoordinates());
  
          Coordinates firstCoordinates = firstLrp.getCoordinates();
          assertEquals(firstCoordinates.getLongitude(),5.7);
          assertEquals(firstCoordinates.getLatitude(), 53.5);
  
          assertTrue(firstLrp.hasLineAttributes());
  
          LineAttributes firstLineAttributes = firstLrp.getLineAttributes();
          assertEquals(firstLineAttributes.getBearing(), 15);
          assertEquals(firstLineAttributes.getFrc(), FRC.FRC_3);
          assertEquals(firstLineAttributes.getFow(), FOW.FOW_MULTIPLE_CARRIAGEWAY);
  
          assertTrue(firstLrp.hasPathAttributes());
  
          PathAttributes firstPathAttributes = firstLrp.getPathAttributes();
          assertEquals(firstPathAttributes.getDistanceToNext(), 200);
          assertEquals(firstPathAttributes.getLowestFrcAlongPath(), FRC.FRC_4);
  
          assertTrue(pointAlongLineLocationReference.hasLast());
  
          openlr.proto.schema.LocationReferencePoint lastLrp = pointAlongLineLocationReference.getLast();
  
          assertTrue(lastLrp.hasCoordinates());
  
          Coordinates lastCoordinates = lastLrp.getCoordinates();
          assertEquals(lastCoordinates.getLongitude(),5.6);
          assertEquals(lastCoordinates.getLatitude(), 53.6);
  
          assertTrue(lastLrp.hasLineAttributes());
  
          LineAttributes lastLineAttributes = lastLrp.getLineAttributes();
          assertEquals(lastLineAttributes.getBearing(), 165);
          assertEquals(lastLineAttributes.getFrc(), FRC.FRC_4);
          assertEquals(lastLineAttributes.getFow(), FOW.FOW_MULTIPLE_CARRIAGEWAY);
  
          assertEquals(pointAlongLineLocationReference.getPositiveOffset(), 20);
          assertEquals(pointAlongLineLocationReference.getSideOfRoad(), openlr.proto.schema.SideOfRoad.SIDE_OF_ROAD_LEFT);
          assertEquals(pointAlongLineLocationReference.getOrientation(), openlr.proto.schema.Orientation.ORIENTATION_AGAINST_LINE_DIRECTION);
      }
test_case.class_method_signature: PointAlongLineEncoderTest.testEncodeLine()
test_case.full_signature: @Test public void testEncodeLine()
test_case.identifier: testEncodeLine
test_case.invocations: encode assertNotNull assertEquals getID assertEquals getLocationType assertTrue isValid assertEquals getDataClass getLocationReferenceData assertNotNull assertTrue assertTrue hasPointAlongLineLocationReference getPointAlongLineLocationReference assertTrue hasFirst getFirst assertTrue hasCoordinates getCoordinates assertEquals getLongitude assertEquals getLatitude assertTrue hasLineAttributes getLineAttributes assertEquals getBearing assertEquals getFrc assertEquals getFow assertTrue hasPathAttributes getPathAttributes assertEquals getDistanceToNext assertEquals getLowestFrcAlongPath assertTrue hasLast getLast assertTrue hasCoordinates getCoordinates assertEquals getLongitude assertEquals getLatitude assertTrue hasLineAttributes getLineAttributes assertEquals getBearing assertEquals getFrc assertEquals getFow assertEquals getPositiveOffset assertEquals getSideOfRoad assertEquals getOrientation
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEncodeLine()
focal_class.declarator: locationReferencePointEncoder
focal_class.modifier: private final
focal_class.original_string: private final LocationReferencePointEncoder locationReferencePointEncoder;
focal_class.type: LocationReferencePointEncoder
focal_class.var_name: locationReferencePointEncoder
focal_class.file: proto/src/main/java/openlr/proto/encoder/PointAlongLineEncoder.java
focal_class.identifier: PointAlongLineEncoder
focal_class.interfaces: implements LocationReferenceEncoder
focal_class.class_method_signature: PointAlongLineEncoder.PointAlongLineEncoder(LocationReferencePointEncoder locationReferencePointEncoder)
focal_class.full_signature:   PointAlongLineEncoder(LocationReferencePointEncoder locationReferencePointEncoder)
focal_class.identifier: PointAlongLineEncoder
focal_class.parameters: (LocationReferencePointEncoder locationReferencePointEncoder)
focal_class.signature:  PointAlongLineEncoder(LocationReferencePointEncoder locationReferencePointEncoder)
focal_class.class_method_signature: PointAlongLineEncoder.encode(RawLocationReference rawLocationReference)
focal_class.full_signature: @Override public LocationReference encode(RawLocationReference rawLocationReference)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (RawLocationReference rawLocationReference)
focal_class.return: LocationReference
focal_class.signature: LocationReference encode(RawLocationReference rawLocationReference)
focal_class.class_method_signature: PointAlongLineEncoder.map(SideOfRoad sideOfRoad)
focal_class.full_signature: private openlr.proto.schema.SideOfRoad map(SideOfRoad sideOfRoad)
focal_class.identifier: map
focal_class.modifiers: private
focal_class.parameters: (SideOfRoad sideOfRoad)
focal_class.return: openlr.proto.schema.SideOfRoad
focal_class.signature: openlr.proto.schema.SideOfRoad map(SideOfRoad sideOfRoad)
focal_class.class_method_signature: PointAlongLineEncoder.map(Orientation orientation)
focal_class.full_signature: private openlr.proto.schema.Orientation map(Orientation orientation)
focal_class.identifier: map
focal_class.modifiers: private
focal_class.parameters: (Orientation orientation)
focal_class.return: openlr.proto.schema.Orientation
focal_class.signature: openlr.proto.schema.Orientation map(Orientation orientation)
focal_method.body: @Override
      public LocationReference encode(RawLocationReference rawLocationReference) throws OpenLRProtoException {
          if (rawLocationReference.getLocationType() != LocationType.POINT_ALONG_LINE) {
              throw new OpenLRProtoException(OpenLRProtoStatusCode.INVALID_LOCATION_REFERENCE);
          }
  
          List<LocationReferencePoint> locationReferencePoints = rawLocationReference.getLocationReferencePoints();
  
          if (locationReferencePoints.size() < 2) {
              throw new OpenLRProtoException(OpenLRProtoStatusCode.INVALID_LOCATION_REFERENCE);
          }
  
          openlr.proto.schema.LocationReferencePoint first = locationReferencePointEncoder.encode(locationReferencePoints.get(0));
          openlr.proto.schema.LocationReferencePoint last = locationReferencePointEncoder.encode(locationReferencePoints.get(locationReferencePoints.size() - 1));
  
          Offsets offsets = rawLocationReference.getOffsets();
          int positiveLength = locationReferencePoints.get(0).getDistanceToNext();
          int positiveOffset = offsets.getPositiveOffset(positiveLength);
  
          openlr.proto.schema.SideOfRoad sideOfRoad = map(rawLocationReference.getSideOfRoad());
          openlr.proto.schema.Orientation orientation = map(rawLocationReference.getOrientation());
  
          PointAlongLineLocationReference pointAlongLineLocationReference = PointAlongLineLocationReference.newBuilder()
                  .setFirst(first)
                  .setLast(last)
                  .setPositiveOffset(positiveOffset)
                  .setSideOfRoad(sideOfRoad)
                  .setOrientation(orientation)
                  .build();
  
          LocationReferenceData locationReferenceData = LocationReferenceData.newBuilder()
                  .setPointAlongLineLocationReference(pointAlongLineLocationReference)
                  .build();
  
          return new LocationReferenceProtoImpl(rawLocationReference.getID(), LocationType.POINT_ALONG_LINE, locationReferenceData);
      }
focal_method.class_method_signature: PointAlongLineEncoder.encode(RawLocationReference rawLocationReference)
focal_method.full_signature: @Override public LocationReference encode(RawLocationReference rawLocationReference)
focal_method.identifier: encode
focal_method.invocations: getLocationType getLocationReferencePoints size encode get encode get size getOffsets getDistanceToNext get getPositiveOffset map getSideOfRoad map getOrientation build setOrientation setSideOfRoad setPositiveOffset setLast setFirst newBuilder build setPointAlongLineLocationReference newBuilder getID
focal_method.modifiers: @Override public
focal_method.parameters: (RawLocationReference rawLocationReference)
focal_method.return: LocationReference
focal_method.signature: LocationReference encode(RawLocationReference rawLocationReference)