View Javadoc

1   /*
2    * joey-gen and its relative products are published under the terms
3    * of the Apache Software License.
4    * 
5    * Created on 2004/08/10 17:15:16
6    */
7   package org.asyrinx.joey.gen.model.rdb;
8   
9   import org.apache.commons.lang.builder.EqualsBuilder;
10  import org.asyrinx.joey.gen.model.ElementSet;
11  
12  /***
13   * @author akima
14   */
15  public class Index extends ElementSet {
16  
17      /***
18       *  
19       */
20      public Index() {
21          super((String) null);
22      }
23  
24      /***
25       *  
26       */
27      public Index(Table parent) {
28          super(parent, null);
29      }
30  
31      /***
32       *  
33       */
34      public Index(Table parent, String name) {
35          super(parent, name);
36      }
37  
38      /*
39       * (non-Javadoc)
40       * 
41       * @see org.asyrinx.joey.gen.model.ElementSet#isEntity()
42       */
43      public boolean isEntity() {
44          return true;
45      }
46  
47      /*
48       * (non-Javadoc)
49       * 
50       * @see org.asyrinx.joey.gen.model.ElementSet#add(org.asyrinx.joey.gen.model.Element)
51       */
52      public void add(IndexEntry entry) {
53          super.add(entry);
54      }
55  
56      /*
57       * (non-Javadoc)
58       * 
59       * @see org.asyrinx.joey.gen.model.ElementSet#contains(org.asyrinx.joey.gen.model.Element)
60       */
61      public boolean contains(IndexEntry entry) {
62          return super.contains(entry);
63      }
64  
65      /*
66       * (non-Javadoc)
67       * 
68       * @see org.asyrinx.joey.gen.model.ElementSet#getElement(int)
69       */
70      public IndexEntry getEntry(int index) {
71          return (IndexEntry) super.getElement(index);
72      }
73  
74      /*
75       * (non-Javadoc)
76       * 
77       * @see org.asyrinx.joey.gen.model.ElementSet#get(java.lang.String)
78       */
79      public IndexEntry getEntry(String name) {
80          return (IndexEntry) super.getElement(name);
81      }
82  
83      /*
84       * (non-Javadoc)
85       * 
86       * @see org.asyrinx.joey.gen.model.ElementSet#remove(java.lang.String)
87       */
88      public IndexEntry removeEntry(String name) {
89          return (IndexEntry) super.removeElement(name);
90      }
91  
92      /*
93       * (non-Javadoc)
94       * 
95       * @see org.asyrinx.joey.gen.model.Element#getParentElement()
96       */
97      public Table getParent() {
98          return (Table) super.getParentElement();
99      }
100 
101     private boolean unique = false;
102 
103     /***
104      * @return Returns the unique.
105      */
106     public boolean isUnique() {
107         return unique;
108     }
109 
110     /***
111      * @param unique
112      *            The unique to set.
113      */
114     public void setUnique(boolean unique) {
115         this.unique = unique;
116     }
117 
118     /*
119      * (non-Javadoc)
120      * 
121      * @see java.lang.Object#equals(java.lang.Object)
122      */
123     public boolean equals(Object obj) {
124         if (!super.equals(obj))
125             return false;
126         if (!(obj instanceof Index))
127             return false;
128         final Index other = (Index) obj;
129         return new EqualsBuilder() //
130                 .append(this.isUnique(), other.isUnique()) //
131                 .isEquals();
132     }
133 
134     /*
135      * (non-Javadoc)
136      * 
137      * @see org.asyrinx.joey.gen.model.ElementSet#careChildOrder()
138      */
139     public boolean careChildOrder() {
140         return true;
141     }
142 }