package com.treelogic.proteus.model;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public abstract class Row {

	protected final int MAGIC_NUMBER = 0x00687691;
	protected int coilId;
	protected int varName;
	protected double value;
	protected byte type;
	protected double x;

	public Row() {
		this.type = this.getClass() == Row2D.class ? (byte) 0x01f : (byte) 0x00f;
	}

	public String toJson() {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.writeValueAsString(this);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
		return null;
	}

	public int getMAGIC_NUMBER() {
		return MAGIC_NUMBER;
	}

	public int getCoilId() {
		return coilId;
	}

	public void setCoilId(int coilId) {
		this.coilId = coilId;
	}

	public int getVarName() {
		return varName;
	}

	public void setVarName(int varName) {
		this.varName = varName;
	}

	public double getValue() {
		return value;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public byte getType() {
		return type;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + MAGIC_NUMBER;
		result = prime * result + coilId;
		result = prime * result + type;
		long temp;
		temp = Double.doubleToLongBits(value);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + varName;
		temp = Double.doubleToLongBits(x);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Row other = (Row) obj;
		if (MAGIC_NUMBER != other.MAGIC_NUMBER)
			return false;
		if (coilId != other.coilId)
			return false;
		if (type != other.type)
			return false;
		if (Double.doubleToLongBits(value) != Double.doubleToLongBits(other.value))
			return false;
		if (varName != other.varName)
			return false;
		if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Row [MAGIC_NUMBER=" + MAGIC_NUMBER + ", coilId=" + coilId + ", varName=" + varName + ", value=" + value
				+ ", type=" + type + ", x=" + x + "]";
	}

}

@@ -176,56 +176,8 @@
  %7B%0A%0A
-%09protected final int MAGIC_NUMBER = 0x00687691;%0A
 %09pro
@@ -195,16 +195,16 @@
 coilId;%0A
+
 %09protect
@@ -596,67 +596,8 @@
 %09%7D%0A%0A
-%09public int getMAGIC_NUMBER() %7B%0A%09%09return MAGIC_NUMBER;%0A%09%7D%0A%0A
 %09pub
@@ -1148,50 +1148,8 @@
  1;%0A
-%09%09result = prime * result + MAGIC_NUMBER;%0A
 %09%09re
@@ -1680,67 +1680,8 @@
 bj;%0A
-%09%09if (MAGIC_NUMBER != other.MAGIC_NUMBER)%0A%09%09%09return false;%0A
 %09%09if
@@ -2074,43 +2074,8 @@
 ow %5B
-MAGIC_NUMBER=%22 + MAGIC_NUMBER + %22, 
 coil
@@ -2137,13 +2137,9 @@
 alue
-%0A%09%09%09%09
+ 
 + %22,
@@ -2165,17 +2165,21 @@
  x=%22 + x
- 
+%0A%09%09%09%09
 + %22%5D%22;%0A%09
@@ -2181,10 +2181,11 @@
 %5D%22;%0A%09%7D%0A%0A
+%0A
 %7D%0A

Remove MAGIC_NUMBER from the POJO class