aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss/util/CellReference.java
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2009-12-25 15:15:55 +0000
committerYegor Kozlov <yegor@apache.org>2009-12-25 15:15:55 +0000
commit821b4291b232894017da3b34d36d57036d44ed8a (patch)
tree3d4d0d16a179f18757f9b4078aa12576b5ee860f /src/java/org/apache/poi/ss/util/CellReference.java
parentf5e2cb8046c19e342901e7ba90163f2d1de04788 (diff)
downloadpoi-821b4291b232894017da3b34d36d57036d44ed8a.tar.gz
poi-821b4291b232894017da3b34d36d57036d44ed8a.zip
added HSSF usermodel tests for array formulas, added support for array formulas in ss interfaces
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@893870 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ss/util/CellReference.java')
-rw-r--r--src/java/org/apache/poi/ss/util/CellReference.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/ss/util/CellReference.java b/src/java/org/apache/poi/ss/util/CellReference.java
index d01cca3540..e542962cba 100644
--- a/src/java/org/apache/poi/ss/util/CellReference.java
+++ b/src/java/org/apache/poi/ss/util/CellReference.java
@@ -22,6 +22,7 @@ import java.util.regex.Pattern;
import org.apache.poi.hssf.record.formula.SheetNameFormatter;
import org.apache.poi.ss.SpreadsheetVersion;
+import org.apache.poi.ss.usermodel.Cell;
/**
*
@@ -113,6 +114,10 @@ public class CellReference {
public CellReference(int pRow, short pCol) {
this(pRow, pCol & 0xFFFF, false, false);
}
+
+ public CellReference(Cell cell) {
+ this(cell.getRowIndex(), cell.getColumnIndex(), false, false);
+ }
public CellReference(int pRow, int pCol, boolean pAbsRow, boolean pAbsCol) {
this(null, pRow, pCol, pAbsRow, pAbsCol);
@@ -483,4 +488,22 @@ public class CellReference {
}
sb.append(_rowIndex+1);
}
+
+ /**
+ * Checks whether this cell reference is equal to another object.
+ * <p>
+ * Two cells references are assumed to be equal if their string representations
+ * ({@link #formatAsString()} are equal.
+ * </p>
+ */
+ @Override
+ public boolean equals(Object o){
+ if(o == null || !(o instanceof CellReference)) {
+ return false;
+ }
+
+ String me = formatAsString();
+ String anotherRef = ((CellReference)o).formatAsString();
+ return me.equals(anotherRef);
+ }
}