IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.patterns.framework
Class PatternMultiplicity

java.lang.Object
  extended bycom.ibm.xtools.patterns.framework.PatternMultiplicity
All Implemented Interfaces:
IMultiplicity

public class PatternMultiplicity
extends Object
implements IMultiplicity

Pattern multiplicity is used when indicating multiplicity. This is the framework implementation of the multiplicity class that specializes the pattern service version.


Nested Class Summary
static class PatternMultiplicity.BoundQualifier
          A type-safe enumeration to be used by the outer class' methods.
 
Field Summary
static PatternMultiplicity MANY
           
static PatternMultiplicity ONE
           
static PatternMultiplicity ONE_TO_MANY
           
static PatternMultiplicity ZERO_TO_MANY
           
static PatternMultiplicity ZERO_TO_ONE
           
 
Constructor Summary
PatternMultiplicity(int upperBound)
          Constructs a new pattern multiplicity element given only an upper bound, the lower bound is assumed to be one if unspecified.
PatternMultiplicity(int lowerBound, int upperBound)
          Constructs a new pattern multiplicity element given a lower and upper bound.
PatternMultiplicity(String identifier)
          Constructs a new pattern multiplicity element given a string that will be parsed to set the pattern multiplicity's internal state.
 
Method Summary
 boolean equals(Object object)
           
 int getLowerBound()
          Returns the lower bound specified by this multiplicity object.
 int getUpperBound()
          Returns the upper bound specified by this multiplicity object.
 int hashCode()
           
 boolean isOptional()
          Indicates whether this multiplicity allows optionality, in other words, if the lower bound is zero or not.
 boolean isSatisfied(int valueCount)
          Determines if the multiplicity is satisfied with the input number of values that are associated with this multiplicity.
 boolean isSatisfied(int valueCount, PatternMultiplicity.BoundQualifier qualifier)
          Determines if the multiplicity is satisfied with the input number of values that are associated with this multiplicity.
 boolean isUnlimited()
          Indicates whether this multiplicity is unlimited, meaning the upper bound is unbounded or internally set to -1 (the same as many).
 String toString()
          Returns a String image of this multiplicity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MANY

public static final PatternMultiplicity MANY

ONE

public static final PatternMultiplicity ONE

ONE_TO_MANY

public static final PatternMultiplicity ONE_TO_MANY

ZERO_TO_MANY

public static final PatternMultiplicity ZERO_TO_MANY

ZERO_TO_ONE

public static final PatternMultiplicity ZERO_TO_ONE
Constructor Detail

PatternMultiplicity

public PatternMultiplicity(int upperBound)
Constructs a new pattern multiplicity element given only an upper bound, the lower bound is assumed to be one if unspecified. For example: -1 indicates one to many instances allowed, same as "1..*"

Parameters:
upperBound -

PatternMultiplicity

public PatternMultiplicity(int lowerBound,
                           int upperBound)
Constructs a new pattern multiplicity element given a lower and upper bound. For example: 0, -1 indicates zero to many instances allowed, same as "0..*"

Parameters:
lowerBound - lower bound on the multiplicity
upperBound - upper bound on the multiplicity

PatternMultiplicity

public PatternMultiplicity(String identifier)
Constructs a new pattern multiplicity element given a string that will be parsed to set the pattern multiplicity's internal state. Here are some examples of properly formatted multiplicity identifiers: "1" indicates only one instance allowed "0..*" indicates zero to many instances allowed, also indicating optionality "1..6" indicates one to six instances allowed "*" indicates many instances allowed

Parameters:
identifier - textual representation of the multiplicity
Method Detail

equals

public boolean equals(Object object)

hashCode

public int hashCode()

getLowerBound

public int getLowerBound()
Returns the lower bound specified by this multiplicity object.

Specified by:
getLowerBound in interface IMultiplicity
Returns:
lower bound of the multiplicity

getUpperBound

public int getUpperBound()
Returns the upper bound specified by this multiplicity object.

Specified by:
getUpperBound in interface IMultiplicity
Returns:
upper bound of the multiplicity

isOptional

public boolean isOptional()
Indicates whether this multiplicity allows optionality, in other words, if the lower bound is zero or not.

Specified by:
isOptional in interface IMultiplicity
Returns:
indicates optionality or not

isUnlimited

public boolean isUnlimited()
Indicates whether this multiplicity is unlimited, meaning the upper bound is unbounded or internally set to -1 (the same as many).

Specified by:
isUnlimited in interface IMultiplicity
Returns:
indicates unlimited upper bound or not

toString

public String toString()
Description copied from interface: IMultiplicity
Returns a String image of this multiplicity.

Specified by:
toString in interface IMultiplicity

isSatisfied

public boolean isSatisfied(int valueCount)
Determines if the multiplicity is satisfied with the input number of values that are associated with this multiplicity.

Parameters:
valueCount - the number of values checked for multiplicity validity
Returns:
true if the multiplicity would be satisfied with the specified number of values

isSatisfied

public boolean isSatisfied(int valueCount,
                           PatternMultiplicity.BoundQualifier qualifier)
Determines if the multiplicity is satisfied with the input number of values that are associated with this multiplicity. A bound qualifier must be specified, a type-safe enumeration defined within an inner-class of this class. If UPPER_BOUND_ONLY is specified, only the upper boundary will be checked for conformance, if LOWER_BOUND_ONLY is specified, only the lower boundary will be checked for conformance.

Parameters:
valueCount - the number of values
qualifier - a type-safe enumeration indicating lower or upper boundary only
Returns:
true if the multiplicity would be satisfied with the specified number of values

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.