/*
 * Copyright 2011 JBoss Inc
 *
 * 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 org.drools.guvnor.client.decisiontable.widget;

/**
 * A coordinate
 * 
 * @author manstis
 * 
 */
public class Coordinate {
	private int row;
	private int col;
	private String displayString;

	Coordinate(Coordinate c) {
		this.row = c.row;
		this.col = c.col;
		this.displayString = "(R" + c.row + ",C" + c.col + ")";
	}

	Coordinate(int row, int col) {
		this.row = row;
		this.col = col;
		this.displayString = "(R" + row + ",C" + col + ")";
	}

	@Override
	public boolean equals(Object o) {
		if (o == null) {
			return false;
		}
		Coordinate c = (Coordinate) o;
		return c.col == col && c.row == row;
	}

	public int getCol() {
		return this.col;
	}

	public int getRow() {
		return this.row;
	}

	@Override
	public int hashCode() {
		int hash = row;
		hash = 31 * hash + col;
		return hash;
	}

	@Override
	public String toString() {
		return displayString;
	}

}
@@ -1041,24 +1041,116 @@
  + %22)%22;%0A%09%7D%0A%0A
+%09public int getCol() %7B%0A%09%09return this.col;%0A%09%7D%0A%0A%09public int getRow() %7B%0A%09%09return this.row;%0A%09%7D%0A%0A
 %09@Override%0A%09
@@ -1140,32 +1140,32 @@
 %0A%09%7D%0A%0A%09@Override%0A
-
 %09public boolean 
@@ -1303,100 +1303,8 @@
 %09%7D%0A%0A
-%09public int getCol() %7B%0A%09%09return this.col;%0A%09%7D%0A%0A%09public int getRow() %7B%0A%09%09return this.row;%0A%09%7D%0A%0A
 %09@Ov
@@ -1465,9 +1465,10 @@
 ng;%0A%09%7D%0A%0A
-
 %7D
+%0A

move method: equals() next to hashCode()