예제 #1
0
 public void removeStation(RattlerStation station)
 {
     if (station.Equals(B))
     {
         this.B = null;
     }
     else if (station.Equals(A))
     {
         this.A = null;
     }
 }
예제 #2
0
        public LinkStation(RattlerStation A, RattlerStation B, double distance)
        {
            if (A.Equals(B))
            {
                throw new ArgumentException("Станция A и станция B одинаковы!");
            }

            if (!A.getType().Equals(B.getType()))
            {
                throw new ArgumentException("Соедиенение станций возможно лишь когда они одного типа!");
            }

            if (distance <= 0)
            {
                throw new ArgumentException("Дистанция должна быть положительной");
            }

            this.type = A.getType();

            this.A        = A;
            this.B        = B;
            this.distance = distance;
        }
예제 #3
0
 public bool containsStation(RattlerStation station)
 {
     return(station != null && (station.Equals(A) || station.Equals(B)));
 }