1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package pathgame.algorithm;
- public class TreeEdge implements Comparable< TreeEdge> {
- private final int src;
- private final int dest;
- private final int weight;
- private boolean checked = false;
- public TreeEdge(int src, int dest, int weight) {
- this.src = src;
- this.dest = dest;
- this.weight = weight;
- }
- public int getSrc() {
- return src;
- }
- public int getDest() {
- return dest;
- }
- public int getOtherVertex(int other) {
- if(other == src) {
- return dest;
- } else {
- return src;
- }
- }
- public Integer getWeight() {
- return weight;
- }
- public boolean isChecked() {
- return checked;
- }
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
- @Override
- public int compareTo(TreeEdge o) {
- return this.getWeight().compareTo(o.getWeight());
- }
- }
|