com.soulgalore.velocity.NamedDescriptiveStatistics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xml-velocity Show documentation
Show all versions of xml-velocity Show documentation
Merge a XML file with a Velocity template
The newest version!
package com.soulgalore.velocity;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
public class NamedDescriptiveStatistics extends DescriptiveStatistics {
/**
*
*/
private static final long serialVersionUID = -3418862026187773755L;
private final String name;
private final String friendlyName;
private final String description;
private final String type;
private final String unit;
private final int decimals;
NamedDescriptiveStatistics() {
name = "";
friendlyName = "";
type = "";
unit = "";
decimals = 0;
description = "";
}
public NamedDescriptiveStatistics(String name, String friendlyName, String description,
String type, String unit, int decimals) {
this.name = name;
this.friendlyName = friendlyName;
this.type = type;
this.unit = unit;
this.decimals = decimals;
this.description = description;
}
public String getName() {
return name;
}
public String getFriendlyName() {
return friendlyName;
}
public String getType() {
return type;
}
public String getUnit() {
return unit;
}
public int getDecimals() {
return decimals;
}
public String getDescription() {
return description;
}
public NamedDescriptiveStatistics newInstance(String name, String friendlyName,
String description, String type, String unit, int decimals) {
return new NamedDescriptiveStatistics(name, friendlyName, description, type, unit, decimals);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + decimals;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
NamedDescriptiveStatistics other = (NamedDescriptiveStatistics) obj;
if (decimals != other.decimals) return false;
if (name == null) {
if (other.name != null) return false;
} else if (!name.equals(other.name)) return false;
if (type == null) {
if (other.type != null) return false;
} else if (!type.equals(other.type)) return false;
if (unit == null) {
if (other.unit != null) return false;
} else if (!unit.equals(other.unit)) return false;
return true;
}
}