001: /*
002: * This file is part of the GeOxygene project source files.
003: *
004: * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
005: * the development and deployment of geographic (GIS) applications. It is a open source
006: * contribution of the COGIT laboratory at the Institut Géographique National (the French
007: * National Mapping Agency).
008: *
009: * See: http://oxygene-project.sourceforge.net
010: *
011: * Copyright (C) 2005 Institut Géographique National
012: *
013: * This library is free software; you can redistribute it and/or modify it under the terms
014: * of the GNU Lesser General Public License as published by the Free Software Foundation;
015: * either version 2.1 of the License, or any later version.
016: *
017: * This library is distributed in the hope that it will be useful, but WITHOUT ANY
018: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
019: * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020: *
021: * You should have received a copy of the GNU Lesser General Public License along with
022: * this library (see file LICENSE if present); if not, write to the Free Software
023: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024: *
025: */
026:
027: package fr.ign.cogit.geoxygene.dico;
028:
029: import java.util.ArrayList;
030: import java.util.List;
031:
032: /**
033: * Classe générique pour traduire les relations d'héritage (généralisation / spécialisation).
034: *
035: * @author Thierry Badard & Arnaud Braun
036: * @version 1.0
037: *
038: */
039:
040: public class GF_InheritanceRelation {
041:
042: /** Identifiant. */
043: protected int id;
044:
045: /** Renvoie l'identifiant. */
046: public int getId() {
047: return this .id;
048: }
049:
050: /** Affecte un identifiant. */
051: public void setId(int Id) {
052: this .id = Id;
053: }
054:
055: /**Nom de la généralisation ou de la spécialisation. */
056: protected String name;
057:
058: /** Renvoie le nom. */
059: public String getName() {
060: return this .name;
061: }
062:
063: /** Affecte un nom. */
064: public void setName(String Name) {
065: this .name = Name;
066: }
067:
068: /** Description.*/
069: protected String description;
070:
071: /** Renvoie la description. */
072: public String getDescription() {
073: return this .description;
074: }
075:
076: /** Affecte une description. */
077: public void setDescription(String Description) {
078: this .description = Description;
079: }
080:
081: /** TRUE si une instance de l'hyperclasse doit être au plus dans une sous-classe, FALSE sinon. */
082: protected boolean uniqueInstance;
083:
084: /** Renvoie l'attribut uniqueInstance. */
085: public boolean getUniqueInstance() {
086: return this .uniqueInstance;
087: }
088:
089: /** Affecte l'attribut uniqueInstance.. */
090: public void setUniqueInstance(boolean UniqueInstance) {
091: this .uniqueInstance = UniqueInstance;
092: }
093:
094: /** Les classes meres de la relation d'héritage. */
095: protected List super Type = new ArrayList();
096:
097: /** Renvoie les classes mere de la relation d'héritage. */
098: public List getSuperType() {
099: return super Type;
100: }
101:
102: /** Affecte une liste de classes meres */
103: public void setSuperType(List L) {
104: this .super Type = L;
105: }
106:
107: /** Nombre de classes meres de la relation d'héritage. */
108: public int sizeSuperType() {
109: return this .super Type.size();
110: }
111:
112: /** Ajoute une classe mere à la relation d'héritage. */
113: public void addSuperType(GF_FeatureType featureType) {
114: super Type.add(featureType);
115: if (!featureType.getSpecialization().contains(this ))
116: featureType.addSpecialization(this );
117: }
118:
119: /** Classe fille de la relation d'heritage. */
120: protected GF_FeatureType subType;
121:
122: /** Renvoie la classe fille de la relation d'héritage. */
123: public GF_FeatureType getSubType() {
124: return subType;
125: }
126:
127: /** Affecte une classe fille à la relation d'héritage. */
128: public void setSubType(GF_FeatureType SubType) {
129: this.subType = SubType;
130: if (!SubType.getGeneralization().contains(this))
131: SubType.addGeneralization(this);
132: }
133:
134: }
|