Class HostFields


  • public class HostFields
    extends java.lang.Object
    All host fields of a screen are accessed using this class.
    Author:
    Christopher Mindus
    • Constructor Detail

      • HostFields

        public HostFields​(HostScreen screen)
        Creates an array of all host fields.
        Parameters:
        screen - The host screen.
    • Method Detail

      • add

        public void add​(HostField field)
        Adds a host field definition. Zero-length fields are not added.
        Parameters:
        field - The field.
      • getCount

        public int getCount()
        Returns the count of host fields.
        Returns:
        The count.
      • getAll

        public HostField[] getAll()
        Gets a copy of the host fields array.
        Returns:
        The array of fields.
      • getFromIndex

        public HostField getFromIndex​(int index)
        Gets a host field from an index.
        Parameters:
        index - The index.
        Returns:
        The host field.
      • get

        public HostField get​(int x,
                             int y)
        Gets a host field from a X/Y position.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        Returns:
        null if no host field is found.
      • get

        public HostField get​(int pos)
        Gets a host field from a zero-based position.
        Parameters:
        pos - Position on screen.
        Returns:
        null if no host field is found.
      • getFirst

        public HostField getFirst​(int x,
                                  int y)
        Gets the first host field from a X/Y position.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        Returns:
        null if no host field exists in the position.
      • getFirst

        public HostField getFirst​(int pos)
        Gets the first host field from a zero-based position.
        Parameters:
        pos - Position on screen.
        Returns:
        null if no host field is found.
      • getFirstUnprotected

        public HostField getFirstUnprotected()
        Gets the first unprotected host field.
        Returns:
        null if non is found.
      • getFirst

        public HostField getFirst​(boolean unprotectedOnly)
        Gets the first unprotected host field.
        Parameters:
        unprotectedOnly - Flag for unprotected only, false for all.
        Returns:
        null if non is found.
      • getPreviousUnprotected

        public HostField getPreviousUnprotected​(int x,
                                                int y)
        Gets the previous unprotected host field. If the position is not at the beginning of the field, the current field is returned.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        Returns:
        null if non is found.
      • getPrevious

        public HostField getPrevious​(int x,
                                     int y,
                                     boolean unprotectedOnly)
        Gets the previous unprotected host field. If the position is not at the beginning of the field, the current field is returned.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        unprotectedOnly - Flag for unprotected only, false for all.
        Returns:
        null if non is found.
      • getNextUnprotected

        public HostField getNextUnprotected​(int x,
                                            int y)
        Gets the next unprotected host field.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        Returns:
        null if non is found.
      • getNext

        public HostField getNext​(int x,
                                 int y,
                                 boolean unprotectedOnly)
        Gets the next unprotected host field.
        Parameters:
        x - X position on screen.
        y - Y position on screen.
        unprotectedOnly - Flag for unprotected only, false for all.
        Returns:
        null if non is found.