blob: 4def8211793d04be6dae9ba035a75664498cbe83 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013, 2019 CEA LIST and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink(CEA LIST) - Initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.examples.codegen.java.iteration;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.analyzer.CodeGenAnalyzer;
import org.eclipse.ocl.examples.codegen.cgmodel.CGBuiltInIterationCallExp;
import org.eclipse.ocl.examples.codegen.cgmodel.CGIterator;
import org.eclipse.ocl.examples.codegen.cgmodel.CGTypeId;
import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.java.Iteration2Java;
import org.eclipse.ocl.examples.codegen.java.JavaStream;
import org.eclipse.ocl.pivot.LoopExp;
public abstract class AbstractIteration2Java implements Iteration2Java
{
@Override
public void appendAccumulatorInit(@NonNull JavaStream js, @NonNull CGBuiltInIterationCallExp cgIterationCallExp) {}
@Override
public @Nullable CGTypeId getAccumulatorTypeId(@NonNull CodeGenAnalyzer analyzer, @NonNull CGBuiltInIterationCallExp cgIterationCallExp) {
return null;
}
@SuppressWarnings("null")
protected @NonNull CGValuedElement getBody(@NonNull CGBuiltInIterationCallExp cgIterationCallExp) {
return cgIterationCallExp.getBody();
}
@SuppressWarnings("null")
protected @NonNull CGIterator getIterator(@NonNull CGBuiltInIterationCallExp cgIterationCallExp) {
return cgIterationCallExp.getIterators().get(0);
}
@Override
public boolean isNonNullAccumulator(@NonNull LoopExp element) {
return true;
}
}