|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.River
public class River
A river for the map generator.
| Nested Class Summary | |
|---|---|
private static class |
River.DirectionChange
Possible direction changes for a river. |
| Field Summary | |
|---|---|
private boolean |
connected
Whether the river is connected to Europe. |
private Map.Direction |
direction
Current direction the river is flowing in. |
private static java.util.logging.Logger |
logger
|
private Map |
map
The map on which the river flows. |
private River |
nextRiver
The next river. |
private java.util.Random |
random
The random number source. |
private ServerRegion |
region
The ServerRegion this River belongs to. |
private java.util.Map<Map.Position,River> |
riverMap
A hashtable of position-river pairs. |
private TileImprovementType |
riverType
|
private java.util.List<RiverSection> |
sections
A list of river sections. |
| Constructor Summary | |
|---|---|
River(Map map,
java.util.Map<Map.Position,River> riverMap,
ServerRegion region,
java.util.Random random)
Constructor. |
|
| Method Summary | |
|---|---|
void |
add(Map.Position position,
Map.Direction direction)
Adds a new section to this river. |
boolean |
contains(Map.Position p)
Returns true if this river already contains the given position. |
private void |
createDelta(Map.Position position,
Map.Direction direction,
RiverSection section)
Describe createDelta method here. |
private void |
delta(Map.Position position,
Map.Direction direction,
RiverSection section,
Map.Direction d)
|
private void |
drawToMap(java.util.List<RiverSection> sections)
Draws the completed river to the map. |
private boolean |
flow(Map.Position source)
Lets the river flow from the given position. |
boolean |
flowFromSource(Map.Position position)
Creates a river flowing from the given position if possible. |
RiverSection |
getLastSection()
|
int |
getLength()
Returns the length of this river. |
ServerRegion |
getRegion()
Get the ServerRegion value. |
java.util.List<RiverSection> |
getSections()
|
void |
grow(RiverSection lastSection,
Map.Position position)
Increases the size of this river. |
boolean |
isNextToSelf(Map.Position p)
Returns true if the given position is next to this river. |
boolean |
isNextToWater(Map.Position p)
Returns true if the given position is next to a river, lake or sea. |
void |
setRegion(ServerRegion newServerRegion)
Set the ServerRegion value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private TileImprovementType riverType
private Map.Direction direction
private Map map
private java.util.List<RiverSection> sections
private River nextRiver
private ServerRegion region
private final java.util.Random random
private java.util.Map<Map.Position,River> riverMap
private boolean connected
| Constructor Detail |
|---|
public River(Map map,
java.util.Map<Map.Position,River> riverMap,
ServerRegion region,
java.util.Random random)
map - The map on which the river flows.riverMap - A hashtable of position-river pairs.region - The region for this river.random - The Random number source to use.| Method Detail |
|---|
public java.util.List<RiverSection> getSections()
public int getLength()
public RiverSection getLastSection()
public final ServerRegion getRegion()
ServerRegion value.
ServerRegion valuepublic final void setRegion(ServerRegion newServerRegion)
ServerRegion value.
newServerRegion - The new ServerRegion value.
public void add(Map.Position position,
Map.Direction direction)
position - Where this section is located.direction - The direction the river is flowing in.
public void grow(RiverSection lastSection,
Map.Position position)
lastSection - The last section of the river flowing into this one.position - The position of the confluence.public boolean isNextToSelf(Map.Position p)
p - A map position.
public boolean isNextToWater(Map.Position p)
p - A map position.
public boolean contains(Map.Position p)
p - A map position.
public boolean flowFromSource(Map.Position position)
position - A map position.
private boolean flow(Map.Position source)
source - A map position.
private void createDelta(Map.Position position,
Map.Direction direction,
RiverSection section)
createDelta method here.
position - a Position valuedirection - a Direction value
private void delta(Map.Position position,
Map.Direction direction,
RiverSection section,
Map.Direction d)
private void drawToMap(java.util.List<RiverSection> sections)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||