Begin SVG.
This commit is contained in:
39
src/ecoparasite/representation/ValeursXY.java
Normal file
39
src/ecoparasite/representation/ValeursXY.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package ecoparasite.representation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ValeursXY {
|
||||
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public ValeursXY(double x, double y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public static <T,V extends Number> HashSet<ValeursXY> convertToXY(HashSet<T> list, Function<T,V> getX, Function<T,V> getY){
|
||||
HashSet<ValeursXY> xy = new HashSet<ValeursXY>();
|
||||
for(T item : list){
|
||||
if(getX.apply(item) != null && getY.apply(item) != null){
|
||||
xy.add( new ValeursXY(getX.apply(item).doubleValue(), getY.apply(item).doubleValue()));
|
||||
}
|
||||
}
|
||||
return xy;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user