KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > dictionary > GenericDescriptorList


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.GenericDescriptorList
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.dictionary;
23
24 import org.apache.derby.iapi.error.StandardException;
25 import org.apache.derby.iapi.services.sanity.SanityManager;
26
27 import org.apache.derby.catalog.UUID;
28
29 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
30 import org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor;
31 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
32
33 import org.apache.derby.iapi.error.StandardException;
34 import org.apache.derby.iapi.services.sanity.SanityManager;
35
36 import org.apache.derby.catalog.UUID;
37
38 import java.util.ArrayList JavaDoc;
39 import java.util.Iterator JavaDoc;
40
41 public class GenericDescriptorList extends ArrayList JavaDoc
42 {
43     private boolean scanned;
44
45     /**
46      * Mark whether or not the underlying system table has
47      * been scanned. (If a table does not have any
48      * constraints then the size of its CDL will always
49      * be 0. We used these get/set methods to determine
50      * when we need to scan the table.
51      *
52      * @param scanned Whether or not the underlying system table has been scanned.
53      */

54     public void setScanned(boolean scanned)
55     {
56         this.scanned = scanned;
57     }
58
59     /**
60      * Return whether or not the underlying system table has been scanned.
61      *
62      * @return Where or not the underlying system table has been scanned.
63      */

64     public boolean getScanned()
65     {
66         return scanned;
67     }
68
69     /**
70      * Get the UniqueTupleDescriptor that matches the
71      * input uuid.
72      *
73      * @param uuid The UUID for the object
74      *
75      * @return The matching UniqueTupleDescriptor.
76      */

77     public UniqueTupleDescriptor getUniqueTupleDescriptor(UUID uuid)
78     {
79         for (Iterator JavaDoc iterator = iterator(); iterator.hasNext(); )
80         {
81             UniqueTupleDescriptor ud = (UniqueTupleDescriptor) iterator.next();
82             if (ud.getUUID().equals(uuid))
83             {
84                 return ud;
85             }
86         }
87         return null;
88     }
89
90     public java.util.Enumeration JavaDoc elements() {
91         return java.util.Collections.enumeration(this);
92     }
93 }
94
Popular Tags