blob: ea2d92de6739a22ce41037e27c53d6706ac5430d [file] [log] [blame]
/*
* Copyright (c) 2005, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - initial API and implementation
*
* $Id: Constraint.java,v 1.7 2006/04/05 13:49:57 khussey Exp $
*/
package org.eclipse.uml2.uml;
import java.util.Map;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Constraint</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
* Constraint contains a ValueSpecification that specifies additional semantics for one or more elements. Certain kinds of constraints (such as an association "xor" constraint) are predefined in UML, others may be user-defined. A user-defined Constraint is described using a specified language, whose syntax and interpretation is a tool responsibility. One predefined language for writing constraints is OCL. In some situations, a programming language such as Java may be appropriate for expressing a constraint. In other situations natural language may be used.
* Constraint is a condition (a Boolean expression) that restricts the extension of the associated element beyond what is imposed by the other language constructs applied to the element. Constraint contains an optional name, although they are commonly unnamed.
* Constraint contains a ValueSpecification that specifies additional semantics for one or more elements. Certain kinds of constraints (such as an association "xor" constraint) are predefined in UML, others may be user-defined. A user-defined Constraint is described using a specified language, whose syntax and interpretation is a tool responsibility. One predefined language for writing constraints is OCL. In some situations, a programming language such as Java may be appropriate for expressing a constraint. In other situations natural language may be used.
* Constraint is a condition (a Boolean expression) that restricts the extension of the associated element beyond what is imposed by the other language constructs applied to that element. Constraint contains an optional name, although they are commonly unnamed.
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.uml2.uml.Constraint#getConstrainedElements <em>Constrained Element</em>}</li>
* <li>{@link org.eclipse.uml2.uml.Constraint#getSpecification <em>Specification</em>}</li>
* <li>{@link org.eclipse.uml2.uml.Constraint#getContext <em>Context</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.uml2.uml.UMLPackage#getConstraint()
* @model
* @generated
*/
public interface Constraint
extends PackageableElement {
/**
* Returns the value of the '<em><b>Constrained Element</b></em>' reference list.
* The list contents are of type {@link org.eclipse.uml2.uml.Element}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The ordered set of Elements referenced by this Constraint.
* <!-- end-model-doc -->
* @return the value of the '<em>Constrained Element</em>' reference list.
* @see org.eclipse.uml2.uml.UMLPackage#getConstraint_ConstrainedElement()
* @model type="org.eclipse.uml2.uml.Element"
* @generated
*/
EList getConstrainedElements();
/**
* Returns the value of the '<em><b>Specification</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* A condition that must be true when evaluated in order for the constraint to be satisfied.
*
* A condition that must be true when evaluated in order for the constraint to be satisfied.
* <!-- end-model-doc -->
* @return the value of the '<em>Specification</em>' containment reference.
* @see #setSpecification(ValueSpecification)
* @see org.eclipse.uml2.uml.UMLPackage#getConstraint_Specification()
* @model containment="true" required="true" ordered="false"
* @generated
*/
ValueSpecification getSpecification();
/**
* Sets the value of the '{@link org.eclipse.uml2.uml.Constraint#getSpecification <em>Specification</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Specification</em>' containment reference.
* @see #getSpecification()
* @generated
*/
void setSpecification(ValueSpecification value);
/**
* Creates a new {@link org.eclipse.uml2.uml.ValueSpecification}, with the specified '<em><b>Name</b></em>', and '<em><b>Type</b></em>', and sets the '<em><b>Specification</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param name The '<em><b>Name</b></em>' for the new {@link org.eclipse.uml2.uml.ValueSpecification}, or <code>null</code>.
* @param type The '<em><b>Type</b></em>' for the new {@link org.eclipse.uml2.uml.ValueSpecification}, or <code>null</code>.
* @param eClass The Ecore class of the {@link org.eclipse.uml2.uml.ValueSpecification} to create.
* @return The new {@link org.eclipse.uml2.uml.ValueSpecification}.
* @see #getSpecification()
* @generated
*/
ValueSpecification createSpecification(String name, Type type, EClass eClass);
/**
* Returns the value of the '<em><b>Context</b></em>' container reference.
* It is bidirectional and its opposite is '{@link org.eclipse.uml2.uml.Namespace#getOwnedRules <em>Owned Rule</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Specifies the namespace that owns the NamedElement.
* <!-- end-model-doc -->
* @return the value of the '<em>Context</em>' container reference.
* @see #setContext(Namespace)
* @see org.eclipse.uml2.uml.UMLPackage#getConstraint_Context()
* @see org.eclipse.uml2.uml.Namespace#getOwnedRules
* @model opposite="ownedRule" ordered="false"
* @generated
*/
Namespace getContext();
/**
* Sets the value of the '{@link org.eclipse.uml2.uml.Constraint#getContext <em>Context</em>}' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Context</em>' container reference.
* @see #getContext()
* @generated
*/
void setContext(Namespace value);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* A constraint cannot be applied to itself.
* not constrainedElement->includes(self)
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean validateNotApplyToSelf(DiagnosticChain diagnostics, Map context);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The value specification for a constraint must evaluate to a Boolean value.
* self.specification().booleanValue().isOclKindOf(Boolean)
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean validateValueSpecificationBoolean(DiagnosticChain diagnostics,
Map context);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The value specification for a constraint must evaluate to a Boolean value.
* true
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean validateBooleanValue(DiagnosticChain diagnostics, Map context);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Evaluating the value specification for a constraint must not have side effects.
* true
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean validateNoSideEffects(DiagnosticChain diagnostics, Map context);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* A constraint cannot be applied to itself.
* not constrainedElement->includes(self)
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean validateNotAppliedToSelf(DiagnosticChain diagnostics, Map context);
} // Constraint