rewrite GraphML importer/exporter
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
|
||||
|
||||
public class Vertex {
|
||||
private final SequenceType type;
|
||||
private final Integer vertexLabel;
|
||||
private final Integer sequence;
|
||||
private final Integer occupancy;
|
||||
private SequenceType type;
|
||||
private Integer vertexLabel;
|
||||
private Integer sequence;
|
||||
private Integer occupancy;
|
||||
|
||||
public Vertex(String vertexLabel) {
|
||||
this.vertexLabel = Integer.parseInt((vertexLabel));
|
||||
}
|
||||
|
||||
public Vertex(SequenceType type, Integer sequence, Integer occupancy, Integer vertexLabel) {
|
||||
this.type = type;
|
||||
@@ -13,15 +17,73 @@ public class Vertex {
|
||||
this.occupancy = occupancy;
|
||||
}
|
||||
|
||||
public SequenceType getType() { return type; }
|
||||
|
||||
public Integer getVertexLabel() { return vertexLabel; }
|
||||
|
||||
public Integer getSequence() {
|
||||
return sequence;
|
||||
public String getType() {
|
||||
return type.name();
|
||||
}
|
||||
|
||||
public Integer getOccupancy() {
|
||||
return occupancy;
|
||||
public void setType(String type) {
|
||||
this.type = SequenceType.valueOf(type);
|
||||
}
|
||||
|
||||
public String getVertexLabel() {
|
||||
return vertexLabel.toString();
|
||||
}
|
||||
|
||||
public void setVertexLabel(String label) {
|
||||
this.vertexLabel = Integer.parseInt(label);
|
||||
}
|
||||
|
||||
public String getSequence() {
|
||||
|
||||
return sequence.toString();
|
||||
}
|
||||
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = Integer.parseInt(sequence);
|
||||
}
|
||||
|
||||
public String getOccupancy() {
|
||||
return occupancy.toString();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user