01: /*
02:
03: Derby - Class org.apache.derby.iapi.sql.dictionary.GenericDescriptorList
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (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;
39: import java.util.Iterator;
40:
41: public class GenericDescriptorList extends ArrayList {
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: this .scanned = scanned;
55: }
56:
57: /**
58: * Return whether or not the underlying system table has been scanned.
59: *
60: * @return Where or not the underlying system table has been scanned.
61: */
62: public boolean getScanned() {
63: return scanned;
64: }
65:
66: /**
67: * Get the UniqueTupleDescriptor that matches the
68: * input uuid.
69: *
70: * @param uuid The UUID for the object
71: *
72: * @return The matching UniqueTupleDescriptor.
73: */
74: public UniqueTupleDescriptor getUniqueTupleDescriptor(UUID uuid) {
75: for (Iterator iterator = iterator(); iterator.hasNext();) {
76: UniqueTupleDescriptor ud = (UniqueTupleDescriptor) iterator
77: .next();
78: if (ud.getUUID().equals(uuid)) {
79: return ud;
80: }
81: }
82: return null;
83: }
84:
85: public java.util.Enumeration elements() {
86: return java.util.Collections.enumeration(this);
87: }
88: }
|