|
@@ -15,29 +15,35 @@ import com.google.gson.annotations.Expose;
|
|
|
*/
|
|
|
public abstract class AbstractCpsObject {
|
|
|
/* Type of the Object. */
|
|
|
- @Expose String objName;
|
|
|
+ @Expose
|
|
|
+ String objName;
|
|
|
/* Name given by the user. */
|
|
|
- @Expose String name;
|
|
|
+ @Expose
|
|
|
+ String name;
|
|
|
/* ID of the Obj. */
|
|
|
- @Expose int id;
|
|
|
+ @Expose
|
|
|
+ int id;
|
|
|
/* Path of the image for the Obj. */
|
|
|
- @Expose String image;
|
|
|
+ @Expose
|
|
|
+ String image;
|
|
|
/* Array of neighbors */
|
|
|
ArrayList<CpsEdge> connections;
|
|
|
/* Position with a X and Y value */
|
|
|
- @Expose Position position;
|
|
|
+ @Expose
|
|
|
+ Position position;
|
|
|
/*
|
|
|
* Energy input and output of each object in the grid Where the Object is
|
|
|
* Stored
|
|
|
*/
|
|
|
- @Expose String sav;
|
|
|
+ @Expose
|
|
|
+ String sav;
|
|
|
/* borderColor the user sets */
|
|
|
Color borderColor = Color.WHITE;
|
|
|
/* a Tag that can be used */
|
|
|
ArrayList<Integer> tags;
|
|
|
/* a Tag that can be used */
|
|
|
ArrayList<Integer> pseudoTags;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Constructor for a CpsObejct with an unique ID.
|
|
|
*
|
|
@@ -246,7 +252,7 @@ public abstract class AbstractCpsObject {
|
|
|
* Set the Border Color of this CpsObject.
|
|
|
*
|
|
|
* @param c
|
|
|
- * the BorderColor
|
|
|
+ * the BorderColor
|
|
|
*/
|
|
|
public void setBorderColor(Color c) {
|
|
|
this.borderColor = c;
|
|
@@ -259,13 +265,13 @@ public abstract class AbstractCpsObject {
|
|
|
* for internal purpose
|
|
|
*/
|
|
|
public void addTag(int tag) {
|
|
|
- if(!(tags.contains(tag))){
|
|
|
+ if (!(tags.contains(tag))) {
|
|
|
this.tags.add(tag);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public void addAllTags(ArrayList<Integer> tags){
|
|
|
- for(Integer tag: tags){
|
|
|
+
|
|
|
+ public void addAllTags(ArrayList<Integer> tags) {
|
|
|
+ for (Integer tag : tags) {
|
|
|
addTag(tag);
|
|
|
}
|
|
|
}
|
|
@@ -304,9 +310,9 @@ public abstract class AbstractCpsObject {
|
|
|
* for internal purpose
|
|
|
*/
|
|
|
public void setPseudoTags(ArrayList<Integer> tags) {
|
|
|
- this.pseudoTags= tags;
|
|
|
+ this.pseudoTags = tags;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Get the pseudo tags.
|
|
|
*
|
|
@@ -315,37 +321,38 @@ public abstract class AbstractCpsObject {
|
|
|
public ArrayList<Integer> getPseudoTags() {
|
|
|
return this.pseudoTags;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* add a pseudo tag.
|
|
|
*
|
|
|
* @return ArrayList
|
|
|
*/
|
|
|
public void addPseudoTag(int tag) {
|
|
|
- if(!pseudoTags.contains(tag)){
|
|
|
+ if (!pseudoTags.contains(tag)) {
|
|
|
pseudoTags.add(tag);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* adds all given pseudotags to the tags
|
|
|
+ *
|
|
|
* @param pseudoTags
|
|
|
*/
|
|
|
- public void addAllPseudoTags(ArrayList<Integer> pseudoTags){
|
|
|
- for(Integer tag: pseudoTags){
|
|
|
+ public void addAllPseudoTags(ArrayList<Integer> pseudoTags) {
|
|
|
+ for (Integer tag : pseudoTags) {
|
|
|
addPseudoTag(tag);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* adds All pseudoTags to tags without duplicates
|
|
|
*/
|
|
|
- public void recalculateTags(){
|
|
|
- for(Integer tag: pseudoTags){
|
|
|
- if(!tags.contains(tag)){
|
|
|
+ public void recalculateTags() {
|
|
|
+ for (Integer tag : pseudoTags) {
|
|
|
+ if (!tags.contains(tag)) {
|
|
|
tags.add(tag);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|