From 0f677032af1533c74859ff0c722e965278d5727b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 3 Aug 2014 07:58:44 -0500 Subject: [PATCH] Remove CodeGenerator API It was an early exploratory attempt at code generation, and not currently in use by the system anywhere. It will be done differently. As this removes API, it is a breaking change. --- pom.xml | 2 +- .../org/scijava/script/CodeGenerator.java | 56 ----------- .../org/scijava/script/CodeGeneratorJava.java | 95 ------------------- .../org/scijava/script/InvocationObject.java | 58 ----------- .../org/scijava/script/ParameterObject.java | 53 ----------- 5 files changed, 1 insertion(+), 263 deletions(-) delete mode 100644 src/main/java/org/scijava/script/CodeGenerator.java delete mode 100644 src/main/java/org/scijava/script/CodeGeneratorJava.java delete mode 100644 src/main/java/org/scijava/script/InvocationObject.java delete mode 100644 src/main/java/org/scijava/script/ParameterObject.java diff --git a/pom.xml b/pom.xml index 9868b80ee..35e36da1e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scijava-common - 2.41.1-SNAPSHOT + 3.0.0-SNAPSHOT SciJava Common SciJava Common is a shared library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, backed by its own annotation processor, so that plugins can be loaded dynamically. It is used by both ImageJ and SCIFIO. diff --git a/src/main/java/org/scijava/script/CodeGenerator.java b/src/main/java/org/scijava/script/CodeGenerator.java deleted file mode 100644 index 010846b43..000000000 --- a/src/main/java/org/scijava/script/CodeGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * SciJava Common shared library for SciJava software. - * %% - * Copyright (C) 2009 - 2015 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.script; - -/** - * Code Generator Interface - * - * @author Grant Harris - */ -public interface CodeGenerator { - - /** Adds delimiter character between arguments (typically a ','). */ - void addArgDelimiter(); - - void addArgument(ParameterObject parameterObject); - - void addModuleCalled(String moduleCalled); - - String getResult(); - - void invokeStatementBegin(); - - void invokeStatementEnd(); - - void statementTerminate(); - -} diff --git a/src/main/java/org/scijava/script/CodeGeneratorJava.java b/src/main/java/org/scijava/script/CodeGeneratorJava.java deleted file mode 100644 index 4fd1fc21c..000000000 --- a/src/main/java/org/scijava/script/CodeGeneratorJava.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * SciJava Common shared library for SciJava software. - * %% - * Copyright (C) 2009 - 2015 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.script; - -/** - * {@link CodeGenerator} for Java. - * - * @author Grant Harris - */ -public class CodeGeneratorJava implements CodeGenerator { - - static final String lsep = System.getProperty("line.separator"); - private final StringBuilder sb = new StringBuilder(); - - @Override - public String getResult() { - return sb.toString(); - } - - @Override - public void invokeStatementBegin() { - sb.append("invoke("); - } - - @Override - public void addModuleCalled(final String moduleCalled) { - sb.append("\""); - sb.append(moduleCalled); - sb.append("\""); - } - - @Override - public void addArgDelimiter() { - sb.append(", "); - } - - @Override - public void addArgument(final ParameterObject parameterObject) { - final StringBuilder sb1 = new StringBuilder(); - // Class type = parameterObject.type; - // String name = parameterObject.param; - final Object value = parameterObject.value; - if (value instanceof String) { - sb1.append("\""); - sb1.append(parameterObject.value.toString()); - sb1.append("\""); - } - else if (value instanceof Boolean) { - if ((Boolean) value) sb1.append("true"); - else sb1.append("false"); - } - else sb1.append(parameterObject.value.toString()); - sb.append(sb1.toString()); - } - - @Override - public void statementTerminate() { - sb.append(lsep); - } - - @Override - public void invokeStatementEnd() { - sb.append(")"); - } - -} diff --git a/src/main/java/org/scijava/script/InvocationObject.java b/src/main/java/org/scijava/script/InvocationObject.java deleted file mode 100644 index 6dad3306a..000000000 --- a/src/main/java/org/scijava/script/InvocationObject.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * SciJava Common shared library for SciJava software. - * %% - * Copyright (C) 2009 - 2015 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.script; - -import java.util.ArrayList; - -/** - * Holds a module or plugin reference that was invoked in a macro recording, and - * the parameters that were passed to it. - * - * @author Grant Harris - */ -public class InvocationObject { - - public String moduleCalled; - public ArrayList parameterObjects = - new ArrayList(); - - public InvocationObject(final String moduleCalled) { - this.moduleCalled = moduleCalled; - } - - public void addParameter(final String param, final Class type, - final Object value) - { - parameterObjects.add(new ParameterObject(param, type, value)); - } - -} diff --git a/src/main/java/org/scijava/script/ParameterObject.java b/src/main/java/org/scijava/script/ParameterObject.java deleted file mode 100644 index 790ee172c..000000000 --- a/src/main/java/org/scijava/script/ParameterObject.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * SciJava Common shared library for SciJava software. - * %% - * Copyright (C) 2009 - 2015 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.script; - -/** - * Holds a parameter, its type and value, for a recorded macro. - * - * @author Grant Harris - */ -public class ParameterObject { - - public ParameterObject(final String param, final Class type, - final Object value) - { - this.param = param; - this.type = type; - this.value = value; - } - - public String param; - public Class type; - public Object value; - -}