Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2b170f4b53a7751609b6ba22193a63139ca06392 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (c) 2013, 2015, 2016 Eike Stepper (Berlin, Germany) 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:
 *    Christian W. Damus (CEA LIST) - initial API and implementation
 */
package org.eclipse.emf.cdo.server.ocl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EStructuralFeature;

import org.eclipse.ocl.EvaluationEnvironment;
import org.eclipse.ocl.ecore.EcoreEnvironmentFactory;
import org.eclipse.ocl.ecore.EcoreEvaluationEnvironment;

/**
 * A CDO-specific specialization of the OCL evaluation environment.
 *
 * @author Christian W. Damus
 * @since 4.2
 */
class CDOEvaluationEnvironment extends EcoreEvaluationEnvironment
{
  public CDOEvaluationEnvironment(EcoreEnvironmentFactory factory)
  {
    super(factory);
  }

  public CDOEvaluationEnvironment(EvaluationEnvironment<EClassifier, EOperation, EStructuralFeature, EClass, EObject> parent)
  {
    super(parent);
  }

  @Override
  public Object callOperation(EOperation operation, int opcode, Object source, Object[] args) throws IllegalArgumentException
  {
    CDOAdditionalOperation cdoOperation = CDOAdditionalOperation.getInstance(operation);
    if (cdoOperation != null)
    {
      return cdoOperation.evaluate(this, source, args);
    }

    return super.callOperation(operation, opcode, source, args);
  }
}

Back to the top