summaryrefslogtreecommitdiff
path: root/CSMath/src/bezier/geom/transform/TDHCombination.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2018-05-23 16:42:38 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2018-05-23 16:42:38 -0400
commit48f781fb6e61539ba9d17efcfd9f9e38245cf6c0 (patch)
tree97e5743678a00d09024ec040490b8fcf8ccb1c74 /CSMath/src/bezier/geom/transform/TDHCombination.java
parent81d8191c01629d881486f1f1fe5ae16c42b46287 (diff)
Refactor package structure
Diffstat (limited to 'CSMath/src/bezier/geom/transform/TDHCombination.java')
-rw-r--r--CSMath/src/bezier/geom/transform/TDHCombination.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/CSMath/src/bezier/geom/transform/TDHCombination.java b/CSMath/src/bezier/geom/transform/TDHCombination.java
new file mode 100644
index 0000000..27d71e7
--- /dev/null
+++ b/CSMath/src/bezier/geom/transform/TDHCombination.java
@@ -0,0 +1,64 @@
+package bezier.geom.transform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import bezier.geom.TDHPoint;
+
+public class TDHCombination implements TDHTransform {
+ public final List<TDHTransform> forms;
+
+ @Override
+ public TDHTransformType type() {
+ return TDHTransformType.COMBINATION;
+ }
+
+ public TDHCombination(TDHTransform... forms) {
+ this.forms = new ArrayList<>(forms.length);
+
+ for (TDHTransform form : forms) {
+ this.forms.add(form);
+ }
+ }
+
+ @Override
+ public TDHPoint transform(TDHPoint punkt) {
+ TDHPoint ret = punkt;
+
+ for (TDHTransform form : forms) {
+ ret = form.transform(ret);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((forms == null) ? 0 : forms.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TDHCombination other = (TDHCombination) obj;
+ if (forms == null) {
+ if (other.forms != null)
+ return false;
+ } else if (!forms.equals(other.forms))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "TDHCombination [forms=" + forms + "]";
+ }
+} \ No newline at end of file