|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.RiverSection
public class RiverSection
This class facilitates building, editing the TileImprovement style for rivers Rivers on the Map are composed of many individual TileImprovements displayed on each Tile the river flows through The river TileImprovement on a Tile has a style which represents the inputs/outputs of water to/from neighboring Tiles This class allows manipulation of individual stream(s) to neighboring Tiles (there are many in case of confluence)
| Field Summary | |
|---|---|
private static int[] |
base
Base numbers used to encode/decode the river style |
private int[] |
branch
River magnitude (size) for each direction toward the edges of the tile |
Map.Direction |
direction
Direction the river is flowing toward, at the current section |
private Map.Position |
position
Position of the current river section |
private int |
size
River magnitude (size) at the center of the tile |
| Constructor Summary | |
|---|---|
RiverSection(int style)
Constructor used by the MapEditor to encode/decode the style |
|
RiverSection(Map.Position position,
Map.Direction direction)
Constructor used to automatically generate rivers. |
|
| Method Summary | |
|---|---|
void |
decodeStyle(int style)
Decodes the style |
int |
encodeStyle()
Encodes the style as a four-digit base-three number. |
int |
getBranch(Map.Direction direction)
Gets the size of a branch |
Map.Position |
getPosition()
Returns the position |
int |
getSize()
Returns the size |
void |
grow()
Increases the size of this section by one. |
void |
growBranch(Map.Direction direction,
int increment)
Increases the size a branch |
void |
removeBranch(Map.Direction direction)
Removes a branch |
void |
setBranch(Map.Direction direction,
int size)
Sets the size of a branch |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static int[] base
private int[] branch
private int size
public Map.Direction direction
private Map.Position position
| Constructor Detail |
|---|
public RiverSection(int style)
style - The encoded style
public RiverSection(Map.Position position,
Map.Direction direction)
position - The map positiondirection - The direction the river is flowing toward| Method Detail |
|---|
public Map.Position getPosition()
public int getSize()
public void decodeStyle(int style)
style - public int encodeStyle()
public void setBranch(Map.Direction direction,
int size)
public int getBranch(Map.Direction direction)
public void removeBranch(Map.Direction direction)
public void growBranch(Map.Direction direction,
int increment)
public void grow()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||