1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * Copyright (C) 2004 |
---|
19 | * & Matthias Schubert (schubert@dbs.ifi.lmu.de) |
---|
20 | * & Zhanna Melnikova-Albrecht (melnikov@cip.ifi.lmu.de) |
---|
21 | * & Rainer Holzmann (holzmann@cip.ifi.lmu.de) |
---|
22 | */ |
---|
23 | |
---|
24 | package weka.clusterers.forOPTICSAndDBScan.Databases; |
---|
25 | |
---|
26 | import weka.clusterers.forOPTICSAndDBScan.DataObjects.DataObject; |
---|
27 | import weka.core.Instances; |
---|
28 | |
---|
29 | import java.util.Iterator; |
---|
30 | import java.util.List; |
---|
31 | |
---|
32 | /** |
---|
33 | * <p> |
---|
34 | * Database.java <br/> |
---|
35 | * Authors: Rainer Holzmann, Zhanna Melnikova-Albrecht, Matthias Schubert <br/> |
---|
36 | * Date: Aug 20, 2004 <br/> |
---|
37 | * Time: 1:03:43 PM <br/> |
---|
38 | * $ Revision 1.4 $ <br/> |
---|
39 | * </p> |
---|
40 | * |
---|
41 | * @author Matthias Schubert (schubert@dbs.ifi.lmu.de) |
---|
42 | * @author Zhanna Melnikova-Albrecht (melnikov@cip.ifi.lmu.de) |
---|
43 | * @author Rainer Holzmann (holzmann@cip.ifi.lmu.de) |
---|
44 | * @version $Revision: 1.2 $ |
---|
45 | */ |
---|
46 | public interface Database { |
---|
47 | |
---|
48 | // ***************************************************************************************************************** |
---|
49 | // methods |
---|
50 | // ***************************************************************************************************************** |
---|
51 | |
---|
52 | /** |
---|
53 | * Select a dataObject from the database |
---|
54 | * @param key The key that is associated with the dataObject |
---|
55 | * @return dataObject |
---|
56 | */ |
---|
57 | DataObject getDataObject(String key); |
---|
58 | |
---|
59 | /** |
---|
60 | * Returns the size of the database (the number of dataObjects in the database) |
---|
61 | * @return size |
---|
62 | */ |
---|
63 | int size(); |
---|
64 | |
---|
65 | /** |
---|
66 | * Returns an iterator over all the keys |
---|
67 | * @return iterator |
---|
68 | */ |
---|
69 | Iterator keyIterator(); |
---|
70 | |
---|
71 | /** |
---|
72 | * Returns an iterator over all the dataObjects in the database |
---|
73 | * @return iterator |
---|
74 | */ |
---|
75 | Iterator dataObjectIterator(); |
---|
76 | |
---|
77 | /** |
---|
78 | * Tests if the database contains the dataObject_Query |
---|
79 | * @param dataObject_Query The query-object |
---|
80 | * @return true if the database contains dataObject_Query, else false |
---|
81 | */ |
---|
82 | boolean contains(DataObject dataObject_Query); |
---|
83 | |
---|
84 | /** |
---|
85 | * Inserts a new dataObject into the database |
---|
86 | * @param dataObject |
---|
87 | */ |
---|
88 | void insert(DataObject dataObject); |
---|
89 | |
---|
90 | /** |
---|
91 | * Returns the original instances delivered from WEKA |
---|
92 | * @return instances |
---|
93 | */ |
---|
94 | Instances getInstances(); |
---|
95 | |
---|
96 | /** |
---|
97 | * Sets the minimum and maximum values for each attribute in different arrays |
---|
98 | * by walking through every DataObject of the database |
---|
99 | */ |
---|
100 | void setMinMaxValues(); |
---|
101 | |
---|
102 | /** |
---|
103 | * Returns the array of minimum-values for each attribute |
---|
104 | * @return attributeMinValues |
---|
105 | */ |
---|
106 | double[] getAttributeMinValues(); |
---|
107 | |
---|
108 | /** |
---|
109 | * Returns the array of maximum-values for each attribute |
---|
110 | * @return attributeMaxValues |
---|
111 | */ |
---|
112 | double[] getAttributeMaxValues(); |
---|
113 | |
---|
114 | /** |
---|
115 | * Performs an epsilon range query for this dataObject |
---|
116 | * @param epsilon Specifies the range for the query |
---|
117 | * @param queryDataObject The dataObject that is used as query-object for epsilon range query |
---|
118 | * @return List with all the DataObjects that are within the specified range |
---|
119 | */ |
---|
120 | List epsilonRangeQuery(double epsilon, DataObject queryDataObject); |
---|
121 | |
---|
122 | /** |
---|
123 | * Emits the k next-neighbours and performs an epsilon-range-query at the parallel. |
---|
124 | * The returned list contains two elements: |
---|
125 | * At index=0 --> list with all k next-neighbours; |
---|
126 | * At index=1 --> list with all dataObjects within epsilon; |
---|
127 | * @param k number of next neighbours |
---|
128 | * @param epsilon Specifies the range for the query |
---|
129 | * @param dataObject the start object |
---|
130 | * @return list with the k-next neighbours (PriorityQueueElements) and a list |
---|
131 | * with candidates from the epsilon-range-query (EpsilonRange_ListElements) |
---|
132 | */ |
---|
133 | List k_nextNeighbourQuery(int k, double epsilon, DataObject dataObject); |
---|
134 | |
---|
135 | /** |
---|
136 | * Calculates the coreDistance for the specified DataObject. |
---|
137 | * The returned list contains three elements: |
---|
138 | * At index=0 --> list with all k next-neighbours; |
---|
139 | * At index=1 --> list with all dataObjects within epsilon; |
---|
140 | * At index=2 --> coreDistance as Double-value |
---|
141 | * @param minPoints minPoints-many neighbours within epsilon must be found to have a non-undefined coreDistance |
---|
142 | * @param epsilon Specifies the range for the query |
---|
143 | * @param dataObject Calculate coreDistance for this dataObject |
---|
144 | * @return list with the k-next neighbours (PriorityQueueElements) and a list |
---|
145 | * with candidates from the epsilon-range-query (EpsilonRange_ListElements) and |
---|
146 | * the double-value for the calculated coreDistance |
---|
147 | */ |
---|
148 | List coreDistance(int minPoints, double epsilon, DataObject dataObject); |
---|
149 | |
---|
150 | } |
---|