public class Address
extends java.lang.Object
Constructor and Description |
---|
Address(Address address)
Creates an instance of Address by copying the given address
|
Address(java.lang.String address)
Creates an instance of Address using the String given
WARNING: if the adress isn't well formed, it will take the "0" address. |
Modifier and Type | Method and Description |
---|---|
void |
addPrefix(Address prefix)
Changes the start of the address by using the given Address and adding it
to the current one.
|
boolean |
equals(java.lang.Object address) |
java.lang.String |
getAddress()
Returns the address as a string
|
Address |
getChildAddress(int i)
Returns the Address of the Child at the given position
|
Address |
getFatherAddress()
Returns the address of the father if it exists
|
java.lang.Integer |
getPosition()
Returns the local position of the Node at the Address
Ex: 0.5.4 gives 4 |
java.lang.String[] |
getPositions()
Returns a table of String
for each one, it is the local position example: 0.0.1 gives "0", "0", "1" |
int |
hashCode() |
boolean |
isRoot()
Returns true if the Address is the Address of the Root
|
boolean |
isSameLevel(Address a)
Looks if the two address are same level (exemple: 0.0.1 and 0.0.2 but not
0.1.1 and 0.0.1 or 0.1.1.0 and 0.1.1)
|
java.lang.String |
toString() |
public Address(java.lang.String address) throws badAddressException
address
- XML address or position of a nodebadAddressException
- If the String of the address isn't validpublic Address(Address address)
address
- Given Address to copypublic void addPrefix(Address prefix)
prefix
- Address that has to be used as prefixpublic java.lang.String getAddress()
public java.lang.String[] getPositions()
public Address getFatherAddress() throws badAddressException
badAddressException
public Address getChildAddress(int i) throws badAddressException
i
- position of the ChildbadAddressException
public java.lang.Integer getPosition()
public boolean isRoot()
public boolean isSameLevel(Address a)
a
- Address to comparepublic boolean equals(java.lang.Object address)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object