BrightSide Workbench Full Report + Source Code
GenericRanking.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2020 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 
19 package org.turro.ranking;
20 
21 import org.turro.path.Path;
22 
27 public class GenericRanking implements IRanking {
28 
29  private String entityPath;
30  private String concept;
31  private double ranking;
32 
33  public GenericRanking(String entityPath, String concept, double ranking) {
34  this.entityPath = entityPath;
35  this.concept = concept;
36  this.ranking = ranking;
37  }
38 
39  public GenericRanking(String entityPath, String concept, long ranking) {
40  this.entityPath = entityPath;
41  this.concept = concept;
42  this.ranking = ranking;
43  }
44 
45  @Override
46  public String getEntityPath() {
47  return entityPath;
48  }
49 
50  @Override
51  public String getConcept() {
52  return concept;
53  }
54 
55  @Override
56  public double getRanking() {
57  return ranking;
58  }
59 
60  @Override
61  public void setEntityPath(String entityPath) {
62  this.entityPath = entityPath;
63  }
64 
65  @Override
66  public void setConcept(String concept) {
67  this.concept = concept;
68  }
69 
70  @Override
71  public void setRanking(double value) {
72  this.ranking = value;
73  }
74 
75 
76  public IRanking copyTo(IRanking rankingEntity) {
77  Path path = new Path(entityPath);
78  rankingEntity.setEntityPath(path.getTill(2));
79  rankingEntity.setConcept(concept);
80  rankingEntity.setRanking(ranking);
81  return rankingEntity;
82  }
83 
84 }
GenericRanking(String entityPath, String concept, long ranking)
GenericRanking(String entityPath, String concept, double ranking)
IRanking copyTo(IRanking rankingEntity)
void setEntityPath(String entityPath)
void setConcept(String concept)
void setEntityPath(String entityPath)
void setRanking(double value)