View Javadoc

1   /*
2    * Copyright (C) 2003-2004 Christian Siefkes <christian@siefkes.net>.
3    * Development of this software is supported by the German Research Society,
4    * Berlin-Brandenburg Graduate School in Distributed Information Systems
5    * (DFG grant no. GRK 316).
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, visit
19   * http://www.gnu.org/licenses/lgpl.html or write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21   */
22  package de.fu_berlin.ties.context;
23  
24  import org.apache.commons.lang.builder.ToStringBuilder;
25  
26  /***
27   * Type-safe enumeration of the types of features used by the default
28   * representation.
29   *
30   * @author Christian Siefkes
31   * @version $Revision: 1.1 $, $Date: 2004/02/02 18:35:58 $, $Author: siefkes $
32   */
33  public final class FeatureType {
34  
35      /***
36       * Constant for features representing attribute values.
37       */
38      public static final FeatureType ATTRIBUTE = new FeatureType("@");
39  
40      /***
41       * Constant for features representing calculated values.
42       */
43      public static final FeatureType CALCULATED = new FeatureType("$");
44  
45      /***
46       * Constant for features representing an element itself (marker is empty
47       * just as for text).
48       */
49      public static final FeatureType ELEMENT = new FeatureType("");
50  
51      /***
52       * Constant for features marking a special position or situation.
53       */
54      public static final FeatureType MARKER = new FeatureType("---");
55  
56      /***
57       * Constant for features representing textual content (marker is empty just
58       * as for elements).
59       */
60      public static final FeatureType TEXT = new FeatureType("");
61  
62      /***
63       * The mark used to introduce features of this type.
64       */
65      private final String mark;
66  
67      /***
68       * Private constructor to prevent creation of further instances.
69       * The static constants defined in this class are the only instantiations.
70       *
71       * @param featureMark the mark used to introduce features of this type
72       */
73      private FeatureType(final String featureMark) {
74          super();
75          mark = featureMark;
76      }
77  
78      /***
79       * Returns the mark used to introduce features of this type.
80       *
81       * @return the mark
82       */
83      public String getMark() {
84          return mark;
85      }
86  
87      /***
88       * Returns a string representation of this object.
89       *
90       * @return a textual representation
91       */
92      public String toString() {
93          return new ToStringBuilder(this)
94              .append("mark", mark)
95              .toString();
96      }
97  
98  }