PenProfile 2.x

com.livescribe.afp
Class PageAddress

java.lang.Object
  extended by com.livescribe.afp.PageAddress

public class PageAddress
extends Object

This class encapsulates the physical address of a page of the Anoto dot space. In human-readable form, this unique address is a segmented number, composed of positive integers that identify the section, segment, shelf, book, and page. Sections contain multiple segments, segments contain multiple shelves, etc.

There is a method, toPageAddress(int, int, int, int), for converting a segmented address (passed as individual integers) to a long value. That value can then be passed to other methods in this class.


Constructor Summary
PageAddress(long pageAddress)
          Constructs a new page address from the given 64-bit value.
 
Method Summary
 PageInstance getPageInstance()
          Gets the PageInstance for this page address.
static PageInstance getPageInstance(long pageAddress)
          Gets the PageInstance for the specified 64-bit page address.
static long toPageAddress(int segment, int shelf, int book, int page)
          Converts a segmented page address into a 64-bit long value.
static long toPageAddress(String value)
          Converts the string representation of a page address into a 64-bit value.
 String toString()
          Returns a formatted string representation of this page address.
static String toString(long pageAddress)
          Gets a formatted string representation of the given 64-bit page address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageAddress

public PageAddress(long pageAddress)
Constructs a new page address from the given 64-bit value.

Parameters:
pageAddress - the 64-bit page address
Method Detail

getPageInstance

public PageInstance getPageInstance()
Gets the PageInstance for this page address. This returns null if there is no paper definition for this page address.

Returns:
the associated PageInstance object, or null if there is no paper definition for this address.
See Also:
getPageInstance(long)

toString

public String toString()
Returns a formatted string representation of this page address.

Overrides:
toString in class Object
Returns:
a formatted string representation of this page address.
See Also:
toString(long)

toString

public static String toString(long pageAddress)
Gets a formatted string representation of the given 64-bit page address. The format is "section.segment.shelf.book.page".

Parameters:
pageAddress - the 64-bit page address
Returns:
the address formatted as a string.

toPageAddress

public static long toPageAddress(int segment,
                                 int shelf,
                                 int book,
                                 int page)
Converts a segmented page address into a 64-bit long value. The value returned by this method can be passed to the PageAddress(long) constructor or to getPageInstance(long).

Note that the section (the top 12 bits) is considered to be zero.

Parameters:
segment - the segment
shelf - the shelf
book - the book
page - the page
Returns:
a 64-bit value representing the requested page address.

getPageInstance

public static PageInstance getPageInstance(long pageAddress)
Gets the PageInstance for the specified 64-bit page address. This returns null if there is no paper definition for the address.

Parameters:
pageAddress - the 64-bit page address
Returns:
the associated PageInstance object, or null if there is no paper definition for this address.

toPageAddress

public static long toPageAddress(String value)
Converts the string representation of a page address into a 64-bit value. The string is expected to be in "section.segment.shelf.book.page" form.

This returns -1 if the value is null or is not formatted correctly.

Parameters:
value - the string-formatted page address
Returns:
the 64-bit value representing the string-formatted address.
See Also:
toString(long)

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.