dip.order
Class OrderFormat

java.lang.Object
  extended bydip.order.OrderFormat

public class OrderFormat
extends java.lang.Object

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}

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

OrderFormat

public OrderFormat()
Method Detail

format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Coast coast)
Format a Coast given the order formatting parameters.


format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Province province)
Format a Province given the order formatting parameters.


format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Unit.Type unitType)
Format a Unit Type given the order formatting parameters.


format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Power power)
Format a Power given the order formatting parameters.

Note: FORMAT_BRIEF is not yet supported for Power names.


format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Location loc)
Format a Location given the order formatting parameters.


formatOrderName

public static java.lang.String formatOrderName(OrderFormatOptions ofo,
                                               Orderable order)
Formats an Order Name (obtained from an Order) given the order formatting parameters.


format

public static java.lang.String format(OrderFormatOptions ofo,
                                      Orderable order)
Formats an Order


format

public 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


getFormatExample

public static java.lang.String getFormatExample(OrderFormatOptions ofo,
                                                OrderFactory of)
Gets an example order, suitable for display in a user interface, using the given OrderFormatOptions.



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.