ca.infoway.messagebuilder.xml
Class Cardinality

Package class diagram package Cardinality
java.lang.Object
  extended by ca.infoway.messagebuilder.xml.Cardinality

public class Cardinality
extends Object

A class that models the cardinality of a particular HL7 relationship.

Author:
Intelliware Development

Constructor Summary
Cardinality(Integer min, Integer max)
          Standard constructor.
 
Method Summary
 boolean contains(int value)
          A convenience method to indicate whether a specified value is contained within the cardinality range.
static Cardinality create(String string)
          Parse a cardinality string (such as "*" or "0-50") into a cardinality object.
 boolean equals(Object obj)
          Determine if this cardinality is equal to another object.
 Integer getMax()
          Get the maximum value.
 Integer getMin()
          Get the miniumum value.
 boolean isMandatory()
          A flag that indicates that the cardinality is at least one.
 boolean isMultiple()
          A convenience method to see if the maximum cardinality is greater than one.
 boolean isSingle()
          A convenience method to see if the cardinality of "1" or "0-1".
 String toString()
          Provide a string representation of the cardinality.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cardinality

public Cardinality(Integer min,
                   Integer max)

Standard constructor.

Parameters:
min - - the minimum value.
max - - the maximum value.
Method Detail

getMax

public Integer getMax()

Get the maximum value.

Returns:
the maximum value.

getMin

public Integer getMin()

Get the miniumum value.

Returns:
the miniumum value.

isMandatory

public boolean isMandatory()

A flag that indicates that the cardinality is at least one.

Returns:
true if the minium cardinality is at least one; false otherwise.

isSingle

public boolean isSingle()

A convenience method to see if the cardinality of "1" or "0-1".

Returns:
true if the maximum cardinality is 1; false otherwise.

isMultiple

public boolean isMultiple()

A convenience method to see if the maximum cardinality is greater than one.

Returns:
true if the cardinality is not single; false otherwise.

equals

public boolean equals(Object obj)

Determine if this cardinality is equal to another object.

Overrides:
equals in class Object
Parameters:
obj - - the other object
Returns:
true if the two objects describe the same cardinality; false otherwise.

toString

public String toString()

Provide a string representation of the cardinality. (e.g. "0-*", indicating unbounded cardinality.

Overrides:
toString in class Object
Returns:
the string representation of the cardinality.

create

public static Cardinality create(String string)

Parse a cardinality string (such as "*" or "0-50") into a cardinality object.

Parameters:
string - - the string representation.
Returns:
- the cardinality

contains

public boolean contains(int value)

A convenience method to indicate whether a specified value is contained within the cardinality range.

Parameters:
value - - the value being specified.
Returns:
- true if the cardinality range contains the value; false otherwise.


Copyright © 2013. All Rights Reserved.