Type Bag

All Supertypes:
Collection

Predefined type Bag
extends Collection

A Bag is a collection that allows duplicates. That is, one object can be an element of a bag many times. There is no ordering defined on the elements in a bag.


Operation Summary
 Boolean =(Bag rhs)
          True if this bag and rhs contain the same elements, the same number of times.
 Boolean <>(Bag rhs)
          True if this bag and rhs do not contain the same elements, the same number of times.
 Sequence asSequence
          A sequence that contains all the elements from this bag.
 Set asSet
          A set that contains all the elements from this bag, with duplicates removed.
 Bag collect(OclAny_Expression expr)
          The Bag of elements which results from applying the expression expr to every member of this bag.
 Integer count(OclAny object)
          The number of occurences of object in this bag.
 Bag excluding(OclAny object)
          The bag containing all elements of this bag apart from all occurence of object.
 Bag including(OclAny object)
          The bag containing all elements of this bag plus object.
 Bag intersection(Bag rhs)
          A bag that contains every elements that are both in this bag and in rhs.
 Set intersection(Set rhs)
          A bag that contains every elements that are both in this bag and in rhs.
 Bag reject(Boolean_Expression expr)
          The sub-bag of all elements for which applying the expr expression evaluates to false.
 Bag select(Boolean_Expression expr)
          The sub-bag of all elements for which applying the expr expression evaluates to true.
 Bag union(Bag rhs)
          A Bag that contains every elements of this bag and every elements in rhs.
 Bag union(Set rhs)
          A Bag that contains every elements of this bag and every elements in rhs.
 
Operations inherited from type Collection
excludes, excludesAll, exists, forAll, getOne, includes, includesAll, isEmpty, isUnique, notEmpty, size, sortedBy, sortedBy, sum
 

Operations Detail

=

 public Boolean =(Bag rhs)
True if this bag and rhs contain the same elements, the same number of times.

<>

 public Boolean <>(Bag rhs)
True if this bag and rhs do not contain the same elements, the same number of times.

union

 public Bag union(Bag rhs)
A Bag that contains every elements of this bag and every elements in rhs. If a same element is contained in this bag and in rhs, it will appear twice in the result.

union

 public Bag union(Set rhs)
A Bag that contains every elements of this bag and every elements in rhs. If a same element is contained in this bag and in rhs, it will appear twice in the result.

intersection

 public Bag intersection(Bag rhs)
A bag that contains every elements that are both in this bag and in rhs. If one element is contained twice in this bag and once in rhs, it appears only once in the result.

intersection

 public Set intersection(Set rhs)
A bag that contains every elements that are both in this bag and in rhs. If one element is contained twice in this bag and once in rhs, it appears only once in the result.

including

 public Bag including(OclAny object)
The bag containing all elements of this bag plus object.

excluding

 public Bag excluding(OclAny object)
The bag containing all elements of this bag apart from all occurence of object.

select

 public Bag select(Boolean_Expression expr)
The sub-bag of all elements for which applying the expr expression evaluates to true.

reject

 public Bag reject(Boolean_Expression expr)
The sub-bag of all elements for which applying the expr expression evaluates to false.

collect

 public Bag collect(OclAny_Expression expr)
The Bag of elements which results from applying the expression expr to every member of this bag. There is a side effect if expr describes a side effect.

count

 public Integer count(OclAny object)
The number of occurences of object in this bag.
Overloads:
count in type Collection

asSequence

 public Sequence asSequence
A sequence that contains all the elements from this bag.

asSet

 public Set asSet
A set that contains all the elements from this bag, with duplicates removed.


Copyright 1999-2002 ObjeXion Software SA. All rights reserved.