Teh-Hai Julian Zheng 8 年之前
父節點
當前提交
926ea2c0a1

+ 0 - 6
src/Interfaces/ComparableObject.java

@@ -1,6 +0,0 @@
-package Interfaces;
-
-public interface ComparableObject {
-	public String getCompareName();
-	public int getID();
-}

+ 1 - 6
src/classes/Category.java

@@ -2,9 +2,8 @@ package classes;
 
 import java.util.ArrayList;
 
-import Interfaces.ComparableObject;
 
-public class Category implements ComparableObject{
+public class Category{
 	
 	private int ID;
 	private ArrayList<CpsObject> objects;
@@ -59,10 +58,6 @@ public class Category implements ComparableObject{
 		this.name = name;
 	}
 
-	@Override
-	public String getCompareName() {
-		return getName();
-	}
 
 	
 }

+ 1 - 6
src/classes/CpsObject.java

@@ -2,10 +2,9 @@ package classes;
 
 import java.util.ArrayList;
 
-import Interfaces.ComparableObject;
 import ui.model.idCounter;
 
-public abstract class CpsObject implements ComparableObject {
+public abstract class CpsObject {
 	/* Type of the Object */
 	String objName;
 	/* Name given by the user */
@@ -153,9 +152,5 @@ public abstract class CpsObject implements ComparableObject {
 		this.energyOut = energyOut;
 	}
 
-	@Override
-	public String getCompareName() {
-		return objName;
-	}
 
 }

+ 0 - 7
src/ui/controller/CategoryController.java

@@ -3,7 +3,6 @@ package ui.controller;
 import java.util.ArrayList;
 
 import Interfaces.CategoryListener;
-import Interfaces.ComparableObject;
 import classes.Category;
 import classes.CpsObject;
 import classes.HolonElement;
@@ -171,12 +170,6 @@ public class CategoryController {
 		removeObject(cat, sC.searchHolonObject(obj, cat.getObjects()));
 	}
 
-	public void print(ArrayList<CpsObject> iterate) {
-		for (CpsObject cps : iterate) {
-			System.out.println(cps.getCompareName());
-		}
-	}
-
 	/**
 	 * 
 	 * @param catLis

+ 0 - 22
src/ui/model/tests.java

@@ -1,22 +0,0 @@
-package ui.model;
-
-import java.util.ArrayList;
-
-import classes.Category;
-import ui.controller.CategoryController;
-
-public class tests {
-	
-//	public static void main(String[] args){
-//		CategoryController cc = new CategoryController(new Model());
-//		ArrayList<Category> cats = new ArrayList<Category>();
-//		cats.add(new Category("sup"));
-//		boolean value;
-//		value = cc.containsInList(cats, new Category("sup"));
-//		if(value){
-//			System.out.println("true");
-//		}else{
-//			System.out.println("false");
-//		}
-	//}
-}

+ 2 - 2
src/ui/view/GUI.java

@@ -474,7 +474,7 @@ public class GUI<E> implements CategoryListener {
 				if (leaf) {
 					for (Category cat : model.getCategories()) {
 						for (CpsObject cps : cat.getObjects()) {
-							if (value.toString().compareTo(cps.getCompareName()) == 0) {
+							if (value.toString().compareTo(cps.getObjName()) == 0) {
 								File checkPath = new File(cps.getImage());
 								if (checkPath.exists()) {
 									imgR = new ImageIcon(cps.getImage()).getImage().getScaledInstance(
@@ -572,7 +572,7 @@ public class GUI<E> implements CategoryListener {
 					} else {
 						for (Category cat : model.getCategories()) {
 							for (CpsObject cps : cat.getObjects()) {
-								if (actualObjectClicked.compareTo(cps.getCompareName()) == 0) {
+								if (actualObjectClicked.compareTo(cps.getObjName()) == 0) {
 									File checkPath = new File(cps.getImage());
 									if (checkPath.exists()) {
 										img = new ImageIcon(cps.getImage()).getImage().getScaledInstance(