Class ConvoyList

  • All Implemented Interfaces:
    java.lang.Iterable<IConvoy>

    public class ConvoyList
    extends java.lang.Object
    implements java.lang.Iterable<IConvoy>
    List of all convois.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Feb 07, 2016
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<IConvoy> convois  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConvoyList()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(IConvoy iConvoy)  
      java.util.List<IConvoy> findConvoy​(ICity city)
      Find all convois in town.
      IConvoy findConvoyOfOrleg​(IShip orleg)
      Find the convoy of an orleg ship.
      java.util.Iterator<IConvoy> iterator()  
      boolean remove​(java.lang.Object o)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • convois

        private java.util.List<IConvoy> convois
    • Constructor Detail

      • ConvoyList

        public ConvoyList()
    • Method Detail

      • add

        public boolean add​(IConvoy iConvoy)
      • remove

        public boolean remove​(java.lang.Object o)
      • findConvoy

        public java.util.List<IConvoy> findConvoy​(ICity city)
        Find all convois in town.
        Parameters:
        city - for which to find convoys
        Returns:
        list ov convoys in the city.
      • findConvoyOfOrleg

        public IConvoy findConvoyOfOrleg​(IShip orleg)
        Find the convoy of an orleg ship.
        Parameters:
        orleg - of the convoy that is looked up.
        Returns:
        convoy
        Throws:
        java.lang.IllegalArgumentException - when the orleg is not an orleg ship of any convoy.
      • iterator

        public java.util.Iterator<IConvoy> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<IConvoy>