All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.nakeduml.javageneration.basicjava.simpleactions.StructuralFeatureClearer Maven / Gradle / Ivy

The newest version!
package net.sf.nakeduml.javageneration.basicjava.simpleactions;

import net.sf.nakeduml.javageneration.NakedStructuralFeatureMap;
import net.sf.nakeduml.javageneration.bpm.actions.ActionMap;
import net.sf.nakeduml.javametamodel.OJBlock;
import net.sf.nakeduml.javametamodel.annotation.OJAnnotatedOperation;
import net.sf.nakeduml.metamodel.actions.INakedClearStructuralFeatureAction;
import nl.klasse.octopus.oclengine.IOclEngine;

public class StructuralFeatureClearer extends SimpleActionBuilder{
	public StructuralFeatureClearer(IOclEngine oclEngine,INakedClearStructuralFeatureAction action){
		super(oclEngine, action);
	}
	@Override
	public void implementActionOn(OJAnnotatedOperation operation,OJBlock block){
		ActionMap actionMap = new ActionMap(node);
		OJBlock forEach = buildLoopThroughTarget(operation, block, actionMap);
		NakedStructuralFeatureMap map = new NakedStructuralFeatureMap(node.getFeature());
		if(map.isOne()){
			forEach.addToStatements(actionMap.targetName() + "." + map.setter() + "(null)");
		}else{
			forEach.addToStatements(actionMap.targetName() + "." + map.clearer() + "()");
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy