Package ch.rabanti.picoxlsx4j
Class Address
- java.lang.Object
-
- ch.rabanti.picoxlsx4j.Address
-
- All Implemented Interfaces:
Comparable<Address>
public class Address extends Object implements Comparable<Address>
C class representing a cell address (no getters and setters to simplify handling)- Author:
- Raphael Stoeckli
-
-
Field Summary
Fields Modifier and Type Field Description int
Column
Column of the address (zero-based)int
Row
Row of the address (zero-based)Cell.AddressType
Type
-
Constructor Summary
Constructors Constructor Description Address(int column, int row)
Constructor with with row and column as argumentsAddress(int column, int row, Cell.AddressType type)
Constructor with with row, column and address type as argumentsAddress(String address)
Constructor with address as stringAddress(String address, Cell.AddressType type)
Constructor with address as string and address type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Address other)
Compares two addresses and returns whether the passed one is bigger or not.boolean
equals(Object o)
Compares two addresses whether they are equal.String
getAddress()
Gets the address as stringString
getColumn()
Gets the column address (A - XFD)String
toString()
Returns the address as string or "Illegal Address" in case of an exception
-
-
-
Field Detail
-
Column
public final int Column
Column of the address (zero-based)
-
Row
public final int Row
Row of the address (zero-based)
-
Type
public final Cell.AddressType Type
-
-
Constructor Detail
-
Address
public Address(int column, int row)
Constructor with with row and column as arguments- Parameters:
column
- Column of the address (zero-based)row
- Row of the address (zero-based)- Throws:
RangeException
- Thrown if the resolved address is out of range
-
Address
public Address(String address)
Constructor with address as string- Parameters:
address
- Address string (e.g. 'A1:B12')- Throws:
RangeException
- Thrown if the resolved address is out of range
-
Address
public Address(int column, int row, Cell.AddressType type)
Constructor with with row, column and address type as arguments- Parameters:
column
- Column of the address (zero-based)row
- Row of the address (zero-based)type
- Referencing type of the address- Throws:
RangeException
- Thrown if the resolved address is out of range
-
Address
public Address(String address, Cell.AddressType type)
Constructor with address as string and address type. The address type overrides possible address variations in the string- Parameters:
address
- Address string (e.g. 'A1:B12')type
- Optional referencing type of the address- Throws:
RangeException
- Thrown if the resolved address is out of range
-
-
Method Detail
-
equals
public boolean equals(Object o)
Compares two addresses whether they are equal. The address type id neglected, only the row and column is considered
-
compareTo
public int compareTo(Address other)
Compares two addresses and returns whether the passed one is bigger or not. Bigger means: Higher column number and / or higher row number- Specified by:
compareTo
in interfaceComparable<Address>
- Parameters:
other
- Other address to compare- Returns:
- 1 If the other address is bigger, -1 if it is smaller and 0 ist it is equal
-
getAddress
public String getAddress()
Gets the address as string- Returns:
- Address as string
- Throws:
RangeException
- Thrown if the column or row is out of range
-
getColumn
public String getColumn()
Gets the column address (A - XFD)- Returns:
- Column address as letter(s)
-
-