wt.util.version
Class ReleaseIdSet

java.lang.Object
  extended bywt.util.version.ReleaseIdSet

public class ReleaseIdSet
extends Object

A ReleaseIdSet is a collection of included ReleaseIds and ReleaseIdRanges and excluded ReleaseIds and ReleaseIdRanges.


Nested Class Summary
private static interface ReleaseIdSet.ForEachReleaseIdAndRangeCallback
          Works in conjunction with the algorithm forEachReleaseIdAndReleaseIdRangeIn as a callback for generic behavior on each matched version or range.
 
Field Summary
private  Integer cachedHashCode
           
private  Set distinctAssemblyIds
           
private  ArrayList excludedReleaseIdRanges
           
private  ArrayList excludedReleaseIds
           
private  ArrayList includedReleaseIdRanges
           
private  ArrayList includedReleaseIds
           
private  HashMap minimumIncludedReleaseIds
           
static String VERSION_ELEMENT_NAME
           
static String VERSION_NUMBER_ATTRIBUTE_NAME
           
static String VERSION_SET_ELEMENT_NAME
           
static String VERSIONS_EXCLUDED_ELEMENT_NAME
           
static String VERSIONS_INCLUDED_ELEMENT_NAME
           
 
Constructor Summary
ReleaseIdSet()
          Constructs an empty ReleaseIdSet
 
Method Summary
 Element asDom(Document dom_factory)
          Create a standard document fragment using the default element name of ReleaseIdSet.
 Element asDom(Document dom_factory, String element_name)
          Create a standard document fragment using the provided element name instead of the default element name.
private  void clearCachedValues()
           
 boolean contains(ReleaseId version)
          Checks that the version is included and not excluded.
static ReleaseIdSet createFrom(Element element)
          Create an instance that is encoded in a DOM subtree in standard form.
 boolean equals(Object other)
          Equality is reference-equality only.
 void exclude(ReleaseId version)
           
 void exclude(ReleaseIdRange version_range)
          Adds a version to the exclude list.
private static void forEachReleaseIdAndReleaseIdRangeIn(Element element, ReleaseIdSet.ForEachReleaseIdAndRangeCallback callback)
          Algorithm for finding all versions and ranges under a provided element.
 Set getDistinctIncludedAssemblyIds()
           
 ReleaseId getMinimumIncludedReleaseId(String assembly_id)
          The lowest version that the set includes for a particular assembly id.
 int hashCode()
           
 boolean hasLowerBounding()
           
 boolean hasUpperBounding()
           
 void include(ReleaseId version)
          Adds a version to the include list.
 void include(ReleaseIdRange version_range)
          Adds a version range to the include list.
private  boolean isExcluded(ReleaseId version)
           
private  boolean isIncluded(ReleaseId version)
           
private static void loadExcludedReleaseIds(Element element, ReleaseIdSet set)
           
private static void loadIncludedReleaseIds(Element element, ReleaseIdSet set)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_SET_ELEMENT_NAME

public static final String VERSION_SET_ELEMENT_NAME
See Also:
Constant Field Values

VERSIONS_INCLUDED_ELEMENT_NAME

public static final String VERSIONS_INCLUDED_ELEMENT_NAME
See Also:
Constant Field Values

VERSIONS_EXCLUDED_ELEMENT_NAME

public static final String VERSIONS_EXCLUDED_ELEMENT_NAME
See Also:
Constant Field Values

VERSION_ELEMENT_NAME

public static final String VERSION_ELEMENT_NAME
See Also:
Constant Field Values

VERSION_NUMBER_ATTRIBUTE_NAME

public static final String VERSION_NUMBER_ATTRIBUTE_NAME
See Also:
Constant Field Values

includedReleaseIds

private ArrayList includedReleaseIds

includedReleaseIdRanges

private ArrayList includedReleaseIdRanges

excludedReleaseIds

private ArrayList excludedReleaseIds

excludedReleaseIdRanges

private ArrayList excludedReleaseIdRanges

minimumIncludedReleaseIds

private HashMap minimumIncludedReleaseIds

cachedHashCode

private Integer cachedHashCode

distinctAssemblyIds

private Set distinctAssemblyIds
Constructor Detail

ReleaseIdSet

public ReleaseIdSet()
Constructs an empty ReleaseIdSet

Method Detail

createFrom

public static ReleaseIdSet createFrom(Element element)
                               throws RangeException,
                                      ReleaseIdException
Create an instance that is encoded in a DOM subtree in standard form.
 <ReleaseIdSet>
    <ReleaseIdsIncluded>
       <ReleaseId number="a.b"/>
       <ReleaseIdRange from="c.d.e" exTo="f.g"/>
    </ReleaseIdsIncluded>
    <ReleaseIdsExcluded>
       <ReleaseId number="a.b.h"/>
    </ReleaseIdsExcluded>
 </ReleaseIdSet>
 

Throws:
RangeException
ReleaseIdException

loadIncludedReleaseIds

private static void loadIncludedReleaseIds(Element element,
                                           ReleaseIdSet set)
                                    throws RangeException,
                                           ReleaseIdException
Throws:
RangeException
ReleaseIdException

loadExcludedReleaseIds

private static void loadExcludedReleaseIds(Element element,
                                           ReleaseIdSet set)
                                    throws RangeException,
                                           ReleaseIdException
Throws:
RangeException
ReleaseIdException

forEachReleaseIdAndReleaseIdRangeIn

private static void forEachReleaseIdAndReleaseIdRangeIn(Element element,
                                                        ReleaseIdSet.ForEachReleaseIdAndRangeCallback callback)
                                                 throws RangeException,
                                                        ReleaseIdException
Algorithm for finding all versions and ranges under a provided element. Invokes the appropriate version or range callback on the provided callback interface

Throws:
RangeException
ReleaseIdException

asDom

public Element asDom(Document dom_factory)
Create a standard document fragment using the default element name of ReleaseIdSet.


asDom

public Element asDom(Document dom_factory,
                     String element_name)
Create a standard document fragment using the provided element name instead of the default element name.


include

public void include(ReleaseId version)
Adds a version to the include list.

Parameters:
version - ReleaseId to include

include

public void include(ReleaseIdRange version_range)
Adds a version range to the include list.

Parameters:
version_range - ReleaseId range to include

exclude

public void exclude(ReleaseId version)

exclude

public void exclude(ReleaseIdRange version_range)
Adds a version to the exclude list.

Parameters:
version_range - ReleaseId range to exclude

contains

public boolean contains(ReleaseId version)
Checks that the version is included and not excluded.

Parameters:
version - ReleaseId to check
Returns:
false if the version is not included or if it is excluded

isIncluded

private boolean isIncluded(ReleaseId version)

isExcluded

private boolean isExcluded(ReleaseId version)

getDistinctIncludedAssemblyIds

public Set getDistinctIncludedAssemblyIds()

getMinimumIncludedReleaseId

public ReleaseId getMinimumIncludedReleaseId(String assembly_id)
The lowest version that the set includes for a particular assembly id.

Returns:
null if the set includes no versions for the given assembly id or all the ranges, if any, have no lower bounds

toString

public String toString()

hashCode

public int hashCode()

equals

public boolean equals(Object other)
Equality is reference-equality only. There is no value-wise equality support for ReleaseIdSets.


clearCachedValues

private void clearCachedValues()

hasLowerBounding

public boolean hasLowerBounding()

hasUpperBounding

public boolean hasUpperBounding()