Codota Logo
ExpressionLanguage.latestValueOf
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.diirt/datasource

/**
 * Both reads and writes the given expression, and returns an object to configure the parameters
 * for the both read and write. It's similar to use both {@link #read(org.diirt.datasource.expression.SourceRateExpression) }
 * and {@link #write(org.diirt.datasource.expression.WriteExpression) } at the same time.
 *
 * @param <R> type of the read payload
 * @param <W> type of the write payload
 * @param readWriteExpression the expression to read and write
 * @return the read and write configuration
 */
public static <R, W> PVConfiguration<R, W> readAndWrite(SourceRateReadWriteExpression<R, W> readWriteExpression) {
  return readAndWrite(ExpressionLanguage.latestValueOf(readWriteExpression));
}
origin: org.diirt/datasource

/**
 * Reads the given expression, and returns an object to configure the parameters
 * for the read. At each notification it will return the latest value,
 * even if more had been received from the last notification.
 *
 * @param <T> type of the read payload
 * @param pvExpression the expression to read
 * @return the read configuration
 */
public static <T> PVReaderConfiguration<T> read(SourceRateExpression<T> pvExpression) {
  return new PVReaderConfiguration<T>(ExpressionLanguage.latestValueOf(pvExpression));
}
origin: org.diirt/datasource-formula

public LastOfChannelExpression(String name, Class<T> clazz) {
  this.expression = latestValueOf(channel(name, clazz, Object.class));
  this.clazz = clazz;
}
origin: org.diirt/datasource

/**
 * For reads, returns (only) the latest value computed
 * from a {@code SourceRateReadWriteExpression}; for writes, same
 * as the given expression.
 *
 * @param <R> read payload
 * @param <W> write payload
 * @param expression expression read at the source rate
 * @return a new expression
 */
public static <R, W> DesiredRateReadWriteExpression<R, W> latestValueOf(SourceRateReadWriteExpression<R, W> expression) {
  return new DesiredRateReadWriteExpressionImpl<R, W>(latestValueOf((SourceRateExpression<R>) expression), expression);
}
origin: org.diirt/datasource-sample

@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
  if (columnIndex != 0) {
    throw new RuntimeException();
  }
  String name = aValue.toString();
  try {
    if (rowIndex == pvNames.size()) {
      group.add(latestValueOf(channel(name)));
      pvNames.add(name);
    } else {
      group.set(rowIndex, latestValueOf(channel(name)));
      pvNames.set(rowIndex, name);
    }
    latestExceptions = group.lastExceptions();
    fireTableDataChanged();
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(MockDynamicTablePVFrame.this, ex.getMessage(), "Can't open pv", JOptionPane.ERROR_MESSAGE);
  }
}
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

/**
 * For reads, returns (only) the latest value computed
 * from a {@code SourceRateReadWriteExpression}; for writes, same
 * as the given expression.
 *
 * @param <R> read payload
 * @param <W> write payload
 * @param expressions expressions read at the source rate
 * @return a new expression
 */
public static <R, W> DesiredRateReadWriteExpressionList<R, W> latestValueOf(SourceRateReadWriteExpressionList<R, W> expressions) {
  DesiredRateReadWriteExpressionListImpl<R, W> list = new DesiredRateReadWriteExpressionListImpl<R, W>();
  for (SourceRateReadWriteExpression<R, W> expression : expressions.getSourceRateReadWriteExpressions()) {
    list.and(latestValueOf(expression));
  }
  return list;
}
origin: org.diirt/datasource-sample

public void v5_assemblingNumericArrayFromScalars() {
  List<String> channelNames = Arrays.asList("channel1", "channel2", "channel3", "channel4");
  // Reads a list of different numeric channels as a single array.
  // The channels can be of any numeric type (double, float, int, ...)
  final PVReader<VNumberArray> pvReader = PVManager.read(
      vNumberArrayOf(latestValueOf(vNumbers(channelNames))))
    .readListener(new PVReaderListener<VNumberArray>() {
      public void pvChanged(PVReaderEvent<VNumberArray> event) {
        if (event.isValueChanged()) {
          // Do something with the value
          System.out.println(event.getPvReader().getValue());
        }
      }
    })
    .maxRate(ofMillis(100));
}
origin: org.diirt/datasource

/**
 * Expression that returns (only) the latest value computed
 * from a {@code SourceRateExpression}.
 *
 * @param <T> type being read
 * @param expressions expressions read at the source rate
 * @return an expression list
 */
public static <T> DesiredRateExpressionList<T> latestValueOf(SourceRateExpressionList<T> expressions) {
  DesiredRateExpressionList<T> list = new DesiredRateExpressionListImpl<T>();
  for (SourceRateExpression<T> expression : expressions.getSourceRateExpressions()) {
    list.and(latestValueOf(expression));
  }
  return list;
}
origin: org.diirt/datasource-sample

  public void v6_assemblingTables() {
    // You can assemble a table by giving a desired rate expression for each cell,
    // organizing them by column. You can use constant expressions for
    // labels or values that do not change.
    List<String> names = Arrays.asList("one", "two", "trhee");
    PVReader<VTable> pvReader = PVManager
        .read(vTable(column("Names", vStringConstants(names)),
               column("Values", latestValueOf(channels(names)))))
        .readListener(new PVReaderListener<VTable>() {
          @Override
          public void pvChanged(PVReaderEvent<VTable> pvReader) {
            VTable vTable = pvReader.getPvReader().getValue();
            // First column is the names
            @SuppressWarnings("unchecked")
            List<String> names = (List<String>) vTable.getColumnData(0);
            // Second column is the values
            ListDouble values = (ListDouble) vTable.getColumnData(1);
            // ...
          }
        })
        .maxRate(ofMillis(100));
  }
}
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 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.datasourceExpressionLanguagelatestValueOf

Javadoc

Expression that returns (only) the latest value computed from a SourceRateExpression.

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
  • 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.
  • mapOf
    An expression that expects a key/value map where the key is the expression name and the value is the
  • resultOf
    An expression that represents the result of a user provided function.

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
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