org.ccnx.ccn.profiles.versioning.VersionNumber Class Reference
Represent the version used in a CCNx name.
More...
List of all members.
Public Member Functions |
| VersionNumber () |
| Create a VersionNUmber with the current timestamp from the system clock.
|
| VersionNumber (CCNTime version) |
| Create a VersionNumber based on the binaryTime of version.
|
| VersionNumber (long msecSinceEpoch) |
| Create a version number from the milliseconds since epoch (as per System.currentTimeMillis or CCNTime.getTime).
|
| VersionNumber (ContentName versionedNamed) throws VersionMissingException |
| Given a versioned ContentName, extract the version number from the end.
|
| VersionNumber (byte[] versionComponent) |
| Create a VersionNumber from a byte array, such as from a ContentName component.
|
| VersionNumber (VersionNumber version1a) |
byte[] | getVersionBytes () |
| Return the byte array corresponding to this version, to be used in the construction of a ContentName.
|
CCNTime | getAsTime () |
| Returns a new CCNTime object representing the version.
|
long | getAsMillis () |
| A representation of the version as milli-seconds since the epoch (as per System.currentTimeMillis).
|
VersionNumber | addAndReturn (long count) |
| Internal binary representation.
|
VersionNumber | addMillisecondsAndreturn (long msec) |
| Add (or subtract) the given number of milliseconds from the version and return a new object.
|
int | compareTo (VersionNumber other) throws ClassCastException |
boolean | equals (Object obj) throws ClassCastException |
int | hashCode () |
String | toString () |
| return the URI-encoded representation and the msec representation as: "%s (%d)"
|
String | printAsVersionComponent () |
| Print the URI-encoded representation.
|
boolean | before (VersionNumber time) |
boolean | after (VersionNumber time) |
boolean | before (CCNTime time) |
boolean | after (CCNTime time) |
Static Public Member Functions |
static VersionNumber | now () |
static VersionNumber | getMaximumVersion () |
static VersionNumber | getMinimumVersion () |
Static Protected Member Functions |
static boolean | isLessThanUnsigned (long n1, long n2) |
| To compare versions, we need unsigned math.
|
static byte[] | copyOf (byte[] input, int length) |
| Copy input to a new array of length, padding with 0's as necessary.
|
Protected Attributes |
final CCNTime | _version |
final byte[] | _versionComponent |
final long | _binaryTime |
String | _asString = null |
Static Protected Attributes |
static final VersionNumber | minVersionNumber = new VersionNumber(VersioningProfile.MIN_VERSION_MARKER) |
static final VersionNumber | maxVersionNumber = new VersionNumber(VersioningProfile.MAX_VERSION_MARKER) |
Detailed Description
Represent the version used in a CCNx name.
The core of this is based on a CCNTime, but CCNTime has two different uses (getTime as long since epoch and binaryTime), which ends up being confusing. This class should eventually be updated to just operate on the raw byte array.
A version number is an immutable object.
This class is currently only used in the versioning package, not in the VersioningProfile or elsewhere in the code.
Constructor & Destructor Documentation
org.ccnx.ccn.profiles.versioning.VersionNumber.VersionNumber |
( |
CCNTime |
version |
) |
|
Create a VersionNumber based on the binaryTime of version.
- Parameters:
-
org.ccnx.ccn.profiles.versioning.VersionNumber.VersionNumber |
( |
long |
msecSinceEpoch |
) |
|
Create a version number from the milliseconds since epoch (as per System.currentTimeMillis or CCNTime.getTime).
- Parameters:
-
Given a versioned ContentName, extract the version number from the end.
- Parameters:
-
- Exceptions:
-
org.ccnx.ccn.profiles.versioning.VersionNumber.VersionNumber |
( |
byte[] |
versionComponent |
) |
|
Create a VersionNumber from a byte array, such as from a ContentName component.
- Parameters:
-
Member Function Documentation
VersionNumber org.ccnx.ccn.profiles.versioning.VersionNumber.addAndReturn |
( |
long |
count |
) |
|
Internal binary representation.
Try not to use.
- Returns:
- Add (or subtract if negative) arg from the current version and return a new object. The caller should understand that the value is used as an unsigned long.
-
VersionNumber org.ccnx.ccn.profiles.versioning.VersionNumber.addMillisecondsAndreturn |
( |
long |
msec |
) |
|
Add (or subtract) the given number of milliseconds from the version and return a new object.
- Parameters:
-
- Returns:
boolean org.ccnx.ccn.profiles.versioning.VersionNumber.after |
( |
CCNTime |
time |
) |
|
- Parameters:
-
- Returns:
- true if this version is strictly greater than time
boolean org.ccnx.ccn.profiles.versioning.VersionNumber.after |
( |
VersionNumber |
time |
) |
|
- Parameters:
-
- Returns:
- true if this version is strictly greater than time
boolean org.ccnx.ccn.profiles.versioning.VersionNumber.before |
( |
CCNTime |
time |
) |
|
- Parameters:
-
- Returns:
- true if this version is strictly less than time
boolean org.ccnx.ccn.profiles.versioning.VersionNumber.before |
( |
VersionNumber |
time |
) |
|
- Parameters:
-
- Returns:
- true if this version is strictly less than time
static byte [] org.ccnx.ccn.profiles.versioning.VersionNumber.copyOf |
( |
byte[] |
input, |
|
|
int |
length | |
|
) |
| | [static, protected] |
Copy input to a new array of length, padding with 0's as necessary.
This is necesary because Java 1.5 does not support Arrays.copyof()
- Parameters:
-
- Returns:
long org.ccnx.ccn.profiles.versioning.VersionNumber.getAsMillis |
( |
|
) |
|
A representation of the version as milli-seconds since the epoch (as per System.currentTimeMillis).
- Returns:
byte [] org.ccnx.ccn.profiles.versioning.VersionNumber.getVersionBytes |
( |
|
) |
|
Return the byte array corresponding to this version, to be used in the construction of a ContentName.
Includes the version marker FD.
- Returns:
- A copy of the internal byte array.
static boolean org.ccnx.ccn.profiles.versioning.VersionNumber.isLessThanUnsigned |
( |
long |
n1, |
|
|
long |
n2 | |
|
) |
| | [static, protected] |
To compare versions, we need unsigned math.
- Parameters:
-
- Returns:
- true if n1 < n2 unsigned
String org.ccnx.ccn.profiles.versioning.VersionNumber.printAsVersionComponent |
( |
|
) |
|
Print the URI-encoded representation.
- Returns:
The documentation for this class was generated from the following file:
- src/org/ccnx/ccn/profiles/versioning/VersionNumber.java