Codota Logo
Jiffle.compile
Code IndexAdd Codota to your IDE (free)

How to use
compile
method
in
it.geosolutions.jaiext.jiffle.Jiffle

Best Java code snippets using it.geosolutions.jaiext.jiffle.Jiffle.compile (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: geosolutions-it/jai-ext

public void getSourceFromJiffleObject(String script) throws JiffleException {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  
  // You have to compile the script before getting the runtime
  // source otherwise an Exception will be thrown
  jiffle.compile();
  
  // Get the Java source. The boolean argument specifies that we
  // want the input script copied into the class javadocs
  String runtimeSource = jiffle.getRuntimeSource(true);
}
// docs end getSourceFromJiffleObject
origin: geosolutions-it/jai-ext

@Test(expected=JiffleException.class)
public void compileWithNoScript() throws Exception {
  System.out.println("   compile with no script set");
  
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}
origin: geosolutions-it/jai-ext

/**
 * Creates a new instance by compiling the script read from {@code scriptFile}. 
 * Using this constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(scriptFile);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param scriptFile file containing the Jiffle script
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * 
 * @throws JiffleException on compilation errors
 */
public Jiffle(File scriptFile, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(scriptFile);
  setImageParams(params);
  compile();
}

origin: it.geosolutions.jaiext.jiffle/jt-jiffle-language

/**
 * Creates a new instance by compiling the provided script. Using this
 * constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(script);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param script Jiffle source code to compile
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * @throws JiffleException on compilation errors
 * 
 */
public Jiffle(String script, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(script);
  setImageParams(params);
  compile();
}
origin: it.geosolutions.jaiext.jiffle/jt-jiffle-language

/**
 * Creates a new instance by compiling the script read from {@code scriptFile}. 
 * Using this constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(scriptFile);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param scriptFile file containing the Jiffle script
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * 
 * @throws JiffleException on compilation errors
 */
public Jiffle(File scriptFile, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(scriptFile);
  setImageParams(params);
  compile();
}

origin: geosolutions-it/jai-ext

private void setupSingleDestScript() throws JiffleException {
  String script = "dest = 42;";
  jiffle.setScript(script);
  
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}

origin: geosolutions-it/jai-ext

@Test(expected=JiffleException.class)
public void compileScriptWithoutImageParams() throws Exception {
  System.out.println("   compile script with missing image params");
  
  String script = "dest = 42;";
  
  jiffle.setScript(script);
  jiffle.compile();
}

origin: geosolutions-it/jai-ext

  protected void compileScript(String script) throws JiffleException {
    Jiffle jiffle = new Jiffle();
    jiffle.setScript(script);
    jiffle.compile();
  }
}
origin: geosolutions-it/jai-ext

@Test(expected=JiffleParserException.class)
public void compileInvalidScriptThrowsException() throws Exception {
  System.out.println("   compile invalid script and get exception");
  
  // script with an uninitialized variable
  String script = "dest = x;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}
origin: geosolutions-it/jai-ext

private Jiffle getCompiledJiffle(String script) throws JiffleException {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
  
  return jiffle;
}

origin: geosolutions-it/jai-ext

@Test(expected=JiffleException.class)
public void emptyImagesBlock() throws Exception {
  System.out.println("   empty images block and no parameters causes exception");
  
  String script = "images { } dest = 42;" ;
  
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
}

origin: geosolutions-it/jai-ext

private JiffleDirectRuntime getRuntime(String script) throws Exception {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  
  Map<String, Jiffle.ImageRole> params = new HashMap<>();
  params.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(params);
  jiffle.compile();
  
  return jiffle.getRuntimeInstance();
}

origin: geosolutions-it/jai-ext

@Test
public void compileValidScript() throws Exception {
  System.out.println("   compile valid script");
  
  String script = "dest = 42;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
  
  assertTrue(jiffle.isCompiled());
}
origin: geosolutions-it/jai-ext

private JiffleDirectRuntime getRuntimeWithImagesBlock() throws Exception {
  String script = 
       "images {"
      + "  src1=read; src2=read; src3=read;"
      + "  dest1=write; dest2=write; dest3=write;"
      + "}"
      + "dest1 = src1; dest2 = src2; dest3 = src3;" ;
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
  return jiffle.getRuntimeInstance();
}

origin: geosolutions-it/jai-ext

@Test
public void compileInvalidScriptAndCheckStatus() throws Exception {
  System.out.println("   compile invalid script and check status");
  
  // script with an uninitialized variable
  String script = "dest = x;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  
  try {
    jiffle.compile();
  } catch (JiffleParserException ignored) {}
  
  assertFalse(jiffle.isCompiled());
}

origin: geosolutions-it/jai-ext

  private JiffleDirectRuntime getRuntime(String script) throws Exception {
    Jiffle jiffle = new Jiffle();
    jiffle.setScript(script);
    jiffle.compile();
    return jiffle.getRuntimeInstance();
  }
}
origin: geosolutions-it/jai-ext

@Test
public void getImageScopeVarNames() throws Exception {
  String script = 
       "images { dest=write; } "
      + "init { foo = 1; bar = 2; foz = 3; baz = 4; } "
      + "dest = 42;" ;
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
  JiffleDirectRuntime runtime = jiffle.getRuntimeInstance();
  
  String[] names = runtime.getVarNames();
  
  List<String> expected = new ArrayList<>();
  expected.add("foo");
  expected.add("bar");
  expected.add("foz");
  expected.add("baz");
  
  assertEquals(expected.size(), names.length);
  for (int i = 0; i < names.length; i++) {
    assertTrue(expected.contains(names[i]));
    expected.remove(names[i]);
  }
}

origin: geosolutions-it/jai-ext

private JiffleDirectRuntime getRuntime(String script) throws Exception {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  
  Map<String, Jiffle.ImageRole> imageParams = new HashMap<>();
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setImageParams(imageParams);
  jiffle.compile();
  JiffleDirectRuntime runtime = jiffle.getRuntimeInstance();
  
  WritableRenderedImage destImg = ImageUtilities.createConstantImage(WIDTH, WIDTH, 0d);
  runtime.setDestinationImage("dest", destImg);
  
  return runtime;
}

origin: geosolutions-it/jai-ext

@Test
public void noDestImage() throws Exception {
  System.out.println("   destination-less script with images block");
  String script = String.format(
       "images { inimage = read; } \n"
      + "init { n = 0; } \n"
      + "n += inimage >= %d;",
      NUM_PIXELS - 5);
  
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
  
  directRuntimeInstance = jiffle.getRuntimeInstance();
  directRuntimeInstance.setSourceImage("inimage", createSequenceImage());
  directRuntimeInstance.evaluateAll(null);
  
  Double var = directRuntimeInstance.getVar("n");
  assertNotNull(var);
  assertEquals(5, var.intValue());
}

origin: geosolutions-it/jai-ext

private void assertScriptResult(String script, 
    Evaluator e, String srcVarName, String destVarName) throws Exception {
  
  RenderedImage srcImg = null;
  WritableRenderedImage destImg = null;
  
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  jiffle.compile();
  
  directRuntimeInstance = (JiffleDirectRuntime) jiffle.getRuntimeInstance();
  
  if (srcVarName != null && srcVarName.length() > 0) {
    srcImg = createSequenceImage();
    directRuntimeInstance.setSourceImage(srcVarName, srcImg);
  }
  
  if (destVarName != null && destVarName.length() > 0) {
    destImg = ImageUtilities.createConstantImage(IMG_WIDTH, IMG_WIDTH, 0d);
    directRuntimeInstance.setDestinationImage(destVarName, destImg);
  }
  
  directRuntimeInstance.evaluateAll(null);
  assertImage(srcImg, destImg, e);
}
it.geosolutions.jaiext.jiffleJifflecompile

Javadoc

Compiles the script into Java source for the runtime class.

Popular methods of Jiffle

  • <init>
    Creates a new instance by compiling the provided script. Using this constructor is equivalent to: J
  • getRuntimeInstance
    Gets the runtime object for this script. The runtime object is an instance of JiffleRuntime. By defa
  • setImageParams
    Sets the image parameters. These define which variables in the script refer to images and their type
  • setScript
    Sets the script. Calling this method will clear any previous script and runtime objects.
  • isCompiled
    Tests whether the script has been compiled successfully.
  • getReadPositions
    A utility method returning the source positions used in a given script
  • getRuntimeSource
    Gets a copy of the Java source for the runtime class. The script must have been compiled before call
  • clearCompiledObjects
    Clears all compiler and runtime objects.
  • createRuntimeInstance
  • createRuntimeSource
  • getImageParams
    Gets the current image parameters. The parameters are returned as an unmodifiable map.
  • getName
    Gets the name assigned to this object. This will either be the default name or one assigned by the c
  • getImageParams,
  • getName,
  • getRuntimeBaseClass,
  • getScript,
  • getScriptImageParams,
  • init,
  • parseScript,
  • reportMessages,
  • setName

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Path (java.nio.file)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now