Improve arc memory management.
This commit is contained in:
@@ -4,7 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Arc {
|
||||
/**
|
||||
* Implementation of Arc that represents a "forward" arc in a graph, this is the
|
||||
* arc implementation that stores data relative to the arc.
|
||||
*
|
||||
*/
|
||||
public class ArcForward implements Arc {
|
||||
|
||||
// Destination node.
|
||||
private final Node origin, destination;
|
||||
@@ -27,7 +32,8 @@ public class Arc {
|
||||
* @param roadInformation Road information for this arc.
|
||||
* @param points Points representing this arc.
|
||||
*/
|
||||
public Arc(Node origin, Node dest, int length, RoadInformation roadInformation, ArrayList<Point> points) {
|
||||
public ArcForward(Node origin, Node dest, int length, RoadInformation roadInformation,
|
||||
ArrayList<Point> points) {
|
||||
this.origin = origin;
|
||||
this.destination = dest;
|
||||
this.length = length;
|
||||
@@ -37,42 +43,42 @@ public class Arc {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Origin node of this arc.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Node getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Destination node of this arc.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Node getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Length of this arc, in meters.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Minimum time required to travel this arc, in seconds.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public double getMinimumTravelTime() {
|
||||
return getLength() * 3600.0 / (info.getMaximumSpeed() * 1000.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Road information for this arc.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public RoadInformation getRoadInformation() {
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Points representing segments of this arc.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public List<Point> getPoints() {
|
||||
return Collections.unmodifiableList(points);
|
||||
|
Reference in New Issue
Block a user