1 package org.simantics.district.network.profile;
3 import java.util.Optional;
5 import org.simantics.db.Resource;
6 import org.simantics.scl.runtime.function.Function1;
9 * @author Tuukka Lehtonen
11 public class DiagramSettings {
13 public final Optional<Function1<Resource, Double>> arrowLengthProperty;
14 public final double arrowLengthGain;
15 public final double arrowLengthBias;
17 public DiagramSettings(
18 Function1<Resource, Double> arrowLengthProperty, double arrowLengthGain, double arrowLengthBias
20 this.arrowLengthProperty = Optional.ofNullable(arrowLengthProperty);
21 this.arrowLengthGain = arrowLengthGain;
22 this.arrowLengthBias = arrowLengthBias;
26 public int hashCode() {
29 //result = prime * result + edgeThicknessProperty.hashCode();
30 result = prime * result + arrowLengthProperty.hashCode();
32 //temp = Double.doubleToLongBits(edgeThicknessGain);
33 result = prime * result + (int) (temp ^ (temp >>> 32));
34 //temp = Double.doubleToLongBits(edgeThicknessBias);
35 result = prime * result + (int) (temp ^ (temp >>> 32));
36 temp = Double.doubleToLongBits(arrowLengthGain);
37 result = prime * result + (int) (temp ^ (temp >>> 32));
38 temp = Double.doubleToLongBits(arrowLengthBias);
39 result = prime * result + (int) (temp ^ (temp >>> 32));
45 public boolean equals(Object obj) {
50 if (getClass() != obj.getClass())
52 DiagramSettings other = (DiagramSettings) obj;
54 if (!arrowLengthProperty.equals(other.arrowLengthProperty))
56 if (Double.doubleToLongBits(arrowLengthGain) != Double.doubleToLongBits(other.arrowLengthGain))
58 if (Double.doubleToLongBits(arrowLengthBias) != Double.doubleToLongBits(other.arrowLengthBias))
65 public String toString() {
66 return String.format("DiagramSettings[%s * %f + %f]",
67 arrowLengthProperty, arrowLengthGain, arrowLengthBias