moving api methods to MindmapController
This commit is contained in:
committed by
Ezequiel Bergamaschi
parent
d089b471fc
commit
d555309c22
@@ -56,4 +56,24 @@ public class Label {
|
||||
public void setColor(@NotNull String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Label)) return false;
|
||||
|
||||
Label label = (Label) o;
|
||||
|
||||
return id == label.id && creator.getId() == label.creator.getId()
|
||||
&& !(parent != null ? !parent.equals(label.parent) : label.parent != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + title.hashCode();
|
||||
result = 31 * result + creator.hashCode();
|
||||
result = 31 * result + (parent != null ? parent.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,13 @@ public class LabelMindmap implements Serializable{
|
||||
private int mindmapId;
|
||||
private int labelId;
|
||||
|
||||
public LabelMindmap(int labelId, int mindmapId) {
|
||||
this.mindmapId = mindmapId;
|
||||
this.labelId = labelId;
|
||||
}
|
||||
|
||||
public LabelMindmap() {}
|
||||
|
||||
public int getMindmapId() {
|
||||
return mindmapId;
|
||||
}
|
||||
|
@@ -318,7 +318,7 @@ public class Mindmap {
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//creo que no se usa mas
|
||||
public boolean hasLabel(@NotNull final String name) {
|
||||
for (Label label : this.labels) {
|
||||
if (label.getTitle().equals(name)) {
|
||||
@@ -327,4 +327,19 @@ public class Mindmap {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable public Label findLabel(int labelId) {
|
||||
Label result = null;
|
||||
for (Label label : this.labels) {
|
||||
if (label.getId() == labelId) {
|
||||
result = label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void removeLabel(@NotNull final Label label) {
|
||||
this.labels.remove(label);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user