1   /*
2    * TClass.java
3    *
4    * Copyright (c) 2002, The University of Sheffield.
5    *
6    * This file is part of GATE (see http://gate.ac.uk/), and is free
7    * software, licenced under the GNU Library General Public License,
8    * Version 2, June1991.
9    *
10   * A copy of this licence is included in the distribution in the file
11   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12   *
13   * borislav popov 02/2002
14   *
15   *
16   *  $Id: TClass.java,v 1.3 2005/12/14 14:28:58 julien_nioche Exp $
17   */
18  package gate.creole.ontology;
19  
20  import java.util.ArrayList;
21  import java.util.Set;
22  
23  /** An Interface representing a single ontology class */
24  public interface TClass extends OntologyResource, OntologyConstants {
25    /**
26     * Gets the id.
27     * 
28     * @return the id of the class
29     */
30    public String getId();
31  
32    /**
33     * Adds a sub class to this class.
34     * 
35     * @param subClass
36     *          the subClass to be added.
37     */
38    public void addSubClass(TClass subClass);
39  
40    /**
41     * Adds a super class to this class.
42     * 
43     * @param superClass
44     *          the super class to be added
45     */
46    public void addSuperClass(TClass superClass);
47  
48    /**
49     * Removes a sub class.
50     * 
51     * @param subClass
52     *          the sub class to be removed
53     */
54    public void removeSubClass(TClass subClass);
55  
56    /**
57     * Removes a super class.
58     * 
59     * @param superClass
60     *          the super class to be removed
61     */
62    public void removeSuperClass(TClass superClass);
63  
64    /**
65     * Gets the subclasses according to the desired closure.
66     * 
67     * @param closure
68     *          either DIRECT_CLOSURE or TRASITIVE_CLOSURE
69     * @return the set of subclasses
70     * @throws NoSuchClosureTypeException
71     *           if an unknown closure is specified.
72     */
73    public Set getSubClasses(byte closure);
74  
75    /**
76     * Gets the super classes according to the desired closure.
77     * 
78     * @param closure
79     *          either DIRECT_CLOSURE or TRASITIVE_CLOSURE
80     * @return the set of super classes
81     * @throws NoSuchClosureTypeException
82     *           if an unknown closure is specified.
83     */
84    public Set getSuperClasses(byte closure);
85  
86    /**
87     * Infers the sub classes transitive closure.
88     */
89    void inferSubClassesTransitiveClosure();
90  
91    /**
92     * Infers the super classes transitive closure.
93     */
94    void inferSuperClassesTransitiveClosure();
95  
96    /**
97     * Checks whether this class is a top.
98     * 
99     * @return true if this is a top class, otherwise - false.
100    */
101   public boolean isTopClass();
102 
103   /**
104    * Dumps the class to string.
105    * 
106    * @return the string representation of the class.
107    */
108   public String toString();
109 
110   /**
111    * Gets the super classes, and returns them in an array list where on each
112    * index there is a collection of the super classes at distance - the index.
113    * 
114    * @return <b>distance</b> from this class to a <b>set of super classes</b>
115    *         e.g. 1 : a,b 2 : c,d
116    */
117   public ArrayList getSuperClassesVSDistance();
118 
119   /**
120    * Gets the sub classes, and returns them in an array list where on each index
121    * there is a collection of the sub classes at distance - the index.
122    * 
123    * @return <b>distance</b> from this class to a <b>set of sub classes</b>
124    *         e.g. 1 : a,b 2 : c,d
125    */
126   public ArrayList getSubClassesVSDistance();
127 
128   /**
129    * Checks the equality of two classes.
130    * 
131    * @param o
132    *          the ontology class to be tested versus this one.
133    * @return true, if the classes are equal, otherwise - false.
134    */
135   public boolean equals(Object o);
136 } // class TClass
137