Skip to content

Commit

Permalink
Minor fixes related to the Score interface (#21)
Browse files Browse the repository at this point in the history
* Fixing the changes related to the Score interface.
  • Loading branch information
jreluiz authored and nmsa committed Nov 1, 2019
1 parent 7390596 commit bda1684
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package eubr.atmosphere.tma.entity.qualitymodel;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
Expand Down Expand Up @@ -45,7 +45,7 @@ public class CompositeAttributeView extends MetricAttributeView implements Seria
public CompositeAttributeView() {
}

public MetricData calculate(ConfigurationProfile profile, Timestamp timestamp) throws UndefinedException {
public MetricData calculate(ConfigurationProfile profile, Date timestamp) throws UndefinedException {

if (profile == null || ListUtils.isEmpty(profile.getPreferences())) {
throw new UndefinedMetricException(
Expand Down Expand Up @@ -82,7 +82,7 @@ public MetricData calculate(ConfigurationProfile profile, Timestamp timestamp) t
return metricData;
}

protected double calculateNeutrality(ConfigurationProfile profile, Timestamp timestamp) throws UndefinedException {
protected double calculateNeutrality(ConfigurationProfile profile, Date timestamp) throws UndefinedException {
double score = 0.0;
if (ListUtils.isNotEmpty(children)) {
for (MetricAttributeView child : children) {
Expand All @@ -99,7 +99,7 @@ protected double calculateNeutrality(ConfigurationProfile profile, Timestamp tim
return score;
}

protected double calculateSimultaneity(ConfigurationProfile profile, Timestamp timestamp) throws UndefinedException {
protected double calculateSimultaneity(ConfigurationProfile profile, Date timestamp) throws UndefinedException {
double score = 0.0;
if (ListUtils.isNotEmpty(this.children)) {
for (MetricAttributeView child : children) {
Expand All @@ -121,7 +121,7 @@ protected double calculateSimultaneity(ConfigurationProfile profile, Timestamp t
return score;
}

protected double calculateReplaceability(ConfigurationProfile profile, Timestamp timestamp) throws UndefinedException {
protected double calculateReplaceability(ConfigurationProfile profile, Date timestamp) throws UndefinedException {
double score = 0.0;
if (ListUtils.isNotEmpty(this.children)) {
for (MetricAttributeView child : children) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eubr.atmosphere.tma.entity.qualitymodel;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -56,7 +56,7 @@ public LeafAttribute(double maximumThreshold, MetricAggregationOperator metricAg
this.numSamples = numSamples;
}

public MetricData calculate(ConfigurationProfile profile, Timestamp timestamp)
public MetricData calculate(ConfigurationProfile profile, Date timestamp)
throws UndefinedMetricException {

if (profile == null || ListUtils.isEmpty(profile.getPreferences())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eubr.atmosphere.tma.entity.qualitymodel;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down Expand Up @@ -37,7 +37,7 @@ public abstract class MetricAttributeView implements Serializable {
@JoinColumn(name="compositeattributeId")
private CompositeAttributeView compositeattribute;

public abstract MetricData calculate(ConfigurationProfile user, Timestamp timestamp)
public abstract MetricData calculate(ConfigurationProfile user, Date timestamp)
throws UndefinedException;

public MetricAttributeView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,79 @@
*/
public class PrivacyScore implements Score {

private Double score;
private Integer configurationProfileId;
private Integer attributeId;
private Double threshold;

public PrivacyScore(Integer configurationProfileId, Integer attributeId, Double score, Double threshold) {
super();
this.score = score;
this.configurationProfileId = configurationProfileId;
this.attributeId = attributeId;
this.threshold = threshold;
}

@Override
public Double getScore() {
return this.score;
}

public void setScore(Double score) {
this.score = score;
}

public Integer getConfigurationProfileId() {
return configurationProfileId;
}

public void setConfigurationProfileId(Integer configurationProfileId) {
this.configurationProfileId = configurationProfileId;
}

public Integer getAttributeId() {
return attributeId;
}

public void setAttributeId(Integer attributeId) {
this.attributeId = attributeId;
}

public Double getThreshold() {
return threshold;
}

public void setThreshold(Double threshold) {
this.threshold = threshold;
}

private Double score;
private Integer configurationProfileId;
private Integer attributeId;
private Double threshold;
private int metricId;
private int resourceId;
private long valueTime;

public PrivacyScore(Integer configurationProfileId, Integer attributeId, Double score, Double threshold) {
super();
this.score = score;
this.configurationProfileId = configurationProfileId;
this.attributeId = attributeId;
this.threshold = threshold;
}

@Override
public Double getScore() {
return this.score;
}

public void setScore(Double score) {
this.score = score;
}

public Integer getConfigurationProfileId() {
return configurationProfileId;
}

public void setConfigurationProfileId(Integer configurationProfileId) {
this.configurationProfileId = configurationProfileId;
}

public Integer getAttributeId() {
return attributeId;
}

public void setAttributeId(Integer attributeId) {
this.attributeId = attributeId;
}

public Double getThreshold() {
return threshold;
}

public void setThreshold(Double threshold) {
this.threshold = threshold;
}

@Override
public long getValueTime() {
return this.valueTime;
}

public void setValueTime(long valueTime) {
this.valueTime = valueTime;
}

@Override
public int getResourceId() {
return this.resourceId;
}

public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}

@Override
public int getMetricId() {
return this.metricId;
}

public void setMetricId(int metricId) {
this.metricId = metricId;
}
}

0 comments on commit bda1684

Please sign in to comment.