//Comparing method
        public override bool Compare(LankytinaVieta place)
        {
            if (place is Muziejus)
            {
                Muziejus a = this as Muziejus;
                Muziejus b = place as Muziejus;

                return(a.Price >= b.Price);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Sorts places
        /// </summary>
        public void SortPlaces()
        {
            for (int i = 0; i < Count - 1; i++)
            {
                int m = i;

                for (int j = i + 1; j < Count; j++)
                {
                    if (Places[i].Compare(Places[j]))
                    {
                        m = j;
                        LankytinaVieta a = Places[i];
                        Places[i] = Places[m];
                        Places[m] = a;
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Adds place
 /// </summary>
 /// <param name="place">object</param>
 public void AddPlace(LankytinaVieta place)
 {
     Places[Count] = place;
     Count++;
 }
 abstract public bool Compare(LankytinaVieta place); //For comparing