Class RoadEdge

java.lang.Object
rgu.transport.geospatial.osm.RoadEdge

public final class RoadEdge extends Object
Author:
Lee A. Christie
  • Constructor Details

  • Method Details

    • distance

      public Distance distance()
    • speed

      public Speed speed()
    • write

      public void write(ObjectOutputStream out) throws IOException
      Throws:
      IOException
    • read

      public static RoadEdge read(ObjectInputStream in) throws IOException
      Throws:
      IOException
    • containsEitherEndPoint

      public static Predicate<Graph.Edge<GeoLocation, RoadEdge>> containsEitherEndPoint(Predicate<GeoLocation> filter)
      A predicate which is true if either end point of a graph edge matches the given predicate.
      Parameters:
      filter - the predicate to test end points
      Returns:
      a predicate on graph edges
    • containsBothEndPoints

      public static Predicate<Graph.Edge<GeoLocation, RoadEdge>> containsBothEndPoints(Predicate<GeoLocation> filter)
      A predicate which is true if both end points of a graph edge match the given predicate.
      Parameters:
      filter - the predicate to test end points
      Returns:
      a predicate on graph edges
    • hasZeroSpeed

      public static Predicate<Graph.Edge<GeoLocation, RoadEdge>> hasZeroSpeed()
      A predicate which is true if the edge has a defined speed, and the speed value is 0 m/s.
      Returns:
      a predicate on graph edges
    • hasDefinedSpeed

      public static Predicate<Graph.Edge<GeoLocation, RoadEdge>> hasDefinedSpeed()
      A predicate which is true if the edge has a defined speed, whether positive or zero.
      Returns:
      a predicate on graph edges
    • hasUndefinedSpeed

      public static Predicate<Graph.Edge<GeoLocation, RoadEdge>> hasUndefinedSpeed()
      A predicate which is true if the edge has a undefined speed.
      Returns:
      a predicate on graph edges
    • speedMultiplier

      public static Function<Graph.Edge<GeoLocation, RoadEdge>, RoadEdge> speedMultiplier(Predicate<Graph.Edge<GeoLocation, RoadEdge>> filter, double multiplicationFactor)
      A function which multiplies the speed limit by a given amount. Edges not matching the filter remain unchanged. Edges matching the filter but with undefined speed limits will also remain unchanged.
      Parameters:
      filter - the filter to check whether to apply the limit, not null
      multiplicationFactor - the factor by which to multiply the speed limit, > 0, finite
      Returns:
      the mapping function
    • speedReplacement

      public static Function<Graph.Edge<GeoLocation, RoadEdge>, RoadEdge> speedReplacement(Predicate<Graph.Edge<GeoLocation, RoadEdge>> filter, Speed newSpeed)
      A function which replaces the speed limit by a given amount. Edges not matching the filter remain unchanged.
      Parameters:
      filter - , not null
      newSpeed - the new speed limit, not null
      Returns:
      the mapping function
    • speedDefault

      public static Function<Graph.Edge<GeoLocation, RoadEdge>, RoadEdge> speedDefault(Predicate<Graph.Edge<GeoLocation, RoadEdge>> filter, Speed defaultSpeed)
      A function which applies a default speed to edges with undefined speed. Edges not matching the filter remain unchanged. Edges matching the filter but which already have a defined speed limit will also remain unchanged.
      Parameters:
      filter - , not null
      defaultSpeed - the new speed limit, not null
      Returns:
      the mapping function
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object