KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.StatisticsDescriptor
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.catalog.Statistics;
25 import org.apache.derby.catalog.UUID;
26
27 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
28 import java.sql.Timestamp JavaDoc;
29
30 /**
31  * Implementation of StatisticsDescriptor.
32  *
33  */

34 public class StatisticsDescriptor extends TupleDescriptor
35 {
36     private UUID statID; // my UUID
37
private UUID statRefID; // UUID of object for which I'm a statistic
38
private UUID statTableID; // UUID of table for which I'm a stat
39
private Timestamp JavaDoc statUpdateTime; // when was I last modified
40

41     /* I for Index, T for table and such; even though right now all
42        our statistics are 'I' but who knows what we'll need later.
43     */

44     private String JavaDoc statType;
45     private boolean statValid = true; // am I valid?
46
private Statistics statStat; // the real enchilada.
47
private int statColumnCount; // for how many columns??
48

49     public StatisticsDescriptor(DataDictionary dd,
50                              UUID newUUID,
51                              UUID objectUUID,
52                              UUID tableUUID,
53                              String JavaDoc type,
54                              Statistics stat,
55                              int colCount)
56     {
57         super (dd);
58         this.statID = newUUID;
59         this.statRefID = objectUUID;
60         this.statTableID = tableUUID;
61         this.statUpdateTime = new Timestamp JavaDoc(System.currentTimeMillis());
62         this.statType = "I"; // for now only index.
63
this.statStat = stat;
64         this.statColumnCount = colCount;
65     }
66
67     public UUID getUUID()
68     {
69         return statID;
70     }
71     
72     /*----- getter functions for rowfactory ------*/
73     public UUID getTableUUID() { return statTableID;}
74     public UUID getReferenceID() { return statRefID; }
75     public Timestamp JavaDoc getUpdateTimestamp() { return statUpdateTime; }
76     public String JavaDoc getStatType() { return statType; }
77     public boolean isValid() { return statValid; }
78     public Statistics getStatistic() { return statStat; }
79     public int getColumnCount() { return statColumnCount; }
80
81     public String JavaDoc toString()
82     {
83         return "statistics: table=" + getTableUUID().toString() +
84             ",conglomerate=" + getReferenceID() +
85             ",colCount=" + getColumnCount() +
86             ",stat=" + getStatistic();
87     }
88 }
89
90
91
92
93
Popular Tags