View Javadoc

1   /***
2    * Redistribution  and use  in source  and binary  forms, with  or without
3    * modification, are permitted provided  that the following conditions are
4    * met :
5    *
6    * . Redistributions  of  source  code  must  retain  the  above copyright
7    *   notice, this list of conditions and the following disclaimer.
8    *
9    * . Redistributions in  binary form  must reproduce  the above  copyright
10   *   notice, this list of conditions  and the following disclaimer in  the
11   *   documentation and/or other materials provided with the distribution.
12   *
13   * . The name of the author may not be used to endorse or promote products
14   *   derived from this software without specific prior written permission.
15   *
16   * THIS SOFTWARE IS  PROVIDED BY THE  AUTHOR ``AS IS''  AND ANY EXPRESS  OR
17   * IMPLIED  WARRANTIES,  INCLUDING,  BUT   NOT  LIMITED  TO,  THE   IMPLIED
18   * WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE ARE
19   * DISCLAIMED.  IN NO  EVENT SHALL  THE AUTHOR  BE LIABLE  FOR ANY  DIRECT,
20   * INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL  DAMAGES
21   * (INCLUDING,  BUT  NOT LIMITED  TO,  PROCUREMENT OF  SUBSTITUTE  GOODS OR
22   * SERVICES;  LOSS  OF USE,  DATA,  OR PROFITS;  OR  BUSINESS INTERRUPTION)
23   * HOWEVER CAUSED  AND ON  ANY THEORY  OF LIABILITY,  WHETHER IN  CONTRACT,
24   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE, EVEN  IF  ADVISED OF  THE
26   * POSSIBILITY OF SUCH DAMAGE.
27   *
28   * $Id: IDirectionGroup.java,v 1.1 2005/09/09 22:12:34 mat007 Exp $
29   */
30  
31  package jtge.util.grid.directiongroup;
32  
33  import java.util.Iterator;
34  import jtge.util.grid.Coordinate;
35  import jtge.util.grid.direction.East;
36  import jtge.util.grid.direction.North;
37  import jtge.util.grid.direction.NorthEast;
38  import jtge.util.grid.direction.NorthWest;
39  import jtge.util.grid.direction.South;
40  import jtge.util.grid.direction.SouthEast;
41  import jtge.util.grid.direction.SouthWest;
42  import jtge.util.grid.direction.West;
43  
44  /***
45   * Direction group definition.
46   *
47   * @author Jean-Laurent Fabre de Morlhon
48   * @version $Id: IDirectionGroup.java,v 1.1 2005/09/09 22:12:34 mat007 Exp $
49   */
50  public interface IDirectionGroup
51  {
52      /***
53       * Retrieve an iterator on directions.
54       *
55       * @return an iterator on directions
56       */
57      Iterator iterator();
58  
59      /***
60       * Retrieve a string representations of all directions.
61       *
62       * @return an array containing the names
63       */
64      String[] getNames();
65  
66      /***
67       * Retrieve a string short representations of all directions.
68       *
69       * @return an array containing the short names
70       */
71      String[] getShortNames();
72  
73      /***
74       * Retrieve the coordinate next to another in a given direction.
75       *
76       * @param coordinate the origin
77       * @param direction the direction
78       * @return a coordinate
79       */
80      Coordinate transform( Coordinate coordinate, West direction );
81  
82      /***
83       * Retrieve the coordinate next to another in a given direction.
84       *
85       * @param coordinate the origin
86       * @param direction the direction
87       * @return a coordinate
88       */
89      Coordinate transform( Coordinate coordinate, East direction );
90  
91      /***
92       * Retrieve the coordinate next to another in a given direction.
93       *
94       * @param coordinate the origin
95       * @param direction the direction
96       * @return a coordinate
97       */
98      Coordinate transform( Coordinate coordinate, North direction );
99  
100     /***
101      * Retrieve the coordinate next to another in a given direction.
102      *
103      * @param coordinate the origin
104      * @param direction the direction
105      * @return a coordinate
106      */
107     Coordinate transform( Coordinate coordinate, NorthEast direction );
108 
109     /***
110      * Retrieve the coordinate next to another in a given direction.
111      *
112      * @param coordinate the origin
113      * @param direction the direction
114      * @return a coordinate
115      */
116     Coordinate transform( Coordinate coordinate, NorthWest direction );
117 
118     /***
119      * Retrieve the coordinate next to another in a given direction.
120      *
121      * @param coordinate the origin
122      * @param direction the direction
123      * @return a coordinate
124      */
125     Coordinate transform( Coordinate coordinate, South direction );
126 
127     /***
128      * Retrieve the coordinate next to another in a given direction.
129      *
130      * @param coordinate the origin
131      * @param direction the direction
132      * @return a coordinate
133      */
134     Coordinate transform( Coordinate coordinate, SouthEast direction );
135 
136     /***
137      * Retrieve the coordinate next to another in a given direction.
138      *
139      * @param coordinate the origin
140      * @param direction the direction
141      * @return a coordinate
142      */
143     Coordinate transform( Coordinate coordinate, SouthWest direction );
144 }