Operation.java [src/java/util] Revision: default Date:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package util;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*/
public class Operation {
protected String name;
private String id;
protected int rowDirection;
protected double residueAmount;
protected Map<String,Object> properties;
protected Operation(){
properties = new HashMap<>();
}
public String getID(){
return id;
}
public void setID(String key){
id = key;
}
public String getName(){
return name;
}
public double getResidueAmount() {
return residueAmount;
}
public void setResidueAmount(double residueAmount) {
this.residueAmount = residueAmount;
}
// public void readJSONData(JSONObject joperation) throws JSONException{
// id = joperation.getString(ID);
// name = joperation.getString(NAME);
// //rowDirection = joperation.getInt(ROW_DIRECTION);
// }
public void addProperty(String name, Object value){
properties.put(name, value);
}
@Override
public boolean equals(Object o){
if(o == null) return false;
if(o == this) return true;
if(!(o instanceof Operation)) return false;
Operation op = (Operation) o;
return this.id.equals(op.id);
}
@Override
public int hashCode() {
int hash = 7;
hash = 83 * hash + Objects.hashCode(this.name);
hash = 83 * hash + Objects.hashCode(this.id);
return hash;
}
}