Teh-Hai Julian Zheng 7 years ago
parent
commit
275c0fa735

+ 2 - 1
src/classes/HolonElement.java

@@ -5,7 +5,8 @@ import java.util.LinkedList;
 
 import com.google.gson.annotations.Expose;
 
-import javafx.util.Pair;
+
+
 
 /**
  * The class "HolonElement" represents any possible element that can be added to

+ 47 - 0
src/classes/Pair.java

@@ -0,0 +1,47 @@
+package classes;
+
+import java.io.Serializable;
+
+public class Pair<K, V> implements Serializable {
+
+	private K key;
+	private V value;
+
+	public Pair(K key, V value) {
+		this.key = key;
+		this.value = value;
+	}
+
+	public K getKey() {
+		return key;
+	}
+
+	public V getValue() {
+		return value;
+	}
+
+	@Override
+	public String toString() {
+		return key + "=" + value;
+	}
+
+	@Override
+	public int hashCode() {
+		return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		if (this == o)
+			return true;
+		if (o instanceof Pair) {
+			Pair pair = (Pair) o;
+			if (key != null ? !key.equals(pair.key) : pair.key != null)
+				return false;
+			if (value != null ? !value.equals(pair.value) : pair.value != null)
+				return false;
+			return true;
+		}
+		return false;
+	}
+}

+ 1 - 1
src/ui/controller/ObjectController.java

@@ -7,7 +7,7 @@ import classes.CpsUpperNode;
 import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
-import javafx.util.Pair;
+import classes.Pair;
 import ui.model.Model;
 
 /**

+ 1 - 1
src/ui/view/AddObjectPopUp.java

@@ -38,7 +38,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
 import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
-import javafx.util.Pair;
+import classes.Pair;
 import ui.controller.Control;
 
 /**