-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#339 Refactoring of BasicStatisticValue: Having an abstract class wit…
…h subclasses for the individual types now.
- Loading branch information
Showing
23 changed files
with
614 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 0 additions & 109 deletions
109
...egration/src/main/java/de/metanome/algorithm_integration/results/BasicStatisticValue.java
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
...de/metanome/algorithm_integration/results/basic_statistic_values/BasicStatisticValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2016 by the Metanome project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package de.metanome.algorithm_integration.results.basic_statistic_values; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
||
/** | ||
* Represents the abstract value of a basic statistic result. | ||
* @param <T> The type of the value. | ||
*/ | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "type") | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = BasicStatisticValueDouble.class, name = "BasicStatisticValueDouble"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueFloat.class, name = "BasicStatisticValueFloat"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueInteger.class, name = "BasicStatisticValueInteger"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueString.class, name = "BasicStatisticValueString"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueLong.class, name = "BasicStatisticValueLong"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueStringList.class, name = "BasicStatisticValueStringList"), | ||
@JsonSubTypes.Type(value = BasicStatisticValueIntegerList.class, name = "BasicStatisticValueIntegerList"), | ||
}) | ||
public abstract class BasicStatisticValue<T> implements Comparable { | ||
|
||
protected T value; | ||
|
||
// Exists for serialization | ||
public BasicStatisticValue() {} | ||
|
||
public BasicStatisticValue(T value) { | ||
this.value = value; | ||
} | ||
|
||
public T getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(T value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public abstract String toString(); | ||
|
||
@Override | ||
public abstract int hashCode(); | ||
|
||
@Override | ||
public abstract boolean equals(Object obj); | ||
|
||
@Override | ||
public abstract int compareTo(Object o); | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
...anome/algorithm_integration/results/basic_statistic_values/BasicStatisticValueDouble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2016 by the Metanome project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package de.metanome.algorithm_integration.results.basic_statistic_values; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
|
||
/** | ||
* Represents a double value for a basic statistic. | ||
*/ | ||
@JsonTypeName("BasicStatisticValueDouble") | ||
public class BasicStatisticValueDouble extends BasicStatisticValue<Double> implements Comparable { | ||
|
||
public BasicStatisticValueDouble() { | ||
super(); | ||
} | ||
|
||
public BasicStatisticValueDouble(Double value) { | ||
super(value); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value.toString(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return this.value.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof BasicStatisticValueDouble && this.value.equals(((BasicStatisticValueDouble) obj).getValue()); | ||
} | ||
|
||
@Override | ||
public int compareTo(Object o) { | ||
if (o instanceof BasicStatisticValueDouble) { | ||
BasicStatisticValueDouble other = (BasicStatisticValueDouble) o; | ||
return (other.getValue()).compareTo(this.value); | ||
} | ||
return -1; | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
...tanome/algorithm_integration/results/basic_statistic_values/BasicStatisticValueFloat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2016 by the Metanome project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package de.metanome.algorithm_integration.results.basic_statistic_values; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
|
||
/** | ||
* Represents a float value for a basic statistic. | ||
*/ | ||
@JsonTypeName("BasicStatisticValueFloat") | ||
public class BasicStatisticValueFloat extends BasicStatisticValue<Float> implements Comparable { | ||
|
||
public BasicStatisticValueFloat() { | ||
super(); | ||
} | ||
|
||
public BasicStatisticValueFloat(Float value) { | ||
super(value); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value.toString(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return this.value.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof BasicStatisticValueFloat && this.value.equals(((BasicStatisticValueFloat) obj).getValue()); | ||
} | ||
|
||
@Override | ||
public int compareTo(Object o) { | ||
if (o instanceof BasicStatisticValueFloat) { | ||
BasicStatisticValueFloat other = (BasicStatisticValueFloat) o; | ||
return (other.getValue()).compareTo(this.value); | ||
} | ||
return -1; | ||
} | ||
|
||
} |
Oops, something went wrong.