Back to project page consort-android.
The source code is released under:
GNU General Public License
If you think the Android project consort-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.amgems.consort.model; //from w w w . ja va 2 s . co m import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.Set; /** * @author Sherman Pay. * @version 0.1, 11/8/14. */ public class Node { @Expose @SerializedName("Data") private String data; @Expose @SerializedName("Id") private int id; @Expose @SerializedName("X") private float x; @Expose @SerializedName("Y") private float y; @Expose @SerializedName("Neighbors") private Set<Integer> neighbors; @Expose @SerializedName("Known") private boolean discovered; private boolean isVisible; public Node() {} public Node(String data) { this(data, -1, -1, -1); } public Node(String data, int id) { this(data, id, -1, -1); } public Node(String data, int id, int x, int y) { this.data = data; this.id = id; this.x = x; this.y = y; } public String getData() { return this.data; } public int getDataLength() { return getData().length(); } public int getId() { return this.id; } public boolean isDiscovered() { return discovered; } public void setDiscovered(boolean v) { this.discovered = v; } public void setVisible(boolean visible) { this.isVisible = visible; } public boolean isVisible() { return isVisible; } public float getX() { return x; } public float getY() { return y; } public float getX(float scalingFactor) { return x * scalingFactor; } public float getY(float scalingFactor) { return y * scalingFactor; } public void setXY(int x, int y) { this.x = x; this.y = y; } /* * Dangerous! */ public Set<Integer> getNeighbors() { return this.neighbors; } @Override public String toString() { return "Node: { id: " + id + " data: " + data + " vis: " + discovered + "\n\tpos: (" + x + ", " + y + ") }"; } @Override public int hashCode() { return (data + this.id).hashCode(); } @Override public boolean equals(Object o) { return o instanceof Node && this.id == ((Node)o).id; } }