org.jmol.modelset
Class LabelToken

java.lang.Object
  extended by org.jmol.modelset.LabelToken

public class LabelToken
extends Object


Field Summary
private  boolean alignLeft
           
private  char ch1
           
private  Object data
           
private  boolean intAsFloat
           
private  String key
           
private static int[] labelTokenIds
           
private static String labelTokenParams
           
private  int precision
           
private  int pt
           
static String STANDARD_LABEL
           
private  String text
           
private  int tok
           
private static int[] twoCharLabelTokenIds
           
private static String twoCharLabelTokenParams
           
private  int width
           
private  boolean zeroPad
           
 
Constructor Summary
private LabelToken(int pt)
           
private LabelToken(String text)
           
 
Method Summary
private static void appendAtomTokenValue(Viewer viewer, Atom atom, LabelToken t, StringBuffer strLabel, int[] indices)
           
static LabelToken[] compile(Viewer viewer, String strFormat, char chAtom, Map<String,Object> htValues)
          Compiles a set of tokens for each primitive element of a label.
private  String format(float floatT, String strT, Tuple3f ptT)
           
static String formatLabel(Viewer viewer, Atom atom, LabelToken[] tokens, char chAtom, int[] indices)
          returns a formatted string based on the precompiled label tokens
static String formatLabel(Viewer viewer, Atom atom, String strFormat)
           
static String formatLabel(Viewer viewer, Bond bond, LabelToken[] tokens, Map<String,Object> values, int[] indices)
           
static String formatLabel(Viewer viewer, Measurement measurement, String label, float value, String units)
           
static Map<String,Object> getBondLabelValues()
           
static String getLabel(LabelToken[] tokens)
           
private static boolean isLabelPropertyTok(int tok)
           
private static int setToken(Viewer viewer, String strFormat, LabelToken lt, int cch, int chAtom, Map<String,Object> htValues)
          sets a label token based on a label string
static void setValues(LabelToken[] tokens, Map<String,Object> values)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

private String text

key

private String key

data

private Object data

tok

private int tok

pt

private int pt

ch1

private char ch1

width

private int width

precision

private int precision

alignLeft

private boolean alignLeft

zeroPad

private boolean zeroPad

intAsFloat

private boolean intAsFloat

labelTokenParams

private static final String labelTokenParams
See Also:
Constant Field Values

labelTokenIds

private static final int[] labelTokenIds

STANDARD_LABEL

public static final String STANDARD_LABEL
See Also:
Constant Field Values

twoCharLabelTokenParams

private static final String twoCharLabelTokenParams
See Also:
Constant Field Values

twoCharLabelTokenIds

private static final int[] twoCharLabelTokenIds
Constructor Detail

LabelToken

private LabelToken(String text)

LabelToken

private LabelToken(int pt)
Method Detail

isLabelPropertyTok

private static boolean isLabelPropertyTok(int tok)

compile

public static LabelToken[] compile(Viewer viewer,
                                   String strFormat,
                                   char chAtom,
                                   Map<String,Object> htValues)
Compiles a set of tokens for each primitive element of a label. This is the efficient way to create a set of labels.

Parameters:
viewer -
strFormat -
chAtom -
htValues -
Returns:
array of tokens

formatLabel

public static String formatLabel(Viewer viewer,
                                 Atom atom,
                                 String strFormat)

formatLabel

public static String formatLabel(Viewer viewer,
                                 Atom atom,
                                 LabelToken[] tokens,
                                 char chAtom,
                                 int[] indices)
returns a formatted string based on the precompiled label tokens

Parameters:
viewer -
atom -
tokens -
chAtom -
indices -
Returns:
formatted string

getBondLabelValues

public static Map<String,Object> getBondLabelValues()

formatLabel

public static String formatLabel(Viewer viewer,
                                 Bond bond,
                                 LabelToken[] tokens,
                                 Map<String,Object> values,
                                 int[] indices)

formatLabel

public static String formatLabel(Viewer viewer,
                                 Measurement measurement,
                                 String label,
                                 float value,
                                 String units)

setValues

public static void setValues(LabelToken[] tokens,
                             Map<String,Object> values)

getLabel

public static String getLabel(LabelToken[] tokens)

setToken

private static int setToken(Viewer viewer,
                            String strFormat,
                            LabelToken lt,
                            int cch,
                            int chAtom,
                            Map<String,Object> htValues)
sets a label token based on a label string

Parameters:
viewer -
strFormat -
lt -
cch -
chAtom -
htValues -
Returns:
new position

appendAtomTokenValue

private static void appendAtomTokenValue(Viewer viewer,
                                         Atom atom,
                                         LabelToken t,
                                         StringBuffer strLabel,
                                         int[] indices)

format

private String format(float floatT,
                      String strT,
                      Tuple3f ptT)