org.eclipse.uml2.uml.Operation.getOwnedParameters()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.eclipse.uml2.uml.Operation.getOwnedParameters()方法的一些代码示例,展示了Operation.getOwnedParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operation.getOwnedParameters()方法的具体详情如下:
包路径:org.eclipse.uml2.uml.Operation
类名称:Operation
方法名:getOwnedParameters

Operation.getOwnedParameters介绍

暂无

代码示例

代码示例来源:origin: org.umlg/java-generation-util

@Override
public EList<Parameter> getOwnedParameters() {
  return this.operation.getOwnedParameters();
}

代码示例来源:origin: org.eclipse.ocl/uml

public List<Parameter> getParameters(Operation operation) {
  List<Parameter> result = new java.util.ArrayList<Parameter>(
      operation.getOwnedParameters().size());
  
  for (Parameter p : operation.getOwnedParameters()) {
    if (p.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
      result.add(p);
    }
  }
  
  return result;
}

代码示例来源:origin: org.umlg/java-generation-util

public static List<Parameter> getParametersExceptReturn(Operation oper) {
    List<Parameter> result = new ArrayList<Parameter>();
    for (Parameter param : oper.getOwnedParameters()) {
      if (param.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
        result.add(param);
      }
    }
    return result;
  }
}

代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArguments()
 */
@Override
protected Collection<Parameter> handleGetArguments()
{
  final Collection<Parameter> arguments = new ArrayList<Parameter>(this.metaObject.getOwnedParameters());
  CollectionUtils.filter(
    arguments,
    new Predicate()
    {
      public boolean evaluate(final Object object)
      {
        final Parameter param = (Parameter)object;
        return !param.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL) && !param.isException();
      }
    });
  return arguments;
}

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * <!-- begin-model-doc -->
 * Retrieves the (only) return result parameter for this operation.
 * @param operation The receiving '<em><b>Operation</b></em>' model object.
 * <!-- end-model-doc -->
 * @generated NOT
 */
public static Parameter getReturnResult(Operation operation) {
  for (Parameter ownedParameter : operation.getOwnedParameters()) {
    if (ownedParameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
      return ownedParameter;
    }
  }
  return null;
}

代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22

public int compare(final Operation operation1, final Operation operation2)
  {
    int rtn = operation1.getName().compareTo(operation2.getName());
    if (rtn == 0)
    {
      rtn = operation1.getOwnedParameters().size() - operation1.getOwnedParameters().size();
      if (rtn == 0)
      {
        int index = 0;
        for (Parameter parameter : operation1.getOwnedParameters())
        {
          rtn = parameter.getName().compareTo(operation2.getOwnedParameters().get(index).getName());
          if (rtn != 0)
          {
            break;
          }
          index++;
        }
      }
    }
    return rtn;
  }
}

代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArguments()
 */
@Override
protected Collection<Parameter> handleGetArguments()
{
  final Collection<Parameter> arguments = new ArrayList<Parameter>(this.metaObject.getOwnedParameters());
  CollectionUtils.filter(
    arguments,
    new Predicate()
    {
      public boolean evaluate(final Object object)
      {
        final Parameter param = (Parameter)object;
        return !param.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL) && !param.isException();
      }
    });
  return arguments;
}

代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22

public int compare(final Operation operation1, final Operation operation2)
  {
    int rtn = operation1.getName().compareTo(operation2.getName());
    if (rtn == 0)
    {
      rtn = operation1.getOwnedParameters().size() - operation1.getOwnedParameters().size();
      if (rtn == 0)
      {
        int index = 0;
        for (Parameter parameter : operation1.getOwnedParameters())
        {
          rtn = parameter.getName().compareTo(operation2.getOwnedParameters().get(index).getName());
          if (rtn != 0)
          {
            break;
          }
          index++;
        }
      }
    }
    return rtn;
  }
}

代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getParameters()
 */
@Override
protected Collection<Parameter> handleGetParameters()
{
  final Collection<Parameter> params = new ArrayList<Parameter>(this.metaObject.getOwnedParameters());
  params.add(this.metaObject.getReturnResult());
  CollectionUtils.filter(
    params,
    new Predicate()
    {
      public boolean evaluate(final Object object)
      {
        return object != null && !((Parameter)object).isException();
      }
    });
  return params;
}

代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getParameters()
 */
@Override
protected Collection<Parameter> handleGetParameters()
{
  final Collection<Parameter> params = new ArrayList<Parameter>(this.metaObject.getOwnedParameters());
  params.add(this.metaObject.getReturnResult());
  CollectionUtils.filter(
    params,
    new Predicate()
    {
      public boolean evaluate(final Object object)
      {
        return object != null && !((Parameter)object).isException();
      }
    });
  return params;
}

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * <!-- begin-model-doc -->
 * The query returnResult() returns the set containing the return parameter of the Operation if one exists, otherwise, it returns an empty set
 * result = ownedParameter->select (par | par.direction = #return)
 * @param operation The receiving '<em><b>Operation</b></em>' model object.
 * <!-- end-model-doc -->
 * @generated NOT
 */
public static EList<Parameter> returnResult(Operation operation) {
  EList<Parameter> returnResult = new UniqueEList.FastCompare<Parameter>();
  for (Parameter ownedParameter : operation.getOwnedParameters()) {
    if (ownedParameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
      returnResult.add(ownedParameter);
    }
  }
  return ECollections.unmodifiableEList(returnResult);
}

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

: name.equals(referred.getName())))
  continue referredLoop;
EList<Parameter> ownedParameterList = referred.getOwnedParameters();
int ownedParameterListSize = ownedParameterList.size();
if (ownedParameterNames != null

代码示例来源:origin: org.eclipse.ocl/uml

continue ownedOperationLoop;
EList<Parameter> ownedParameterList = ownedOperation
  .getOwnedParameters();
int ownedParameterListSize = ownedParameterList.size();
if (ownedParameterNames != null

代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArgumentTypeNames()
 */
@Override
protected String handleGetArgumentTypeNames()
{
  final StringBuilder buffer = new StringBuilder();
  final Iterator<Parameter> iterator = this.metaObject.getOwnedParameters().iterator();
  boolean commaNeeded = false;
  while (iterator.hasNext())
  {
    final Parameter parameter = iterator.next();
    if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
    {
      if (commaNeeded)
      {
        buffer.append(", ");
      }
      final ParameterFacade facade = (ParameterFacade)this.shieldedElement(parameter);
      buffer.append(facade.getType().getFullyQualifiedName());
      commaNeeded = true;
    }
  }
  return buffer.toString();
}

代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArgumentNames()
 */
@Override
protected String handleGetArgumentNames()
{
  final StringBuilder buffer = new StringBuilder();
  final Iterator<Parameter> iterator = this.metaObject.getOwnedParameters().iterator();
  boolean commaNeeded = false;
  final String comma = ", ";
  while (iterator.hasNext())
  {
    final Parameter parameter = iterator.next();
    if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
    {
      if (commaNeeded)
      {
        buffer.append(comma);
      }
      final ParameterFacade facade = (ParameterFacade)this.shieldedElement(parameter);
      buffer.append(facade.getName());
      commaNeeded = true;
    }
  }
  return buffer.toString();
}

代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArgumentNames()
 */
@Override
protected String handleGetArgumentNames()
{
  final StringBuilder buffer = new StringBuilder();
  final Iterator<Parameter> iterator = this.metaObject.getOwnedParameters().iterator();
  boolean commaNeeded = false;
  final String comma = ", ";
  while (iterator.hasNext())
  {
    final Parameter parameter = iterator.next();
    if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
    {
      if (commaNeeded)
      {
        buffer.append(comma);
      }
      final ParameterFacade facade = (ParameterFacade)this.shieldedElement(parameter);
      buffer.append(facade.getName());
      commaNeeded = true;
    }
  }
  return buffer.toString();
}

代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22

/**
 * @see org.andromda.metafacades.uml.OperationFacade#getArgumentTypeNames()
 */
@Override
protected String handleGetArgumentTypeNames()
{
  final StringBuilder buffer = new StringBuilder();
  final Iterator<Parameter> iterator = this.metaObject.getOwnedParameters().iterator();
  boolean commaNeeded = false;
  while (iterator.hasNext())
  {
    final Parameter parameter = iterator.next();
    if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
    {
      if (commaNeeded)
      {
        buffer.append(", ");
      }
      final ParameterFacade facade = (ParameterFacade)this.shieldedElement(parameter);
      buffer.append(facade.getType().getFullyQualifiedName());
      commaNeeded = true;
    }
  }
  return buffer.toString();
}

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

@Override
public Object caseEParameter(EParameter eParameter) {
  EOperation eOperation = eParameter.getEOperation();
  if (eOperation != null) {
    Parameter parameter = UMLFactory.eINSTANCE.createParameter();
    eModelElementToElementMap.put(eParameter, parameter);
    Operation operation = (Operation) doSwitch(eOperation);
    operation.getOwnedParameters().add(parameter);
    parameter.setName(eParameter.getName());
    caseETypedElement(eParameter);
    defaultCase(eParameter);
    return parameter;
  }
  return super.caseEParameter(eParameter);
}

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public void setOperation(Operation newOperation) {
  if (newOperation != eInternalContainer()) {
    if (EcoreUtil.isAncestor(this, newOperation))
      throw new IllegalArgumentException(
        "Recursive containment not allowed for " + toString()); //$NON-NLS-1$
    NotificationChain msgs = null;
    if (eInternalContainer() != null)
      msgs = eBasicRemoveFromContainer(msgs);
    if (newOperation != null)
      msgs = ((InternalEList<Parameter>) newOperation
        .getOwnedParameters()).basicAdd(this, msgs);
    msgs = eBasicSetContainer((InternalEObject) newOperation,
      InternalEObject.EOPPOSITE_FEATURE_BASE
        - UMLPackage.OPERATION__OWNED_PARAMETER, msgs);
    if (msgs != null)
      msgs.dispatch();
  } else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET,
      UMLPackage.PARAMETER__OPERATION, newOperation, newOperation));
}

代码示例来源:origin: org.eclipse.ocl/uml

public Operation defineOperation(Classifier owner, String name,
    Classifier type, List<Variable<Classifier, Parameter>> params,
    Constraint constraint) {
  resetTypeCaches();        
  Operation result = UMLFactory.eINSTANCE.createOperation();
  result.addKeyword(UMLReflection.OCL_HELPER);
  result.setName(name);
  result.setType(type == null ? getOCLStandardLibrary().getOclVoid()
    : type);
  result.setIsQuery(true); // OCL can only define queries
  for (Variable<Classifier, Parameter> next : params) {
    Parameter param = UMLFactory.eINSTANCE.createParameter();
    param.setName(next.getName());
    param.setType(next.getType() == null ? getOCLStandardLibrary()
      .getOclVoid()
      : next.getType());
    param.setDirection(ParameterDirectionKind.IN_LITERAL);
    param.setEffect(ParameterEffectKind.READ_LITERAL);
    result.getOwnedParameters().add(param);
  }
  annotate(result, constraint);
  addHelperOperation(owner, result);
  return result;
}

相关文章