示例#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));
 }