com.starteam.util
Class DotNotation

java.lang.Object
  extended by com.starteam.util.DotNotation
All Implemented Interfaces:
java.io.Serializable

public class DotNotation
extends java.lang.Object
implements java.io.Serializable

Represents a DotNotation (e.g., 1.25.1.0).

See Also:
Serialized Form

Constructor Summary
DotNotation(DotNotation n)
          Constructs a new DotNotation that is a copy of another one.
DotNotation(java.lang.String s)
          Constructs a new DotNotation.
 
Method Summary
static int compare(DotNotation n1, DotNotation n2)
          Compares two DotNotations.
 int compareTo(DotNotation n)
          Compares this DotNotation to another one.
 boolean equals(java.lang.Object object)
          Determines whether or not this DotNotation is equal to another one.
 int getBranchRevision()
          Gets the revision number of this DotNotation within its branch.
 DotNotation getBranchRoot()
          Gets the DotNotation representing the root of this branch.
 DotNotation getCommonAncestor(DotNotation other)
          Determines the common ancestor between this DotNotation and another one.
 int getHistoryLength()
          Determines how many total revision would be in the history of an artifact with this DotNotation.
 DotNotation getNext()
          Gets the next DotNotation in this branch.
 DotNotation getParent()
          Gets the parent branch point of this DotNotation, or null if this DotNotation is not a branched DotNotation.
 DotNotation getPrevious()
          Gets the previous DotNotation in this one's revision history, or null if this is the first revision in the history.
 int hashCode()
          Gets a hash code for this DotNotation.
 boolean isAncestorOf(DotNotation other)
          Determines whether or not this DotNotation is an ancestor of the given one.
 boolean isBranched()
          Determines whether or not this is a branched DotNotation.
 boolean isOnSameBranchAs(DotNotation other)
          Determines whether or not this DotNotation is on the same branch as another one.
 java.lang.String toString()
          Converts this DotNotation to string format.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DotNotation

public DotNotation(java.lang.String s)
Constructs a new DotNotation.

Parameters:
s - A DotNotation in string form (e.g., "1.25.1.0").

DotNotation

public DotNotation(DotNotation n)
Constructs a new DotNotation that is a copy of another one.

Parameters:
n - The DotNotation to be copied.
Method Detail

getBranchRoot

public DotNotation getBranchRoot()
Gets the DotNotation representing the root of this branch. For example, the branch root of "1.25" is "1.0"; the branch root of "1.25.2.75" is "1.25.2.0".

Returns:
The DotNotation representing the root of this branch.

getBranchRevision

public int getBranchRevision()
Gets the revision number of this DotNotation within its branch. For example, the revision number of "1.25" is 25; the revision number of "1.25.2.75" is 75.

Returns:
The revision number of this DotNotation within its branch.

isBranched

public boolean isBranched()
Determines whether or not this is a branched DotNotation. For example, the revision number of "1.25.2.75" is branched, but "1.25" is not.

Returns:
true if this DotNotation has branched; false otherwise.

getParent

public DotNotation getParent()
Gets the parent branch point of this DotNotation, or null if this DotNotation is not a branched DotNotation. For example, the parent branch point of "1.25.2.75" is "1.25"; the parent of "1.25" is null.

Returns:
The patent branch point of this DotNotation, or null if this DotNotation has not branched.
See Also:
DotNotation.isBranched()

getHistoryLength

public int getHistoryLength()
Determines how many total revision would be in the history of an artifact with this DotNotation.

Returns:
The total number of revisions in the history of an artifact with this DotNotation.

getNext

public DotNotation getNext()
Gets the next DotNotation in this branch.

Returns:
The next DotNotation in this branch.

getPrevious

public DotNotation getPrevious()
Gets the previous DotNotation in this one's revision history, or null if this is the first revision in the history.

Returns:
The previous DotNotation in the revision history, or null.

isOnSameBranchAs

public boolean isOnSameBranchAs(DotNotation other)
Determines whether or not this DotNotation is on the same branch as another one.

Parameters:
other - The DotNotation to be compared.
Returns:
True if the two DotNotations are on the same branch; false otherwise.

isAncestorOf

public boolean isAncestorOf(DotNotation other)
Determines whether or not this DotNotation is an ancestor of the given one. Note that a DotNotation is considered an ancestor of itself.

Parameters:
other - The DotNotation to be compared.
Returns:
true if this DotNotation is equal to or is an ancestor of the given one; false otherwise.

getCommonAncestor

public DotNotation getCommonAncestor(DotNotation other)
Determines the common ancestor between this DotNotation and another one.

Parameters:
other - The DotNotation to be compared.
Returns:
The DotNotation that is the common ancestor, or null if the two DotNotations have no common ancestor.

compareTo

public int compareTo(DotNotation n)
Compares this DotNotation to another one.

Parameters:
n - The DotNotation to be compared.
Returns:
-1 if this DotNotation is less than the given one; 0 if this DotNotation and the given one are equal; 1 if this DotNotation is greater than the given one.

compare

public static int compare(DotNotation n1,
                          DotNotation n2)
Compares two DotNotations.

Parameters:
n1 - The first DotNotation to be compared.
n2 - The second DotNotation to be compared.
Returns:
-1 if n1 is less than the given one; 0 if n1 and n2 are equal; 1 if n1 is greater than n2.

toString

public java.lang.String toString()
Converts this DotNotation to string format.

Overrides:
toString in class java.lang.Object
Returns:
The string format of this DotNotation.

equals

public boolean equals(java.lang.Object object)
Determines whether or not this DotNotation is equal to another one.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to be compared.
Returns:
True if the given object is a DotNotation that is equal to this one; false otherwise.

hashCode

public int hashCode()
Gets a hash code for this DotNotation.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this DotNotation.


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.