import org.jheaps.AddressableHeap; import java.io.Serializable; public class Vertex implements Serializable, Comparable { private SequenceType type; private Integer vertexLabel; private String sequence; private Integer occupancy; private Integer readCount; private Double potential; private AddressableHeap queue; public Vertex(Integer vertexLabel) { this.vertexLabel = vertexLabel; } public Vertex(String vertexLabel) { this.vertexLabel = Integer.parseInt((vertexLabel)); } public Vertex(SequenceType type, String sequence, Integer occupancy, Integer vertexLabel) { this.type = type; this.vertexLabel = vertexLabel; this.sequence = sequence; this.occupancy = occupancy; this.readCount = 1; } public Vertex(SequenceType type, String sequence, Integer occupancy, Integer vertexLabel, Integer readCount) { this.type = type; this.vertexLabel = vertexLabel; this.sequence = sequence; this.occupancy = occupancy; this.readCount = readCount; } public SequenceType getType() { return type; } public void setType(String type) { this.type = SequenceType.valueOf(type); } public Integer getVertexLabel() { return vertexLabel; } public void setVertexLabel(String label) { this.vertexLabel = Integer.parseInt(label); } public String getSequence() { return sequence; } public void setSequence(String sequence) { this.sequence = sequence; } public Integer getOccupancy() { return occupancy; } public void setOccupancy(String occupancy) { this.occupancy = Integer.parseInt(occupancy); } @Override //adapted from JGraphT example code public int hashCode() { return (sequence == null) ? 0 : sequence.hashCode(); } @Override //adapted from JGraphT example code public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Vertex other = (Vertex) obj; if (sequence == null) { return other.sequence == null; } else { return sequence.equals(other.sequence); } } @Override //adapted from JGraphT example code public String toString() { StringBuilder sb = new StringBuilder(); sb.append("(").append(vertexLabel) .append(", Type: ").append(type.name()) .append(", Sequence: ").append(sequence) .append(", Occupancy: ").append(occupancy).append(")"); return sb.toString(); } @Override public int compareTo(Vertex other) { return this.vertexLabel - other.getVertexLabel(); } public Integer getReadCount() { return readCount; } public void setReadCount(Integer readCount) { this.readCount = readCount; } }