org.flexgen.map
Class MapTileType

java.lang.Object
  extended by org.flexgen.map.MapTileType

public class MapTileType
extends java.lang.Object

Class representing types of map tiles that can be used in maps. Each map tile type contains a two-dimensional array of map units that define the map tile type and an array of map tile edges that define the four edges of the map tile.


Constructor Summary
MapTileType(java.lang.String name, int weight, MapUnit[][] mapUnits, MapTileEdge[] mapTileEdges, MapTileOrientation[] distinctMapTileOrientations)
          Construct a map tile type.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines whether or not this map tile type is equal to another map tile type.
 MapTileOrientation[] getDistinctMapTileOrientations()
          Get the array of map tile orientations that specify the distinct orientations that are possible for this map tile type.
 MapTileEdge getMapTileEdge(MapTileEdgePosition mapTileEdgePosition)
          Get the map tile edge at the specified position in this map tile type.
 MapUnit getMapUnit(int x, int y)
          Get the map unit at the specified coordinates in this map tile type.
 int getSize()
          Get the size of the map unit array that defines this map tile type.
 int getWeight()
          Get the weight value used to determine the probability of selecting this tile type when generating a map.
 int hashCode()
          Returns a hash code value for the object.
 java.lang.String toString()
          Get the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapTileType

public MapTileType(java.lang.String name,
                   int weight,
                   MapUnit[][] mapUnits,
                   MapTileEdge[] mapTileEdges,
                   MapTileOrientation[] distinctMapTileOrientations)
Construct a map tile type.

Parameters:
name - Name of the map tile type. Cannot be null.
weight - The weight value used to determine the probability of selecting this tile type when generating a map. Larger values make this tile type more likely to be selected. The probability of selecting this tile type is computed by taking the weight of this tile type and dividing it by the sum of the weight values for all of the tile types. Cannot be negative.
mapUnits - Two-dimensional array of map units that define the map tile type. Cannot be null. Must contain at least one row. Each row must contain the same number of elements. Must contain the same number of columns as it does rows. No element can be null.
mapTileEdges - Array of map tile edges that define the four edges of this map tile type. Cannot be null. Must contain four elements. No element can be null. The first element is the top edge of the tile. The second element is the right edge of the tile. The third element is the bottom edge of the tile. The fourth element is the left edge of the tile.
distinctMapTileOrientations - Array of map tile orientations that specify the distinct orientations that are possible for this map tile type. Cannot be null. Must contain at lease one element. No element can be null. Cannot contain two or more elements that are identical.
Method Detail

getWeight

public int getWeight()
Get the weight value used to determine the probability of selecting this tile type when generating a map.

Returns:
The weight value used to determine the probability of selecting this tile type when generating a map.

getSize

public int getSize()
Get the size of the map unit array that defines this map tile type.

Returns:
The size of the map unit array that defines this map tile type.

getMapUnit

public MapUnit getMapUnit(int x,
                          int y)
Get the map unit at the specified coordinates in this map tile type.

Parameters:
x - X coordinate of the map unit to get. Must be greater than or equal to 0. Must be less than the size of the array of map units defining this map tile type.
y - Y coordinate of the map unit to get. Must be greater than or equal to 0. Must be less than the size of the array of map units defining this map tile type.
Returns:
The map unit at the specified coordinates in this map tile type.

getMapTileEdge

public MapTileEdge getMapTileEdge(MapTileEdgePosition mapTileEdgePosition)
Get the map tile edge at the specified position in this map tile type.

Parameters:
mapTileEdgePosition - Position of the map tile edge to get.
Returns:
The map unit at the specified coordinates in this map tile type.

getDistinctMapTileOrientations

public MapTileOrientation[] getDistinctMapTileOrientations()
Get the array of map tile orientations that specify the distinct orientations that are possible for this map tile type.

Returns:
The array of map tile orientations that specify the distinct orientations that are possible for this map tile type.

toString

public java.lang.String toString()
Get the string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this object.

equals

public boolean equals(java.lang.Object obj)
Determines whether or not this map tile type is equal to another map tile type.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The map tile type against which to compare this map tile type.
Returns:
True if the two map tile types are equal, false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.


FlexGen Home

Get FlexGen at SourceForge.net. Fast, secure and Free Open Source software downloads

Copyright © 2009 - Jeffrey J. Weston <jjweston@gmail.com>

All rights reserved. Use is subject to license terms.