Tabnine Logo
ExpressionLanguage.mapOf
Code IndexAdd Tabnine to your IDE (free)

How to use
mapOf
method
in
org.diirt.datasource.ExpressionLanguage

Best Java code snippets using org.diirt.datasource.ExpressionLanguage.mapOf (Showing top 5 results out of 315)

origin: org.diirt/datasource-sample

public void m2_readMultipleChannels() {
  // Write a map to the channels named "one", "two" and "three"
  PVWriter<Map<String, Object>> pvWriter = PVManager
      .write(mapOf(channels("one", "two", "three")))
      .async();
  // Prepare the 3 values
  Map<String, Object> values = new HashMap<String, Object>();
  values.put("one", 1.0);
  values.put("two", 2.0);
  values.put("three", "run");
  // Write
  pvWriter.write(values);
  // Remember to close
  pvWriter.close();
  // Note that when using a composite datasource, the channels can be
  //from different sources (e.g. "sim://noise" and "ca://mypv").
}
origin: org.diirt/datasource-sample

public void m3_readWriteMultipleChannels() {
  // Read and write a map to the channels named "one", "two" and "three"
  PV<Map<String, Object>, Map<String, Object>> pv = PVManager
    .readAndWrite(mapOf(latestValueOf(channels("one", "two", "three"))))
    .asynchWriteAndMaxReadRate(ofMillis(100));
  // Do something
  // ...
  // Remember to close
  pv.close();
}
origin: org.diirt/datasource-sample

public void m1_readMultipleChannels() {
  // Read a map with the channels named "one", "two" and "three"
  PVReader<Map<String, Object>> pvReader = PVManager
    .read(mapOf(latestValueOf(channels("one", "two", "three"))))
    .readListener(new PVReaderListener<Map<String, Object>>() {
      @Override
      public void pvChanged(PVReaderEvent<Map<String, Object>> event) {
        // Print the values if any
        Map<String, Object> map = event.getPvReader().getValue();
        if (map != null) {
          System.out.println("one: " + map.get("one") +
              " - two: " + map.get("two") +
              " - three: " + map.get("three"));
        }
      }
    })
    .maxRate(ofMillis(100));
  // Remember to close
  pvReader.close();
  // Note that when using a composite datasource, the channels can be
  //from different sources (e.g. "sim://noise" and "ca://mypv").
}
origin: org.diirt/datasource-sample

  public void m5_writeOrdering() {
    // Write a map to the channels named "one", "two" and "three"
    // Write "two" after "one" and write "three" after "two"
    PVWriter<Map<String, Object>> pvWriter = PVManager.write(
        mapOf(channel("one")
           .and(channel("two").after("one"))
           .and(channel("three").after("two")))).async();

    // Do something
    // ...

    // Remember to close
    pvWriter.close();
  }
}
origin: org.diirt/datasource-sample

public void m4_renameChannels() {
  // Read a map with the channels "one", "two" and "three"
  // reffered in the map as "setpoint", "readback" and "difference"
  PVReader<Map<String, Object>> pvReader = PVManager
    .read(mapOf(latestValueOf(channel("one").as("setpoint")
           .and(channel("two").as("readback"))
           .and(channel("three").as("difference")))))
    .readListener(new PVReaderListener<Map<String, Object>>() {
      @Override
      public void pvChanged(PVReaderEvent<Map<String, Object>> event) {
        // Print the values if any
        Map<String, Object> map = event.getPvReader().getValue();
        if (map != null) {
          System.out.println("setpoint: " + map.get("setpoint") +
              " - readback: " + map.get("readback") +
              " - difference: " + map.get("difference"));
        }
      }
    })
    .maxRate(ofMillis(100));
  // Remember to close
  pvReader.close();
  // Any expression however created can be renamed.
}
org.diirt.datasourceExpressionLanguagemapOf

Javadoc

An empty map that can read/write expressions of the given type.

The returned expression is dynamic, which means child expressions can be added or removed from the map.

Popular methods of ExpressionLanguage

  • channel
    A channel with the given name and type. This expression can be used both in a read and a write expre
  • channels
    A list of channels with the given names of any type. This expression can be used both in a read and
  • constant
    Creates a constant expression that always return that object, with the given name for the expression
  • latestValueOf
    For reads, returns (only) the latest value computed from a SourceRateReadWriteExpression; for writes
  • newValuesOf
    Returns all the new values generated by the expression source rate.
  • listOf
    Converts a list of expressions to an expression that returns the list of results.
  • resultOf
    An expression that represents the result of a user provided function.

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now