Пример #1
0
        public TrainCoach GetTrainCoach()
        {
            TrainCoach coach = new TrainCoach();

            coach.CoachID      = Convert.ToInt32(txtCoachID.Text);
            coach.LoadCapacity = Convert.ToDouble(txtLoadCapacity.Text);
            coach.CoachType    = txtCoachType.Text;
            return(coach);
        }
Пример #2
0
        public bool RemoveAfter(int id, TrainCoach coach)
        {
            TrainCoach tCoach = new TrainCoach();

            tCoach.CoachID = id;
            LinkedListNode <TrainCoach> targetNode = coaches.Find(tCoach);

            if (targetNode.Next != null)
            {
                coaches.Remove(targetNode.Next);
                return(true);
            }
            return(false);
        }
Пример #3
0
        public bool RemoveBefore(int id, TrainCoach coach)
        {
            TrainCoach tCoach = new TrainCoach();

            tCoach.CoachID = id;
            LinkedListNode <TrainCoach> targetNode = coaches.Find(tCoach);

            if (targetNode.Previous != null)
            {
                coaches.Remove(targetNode.Previous);
                return(true);
            }
            return(false);
        }
Пример #4
0
        public bool InsertBefore(int id, TrainCoach coach)
        {
            TrainCoach tCoach = new TrainCoach();

            tCoach.CoachID = id;
            LinkedListNode <TrainCoach> targetNode = coaches.Find(tCoach);

            if (targetNode != null)
            {
                coaches.AddBefore(targetNode, coach);
                return(true);
            }
            return(false);
        }
Пример #5
0
        public override bool Equals(object obj)
        {
            TrainCoach tCoach = obj as TrainCoach;

            return(this.Equals(tCoach));
        }
Пример #6
0
 public bool Equals(TrainCoach other)
 {
     return(this.CoachID == other.CoachID);
 }
Пример #7
0
 public LinkedListNode <TrainCoach> AddEnd(TrainCoach coach)
 {
     return(coaches.AddLast(coach));
 }
Пример #8
0
 public LinkedListNode <TrainCoach> AddFront(TrainCoach coach)
 {
     return(coaches.AddFirst(coach));
 }