View Javadoc

1   package fr.ove.palette;
2   
3   import java.io.Serializable;
4   
5   /***
6   * The palette information.<BR>
7   * The kind of palette currently used is for different operators requiring particular syntax.
8   * The instance of this class contain this particular syntax.<BR>
9   * Moreover, when these operators take one or more arguments, the syntax is often made of brackets
10  * and eventually separators (according to the arity of the operator). The instance of this class
11  * contains also an offset representing where to start entering the argument(s) of the operator.<BR>
12  * For example, the button (or other) in the palette associated to the trigonometric function sin, will
13  * will provide an instance of this class with the syntax sin() and the offset 4.
14  *
15  * @author © 1999 DIRAT Laurent
16  * @version 1.0  18/09/1999
17  */
18  public class PaletteInfo implements Serializable {
19      /***
20      * The syntax of the associated operator in the palette.
21      */
22      private String syntax;
23      
24      /***
25      * The offset associated to the syntax.
26      */
27      private byte offset;
28      
29      /***
30      * the constructor.
31      * @param syntax the syntax of the associated operator in the palette.
32      * @param offset the offset associated to the syntax.
33      */
34      public PaletteInfo(String syntax, byte offset) {
35          this.syntax = syntax;
36          this.offset = offset;
37      }
38      
39      /***
40      * Sets the syntax of the associated operator in the palette.
41      * @param syntax the syntax of the associated operator in the palette.
42      */
43      public void setSyntax(String syntax) {
44          this.syntax = syntax;
45      }
46      
47      /***
48      * Returns the syntax of the associated operator in the palette.
49      */
50      public String getSyntax() {
51          return syntax;
52      }
53      
54      /***
55      * Sets the offset associated to the syntax.
56      * @param offset the offset associated to the syntax. Its value must be > 0
57      */
58      public void setOffset(byte offset) {
59          this.offset = offset;
60      }
61      
62      /***
63      * Returns the offset associated to the syntax.
64      */
65      public byte getOffset() {
66          return offset;
67      }
68      
69      /***
70      * For Debugg. Turns the instance into a String
71      */
72      public String toString() {
73          return syntax + "\t" + offset;
74      }
75  }