1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.sql.dictionary.StatisticsDescriptor |
4 | |
5 | Copyright 2001, 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.catalog.Statistics; |
24 | import org.apache.derby.catalog.UUID; |
25 | |
26 | import org.apache.derby.iapi.sql.dictionary.DataDictionary; |
27 | import java.sql.Timestamp; |
28 | |
29 | /** |
30 | * Implementation of StatisticsDescriptor. |
31 | * |
32 | */ |
33 | public class StatisticsDescriptor extends TupleDescriptor |
34 | { |
35 | private UUID statID; // my UUID |
36 | private UUID statRefID; // UUID of object for which I'm a statistic |
37 | private UUID statTableID; // UUID of table for which I'm a stat |
38 | private Timestamp statUpdateTime; // when was I last modified |
39 | |
40 | /* I for Index, T for table and such; even though right now all |
41 | our statistics are 'I' but who knows what we'll need later. |
42 | */ |
43 | private String statType; |
44 | private boolean statValid = true; // am I valid? |
45 | private Statistics statStat; // the real enchilada. |
46 | private int statColumnCount; // for how many columns?? |
47 | |
48 | public StatisticsDescriptor(DataDictionary dd, |
49 | UUID newUUID, |
50 | UUID objectUUID, |
51 | UUID tableUUID, |
52 | String type, |
53 | Statistics stat, |
54 | int colCount) |
55 | { |
56 | super (dd); |
57 | this.statID = newUUID; |
58 | this.statRefID = objectUUID; |
59 | this.statTableID = tableUUID; |
60 | this.statUpdateTime = new Timestamp(System.currentTimeMillis()); |
61 | this.statType = "I"; // for now only index. |
62 | this.statStat = stat; |
63 | this.statColumnCount = colCount; |
64 | } |
65 | |
66 | public UUID getUUID() |
67 | { |
68 | return statID; |
69 | } |
70 | |
71 | /*----- getter functions for rowfactory ------*/ |
72 | public UUID getTableUUID() { return statTableID;} |
73 | public UUID getReferenceID() { return statRefID; } |
74 | public Timestamp getUpdateTimestamp() { return statUpdateTime; } |
75 | public String getStatType() { return statType; } |
76 | public boolean isValid() { return statValid; } |
77 | public Statistics getStatistic() { return statStat; } |
78 | public int getColumnCount() { return statColumnCount; } |
79 | |
80 | public String toString() |
81 | { |
82 | return "statistics: table=" + getTableUUID().toString() + |
83 | ",conglomerate=" + getReferenceID() + |
84 | ",colCount=" + getColumnCount() + |
85 | ",stat=" + getStatistic(); |
86 | } |
87 | } |
88 | |
89 | |
90 | |
91 | |