aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/server/protocol/Directive.java
blob: 0d7a1622f42714284d273523628e8fa9ded7aab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
 * 
 */
package uk.org.ury.server.protocol;

/**
 * Directives supported by the protocol.
 * 
 * @author  Matt Windsor
 */

public enum Directive
  {
    // ID           String representation  Singleton?
    
    /** Directive marking the start of an item block. */ 
    ITEM_START      ("ITEM-START"        , false),
    
    /** Directive marking a property inside an item block. */  
    ITEM_PROPERTY   ("PROP"              , false),
    
    /** Directive marking the end of an item block. */
    ITEM_END        ("ITEM-END"          , false);
    
    
    
    private String strRep;        // String representation
    private boolean isSingleton;  // Is a singleton?

    
    /**
     * Construct a new Directive.
     * 
     * @param strRep  The string representation of the Directive.
     * 
     * @param isSingleton  If true, then the Directive accepts no 
     *                     properties.  If false, then the Directive 
     *                     must be provided with at least one.
     */
    
    private
    Directive (String strRep, boolean isSingleton)
    {
      this.strRep = strRep;
      this.isSingleton = isSingleton;
    }
    
    
    /**
     * @return  the string representation.
     */
    
    public String
    toString ()
    {
      return strRep;
    }
    
    
    /**
     * @return  true if the directive has no properties.
     */
    
    public Boolean
    isSingleton ()
    {
      return isSingleton;
    }
  }