org.openxri
Class XRISegment

java.lang.Object
  extended by org.openxri.Parsable
      extended by org.openxri.XRISegment
All Implemented Interfaces:
java.lang.Comparable

public class XRISegment
extends Parsable

This class provides a strong typing for a XRI Segment. Any object of this class that appears outside of the package is a valid XRI Segment with at least one subsegment.

Author:
=chetan

Constructor Summary
XRISegment(java.lang.String sVal)
          Constructs XRISegment from String
XRISegment(java.lang.String sVal, boolean bAllowImpliedDelimiter, boolean bAllowColon)
          Constructs XRISegment from String
 
Method Summary
 boolean equals(XRISegment segment)
           
 boolean equalsIgnoreCase(XRISegment segment)
           
 int getNumSubSegments()
          Returns the number of subsegments in the XRI segment
 XRISegment getParent()
          Returns the parent XRISegment for this object.
 XRISegment getRemainder(int nSkip)
          Returns the last part of the XRI segment.
 XRISubSegment getSubSegmentAt(int nIndex)
          Returns the subsegment at the given index
 java.util.Iterator getSubSegmentIterator()
          provides an Iterator for the subsegments
 boolean isPrefixOf(XRISegment segment)
           
 java.lang.String toIRINormalForm()
          Serialzes XRISegment into IRI normal from
 java.lang.String toIRINormalForm(boolean wantOptionalDelim)
          Serialzes XRISegment into IRI normal from
 java.lang.String toString()
          String representation of the object.
 java.lang.String toURINormalForm()
          Serialzes XRISegment into URI normal from
 java.lang.String toURINormalForm(boolean wantOptionalDelim)
          Serialzes XRISegment into URI normal from
 
Methods inherited from class org.openxri.Parsable
compareTo, equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XRISegment

public XRISegment(java.lang.String sVal)
Constructs XRISegment from String


XRISegment

public XRISegment(java.lang.String sVal,
                  boolean bAllowImpliedDelimiter,
                  boolean bAllowColon)
Constructs XRISegment from String

Method Detail

getNumSubSegments

public int getNumSubSegments()
Returns the number of subsegments in the XRI segment

Returns:
int number of subsegments

getSubSegmentIterator

public java.util.Iterator getSubSegmentIterator()
provides an Iterator for the subsegments

Returns:
Iterator provides an Iterator for the subsegments

getSubSegmentAt

public XRISubSegment getSubSegmentAt(int nIndex)
Returns the subsegment at the given index

Parameters:
nIndex - The index of the subsegment to return
Returns:
SubSegment The subsegment at the specified location

getParent

public XRISegment getParent()
Returns the parent XRISegment for this object. Equivalent to all but the last SubSegment.

Returns:
XRISegment The parent XRISegment of this object

getRemainder

public XRISegment getRemainder(int nSkip)
Returns the last part of the XRI segment. Skips over the specified number of subsegments and returns the remainder as a XRISegment. For example: This XRI Segment is "!a!b!c!d" getSegmentRemaider(0) => !a!b!c!d getSegmentRemaider(1) => !b!c!d getSegmentRemaider(2) => !c!d getSegmentRemaider(3) => !d getSegmentRemaider(4) => null

Parameters:
nSkip - The number of subsegments to skip.

toString

public java.lang.String toString()
String representation of the object.

Overrides:
toString in class Parsable
Returns:
String the String form of the XRI with its persistent indicator.

toIRINormalForm

public java.lang.String toIRINormalForm(boolean wantOptionalDelim)
Serialzes XRISegment into IRI normal from

Returns:
The IRI normal form of the XRISegment

toIRINormalForm

public java.lang.String toIRINormalForm()
Serialzes XRISegment into IRI normal from

Returns:
The IRI normal form of the XRISegment

toURINormalForm

public java.lang.String toURINormalForm(boolean wantOptionalDelim)
Serialzes XRISegment into URI normal from

Returns:
The URI normal form of the XRISegment

toURINormalForm

public java.lang.String toURINormalForm()
Serialzes XRISegment into URI normal from

Returns:
The URI normal form of the XRISegment

equals

public boolean equals(XRISegment segment)

equalsIgnoreCase

public boolean equalsIgnoreCase(XRISegment segment)

isPrefixOf

public boolean isPrefixOf(XRISegment segment)


Copyright © 2005-2012. All Rights Reserved.