|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.order.OrderFormat
OrderFormat formats orders according to the specified format string.
While OrderFormat is more flexible than using Order.toBriefString() or Order.toFullString(), it is also considerably slower. This is should not generally be a problem, unless one is doing multiple adjudications (e.g., for an AI).
OrderFormat uses keywords that are delimited by braces "{}". Valid keywords are described below. Any text (including whitespace) not in braces will be output literally, without modification.
Example: (Hold order)
{getPower()}: {getSourceUnitType()} {getSource()} {:orderName}
false
,
the text in "FALSE" is displayed. If non-null or boolean-true, the
text in TRUE may be displayed. Note that the following expressions
{field:?:FALSE} and {field:?TRUE:} are valid; the former will
display an empty value when true
, and the latter
an empty value when false
Keywords (these do not modify fields or methods)
Modifiers; these must be preceded by a field or method.
If an object is of a type usable by format() (e.g., Location, Coast, Province, Power, Unit, or OrderName), it will be formatted according to OrderFormatOptions before being output. If not, it will be converted to a String (via Object.toString()) before being output.
Methods are also available to format individual (non-order) components (such as Provinces, Locations, and Coasts) according to rules defined by OrderFormatOptions.
Constructor Summary | |
OrderFormat()
|
Method Summary | |
static java.lang.String |
format(OrderFormatOptions ofo,
Coast coast)
Format a Coast given the order formatting parameters. |
static java.lang.String |
format(OrderFormatOptions ofo,
Location loc)
Format a Location given the order formatting parameters. |
static java.lang.String |
format(OrderFormatOptions ofo,
Orderable order)
Formats an Order |
static java.lang.String |
format(OrderFormatOptions ofo,
Power power)
Format a Power given the order formatting parameters. |
static java.lang.String |
format(OrderFormatOptions ofo,
Province province)
Format a Province given the order formatting parameters. |
static java.lang.String |
format(OrderFormatOptions ofo,
java.lang.String format,
Orderable order)
Formats an Order according to the specified order format options, and the specified order format String |
static java.lang.String |
format(OrderFormatOptions ofo,
Unit.Type unitType)
Format a Unit Type given the order formatting parameters. |
static java.lang.String |
formatOrderName(OrderFormatOptions ofo,
Orderable order)
Formats an Order Name (obtained from an Order) given the order formatting parameters. |
static java.lang.String |
getFormatExample(OrderFormatOptions ofo,
OrderFactory of)
Gets an example order, suitable for display in a user interface, using the given OrderFormatOptions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OrderFormat()
Method Detail |
public static java.lang.String format(OrderFormatOptions ofo, Coast coast)
public static java.lang.String format(OrderFormatOptions ofo, Province province)
public static java.lang.String format(OrderFormatOptions ofo, Unit.Type unitType)
public static java.lang.String format(OrderFormatOptions ofo, Power power)
Note: FORMAT_BRIEF is not yet supported for Power names.
public static java.lang.String format(OrderFormatOptions ofo, Location loc)
public static java.lang.String formatOrderName(OrderFormatOptions ofo, Orderable order)
public static java.lang.String format(OrderFormatOptions ofo, Orderable order)
public static java.lang.String format(OrderFormatOptions ofo, java.lang.String format, Orderable order)
public static java.lang.String getFormatExample(OrderFormatOptions ofo, OrderFactory of)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |