BrightSide Workbench Full Report + Source Code
FoundList.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.elephant.search;
19 
20 import java.util.TreeSet;
21 
26 public class FoundList extends TreeSet {
27 
28  public class FoundItem implements IFoundItem {
29  private String id, link, image, title, value;
30  private double similarity;
31 
32  public FoundItem(String id, String link, String image,
33  String title, String value, double similarity, String query) {
34  this.id = id;
35  this.link = link;
36  this.image = image;
37  this.title = title;
38  this.value = value;
39  this.similarity = similarity;
40  }
41  @Override
42  public String getId() { return id; }
43  @Override
44  public String getLink() { return link; }
45  @Override
46  public String getImage() { return image; }
47  @Override
48  public String getTitle() { return title; }
49  @Override
50  public String getString() { return value; }
51  @Override
52  public double getSimilarity() { return similarity; }
53  }
54 
56  public FoundList() {
57  super(new FoundComparator());
58  }
59 
60  public void addResults(FoundList newList) {
61  if(newList != null) {
62  addAll(newList);
63  }
64  }
65 
66  public void addItem(String id, String link, String image,
67  String title, String value, double similarity, String query) {
68  add(new FoundItem(id, link, image, title, value, similarity, query));
69  }
70 
71  public int getCount() {
72  return size();
73  }
74 }
FoundItem(String id, String link, String image, String title, String value, double similarity, String query)
Definition: FoundList.java:32
void addItem(String id, String link, String image, String title, String value, double similarity, String query)
Definition: FoundList.java:66
void addResults(FoundList newList)
Definition: FoundList.java:60