|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsoc.game.SOCSpecialItem.Requirement
public static final class SOCSpecialItem.Requirement
Data structure and parser for a special item's requirements.
A requirement is a minimum count of items (Settlements, Cities, Victory Points, or Length of player's longest route) with an optional required position (at a Port, or at a list of special nodes) for at least one of the Settlement or City items.
At the client, requirements are rendered in SOCSpecialItemDialog.buildRequirementsText;
if new fields or requirement types are added, please update that method.
parse(String),
SOCSpecialItem.checkRequirements(SOCPlayer, boolean)| Field Summary | |
|---|---|
java.lang.String |
atCoordList
Board layout coordinate list such as "N1", or null. |
boolean |
atPort
If true, a reqType piece must be at a 3:1 or 2:1 port. |
int |
count
Number of pieces, victory points, or length of route required |
char |
reqType
'S' for settlement, 'C' for city, 'V' for victory points, 'L' for length of player's longest route |
| Constructor Summary | |
|---|---|
SOCSpecialItem.Requirement(char reqType,
int count,
boolean atPort,
java.lang.String atCoordList)
Create a Requirement item with these field values. |
|
| Method Summary | |
|---|---|
static java.util.List<SOCSpecialItem.Requirement> |
parse(java.lang.String req)
Parse a requirement specification string into SOCSpecialItem.Requirement objects. |
java.lang.String |
toString()
String representation for debugging; same format as parse(String). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final char reqType
public final int count
public final boolean atPort
reqType piece must be at a 3:1 or 2:1 port.
Currently, only reqType C (City) is supported here,
because no current scenario justified the extra coding for S-or-C.
public final java.lang.String atCoordList
getAddedLayoutParts.
| Constructor Detail |
|---|
public SOCSpecialItem.Requirement(char reqType,
int count,
boolean atPort,
java.lang.String atCoordList)
reqType - See reqTypecount - See countatPort - See atPortatCoordList - See atCoordList| Method Detail |
|---|
public static java.util.List<SOCSpecialItem.Requirement> parse(java.lang.String req)
throws java.lang.IllegalArgumentException
SOCSpecialItem.Requirement objects.
Requirements are a comma-separated list of items, each item having this syntax:
[count] itemType [@ location]
itemType pieces must be at:
P for any 3:1 or 2:1 trade port, or N1 through N9 for a Node List in the board layout
(board.getAddedLayoutPart("N1") etc).
3S = 3 settlements
2C,8V = 2 cities, 8 victory points
6L = trade route length 6
S@P = settlement at any port
2C@N2 = 2 cities, at least one of which is in node list 2 ("N2") in the board layout
req - Requirements string following the syntax given above
SOCSpecialItem.Requirements, or null if req is ""
java.lang.IllegalArgumentException - if req isn't a syntactically valid specificationpublic java.lang.String toString()
parse(String).
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||