blob: b4f75142b53f22d73c6639989f28f094c6a9e50d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
* 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:
* Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.buffers;
import java.net.URISyntaxException;
import org.eclipse.viatra2.core.IModelSpace;
import org.eclipse.viatra2.errors.VPMRuntimeException;
import org.eclipse.viatra2.natives.ASMNativeFunction;
import org.eclipse.viatra2.natives.NativeFunctionParameter;
import org.eclipse.viatra2.natives.VIATRANativeFunction;
@VIATRANativeFunction(name = "clearBuffer", remark = "Clears an output buffer.",
returns = { NativeFunctionParameter.ParameterType.BOOLEAN },
params = { @NativeFunctionParameter(
description = "Uniquely identifies an output buffer.Currently supported schemes are: core://<<id>>, file://<<workspace-relative path>>, os://<<absolute path>>.",
name = "bufferURI",
type = { NativeFunctionParameter.ParameterType.STRING }) })
public class ClearBuffer implements ASMNativeFunction {
public Object evaluate(IModelSpace msp, Object[] params)
throws VPMRuntimeException {
try {
BufferStore.clearBuffer(msp, params[0].toString());
return Boolean.TRUE;
} catch (URISyntaxException e) {
throw new VPMRuntimeException("Invalid URI syntax", e);
}
}
public String getDescription() {
return "Clears a core:// output buffer";
}
public String getID() {
return this.getClass().getCanonicalName();
}
public String getName() {
return "clearBuffer"; // VTCL
}
}