/*
* Copyright (c) 2012 Diamond Light Source Ltd.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.dawnsci.analysis.dataset.roi.json;
import java.util.Arrays;
public class CircularROIBean extends ROIBean {
public static final String TYPE = "CircularROI";
private double radius;
public CircularROIBean() {
this.type = TYPE;
}
public CircularROIBean(String name) {
this.type = name;
}
/**
* Returns the radius
* @return radius
*/
public double getRadius() {
return radius;
}
/**
* Set radius
* @param radius
*/
public void setRadius(double radius) {
this.radius = radius;
}
@Override
public String toString(){
return String.format("{\"type\": \"%s\", \"name\": \"%s\", \"startPoint\": \"%s\", \"radius\": \"%s\"}",
type, name, Arrays.toString(startPoint), radius);
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
long temp;
temp = Double.doubleToLongBits(radius);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
CircularROIBean other = (CircularROIBean) obj;
if (Double.doubleToLongBits(radius) != Double.doubleToLongBits(other.radius))
return false;
return true;
}
}