1 /*
2  * This file is part of ELKI:
3  * Environment for Developing KDD-Applications Supported by Index-Structures
4  *
5  * Copyright (C) 2018
6  * ELKI Development Team
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 package de.lmu.ifi.dbs.elki.algorithm.timeseries;
22 
23 import de.lmu.ifi.dbs.elki.database.ids.DBID;
24 import de.lmu.ifi.dbs.elki.database.ids.DBIDRef;
25 import de.lmu.ifi.dbs.elki.database.ids.DBIDUtil;
26 
27 /**
28  * Single Change Point
29  *
30  * @author Sebastian Rühl
31  * @author Erich Schubert
32  */
33 public class ChangePoint {
34   /**
35    * Data set reference.
36    */
37   DBID id;
38 
39   /**
40    * Column id.
41    */
42   int column;
43 
44   /**
45    * Score
46    */
47   double score;
48 
49   /**
50    * Constructor.
51    *
52    * @param iter Data set reference
53    * @param column Column
54    * @param score Score
55    */
ChangePoint(DBIDRef iter, int column, double score)56   public ChangePoint(DBIDRef iter, int column, double score) {
57     this.id = DBIDUtil.deref(iter);
58     this.column = column;
59     this.score = score;
60   }
61 
62   /**
63    * Append to a text buffer.
64    *
65    * @param buf Text buffer
66    * @return Text buffer
67    */
appendTo(StringBuilder buf)68   public StringBuilder appendTo(StringBuilder buf) {
69     return buf.append(DBIDUtil.toString((DBIDRef) id)).append(" ").append(column).append(" ").append(score);
70   }
71 }
72