add java examples

This commit is contained in:
hpid91 2020-06-25 16:00:13 +02:00 committed by nojhan
commit d345f67212
19 changed files with 1208 additions and 0 deletions

25
java/crtp/Transit.java Normal file
View file

@ -0,0 +1,25 @@
package patterns.crtp;
import java.util.List;
import java.util.Map;
import patterns.Point;
/**
*
* @author pouyllau
*
* @param <T>
*/
public class Transit<T extends Transit<T>> {
T t;
public double transit(Point p, List<Point> neighbors, Map<Point, Double> costs) {
return t.transit(p, neighbors, costs);
}
public static boolean hasCost(Point p ,Map<Point, Double> costs) {
return (costs.get(p) != null && costs.get(p) != Double.POSITIVE_INFINITY);
}
}