## com.bbn.openmap.tools.symbology.milStd2525
Class CodeScheme

    java.lang.Object
      com.bbn.openmap.tools.symbology.milStd2525.CodePosition
          com.bbn.openmap.tools.symbology.milStd2525.CodeScheme

Direct Known Subclasses:
  CodePositionTree

public class CodeScheme
extends CodePosition

The CodeScheme represents the options presented in the first character of the 15 character symbol code. This character represents the scheme, or symbology set, of the top-most branches of the MIL-STD-2525B symbol tree. The layout and meaning of the 15 characters depend on the scheme, and the CodeScheme can figure out some of them when it parses the position properties to see what other CodePositions are fundamental for a particular instance of a CodeScheme. There are other CodePositions that present choices for a particular scheme type, and the CodeScheme needs to be told what those options are. The CodePositionTree handles setting up the CodeScheme with its optional CodePositions.

Field Summary
`protected java.lang.String` `defaultSymbolCode` The base 15 character code for a symbol under a scheme.
`static java.lang.String` `DefaultSymbolCodeProperty` Property keyword for the default symbol code 'defaultSymbolCode'.
`protected java.lang.String` `hierarchyAddition` For parsing the hierarchy, most schemes have some characters added to their hierarchy index number.
`static java.lang.String` `HierarchyCodeAdditionProperty` Property keyword for the hierarchy addition string 'hierarchyCodeAddition'.
`protected CodeOptions` `options` A set of CodePostitions that can be set with on this scheme.

Fields inherited from class com.bbn.openmap.tools.symbology.milStd2525.CodePosition
`choices, DEBUG, endIndex, hierarchyNumber, id, NameProperty, nextPosition, NextProperty, NO_CHAR, NO_NUMBER, prettyName, startIndex, symbolPart`

Constructor Summary
`CodeScheme()`

Method Summary
`CodePosition` `addPositionChoice(int index, java.lang.String entry, java.lang.String prefix, java.util.Properties props)` The method needs more information from the properties than the CodePosition version of this method provides, like getting the base symbol code for the scheme and the hierarchy addition.
`CodeOptions` `getCodeOptions()` Get the code options set for this scheme.
`CodeOptions` `getCodeOptions(SymbolPart sp)` Get the code options for the scheme as it relates to the symbol part.
`java.lang.StringBuffer` `getDefaultSymbolCode()` Return the default 15 character symbol code for this instance of a scheme.
`SymbolPart` `parseHierarchy(java.util.Properties props, SymbolPart parent)` Parse the hierarchy properties to create SymbolParts for those parts under a particular scheme represented by this instance of CodeScheme.
`void` `parseHierarchy(java.lang.String hCode, java.util.Properties props, SymbolPart parent)` Parse the hierarchy properties to create SymbolParts for those parts under a particular scheme represented by this instance of CodeScheme.
`void` `setCodeOptions(CodeOptions co)` Set the code options for this scheme.

Methods inherited from class com.bbn.openmap.tools.symbology.milStd2525.CodePosition
`addPositionChoice, codeMatches, getEndIndex, getFromChoices, getHierarchyNumber, getHierarchyNumberString, getID, getNextPosition, getNULLCodePosition, getPositionChoices, getPrettyName, getStartIndex, getSymbolPart, parsePositions, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### defaultSymbolCode

    protected java.lang.String defaultSymbolCode

  The base 15 character code for a symbol under a scheme. This code has wild-cards and unused charaters in them where appropriate for the scheme.

### hierarchyAddition

    protected java.lang.String hierarchyAddition

  For parsing the hierarchy, most schemes have some characters added to their hierarchy index number. This can be specified in the position properties.

### DefaultSymbolCodeProperty

    public static final java.lang.String DefaultSymbolCodeProperty

  Property keyword for the default symbol code 'defaultSymbolCode'.

  See Also:
    Constant Field Values

### HierarchyCodeAdditionProperty

    public static final java.lang.String HierarchyCodeAdditionProperty

  Property keyword for the hierarchy addition string 'hierarchyCodeAddition'.

  See Also:
    Constant Field Values

### options

    protected CodeOptions options

  A set of CodePostitions that can be set with on this scheme. It's different from the choices, which is a list of instantiated CodePositions for a particular CodePosition. The options are a set of CodePositions, containing choices. For instance, for a warfighing code scheme, there would be code positions for affiliation, status, order of battle and modifiers. The metoc code scheme wouldn't have options. Each CodePosition returned in the options can represent a setting for the position (its choices will be null), or can represent a suite of choices if there is a list of other CodePositions in its choices parameter.

Constructor Detail

### CodeScheme

    public CodeScheme()

Method Detail

### addPositionChoice

    public CodePosition addPositionChoice(int index,
                                          java.lang.String entry,
                                          java.lang.String prefix,
                                          java.util.Properties props)

  The method needs more information from the properties than the CodePosition version of this method provides, like getting the base symbol code for the scheme and the hierarchy addition.

  Overrides:
    `addPositionChoice` in class `CodePosition`
  Parameters:
    `index` - the hierarhical index for this position choice. This really only becomes important for those CodePositions which are used for interpreting the hierarchy properties. Other positions can use them for convenience, and this value will probably be just an ordering number for this choice out of all the other choices for the position.
    `entry` - this should be character or characters used in the symbol code for this particular position choice.
    `prefix` - the scoping property prefix used for all the properties. The entry is discovered by looking in the properties for this 'prefix.index'. Then other properties are discovered by looking for 'prefix.entry.propertyKey' properties.
    `props` - the position properties.

### parseHierarchy

    public SymbolPart parseHierarchy(java.util.Properties props,
                                     SymbolPart parent)

  Parse the hierarchy properties to create SymbolParts for those parts under a particular scheme represented by this instance of CodeScheme.

  Parameters:
    `props` - the hierarchy properties.
    `parent` - the SymbolPart parent that the new SymbolPart tree falls under.

### parseHierarchy

    public void parseHierarchy(java.lang.String hCode,
                               java.util.Properties props,
                               SymbolPart parent)

  Parse the hierarchy properties to create SymbolParts for those parts under a particular scheme represented by this instance of CodeScheme.

  Overrides:
    `parseHierarchy` in class `CodePosition`
  Parameters:
    `hCode` - the hierarchy code of this scheme, used to grow the tree for subsequent generations.
    `props` - the hierarchy properties.
    `parent` - the SymbolPart parent that the new SymbolPart tree falls under.

### getDefaultSymbolCode

    public java.lang.StringBuffer getDefaultSymbolCode()

  Return the default 15 character symbol code for this instance of a scheme. Pretty much all of the symbols below this node in the SymbolPart tree will have the same base code, with their parameters written on top of it.

### setCodeOptions

    public void setCodeOptions(CodeOptions co)

  Set the code options for this scheme.

### getCodeOptions

    public CodeOptions getCodeOptions()

  Get the code options set for this scheme.

### getCodeOptions

    public CodeOptions getCodeOptions(SymbolPart sp)

  Get the code options for the scheme as it relates to the symbol part. The symbol part may have some restrictions set on it by having one of the option CodePositions set within it. If that's the case, then the CodeOptions returned will have the CodePosition object for that aspect of the symbol represented by a CodePosition object without choices.

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details