org.umlg.runtime.collection.ocl.OclStdLibOrderedSet Maven / Gradle / Ivy
package org.umlg.runtime.collection.ocl;
import org.umlg.runtime.collection.UmlgBag;
import org.umlg.runtime.collection.UmlgOrderedSet;
import org.umlg.runtime.collection.UmlgSequence;
import java.util.Comparator;
public interface OclStdLibOrderedSet extends OclStdLibCollection {
/**
* append (object: T) : OrderedSet(T)
*
* The set of elements, consisting of all elements of self, followed by object.
* post: result->size() = self->size() + 1
* post: result->at(result->size() ) = object
* post: Sequence{1..self->size() }->forAll(index : Integer |
* result->at(index) = self ->at(index))
*
* @param e
* @return
*/
UmlgOrderedSet append(E e);
/**
* prepend(object : T) : OrderedSet(T)
*
* The sequence consisting of object, followed by all elements in self.
* post: result->size = self->size() + 1
* post: result->at(1) = object
* post: Sequence{1..self->size()}->forAll(index : Integer |
* self->at(index) = result->at(index + 1))
*
* @param e
* @return
*/
UmlgOrderedSet prepend(E e);
/**
* insertAt(index : Integer, object : T) : OrderedSet(T)
*
* The set consisting of self with object inserted at position index.
* post: result->size = self->size() + 1
* post: result->at(index) = object
* post: Sequence{1..(index - 1)}->forAll(i : Integer |
* self->at(i) = result->at(i))
* post: Sequence{(index + 1)..self->size()}->forAll(i : Integer |
* self->at(i) = result->at(i + 1))
*
*/
UmlgOrderedSet insertAt(Integer index, E e);
/**
* subOrderedSet(lower : Integer, upper : Integer) : OrderedSet(T)
*
* The sub-set of self starting at number lower, up to and including element number upper.
* pre : 1 <= lower
* pre : lower <= upper
* pre : upper <= self->size()
* post: result->size() = upper -lower + 1
* post: Sequence{lower..upper}->forAll( index |
* result->at(index - lower + 1) =
* self->at(index))
*/
UmlgOrderedSet subOrderedSet(Integer lower, Integer upper);
/**
* at(i : Integer) : T
*
* The i-th element of self.
* pre : i >= 1 and i <= self->size()
*
*/
E at(Integer i);
/**
* indexOf(obj : T) : Integer
*
* The index of object obj in the sequence.
* pre : self->includes(obj)
* post : self->at(i) = obj
*/
//The obj parameter id Object and not E to be compatible with the java.util.List interface
int indexOf(Object obj);
/**
* first() : T
* * The first element in self. * post: result = self->at(1)*/ E first(); /** * last() : T *
* The last element in self. * post: result = self->at(self->size() ) **/ E last(); /** * reverse() : OrderedSet(T) *
* The ordered set of elements with same elements but with the opposite order. * post: result->size() = self->size()*/ UmlgOrderedSet
* Redefines the Collection operation to remove the requirement for the + operation to be associative and/or commutative, * since the order of evaluation is well-defined by the iteration over an ordered collection.*/ E sum(); // /** // * asSet() : Set(T) // * // * Redefines the Set operation. Returns a Set containing all of the elements of self, in undefined order. // *
// */ // @Override // UmlgSetasSet(); /** * asOrderedSet() : OrderedSet(T) * * Redefines the Set operation. An OrderedSet identical to self. * post: result = self * post: Sequence{1..self.size()}->forAll(i | result->at(i) = self->at(i))*/ @Override UmlgOrderedSetasOrderedSet(); /** * asSequence() : Sequence(T) * * Redefines the Set operation. A Sequence that contains all the elements from self, in the same order. * post: Sequence{1..self.size()}->forAll(i | result->at(i) = self->at(i))* */ @Override UmlgSequenceasSequence(); /** * asBag() : Bag(T) * * Redefines the Set operation. The Bag that contains all the elements from self, in undefined order. **/ @Override UmlgBagasBag(); @Override UmlgOrderedSet select(BooleanExpressionEvaluator e); @Override UmlgSequence collectNested(BodyExpressionEvaluator e); @Override UmlgSequence collect(BodyExpressionEvaluator e); @Override UmlgSequence flatten(); /************************************************* * * Not in spec * *************************************************/ /** * including(object : T) : Set(T) * * * The set containing all elements of self plus object. * post: result->forAll(elem | self->includes(elem) or (elem = object)) * post: self- >forAll(elem | result->includes(elem)) * post: result->includes(object) **/ UmlgOrderedSetincluding(E e); //Predefined Iterator Expressions UmlgOrderedSet sortedBy(Comparator e); }