⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constraint.java

📁 为了下东西 随便发了个 datamining 的源代码
💻 JAVA
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

 /**
  * Title: XELOPES Data Mining Library
  * Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
  * Copyright: Copyright (c) 2002 Prudential Systems Software GmbH
  * Company: ZSoft (www.zsoft.ru), Prudsys (www.prudsys.com)
  * @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
  * @version 1.0
  */

package com.prudsys.pdm.Cwm.Core;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;


/**
 * A constraint is a semantic condition or restriction expressed in text.
 *
 *
 *
 * In the metamodel, a Constraint is a BooleanExpression on an associated
 * ModelElement(s) which must be true for the model to be well formed. This
 * restriction can be stated in natural language, or in different kinds of
 * languages with well-defined semantics. Certain Constraints are predefined,
 * others may be user defined. Note that a Constraint is an assertion, not an
 * executable mechanism.
 *
 *
 *
 * The specification is written as an expression in a designated constraint
 * language. The language can be specially designed for writing constraints (such
 * as OCL), a programming language, mathematical notation, or natural language. If
 * constraints are to be enforced by a model editor tool, then the tool must
 * understand the syntax and semantics of the constraint language. Because the
 * choice of language is arbitrary, constraints can be used as an extension
 * mechanism.
 *
 *
 *
 * The constraint concept allows new semantics to be specified linguistically for
 * a model element. In the metamodel a Constraint directly attached to a
 * ModelElement describes semantic restrictions that this ModelElement must obey.
 */
public class Constraint extends ModelElement implements org.omg.cwm.objectmodel.core.Constraint
{

   /**
    * A BooleanExpression that must be true when evaluated for an instance of a
    * system to be well-formed. A boolean expression defining the constraint.
    * Expressions are written as strings in a designated language. For the model to
    * be well formed, the expression must always yield a true value when evaluated
    * for instances of the constrained elements at any time when the system is stable
    * (i.e., not during the execution of an atomic operation).
    */
   public BooleanExpression body;
   public ModelElement constrainedElement[];
   public Stereotype constrainedStereotype;

   /**
    * @roseuid 3C5E9524013E
    */
   public Constraint()
   {

   }

   public org.omg.cwm.objectmodel.core.BooleanExpression getBody() {
     return body;
   }

   public void setBody(org.omg.cwm.objectmodel.core.BooleanExpression body) {

     this.body = (BooleanExpression) body;
   }

   public List getConstrainedElement() {

     return CWMTools.ArrayToList(constrainedElement);
   }

   public void setConstrainedElement(Collection constrainedElement) {

     this.constrainedElement = new ModelElement[ constrainedElement.size() ];
     Iterator it = constrainedElement.iterator();
     for (int i = 0; i < constrainedElement.size(); i++)
       this.constrainedElement[i] = (ModelElement) it.next();
   }

   public void addConstrainedElement(org.omg.cwm.objectmodel.core.ModelElement input) {

     int size = (constrainedElement == null) ? 0 : constrainedElement.length;
     ModelElement[] oldData = constrainedElement;
     constrainedElement = new ModelElement[size+1];
     if (size > 0) System.arraycopy(oldData, 0, constrainedElement, 0, size);
     constrainedElement[size] = (ModelElement) input;
   }

   public void removeConstrainedElement(org.omg.cwm.objectmodel.core.ModelElement input) {

     int size = (constrainedElement == null) ? 0 : constrainedElement.length;
     if (size == 0)
       return;

     int ipos = -1;
     for (int i = 0; i < size; i++)
       if (constrainedElement[i].equals(input)) {
         ipos = i;
         break;
       }
     if (ipos == -1)
       return;

     ModelElement[] oldData = constrainedElement;
     constrainedElement = new ModelElement[size-1];
     for (int i = 0; i < ipos; i++)
       constrainedElement[i] = oldData[i];
     for (int i = ipos+1; i < size; i++)
       constrainedElement[i-1] = oldData[i];
   }

   public void addConstrainedElementBefore(org.omg.cwm.objectmodel.core.ModelElement before, org.omg.cwm.objectmodel.core.ModelElement input){};

   public void addConstrainedElementAfter(org.omg.cwm.objectmodel.core.ModelElement before, org.omg.cwm.objectmodel.core.ModelElement input){};

   public void moveConstrainedElementBefore(org.omg.cwm.objectmodel.core.ModelElement before, org.omg.cwm.objectmodel.core.ModelElement input){};

   public void moveConstrainedElementAfter(org.omg.cwm.objectmodel.core.ModelElement before, org.omg.cwm.objectmodel.core.ModelElement input){};

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -