Files
BiGpairSEQ/src/main/java/Vertex.java
2022-10-14 17:32:37 -05:00

86 lines
2.4 KiB
Java

import org.jheaps.AddressableHeap;
import java.io.Serializable;
import java.util.Map;
public class Vertex implements Serializable, Comparable<Vertex> {
private SequenceRecord record;
private Integer vertexLabel;
private Double potential;
private AddressableHeap queue;
public Vertex(SequenceRecord record, Integer vertexLabel) {
this.record = record;
this.vertexLabel = vertexLabel;
}
public SequenceRecord getRecord() { return record; }
public SequenceType getType() { return record.getSequenceType(); }
public Integer getVertexLabel() {
return vertexLabel;
}
public String getSequence() {
return record.getSequence();
}
public Integer getOccupancy() {
return record.getOccupancy();
}
public Integer getReadCount() { return record.getReadCount(); }
public Integer getReadCount(Integer well) { return record.getReadCount(well); }
public Map<Integer, Integer> getWellOccupancies() { return record.getWellOccupancies(); }
@Override //adapted from JGraphT example code
public int hashCode()
{
return (this.getSequence() == null) ? 0 : this.getSequence().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 (this.getSequence() == null) {
return other.getSequence() == null;
} else {
return this.getSequence().equals(other.getSequence());
}
}
@Override //adapted from JGraphT example code
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("(").append(vertexLabel)
.append(", Type: ").append(this.getType().name())
.append(", Sequence: ").append(this.getSequence())
.append(", Occupancy: ").append(this.getOccupancy()).append(")");
return sb.toString();
}
@Override
public int compareTo(Vertex other) {
return this.vertexLabel - other.getVertexLabel();
}
public Double getPotential() {
return potential;
}
public void setPotential(Double potential) {
this.potential = potential;
}
}