package interpretacja; public class Edge { private int n1; private int n2; private GrafAdv g; public Edge(int n1, int n2, GrafAdv g) { this.n1 = n1; this.n2 = n2; this.g = g; } @Override public boolean equals(Object o) { if (o instanceof Edge) { Edge e = (Edge)o; if ((e.n1 == this.n1)&&(e.n2 == this.n2)) { return true; } if ((e.n1 == this.n2)&&(e.n2 == this.n1)) { return true; } } return false; } public int n1() { return this.n1; } public int[] n1Coord() { return this.g.N(this.n1); } public int n2() { return this.n2; } public int[] n2Coord() { return this.g.N(this.n2); } public double kat() { return Geom.kat(g.N(n1), g.N(n2)); } public double len() { return Geom.len(g.N(n1), g.N(n2)); } public String toString() { return "[" + this.g.N(n1)[0] + ", " + this.g.N(n1)[1] + "]-->[" + this.g.N(n2)[0] + ", " + this.g.N(n2)[1] + "]"; } }