Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.jigsaw.pics
Class SampleLabel

    java.lang.Object
      |
      +--org.w3c.jigsaw.pics.SampleLabel

public class SampleLabel
extends java.lang.Object
implements LabelInterface

Label internal representation. The server has to know something about labels. In this implementation, I try to reduce this knowledge as fas as I could. Here, a label is a set of assignements to variables (options in PICS terms), and a rating. The syntax for writing label files is the following: =\n

Comments are allowed through the '#' at beginning of line. With the special variable 'ratings' being mandatory.

Constructor Summary
`SampleLabel(java.lang.String[] optnames, java.lang.String[] optvals)` Create a new label from a set of options.

Method Summary
`void` | `dump(java.lang.StringBuffer into, int format)` Dump this label according to the given format.
`int` | `getOptionIndex(java.lang.String option)` Get an option index.
`java.lang.String` | `getOptionValue(int idx)` Get an option value, by index.
`java.lang.String` | `getOptionValue(java.lang.String option)` Get an option value, by option name.
`boolean` | `hasOption(java.lang.String option)` Does this label defines the given option ?
`boolean` | `isGeneric()` Is this label generic ?
`static void` | `main(java.lang.String[] args)`
`void` | `print(java.io.PrintStream out)` Debugging: print the given options of this label.

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

Constructor Detail

### SampleLabel

    public SampleLabel(java.lang.String[] optnames,
                       java.lang.String[] optvals)

  Create a new label from a set of options. This constructor takes two arrays, one of option names, and one of option values. It builds out of them the internal representation for this label.

  The given arrays are used as is (no copy), and might side-effected by the new instance.

  Parameters:
    `optnames` - Names of option for this label.
    `optvalues` - Values of option for this label.

Method Detail

### print

    public void print(java.io.PrintStream out)

  Debugging: print the given options of this label.
  Parameters:
    `out` - The PrintStream to print to.

### hasOption

    public boolean hasOption(java.lang.String option)

  Does this label defines the given option ?
  Parameters:
    `option` - The option to look for.
  Returns:
    true if the label defines the given option.

### getOptionIndex

    public int getOptionIndex(java.lang.String option)

  Get an option index. This allows for fast acces to label options. There is no guarantee that the same option will get the same index across labels.
  Parameters:
    `option` - The option to look for.
  Returns:
    An integer, which is the option index if the option was found or -1 if the option isn't defined for this label.

### getOptionValue

    public java.lang.String getOptionValue(int idx)

  Get an option value, by index. This, along with the getOptionIndex method provides a fast access to option values.
  Parameters:
    `idx` - The index of the option, as gotten from getOptionIndex.
  Returns:
    A String instance, providing the option value.

### getOptionValue

    public java.lang.String getOptionValue(java.lang.String option)

  Get an option value, by option name.
  Parameters:
    `option` - The option that you want the value of.
  Returns:
    A String instance giving the option value, or null, if the option isn't defined for this label.

### isGeneric

    public boolean isGeneric()

  Is this label generic ?
  Returns:
    true if the label if generic.

### dump

    public void dump(java.lang.StringBuffer into,
                     int format)

  Dump this label according to the given format. The dump should take place after the service has dump itself.
  Specified by:
    dump in interface LabelInterface
  Parameters:
    `into` - A StringBuffer to dump the labels to.
    `format` - The format in which the dump should be done. This can be one of the four format described in the PICS specification.

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD