1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.sql.dictionary.GenericDescriptorList |
4 | |
5 | Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.iapi.sql.dictionary; |
22 | |
23 | import org.apache.derby.iapi.error.StandardException; |
24 | import org.apache.derby.iapi.services.sanity.SanityManager; |
25 | |
26 | import org.apache.derby.catalog.UUID; |
27 | |
28 | import org.apache.derby.iapi.sql.dictionary.DataDictionary; |
29 | import org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor; |
30 | import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; |
31 | |
32 | import org.apache.derby.iapi.error.StandardException; |
33 | import org.apache.derby.iapi.services.sanity.SanityManager; |
34 | |
35 | import org.apache.derby.catalog.UUID; |
36 | |
37 | import java.util.ArrayList; |
38 | import java.util.Iterator; |
39 | |
40 | public class GenericDescriptorList extends ArrayList |
41 | { |
42 | private boolean scanned; |
43 | |
44 | /** |
45 | * Mark whether or not the underlying system table has |
46 | * been scanned. (If a table does not have any |
47 | * constraints then the size of its CDL will always |
48 | * be 0. We used these get/set methods to determine |
49 | * when we need to scan the table. |
50 | * |
51 | * @param scanned Whether or not the underlying system table has been scanned. |
52 | */ |
53 | public void setScanned(boolean scanned) |
54 | { |
55 | this.scanned = scanned; |
56 | } |
57 | |
58 | /** |
59 | * Return whether or not the underlying system table has been scanned. |
60 | * |
61 | * @return Where or not the underlying system table has been scanned. |
62 | */ |
63 | public boolean getScanned() |
64 | { |
65 | return scanned; |
66 | } |
67 | |
68 | /** |
69 | * Get the UniqueTupleDescriptor that matches the |
70 | * input uuid. |
71 | * |
72 | * @param uuid The UUID for the object |
73 | * |
74 | * @return The matching UniqueTupleDescriptor. |
75 | */ |
76 | public UniqueTupleDescriptor getUniqueTupleDescriptor(UUID uuid) |
77 | { |
78 | for (Iterator iterator = iterator(); iterator.hasNext(); ) |
79 | { |
80 | UniqueTupleDescriptor ud = (UniqueTupleDescriptor) iterator.next(); |
81 | if (ud.getUUID().equals(uuid)) |
82 | { |
83 | return ud; |
84 | } |
85 | } |
86 | return null; |
87 | } |
88 | |
89 | public java.util.Enumeration elements() { |
90 | return java.util.Collections.enumeration(this); |
91 | } |
92 | } |