target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void toNanosLong1() { Duration duration = TimeDuration.ofSeconds(1.5); assertThat(duration.toNanos(), equalTo(1500000000L)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isPositive1() { Duration duration = TimeDuration.ofSeconds(0); assertThat(!duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isPositive2() { Duration duration = TimeDuration.ofSeconds(1.3); assertThat(!duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isPositive3() { Duration duration = TimeDuration.ofSeconds(0.5); assertThat(!duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isPositive4() { Duration duration = TimeDuration.ofSeconds(5.0); assertThat(!duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void testgetParentNode() { Node parentNode = Node.builder().name("a").uniqueId("u").build(); when(nodeDAO.getParentNode("u")).thenReturn(parentNode); assertNotNull(services.getParentNode("u")); }
@Override public Node getParentNode(String uniqueNodeId) { return nodeDAO.getParentNode(uniqueNodeId); }
Services implements IServices { @Override public Node getParentNode(String uniqueNodeId) { return nodeDAO.getParentNode(uniqueNodeId); } }
Services implements IServices { @Override public Node getParentNode(String uniqueNodeId) { return nodeDAO.getParentNode(uniqueNodeId); } }
Services implements IServices { @Override public Node getParentNode(String uniqueNodeId) { return nodeDAO.getParentNode(uniqueNodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node creat...
Services implements IServices { @Override public Node getParentNode(String uniqueNodeId) { return nodeDAO.getParentNode(uniqueNodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node creat...
@Test public void isPositive5() { Duration duration = TimeDuration.ofSeconds(-0.5); assertThat(!duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isPositive6() { Duration duration = TimeDuration.ofSeconds(-5.5); assertThat(!duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative1() { Duration duration = TimeDuration.ofSeconds(0); assertThat(duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative2() { Duration duration = TimeDuration.ofSeconds(1.3); assertThat(duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative3() { Duration duration = TimeDuration.ofSeconds(0.5); assertThat(duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative4() { Duration duration = TimeDuration.ofSeconds(5.0); assertThat(duration.isNegative(), equalTo(false)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative5() { Duration duration = TimeDuration.ofSeconds(-0.5); assertThat(duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void isNegative6() { Duration duration = TimeDuration.ofSeconds(-5.5); assertThat(duration.isNegative(), equalTo(true)); }
public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); }
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
TimeDuration { public static Duration ofSeconds(double sec) { return Duration.ofNanos((long) (sec * NANOSEC_IN_SEC)); } private TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofDays(double day); static Duration ofHours(double hour); static Duration ofMinutes(double min); static ...
@Test public void equals1() { TimeInterval interval = TimeInterval.between(Instant.ofEpochSecond(0, 0), Instant.ofEpochSecond(3600, 0)); assertThat(interval, equalTo(TimeInterval.between(Instant.ofEpochSecond(0, 0), Instant.ofEpochSecond(3600, 0)))); }
public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
@Test public void equals2() { TimeInterval interval = TimeInterval.between(Instant.ofEpochSecond(0, 1), Instant.ofEpochSecond(3600, 0)); assertThat(interval, not(equalTo(TimeInterval.between(Instant.ofEpochSecond(0, 0), Instant.ofEpochSecond(3600, 0))))); }
public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
@Test public void testGetChildNodes() { when(nodeDAO.getChildNodes("a")).thenReturn(Arrays.asList(Node.builder().build())); assertNotNull(services.getChildNodes("a")); }
@Override public List<Node> getChildNodes(String nodeUniqueId) { logger.info("Getting child nodes for node unique id={}", nodeUniqueId); return nodeDAO.getChildNodes(nodeUniqueId); }
Services implements IServices { @Override public List<Node> getChildNodes(String nodeUniqueId) { logger.info("Getting child nodes for node unique id={}", nodeUniqueId); return nodeDAO.getChildNodes(nodeUniqueId); } }
Services implements IServices { @Override public List<Node> getChildNodes(String nodeUniqueId) { logger.info("Getting child nodes for node unique id={}", nodeUniqueId); return nodeDAO.getChildNodes(nodeUniqueId); } }
Services implements IServices { @Override public List<Node> getChildNodes(String nodeUniqueId) { logger.info("Getting child nodes for node unique id={}", nodeUniqueId); return nodeDAO.getChildNodes(nodeUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUnique...
Services implements IServices { @Override public List<Node> getChildNodes(String nodeUniqueId) { logger.info("Getting child nodes for node unique id={}", nodeUniqueId); return nodeDAO.getChildNodes(nodeUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUnique...
@Test public void equals3() { TimeInterval interval = TimeInterval.between(Instant.ofEpochSecond(0, 0), Instant.ofEpochSecond(3600, 1)); assertThat(interval, not(equalTo(TimeInterval.between(Instant.ofEpochSecond(0, 0), Instant.ofEpochSecond(3600, 0))))); }
public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
@Test public void equals4() { TimeInterval interval = TimeInterval.between(Instant.ofEpochSecond(0, 0), null); assertThat(interval, equalTo(TimeInterval.between(Instant.ofEpochSecond(0, 0), null))); }
public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
@Test public void equals5() { TimeInterval interval = TimeInterval.between(null, Instant.ofEpochSecond(0, 0)); assertThat(interval, equalTo(TimeInterval.between(null, Instant.ofEpochSecond(0, 0)))); }
public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); }
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
TimeInterval { public static TimeInterval between(Instant start, Instant end) { return new TimeInterval(start, end); } private TimeInterval(Instant start, Instant end); boolean contains(Instant instant); static TimeInterval between(Instant start, Instant end); TimeInterval minus(Duration duration); static TimeInterval...
@Test public void getNow() { Instant ts = TimeParser.getInstant("now"); assertTrue("Failed to obtain Timestamp corresponding to now ", ts != null && ts instanceof Instant); }
@Deprecated public static Instant getInstant(String time) { if (time.equalsIgnoreCase(NOW)) { return Instant.now(); } else { Matcher nUnitsAgoMatcher = timeQuantityUnitsPattern.matcher(time); while (nUnitsAgoMatcher.find()) { return Instant.now().minus(parseDuration(nUnitsAgoMatcher.group(1))); } DateTimeFormatter form...
TimeParser { @Deprecated public static Instant getInstant(String time) { if (time.equalsIgnoreCase(NOW)) { return Instant.now(); } else { Matcher nUnitsAgoMatcher = timeQuantityUnitsPattern.matcher(time); while (nUnitsAgoMatcher.find()) { return Instant.now().minus(parseDuration(nUnitsAgoMatcher.group(1))); } DateTimeF...
TimeParser { @Deprecated public static Instant getInstant(String time) { if (time.equalsIgnoreCase(NOW)) { return Instant.now(); } else { Matcher nUnitsAgoMatcher = timeQuantityUnitsPattern.matcher(time); while (nUnitsAgoMatcher.find()) { return Instant.now().minus(parseDuration(nUnitsAgoMatcher.group(1))); } DateTimeF...
TimeParser { @Deprecated public static Instant getInstant(String time) { if (time.equalsIgnoreCase(NOW)) { return Instant.now(); } else { Matcher nUnitsAgoMatcher = timeQuantityUnitsPattern.matcher(time); while (nUnitsAgoMatcher.find()) { return Instant.now().minus(parseDuration(nUnitsAgoMatcher.group(1))); } DateTimeF...
TimeParser { @Deprecated public static Instant getInstant(String time) { if (time.equalsIgnoreCase(NOW)) { return Instant.now(); } else { Matcher nUnitsAgoMatcher = timeQuantityUnitsPattern.matcher(time); while (nUnitsAgoMatcher.find()) { return Instant.now().minus(parseDuration(nUnitsAgoMatcher.group(1))); } DateTimeF...
@Test public void getDuration() { Duration lastMin = TimeParser.parseDuration("1 min"); assertEquals("Failed to get Duration for last min", Duration.ofSeconds(60), lastMin); Duration lastHour = TimeParser.parseDuration("1 hour"); assertEquals("Failed to get Duration for last hour", Duration.ofHours(1), lastHour); Tempo...
@Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equals(timeQunatit...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
@Test public void parse() { Instant now = Instant.now(); TimeRelativeInterval interval = TimeRelativeInterval.of(TimeParser.parseTemporalAmount("1 min"), now); assertEquals(now.minusSeconds(60), interval.toAbsoluteInterval().getStart()); assertEquals(now, interval.toAbsoluteInterval().getEnd()); }
public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; while (timeQuant...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
@Test public void parseCompositeTimeString() { TemporalAmount last5Mins30Secs = TimeParser.parseDuration("5 mins 30 secs"); assertEquals("Failed to get Duration for last 5 mins", Duration.ofMinutes(5).plusSeconds(30), last5Mins30Secs); TemporalAmount last3Hours5Mins30Secs = TimeParser.parseDuration("3 hours 5 mins 30 s...
@Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equals(timeQunatit...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
@Test public void parseRelativeInterval() { TimeRelativeInterval interval = TimeRelativeInterval.of(TimeParser.parseTemporalAmount("1 month"), LocalDateTime .parse("2011-02-01T00:00:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME).toInstant(ZoneOffset.UTC)); TimeInterval jan = interval.toAbsoluteInterval(); assertEquals(31L...
public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; while (timeQuant...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
@Test public void testParseDuration() { TemporalAmount amount = TimeParser.parseDuration("3 days"); final long seconds = LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.UTC).plus(amount).toEpochSecond(ZoneOffset.UTC); assertEquals(3*24*60*60, seconds); }
@Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equals(timeQunatit...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
TimeParser { @Deprecated public static Duration parseDuration(String string) { int quantity = 0; String unit = ""; Matcher timeQunatityUnitsMatcher = durationTimeQunatityUnitsPattern.matcher(string); Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equal...
@Test public void testParseTemporalAmount() { TemporalAmount amount = TimeParser.parseTemporalAmount("3 days"); long seconds = LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.UTC).plus(amount).toEpochSecond(ZoneOffset.UTC); assertEquals(3*24*60*60, seconds); amount = TimeParser.parseTemporalAmount("3 days 20 mins 10 sec")...
public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; while (timeQuant...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
TimeParser { public static TemporalAmount parseTemporalAmount(final String string) { if (NOW.equalsIgnoreCase(string)) return Duration.ZERO; final Matcher timeQuantityUnitsMatcher = timeQuantityUnitsPattern.matcher(string); final Map<ChronoUnit, Integer> timeQuantities = new HashMap<>(); boolean use_period = false; whi...
@Test public void testGetRootNode() { when(nodeDAO.getRootNode()).thenReturn(Node.builder().build()); assertNotNull(services.getRootNode()); }
@Override public Node getRootNode() { return nodeDAO.getRootNode(); }
Services implements IServices { @Override public Node getRootNode() { return nodeDAO.getRootNode(); } }
Services implements IServices { @Override public Node getRootNode() { return nodeDAO.getRootNode(); } }
Services implements IServices { @Override public Node getRootNode() { return nodeDAO.getRootNode(); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNode(String parentsUniqueId, Node ...
Services implements IServices { @Override public Node getRootNode() { return nodeDAO.getRootNode(); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNode(String parentsUniqueId, Node ...
@Test public void testFormatTemporalAmount() { String text = TimeParser.format(Duration.ofHours(2)); assertEquals("2 hours", text); text = TimeParser.format(Period.of(1, 2, 3)); assertEquals("1 year 2 months 3 days", text); text = TimeParser.format(Duration.ofSeconds(2*24*60*60 + 1*60*60 + 10, 123000000L)); assertEqual...
public static String format(final TemporalAmount amount) { final StringBuilder buf = new StringBuilder(); if (amount instanceof Period) { final Period period = (Period) amount; if (period.isZero()) return NOW; if (period.getYears() == 1) buf.append("1 year "); else if (period.getYears() > 1) buf.append(period.getYears(...
TimeParser { public static String format(final TemporalAmount amount) { final StringBuilder buf = new StringBuilder(); if (amount instanceof Period) { final Period period = (Period) amount; if (period.isZero()) return NOW; if (period.getYears() == 1) buf.append("1 year "); else if (period.getYears() > 1) buf.append(per...
TimeParser { public static String format(final TemporalAmount amount) { final StringBuilder buf = new StringBuilder(); if (amount instanceof Period) { final Period period = (Period) amount; if (period.isZero()) return NOW; if (period.getYears() == 1) buf.append("1 year "); else if (period.getYears() > 1) buf.append(per...
TimeParser { public static String format(final TemporalAmount amount) { final StringBuilder buf = new StringBuilder(); if (amount instanceof Period) { final Period period = (Period) amount; if (period.isZero()) return NOW; if (period.getYears() == 1) buf.append("1 year "); else if (period.getYears() > 1) buf.append(per...
TimeParser { public static String format(final TemporalAmount amount) { final StringBuilder buf = new StringBuilder(); if (amount instanceof Period) { final Period period = (Period) amount; if (period.isZero()) return NOW; if (period.getYears() == 1) buf.append("1 year "); else if (period.getYears() > 1) buf.append(per...
@Test public void testCommandSplit() throws Exception { List<String> cmd = CommandExecutor.splitCmd("path/cmd"); System.out.println(cmd); assertThat(cmd, equalTo(Arrays.asList("path/cmd"))); cmd = CommandExecutor.splitCmd("path/cmd arg1"); System.out.println(cmd); assertThat(cmd, equalTo(Arrays.asList("path/cmd", "arg1...
public static List<String> splitCmd(final String cmd) { final List<String> items = new ArrayList<>(); final int len = cmd.length(); int i = 0; final StringBuilder line = new StringBuilder(); while (i < len) { char c = cmd.charAt(i); if (c == ' ' || c == '\t') { items.add(line.toString()); line.delete(0, line.length());...
CommandExecutor implements Callable<Integer> { public static List<String> splitCmd(final String cmd) { final List<String> items = new ArrayList<>(); final int len = cmd.length(); int i = 0; final StringBuilder line = new StringBuilder(); while (i < len) { char c = cmd.charAt(i); if (c == ' ' || c == '\t') { items.add(l...
CommandExecutor implements Callable<Integer> { public static List<String> splitCmd(final String cmd) { final List<String> items = new ArrayList<>(); final int len = cmd.length(); int i = 0; final StringBuilder line = new StringBuilder(); while (i < len) { char c = cmd.charAt(i); if (c == ' ' || c == '\t') { items.add(l...
CommandExecutor implements Callable<Integer> { public static List<String> splitCmd(final String cmd) { final List<String> items = new ArrayList<>(); final int len = cmd.length(); int i = 0; final StringBuilder line = new StringBuilder(); while (i < len) { char c = cmd.charAt(i); if (c == ' ' || c == '\t') { items.add(l...
CommandExecutor implements Callable<Integer> { public static List<String> splitCmd(final String cmd) { final List<String> items = new ArrayList<>(); final int len = cmd.length(); int i = 0; final StringBuilder line = new StringBuilder(); while (i < len) { char c = cmd.charAt(i); if (c == ' ' || c == '\t') { items.add(l...
@Test public void testShortCommand() throws Exception { if (is_windows) return; final String cmd = "./cmd_short.sh \"With one arg\" another_arg"; final Integer status = new CommandExecutor(cmd, examples_dir).call(); final String log = getLoggedMessages(); assertThat(log, containsString("Example warning")); assertThat(l...
@Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream(), cmd, Level.INFO); final Thread stderr = new L...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
@Test public void testErrorCommand() throws Exception { if (is_windows) return; final Integer status = new CommandExecutor("cmds/cmd_short.sh", examples_dir.getParentFile()).call(); final String log = getLoggedMessages(); assertThat(log, containsString("Wrong directory")); assertThat(log, containsString("exited with st...
@Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream(), cmd, Level.INFO); final Thread stderr = new L...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
CommandExecutor implements Callable<Integer> { @Override public Integer call() throws Exception { String cmd = process_builder.command().get(0); final int sep = cmd.lastIndexOf('/'); if (sep >= 0) cmd = cmd.substring(sep+1); process = process_builder.start(); final Thread stdout = new LogWriter(process.getInputStream()...
@Test public void checkWebToURI() throws Exception { URI uri = createResourceURI("http: System.out.println(uri); assertThat(uri.getScheme(), equalTo("http")); assertThat(uri.getHost(), equalTo("some.site")); assertThat(uri.getPath(), equalTo("/file/path")); }
public static URI createResourceURI(final String resource) throws Exception { try { final URI uri = URI.create(resource); if (uri.getScheme() != null) return uri; else { final Path fileResource = Paths.get(resource); return fileResource.toUri(); } } catch (Throwable ex) { try { return new File(resource).toURI(); } catc...
ResourceParser { public static URI createResourceURI(final String resource) throws Exception { try { final URI uri = URI.create(resource); if (uri.getScheme() != null) return uri; else { final Path fileResource = Paths.get(resource); return fileResource.toUri(); } } catch (Throwable ex) { try { return new File(resource...
ResourceParser { public static URI createResourceURI(final String resource) throws Exception { try { final URI uri = URI.create(resource); if (uri.getScheme() != null) return uri; else { final Path fileResource = Paths.get(resource); return fileResource.toUri(); } } catch (Throwable ex) { try { return new File(resource...
ResourceParser { public static URI createResourceURI(final String resource) throws Exception { try { final URI uri = URI.create(resource); if (uri.getScheme() != null) return uri; else { final Path fileResource = Paths.get(resource); return fileResource.toUri(); } } catch (Throwable ex) { try { return new File(resource...
ResourceParser { public static URI createResourceURI(final String resource) throws Exception { try { final URI uri = URI.create(resource); if (uri.getScheme() != null) return uri; else { final Path fileResource = Paths.get(resource); return fileResource.toUri(); } } catch (Throwable ex) { try { return new File(resource...
@Test public void testSimProposal() { Proposal proposal = new SimProposal("sim: assertThat(proposal.getDescription(), equalTo("sim: assertThat(proposal.apply("sine"), equalTo("sim: assertThat(proposal.apply("sim: equalTo("sim: assertThat(proposal.apply("sin(-10, 10, 2)"), equalTo("sim: assertThat(proposal.apply("sin(-1...
public SimProposal(final String name, final String... arguments) { super(name); this.arguments = arguments; }
SimProposal extends Proposal { public SimProposal(final String name, final String... arguments) { super(name); this.arguments = arguments; } }
SimProposal extends Proposal { public SimProposal(final String name, final String... arguments) { super(name); this.arguments = arguments; } SimProposal(final String name, final String... arguments); }
SimProposal extends Proposal { public SimProposal(final String name, final String... arguments) { super(name); this.arguments = arguments; } SimProposal(final String name, final String... arguments); @Override String getDescription(); @Override List<MatchSegment> getMatch(final String text); }
SimProposal extends Proposal { public SimProposal(final String name, final String... arguments) { super(name); this.arguments = arguments; } SimProposal(final String name, final String... arguments); @Override String getDescription(); @Override List<MatchSegment> getMatch(final String text); }
@Test public void testMatch() { Proposal proposal = new SimProposal("sim: List<MatchSegment> match = proposal.getMatch("sine"); assertThat(match, equalTo(List.of(MatchSegment.normal("sim: MatchSegment.match("sine"), MatchSegment.comment("(min, max, update_seconds)")))); match = proposal.getMatch("sim: assertThat(match,...
@Override public List<MatchSegment> getMatch(final String text) { final List<String> split = splitNameAndParameters(text); if (split.isEmpty()) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); final String noparm_text = split.get(0); final int match = value.indexOf(noparm_text); if (matc...
SimProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final List<String> split = splitNameAndParameters(text); if (split.isEmpty()) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); final String noparm_text = split.get(0); final int match = value...
SimProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final List<String> split = splitNameAndParameters(text); if (split.isEmpty()) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); final String noparm_text = split.get(0); final int match = value...
SimProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final List<String> split = splitNameAndParameters(text); if (split.isEmpty()) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); final String noparm_text = split.get(0); final int match = value...
SimProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final List<String> split = splitNameAndParameters(text); if (split.isEmpty()) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); final String noparm_text = split.get(0); final int match = value...
@Test public void testHistory() { final History history = new History(); List<Proposal> proposals = history.lookup("test"); assertThat(proposals.size(), equalTo(0)); history.add(new Proposal("Test1")); history.add(new Proposal("Other")); history.add(new Proposal("Test2")); proposals = history.lookup("test"); assertThat...
public History() { this(10); }
History implements ProposalProvider { public History() { this(10); } }
History implements ProposalProvider { public History() { this(10); } History(); History(final int max_size); }
History implements ProposalProvider { public History() { this(10); } History(); History(final int max_size); @Override String getName(); synchronized void add(final Proposal proposal); @Override synchronized List<Proposal> lookup(String text); }
History implements ProposalProvider { public History() { this(10); } History(); History(final int max_size); @Override String getName(); synchronized void add(final Proposal proposal); @Override synchronized List<Proposal> lookup(String text); }
@Test public void testMatch() { Proposal proposal = new FormulaFunctionProposal(new Sin()); List<MatchSegment> match = proposal.getMatch("=sin("); assertThat(match, equalTo(List.of(MatchSegment.normal("="), MatchSegment.match("sin"), MatchSegment.match("("), MatchSegment.comment("", "angle")))); match = proposal.getMat...
@Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(text.substring(0, match))); segs.add(...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
@Test public void testVarArg() { Proposal proposal = new FormulaFunctionProposal(new StringFunction()); List<MatchSegment> match = proposal.getMatch("=concat(a, b) + 2"); assertThat(match, equalTo(List.of(MatchSegment.normal("="), MatchSegment.match("concat"), MatchSegment.match("(a, b)"), MatchSegment.normal(" + 2")))...
@Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(text.substring(0, match))); segs.add(...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
FormulaFunctionProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { final int match = text.indexOf(function.getName()); if (match < 0) return List.of(MatchSegment.normal(getDescription())); final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.n...
@Test public void testGetConfigPvs() { when(nodeDAO.getConfigPvs("a")).thenReturn(Arrays.asList(ConfigPv.builder().build())); assertNotNull(services.getConfigPvs("a")); }
@Override public List<ConfigPv> getConfigPvs(String configUniqueId) { logger.info("Getting config pvs config id id {}", configUniqueId); return nodeDAO.getConfigPvs(configUniqueId); }
Services implements IServices { @Override public List<ConfigPv> getConfigPvs(String configUniqueId) { logger.info("Getting config pvs config id id {}", configUniqueId); return nodeDAO.getConfigPvs(configUniqueId); } }
Services implements IServices { @Override public List<ConfigPv> getConfigPvs(String configUniqueId) { logger.info("Getting config pvs config id id {}", configUniqueId); return nodeDAO.getConfigPvs(configUniqueId); } }
Services implements IServices { @Override public List<ConfigPv> getConfigPvs(String configUniqueId) { logger.info("Getting config pvs config id id {}", configUniqueId); return nodeDAO.getConfigPvs(configUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqu...
Services implements IServices { @Override public List<ConfigPv> getConfigPvs(String configUniqueId) { logger.info("Getting config pvs config id id {}", configUniqueId); return nodeDAO.getConfigPvs(configUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqu...
@Test public void testImplementation() throws Exception { final ScanCommand cmd = new CommentCommand("Test"); final ScanCommandImpl<ScanCommand> impl = ScanCommandImplTool.implement(cmd, null); System.out.println(impl); assertThat(impl, instanceOf(CommentCommandImpl.class)); }
@SuppressWarnings("unchecked") public static <C extends ScanCommand> ScanCommandImpl<C> implement(final C command, final JythonSupport jython) throws Exception { for (ScanCommandImplFactory factory : factories) { ScanCommandImpl<?> impl = factory.createImplementation(command, jython); if (impl != null) return (ScanComm...
ScanCommandImplTool { @SuppressWarnings("unchecked") public static <C extends ScanCommand> ScanCommandImpl<C> implement(final C command, final JythonSupport jython) throws Exception { for (ScanCommandImplFactory factory : factories) { ScanCommandImpl<?> impl = factory.createImplementation(command, jython); if (impl != ...
ScanCommandImplTool { @SuppressWarnings("unchecked") public static <C extends ScanCommand> ScanCommandImpl<C> implement(final C command, final JythonSupport jython) throws Exception { for (ScanCommandImplFactory factory : factories) { ScanCommandImpl<?> impl = factory.createImplementation(command, jython); if (impl != ...
ScanCommandImplTool { @SuppressWarnings("unchecked") public static <C extends ScanCommand> ScanCommandImpl<C> implement(final C command, final JythonSupport jython) throws Exception { for (ScanCommandImplFactory factory : factories) { ScanCommandImpl<?> impl = factory.createImplementation(command, jython); if (impl != ...
ScanCommandImplTool { @SuppressWarnings("unchecked") public static <C extends ScanCommand> ScanCommandImpl<C> implement(final C command, final JythonSupport jython) throws Exception { for (ScanCommandImplFactory factory : factories) { ScanCommandImpl<?> impl = factory.createImplementation(command, jython); if (impl != ...
@Test public void testPlainProposal() { Proposal proposal = new Proposal("Test1"); assertThat(proposal.apply("est"), equalTo("Test1")); assertThat(proposal.apply("anything"), equalTo("Test1")); }
public String apply(final String text) { final StringBuilder result = new StringBuilder(); final List<MatchSegment> match = getMatch(text); for (MatchSegment seg : match) if (seg.getType() != MatchSegment.Type.COMMENT) result.append(seg.getText()); return result.toString(); }
Proposal { public String apply(final String text) { final StringBuilder result = new StringBuilder(); final List<MatchSegment> match = getMatch(text); for (MatchSegment seg : match) if (seg.getType() != MatchSegment.Type.COMMENT) result.append(seg.getText()); return result.toString(); } }
Proposal { public String apply(final String text) { final StringBuilder result = new StringBuilder(); final List<MatchSegment> match = getMatch(text); for (MatchSegment seg : match) if (seg.getType() != MatchSegment.Type.COMMENT) result.append(seg.getText()); return result.toString(); } Proposal(final String value); }
Proposal { public String apply(final String text) { final StringBuilder result = new StringBuilder(); final List<MatchSegment> match = getMatch(text); for (MatchSegment seg : match) if (seg.getType() != MatchSegment.Type.COMMENT) result.append(seg.getText()); return result.toString(); } Proposal(final String value); St...
Proposal { public String apply(final String text) { final StringBuilder result = new StringBuilder(); final List<MatchSegment> match = getMatch(text); for (MatchSegment seg : match) if (seg.getType() != MatchSegment.Type.COMMENT) result.append(seg.getText()); return result.toString(); } Proposal(final String value); St...
@Test public void testMatch() { Proposal proposal = new Proposal("Test1"); List<MatchSegment> match = proposal.getMatch("es"); assertThat(match, equalTo(List.of(MatchSegment.normal("T"), MatchSegment.match("es"), MatchSegment.normal("t1")))); match = proposal.getMatch("Tes"); assertThat(match, equalTo(List.of(MatchSegm...
public List<MatchSegment> getMatch(final String text) { final int match = value.indexOf(text); if (match < 0) return List.of(MatchSegment.normal(value)); else { final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(value.substring(0, match))); if (! text.isEmpty()) segs.add(Matc...
Proposal { public List<MatchSegment> getMatch(final String text) { final int match = value.indexOf(text); if (match < 0) return List.of(MatchSegment.normal(value)); else { final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(value.substring(0, match))); if (! text.isEmpty()) se...
Proposal { public List<MatchSegment> getMatch(final String text) { final int match = value.indexOf(text); if (match < 0) return List.of(MatchSegment.normal(value)); else { final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(value.substring(0, match))); if (! text.isEmpty()) se...
Proposal { public List<MatchSegment> getMatch(final String text) { final int match = value.indexOf(text); if (match < 0) return List.of(MatchSegment.normal(value)); else { final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(value.substring(0, match))); if (! text.isEmpty()) se...
Proposal { public List<MatchSegment> getMatch(final String text) { final int match = value.indexOf(text); if (match < 0) return List.of(MatchSegment.normal(value)); else { final List<MatchSegment> segs = new ArrayList<>(); if (match > 0) segs.add(MatchSegment.normal(value.substring(0, match))); if (! text.isEmpty()) se...
@Test public void testArguments() { List<String> split = LocProposal.splitNameTypeAndInitialValues("loc: assertThat(split, equalTo(Arrays.asList("loc: split = LocProposal.splitNameTypeAndInitialValues("loc: assertThat(split, equalTo(Arrays.asList("loc: split = LocProposal.splitNameTypeAndInitialValues("loc: assertThat(...
static List<String> splitNameTypeAndInitialValues(final String text) { final List<String> result = new ArrayList<>(); int sep = text.indexOf('<'); if (sep >= 0) { result.add(text.substring(0, sep).trim()); int pos = text.indexOf('>', sep+1); if (pos < 0) result.add(text.substring(sep+1).trim()); else { result.add(text....
LocProposal extends Proposal { static List<String> splitNameTypeAndInitialValues(final String text) { final List<String> result = new ArrayList<>(); int sep = text.indexOf('<'); if (sep >= 0) { result.add(text.substring(0, sep).trim()); int pos = text.indexOf('>', sep+1); if (pos < 0) result.add(text.substring(sep+1).t...
LocProposal extends Proposal { static List<String> splitNameTypeAndInitialValues(final String text) { final List<String> result = new ArrayList<>(); int sep = text.indexOf('<'); if (sep >= 0) { result.add(text.substring(0, sep).trim()); int pos = text.indexOf('>', sep+1); if (pos < 0) result.add(text.substring(sep+1).t...
LocProposal extends Proposal { static List<String> splitNameTypeAndInitialValues(final String text) { final List<String> result = new ArrayList<>(); int sep = text.indexOf('<'); if (sep >= 0) { result.add(text.substring(0, sep).trim()); int pos = text.indexOf('>', sep+1); if (pos < 0) result.add(text.substring(sep+1).t...
LocProposal extends Proposal { static List<String> splitNameTypeAndInitialValues(final String text) { final List<String> result = new ArrayList<>(); int sep = text.indexOf('<'); if (sep >= 0) { result.add(text.substring(0, sep).trim()); int pos = text.indexOf('>', sep+1); if (pos < 0) result.add(text.substring(sep+1).t...
@Test public void testLocProposal() { Proposal proposal = new LocProposal("loc: assertThat(proposal.getDescription(), equalTo("loc: proposal = new LocProposal("loc: assertThat(proposal.getDescription(), equalTo("loc: proposal = new LocProposal("loc: assertThat(proposal.getDescription(), equalTo("loc: proposal = new Loc...
public LocProposal(final String name, final String type, final String... initial_values) { super(name); this.type = type; this.initial_values = initial_values; }
LocProposal extends Proposal { public LocProposal(final String name, final String type, final String... initial_values) { super(name); this.type = type; this.initial_values = initial_values; } }
LocProposal extends Proposal { public LocProposal(final String name, final String type, final String... initial_values) { super(name); this.type = type; this.initial_values = initial_values; } LocProposal(final String name, final String type, final String... initial_values); }
LocProposal extends Proposal { public LocProposal(final String name, final String type, final String... initial_values) { super(name); this.type = type; this.initial_values = initial_values; } LocProposal(final String name, final String type, final String... initial_values); @Override String getDescription(); @Override...
LocProposal extends Proposal { public LocProposal(final String name, final String type, final String... initial_values) { super(name); this.type = type; this.initial_values = initial_values; } LocProposal(final String name, final String type, final String... initial_values); @Override String getDescription(); @Override...
@Test public void testMatch() { Proposal proposal = new LocProposal("loc: List<MatchSegment> match = proposal.getMatch("loc: assertThat(match, equalTo(List.of( MatchSegment.match("loc: MatchSegment.comment("<VType>"), MatchSegment.comment("(initial value)")))); match = proposal.getMatch(""); assertThat(match, equalTo(L...
@Override public List<MatchSegment> getMatch(final String text) { if (! text.startsWith("loc")) return List.of(MatchSegment.normal(getDescription())); final List<String> split = splitNameTypeAndInitialValues(text); if (split.size() < 1) return List.of(); final List<MatchSegment> segs = new ArrayList<>(split.size()); St...
LocProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { if (! text.startsWith("loc")) return List.of(MatchSegment.normal(getDescription())); final List<String> split = splitNameTypeAndInitialValues(text); if (split.size() < 1) return List.of(); final List<MatchSegment> segs = ne...
LocProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { if (! text.startsWith("loc")) return List.of(MatchSegment.normal(getDescription())); final List<String> split = splitNameTypeAndInitialValues(text); if (split.size() < 1) return List.of(); final List<MatchSegment> segs = ne...
LocProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { if (! text.startsWith("loc")) return List.of(MatchSegment.normal(getDescription())); final List<String> split = splitNameTypeAndInitialValues(text); if (split.size() < 1) return List.of(); final List<MatchSegment> segs = ne...
LocProposal extends Proposal { @Override public List<MatchSegment> getMatch(final String text) { if (! text.startsWith("loc")) return List.of(MatchSegment.normal(getDescription())); final List<String> split = splitNameTypeAndInitialValues(text); if (split.size() < 1) return List.of(); final List<MatchSegment> segs = ne...
@Test public void testProperties() { System.out.println(PreferencesReader.replaceProperties("Running on Java $(java.version) in $(java.home)")); System.out.println("Expect warning about undefined property"); assertThat(PreferencesReader.replaceProperties("$(VeryUnlikelyToExist)"), equalTo("$(VeryUnlikelyToExist)")); Sy...
static String replaceProperties(final String value) { if (value == null) return value; String result = value; Matcher matcher = PROP_PATTERN.matcher(value); while (matcher.find()) { final String prop_spec = matcher.group(); final String prop_name = prop_spec.substring(2, prop_spec.length()-1); final int start = matcher...
PreferencesReader { static String replaceProperties(final String value) { if (value == null) return value; String result = value; Matcher matcher = PROP_PATTERN.matcher(value); while (matcher.find()) { final String prop_spec = matcher.group(); final String prop_name = prop_spec.substring(2, prop_spec.length()-1); final...
PreferencesReader { static String replaceProperties(final String value) { if (value == null) return value; String result = value; Matcher matcher = PROP_PATTERN.matcher(value); while (matcher.find()) { final String prop_spec = matcher.group(); final String prop_name = prop_spec.substring(2, prop_spec.length()-1); final...
PreferencesReader { static String replaceProperties(final String value) { if (value == null) return value; String result = value; Matcher matcher = PROP_PATTERN.matcher(value); while (matcher.find()) { final String prop_spec = matcher.group(); final String prop_name = prop_spec.substring(2, prop_spec.length()-1); final...
PreferencesReader { static String replaceProperties(final String value) { if (value == null) return value; String result = value; Matcher matcher = PROP_PATTERN.matcher(value); while (matcher.find()) { final String prop_spec = matcher.group(); final String prop_name = prop_spec.substring(2, prop_spec.length()-1); final...
@Test(timeout=5000) public void testUpdateThrottle() throws Exception { final Runnable update = new Runnable() { @Override public void run() { System.out.println("<- Update!"); updates.incrementAndGet(); synchronized (this) { notifyAll(); } } }; final UpdateThrottle throttle = new UpdateThrottle(1L, TimeUnit.SECONDS, u...
public UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update) { this(dormant_time, unit, update, TIMER); }
UpdateThrottle { public UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update) { this(dormant_time, unit, update, TIMER); } }
UpdateThrottle { public UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update) { this(dormant_time, unit, update, TIMER); } UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update); UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable updat...
UpdateThrottle { public UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update) { this(dormant_time, unit, update, TIMER); } UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update); UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable updat...
UpdateThrottle { public UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update) { this(dormant_time, unit, update, TIMER); } UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable update); UpdateThrottle(final long dormant_time, final TimeUnit unit, final Runnable updat...
@Test public void testNaNInf() throws Exception { VType number = VDouble.of(Double.NaN, Alarm.none(), Time.now(), display); String text = FormatOptionHandler.format(number, FormatOption.DEFAULT, -1, true); System.out.println(text); assertThat(text, equalTo("NaN V")); number = VDouble.of(Double.POSITIVE_INFINITY, Alarm....
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testDecimal() throws Exception { VType number = VDouble.of(3.16, Alarm.none(), Time.now(), display); assertThat(fmt.format(3.16), equalTo("3.16")); String text = FormatOptionHandler.format(number, FormatOption.DEFAULT, -1, true); System.out.println(text); assertThat(text, equalTo("3.160 V")); text = F...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testEnum() throws Exception { final VEnum value = VEnum.of(1, EnumDisplay.of("One", "Two"), Alarm.none(), Time.now()); String text = FormatOptionHandler.format(value, FormatOption.DECIMAL, 4, true); System.out.println(text); assertThat(text, equalTo("1")); text = FormatOptionHandler.format(value, Form...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testSaveSnapshot() { when(nodeDAO.saveSnapshot("a", Collections.emptyList(), "b", "c", "d")).thenReturn(Node.builder().nodeType(NodeType.SNAPSHOT).build()); assertNotNull(services.saveSnapshot("a", Collections.emptyList(), "b", "d", "c")); }
@Override public Node saveSnapshot(String configUniqueId, List<SnapshotItem> snapshotItems, String snapshotName, String userName, String comment) { logger.info("Saving snapshot for config id {}", configUniqueId); logger.info("Snapshot name: {}, values:", snapshotName); for (SnapshotItem snapshotItem : snapshotItems) { ...
Services implements IServices { @Override public Node saveSnapshot(String configUniqueId, List<SnapshotItem> snapshotItems, String snapshotName, String userName, String comment) { logger.info("Saving snapshot for config id {}", configUniqueId); logger.info("Snapshot name: {}, values:", snapshotName); for (SnapshotItem ...
Services implements IServices { @Override public Node saveSnapshot(String configUniqueId, List<SnapshotItem> snapshotItems, String snapshotName, String userName, String comment) { logger.info("Saving snapshot for config id {}", configUniqueId); logger.info("Snapshot name: {}, values:", snapshotName); for (SnapshotItem ...
Services implements IServices { @Override public Node saveSnapshot(String configUniqueId, List<SnapshotItem> snapshotItems, String snapshotName, String userName, String comment) { logger.info("Saving snapshot for config id {}", configUniqueId); logger.info("Snapshot name: {}, values:", snapshotName); for (SnapshotItem ...
Services implements IServices { @Override public Node saveSnapshot(String configUniqueId, List<SnapshotItem> snapshotItems, String snapshotName, String userName, String comment) { logger.info("Saving snapshot for config id {}", configUniqueId); logger.info("Snapshot name: {}, values:", snapshotName); for (SnapshotItem ...
@Test public void testExponential() throws Exception { VType number = VDouble.of(3.16, Alarm.none(), Time.now(), display); String text = FormatOptionHandler.format(number, FormatOption.DEFAULT, -1, true); System.out.println(text); assertThat(text, equalTo("3.160 V")); text = FormatOptionHandler.format(number, FormatOpt...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testEngineering() throws Exception { VType number = VDouble.of(0.0316, Alarm.none(), Time.now(), display); String text = FormatOptionHandler.format(number, FormatOption.ENGINEERING, 1, true); System.out.println(text); assertThat(text, equalTo("31.6E-3 V")); text = FormatOptionHandler.format(number, Fo...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testHexFormat() throws Exception { VType number = VDouble.of(65535.0, Alarm.none(), Time.now(), display); String text = FormatOptionHandler.format(number, FormatOption.HEX, 4, true); System.out.println(text); assertThat(text, equalTo("0xFFFF V")); text = FormatOptionHandler.format(number, FormatOption...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testHexParse() throws Exception { final VType number = VDouble.of(65535.0, Alarm.none(), Time.now(), display); Object parsed = FormatOptionHandler.parse(number, "0xFF", FormatOption.HEX); System.out.println(parsed); assertThat(parsed, instanceOf(Number.class)); assertThat(((Number)parsed).intValue(), ...
public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.startsWith("0X")) text =...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
@Test public void testString() throws Exception { VType value = VString.of("Test1", Alarm.none(), Time.now()); String text = FormatOptionHandler.format(value, FormatOption.DEFAULT, -1, true); System.out.println(text); assertThat(text, equalTo("Test1")); text = FormatOptionHandler.format(value, FormatOption.STRING, -1, ...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testCompact() throws Exception { String text = FormatOptionHandler.format(VDouble.of(65.43, Alarm.none(), Time.now(), display), FormatOption.COMPACT, 2, true); System.out.println(text); assertThat(text, equalTo("65.43 V")); text = FormatOptionHandler.format(VDouble.of(0.00006543, Alarm.none(), Time.no...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testBinary() throws Exception { String text = FormatOptionHandler.format(VLong.of(0b101010, Alarm.none(), Time.now(), display), FormatOption.BINARY, 10, true); System.out.println(text); assertThat(text, equalTo("0b0000101010 V")); text = FormatOptionHandler.format(VLong.of(0b101010, Alarm.none(), Time...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testBinaryParse() throws Exception { final VType number = VLong.of(0b101010, Alarm.none(), Time.now(), display); Object parsed = FormatOptionHandler.parse(number, "0b0000101010", FormatOption.BINARY); System.out.println(parsed); assertThat(parsed, instanceOf(Number.class)); assertThat(((Number)parsed)...
public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.startsWith("0X")) text =...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
@Test public void testArray() throws Exception { final ListNumber data = ArrayDouble.of(1.0, 2.0, 3.0, 4.0); VType value = VNumberArray.of(data, Alarm.none(), Time.now(), display); System.out.println(value); String text = FormatOptionHandler.format(value, FormatOption.DEFAULT, 0, true); System.out.println(text); assert...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testSexagesimalFormat() throws Exception { final VType sexaPositiveValue = VDouble.of(12.5824414, Alarm.none(), Time.now(), display), sexaNegativeValue = VDouble.of(-12.5824414, Alarm.none(), Time.now(), display), sexaRoundedValue = VDouble.of(12.9999999, Alarm.none(), Time.now(), display); assertThat...
public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = formatNumber(number.getValue...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
FormatOptionHandler { public static String format(final VType value, final FormatOption option, int precision, final boolean show_units) { precision = actualPrecision(value, precision); if (value == null) return "<null>"; if (value instanceof VNumber) { final VNumber number = (VNumber) value; final String text = format...
@Test public void testGetFromPath(){ Node node = Node.builder().name("SomeFolder").build(); when(nodeDAO.getFromPath("path")).thenReturn(Arrays.asList(node)); assertEquals("SomeFolder", services.getFromPath("path").get(0).getName()); }
@Override public List<Node> getFromPath(String path){ return nodeDAO.getFromPath(path); }
Services implements IServices { @Override public List<Node> getFromPath(String path){ return nodeDAO.getFromPath(path); } }
Services implements IServices { @Override public List<Node> getFromPath(String path){ return nodeDAO.getFromPath(path); } }
Services implements IServices { @Override public List<Node> getFromPath(String path){ return nodeDAO.getFromPath(path); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNode(String pa...
Services implements IServices { @Override public List<Node> getFromPath(String path){ return nodeDAO.getFromPath(path); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNode(String pa...
@Test public void testSexagesimalParser() throws Exception { final VType number = VDouble.of(0.0, Alarm.none(), Time.now(), display); assertEquals(12.5824414, (Double)FormatOptionHandler.parse(number, "12:34:56.789", FormatOption.SEXAGESIMAL), 0.0000001); assertEquals(Math.PI, (Double)FormatOptionHandler.parse(number, ...
public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.startsWith("0X")) text =...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
@Test public void testNumberParsing() throws Exception { VType value = VDouble.of(3.16, Alarm.none(), Time.now(), display); Object parsed = FormatOptionHandler.parse(value, "42.5 Socks", FormatOption.DEFAULT); assertThat(parsed, instanceOf(Number.class)); assertThat(((Number)parsed).doubleValue(), equalTo(42.5)); }
public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.startsWith("0X")) text =...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
@Test public void testNumberArrayParsing() throws Exception { final ListNumber data = ArrayDouble.of(1.0, 2.0, 3.0, 4.0); final VType value = VNumberArray.of(data, Alarm.none(), Time.now(), display); Object parsed = FormatOptionHandler.parse(value, " [ 1, 2.5 , 3 ] ", FormatOption.DEFAULT); assertThat(parsed, instanceO...
public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.startsWith("0X")) text =...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
FormatOptionHandler { public static Object parse(final VType value, String text, final FormatOption format) { try { switch (format) { case STRING: return text; case HEX: { text = text.trim(); final int sep = text.lastIndexOf(' '); if (sep > 0) text = text.substring(0, sep).trim(); text = text.toUpperCase(); if (text.st...
@Test public void compute(){ ArrayScalarDivisionFunction arrayScalarDivisionFunction = new ArrayScalarDivisionFunction(); assertEquals("arrayDivScalar", arrayScalarDivisionFunction.getName()); assertEquals("array", arrayScalarDivisionFunction.getCategory()); VType array = VNumberArray.of(ArrayDouble.of(2.0, 10.0, 30.0)...
@Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array1 = (VNumberArray)args[0]; VNumber factor = (VNumber) args[1]; return VNumberArray.of( ListMath.rescale(array1.getData(), 1d / factor.getValue().doubleValue(), 0), Alarm.none(), Time....
ArrayScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array1 = (VNumberArray)args[0]; VNumber factor = (VNumber) args[1]; return VNumberArray.of( ListMath.rescale(array1.getData(), 1d / ...
ArrayScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array1 = (VNumberArray)args[0]; VNumber factor = (VNumber) args[1]; return VNumberArray.of( ListMath.rescale(array1.getData(), 1d / ...
ArrayScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array1 = (VNumberArray)args[0]; VNumber factor = (VNumber) args[1]; return VNumberArray.of( ListMath.rescale(array1.getData(), 1d / ...
ArrayScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array1 = (VNumberArray)args[0]; VNumber factor = (VNumber) args[1]; return VNumberArray.of( ListMath.rescale(array1.getData(), 1d / ...
@Test public void compute() { ArrayMinFunction arrayMinFunction = new ArrayMinFunction(); assertEquals("arrayMin", arrayMinFunction.getName()); assertEquals("array", arrayMinFunction.getCategory()); VNumberArray doubleArray = VNumberArray.of(ArrayDouble.of(-1.0, 0, 1.0, 2.0, 3.0, 4.0, 5), Alarm.none(), Time.now(), Disp...
@Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMin(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } }
ArrayMinFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMin(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } }
ArrayMinFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMin(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
ArrayMinFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMin(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
ArrayMinFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMin(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
@Test public void computeString() throws Exception{ ElementAtNumberFunction elementAtNumberFunction = new ElementAtNumberFunction(); VType index = VDouble.of(2.0, Alarm.none(), Time.now(), Display.none()); VType array = VStringArray.of(List.of("a", "b", "c")); VString vString = (VString) elementAtNumberFunction.compute...
@Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)args[1]).getValue().intValue(); if(index < 0 || index >...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
@Test(expected = Exception.class) public void invalidArguments1() throws Exception{ ElementAtNumberFunction elementAtNumberFunction = new ElementAtNumberFunction(); VType index = VDouble.of(8.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0), Alarm.none(), Time.no...
@Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)args[1]).getValue().intValue(); if(index < 0 || index >...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
@Test(expected = Exception.class) public void invalidArguments2() throws Exception{ ElementAtNumberFunction elementAtNumberFunction = new ElementAtNumberFunction(); VType index = VDouble.of(-1.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0), Alarm.none(), Time.n...
@Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)args[1]).getValue().intValue(); if(index < 0 || index >...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
ElementAtNumberFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { boolean isStringArray = args[0] instanceof VStringArray; if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray numberArray = (VNumberArray)args[0]; int index = ((VNumber)arg...
@Test public void compute() { ArrayOfFunction arrayOfFunction = new ArrayOfFunction(); assertEquals("arrayOf", arrayOfFunction.getName()); assertEquals("array", arrayOfFunction.getCategory()); VString a = VString.of("a", Alarm.none(), Time.now()); VString b = VString.of("b", Alarm.none(), Time.now()); VString c = VStri...
@Override public VType compute(VType... args) { if(args[0] instanceof VString){ List<String> data = new ArrayList<>(); for (Object arg : args) { if(arg == null){ data.add(null); } else { data.add(((VString)arg).getValue()); } } return VStringArray.of(data, Alarm.none(), Time.now()); } else if(args[0] instanceof VNumber...
ArrayOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VString){ List<String> data = new ArrayList<>(); for (Object arg : args) { if(arg == null){ data.add(null); } else { data.add(((VString)arg).getValue()); } } return VStringArray.of(data, Alarm.none(), Time....
ArrayOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VString){ List<String> data = new ArrayList<>(); for (Object arg : args) { if(arg == null){ data.add(null); } else { data.add(((VString)arg).getValue()); } } return VStringArray.of(data, Alarm.none(), Time....
ArrayOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VString){ List<String> data = new ArrayList<>(); for (Object arg : args) { if(arg == null){ data.add(null); } else { data.add(((VString)arg).getValue()); } } return VStringArray.of(data, Alarm.none(), Time....
ArrayOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VString){ List<String> data = new ArrayList<>(); for (Object arg : args) { if(arg == null){ data.add(null); } else { data.add(((VString)arg).getValue()); } } return VStringArray.of(data, Alarm.none(), Time....
@Test public void compute() throws Exception{ ArrayDivisionFunction arrayDivisionFunction = new ArrayDivisionFunction(); assertEquals("arrayDiv", arrayDivisionFunction.getName()); assertEquals("array", arrayDivisionFunction.getCategory()); VType array1 = VNumberArray.of(ArrayDouble.of(2.0, 10.0, 30.0), Alarm.none(), Ti...
@Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2.getData().size()){ throw new Exception(String.fo...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
@Test public void testGetFullPath(){ when(nodeDAO.getFullPath("nodeId")).thenReturn("/a/b/c"); assertEquals("/a/b/c", nodeDAO.getFullPath("nodeId")); }
@Override public String getFullPath(String uniqueNodeId){ return nodeDAO.getFullPath(uniqueNodeId); }
Services implements IServices { @Override public String getFullPath(String uniqueNodeId){ return nodeDAO.getFullPath(uniqueNodeId); } }
Services implements IServices { @Override public String getFullPath(String uniqueNodeId){ return nodeDAO.getFullPath(uniqueNodeId); } }
Services implements IServices { @Override public String getFullPath(String uniqueNodeId){ return nodeDAO.getFullPath(uniqueNodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNo...
Services implements IServices { @Override public String getFullPath(String uniqueNodeId){ return nodeDAO.getFullPath(uniqueNodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Override Node createNo...
@Test(expected = Exception.class) public void testWrongArguments() throws Exception{ ArrayDivisionFunction arrayDivisionFunction = new ArrayDivisionFunction(); VType array1 = VNumberArray.of(ArrayDouble.of(1.0, 2.0), Alarm.none(), Time.now(), Display.none()); VType array2 = VNumberArray.of(ArrayDouble.of(2.0, 5.0, 7.0)...
@Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2.getData().size()){ throw new Exception(String.fo...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
ArrayDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(VTypeHelper.isNumericArray(args[0]) && VTypeHelper.isNumericArray(args[1])){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array...
@Test public void compute() { ArrayMaxFunction arrayMaxFunction = new ArrayMaxFunction(); assertEquals("arrayMax", arrayMaxFunction.getName()); assertEquals("array", arrayMaxFunction.getCategory()); VNumberArray doubleArray = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0, 4.0, 5), Alarm.none(), Time.now(), Display.none(...
@Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMax(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } }
ArrayMaxFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMax(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } }
ArrayMaxFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMax(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
ArrayMaxFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMax(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
ArrayMaxFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { return VDouble.of(Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics().getMax(), Alarm.none(), Time.now(), Display.none()); } else { return DEFAULT_NAN_DOUBLE_ARRAY; } } ...
@Test public void compute() throws Exception{ ArrayMultiplicationFunction arrayMultiplicationFunction = new ArrayMultiplicationFunction(); assertEquals("arrayMult", arrayMultiplicationFunction.getName()); assertEquals("array", arrayMultiplicationFunction.getCategory()); VType array1 = VNumberArray.of(ArrayDouble.of(1.0...
@Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2.getData().size()){ throw new Exception(String.format("Fu...
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
@Test(expected = Exception.class) public void testWrongArguments() throws Exception{ ArrayMultiplicationFunction arrayMultiplicationFunction = new ArrayMultiplicationFunction(); VType array1 = VNumberArray.of(ArrayDouble.of(1.0, 2.0), Alarm.of(AlarmSeverity.MAJOR, AlarmStatus.NONE, ""), Time.now(), Display.none()); VTy...
@Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2.getData().size()){ throw new Exception(String.format("Fu...
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
ArrayMultiplicationFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { if(args[0] instanceof VNumberArray && args[1] instanceof VNumberArray){ VNumberArray array1 = (VNumberArray)args[0]; VNumberArray array2 = (VNumberArray)args[1]; if(array1.getData().size() != array2....
@Test public void compute() { ArrayRangeOfFunction arrayRangeOfFunction = new ArrayRangeOfFunction(); assertEquals("arrayRangeOf", arrayRangeOfFunction.getName()); assertEquals("array", arrayRangeOfFunction.getCategory()); Display display = Display.of(Range.of(1d, 10d), Range.of(10d, 20d), Range.of(20d, 30d), Range.of(...
@Override public VType compute(VType... args) { if(args[0] instanceof VNumberArray){ VNumberArray array = (VNumberArray)args[0]; Range range = array.getDisplay().getDisplayRange(); double min = range.getMinimum(); double max = range.getMaximum(); return VNumberArray.of( ArrayDouble.of(min, max), Alarm.none(), Time.now(...
ArrayRangeOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumberArray){ VNumberArray array = (VNumberArray)args[0]; Range range = array.getDisplay().getDisplayRange(); double min = range.getMinimum(); double max = range.getMaximum(); return VNumberArray.of( ...
ArrayRangeOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumberArray){ VNumberArray array = (VNumberArray)args[0]; Range range = array.getDisplay().getDisplayRange(); double min = range.getMinimum(); double max = range.getMaximum(); return VNumberArray.of( ...
ArrayRangeOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumberArray){ VNumberArray array = (VNumberArray)args[0]; Range range = array.getDisplay().getDisplayRange(); double min = range.getMinimum(); double max = range.getMaximum(); return VNumberArray.of( ...
ArrayRangeOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumberArray){ VNumberArray array = (VNumberArray)args[0]; Range range = array.getDisplay().getDisplayRange(); double min = range.getMinimum(); double max = range.getMaximum(); return VNumberArray.of( ...
@Test public void compute() throws Exception{ ScaleArrayFormulaFunction scaleArray = new ScaleArrayFormulaFunction(); assertEquals("scale", scaleArray.getName()); assertEquals("array", scaleArray.getCategory()); VType factor = VDouble.of(2.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(Arra...
@Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; VNumber factor = (VNum...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
@Test(expected = Exception.class) public void testWrongNnumberOfArgumenst1() throws Exception{ ScaleArrayFormulaFunction scaleArray = new ScaleArrayFormulaFunction(); VType factor = VDouble.of(2.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0), Alarm.none(), Time...
@Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; VNumber factor = (VNum...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
@Test(expected = Exception.class) public void testWrongNnumberOfArgumenst2() throws Exception{ ScaleArrayFormulaFunction scaleArray = new ScaleArrayFormulaFunction(); VType array = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0), Alarm.none(), Time.now(), Display.none()); scaleArray.compute(array); }
@Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; VNumber factor = (VNum...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
ScaleArrayFormulaFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception{ if(args.length != 2 && args.length != 3){ throw new Exception(String.format("Function %s takes 2 or 3 aruments, got %d", getName(), args.length)); } if(VTypeHelper.isNumericArray(args[0])){ VNumberArray...
@Test public void compute() { ArrayStatsFunction arrayStatsFunction = new ArrayStatsFunction(); assertEquals("arrayStats", arrayStatsFunction.getName()); assertEquals("array", arrayStatsFunction.getCategory()); VNumberArray numberArray = VNumberArray.of(ArrayDouble.of(1d, 2d), Alarm.none(), Time.now(), Display.none());...
@Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { DoubleSummaryStatistics stats = Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics(); return VStatistics.of(stats.getAverage(), Double.NaN, stats.getMin(), stats.getMax(), (int) stats.getCount(), Alarm.none(), Time.n...
ArrayStatsFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { DoubleSummaryStatistics stats = Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics(); return VStatistics.of(stats.getAverage(), Double.NaN, stats.getMin(), stats.getMax(...
ArrayStatsFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { DoubleSummaryStatistics stats = Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics(); return VStatistics.of(stats.getAverage(), Double.NaN, stats.getMin(), stats.getMax(...
ArrayStatsFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { DoubleSummaryStatistics stats = Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics(); return VStatistics.of(stats.getAverage(), Double.NaN, stats.getMin(), stats.getMax(...
ArrayStatsFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { DoubleSummaryStatistics stats = Arrays.stream(VTypeHelper.toDoubles(args[0])).summaryStatistics(); return VStatistics.of(stats.getAverage(), Double.NaN, stats.getMin(), stats.getMax(...
@Test public void compute() { ArraySumFunction scaleArrayFunction = new ArraySumFunction(); assertEquals("arraySum", scaleArrayFunction.getName()); assertEquals("array", scaleArrayFunction.getCategory()); VType offset = VDouble.of(2.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(ArrayDouble...
@Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber offset = (VNumber)args[1]; return VNumberArray.of( ListMath.rescale(array.getData(), 1, offset.getValue().doubleValue()), Alarm.none(), Time.now(), D...
ArraySumFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber offset = (VNumber)args[1]; return VNumberArray.of( ListMath.rescale(array.getData(), 1, offset.getValue(...
ArraySumFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber offset = (VNumber)args[1]; return VNumberArray.of( ListMath.rescale(array.getData(), 1, offset.getValue(...
ArraySumFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber offset = (VNumber)args[1]; return VNumberArray.of( ListMath.rescale(array.getData(), 1, offset.getValue(...
ArraySumFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber offset = (VNumber)args[1]; return VNumberArray.of( ListMath.rescale(array.getData(), 1, offset.getValue(...
@Test public void testGetDataType() { VByte vByte = VByte.of(new Byte((byte) 1), alarm, time, display); assertEquals(SnapshotPvDataType.BYTE, SnapshotDataConverter.getDataType(vByte)); VUByte vUByte = VUByte.of(new UByte((byte) 1), alarm, time, display); assertEquals(SnapshotPvDataType.UBYTE, SnapshotDataConverter.getD...
protected static SnapshotPvDataType getDataType(VType vType) { if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Class<?> clazz = vNumber.getValue().getClass(); if(clazz.equals(Byte.class)) { return SnapshotPvDataType.BYTE; } else if(clazz.equals(UByte.class)) { return SnapshotPvDataType.UBYTE; } else if...
SnapshotDataConverter { protected static SnapshotPvDataType getDataType(VType vType) { if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Class<?> clazz = vNumber.getValue().getClass(); if(clazz.equals(Byte.class)) { return SnapshotPvDataType.BYTE; } else if(clazz.equals(UByte.class)) { return SnapshotPvD...
SnapshotDataConverter { protected static SnapshotPvDataType getDataType(VType vType) { if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Class<?> clazz = vNumber.getValue().getClass(); if(clazz.equals(Byte.class)) { return SnapshotPvDataType.BYTE; } else if(clazz.equals(UByte.class)) { return SnapshotPvD...
SnapshotDataConverter { protected static SnapshotPvDataType getDataType(VType vType) { if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Class<?> clazz = vNumber.getValue().getClass(); if(clazz.equals(Byte.class)) { return SnapshotPvDataType.BYTE; } else if(clazz.equals(UByte.class)) { return SnapshotPvD...
SnapshotDataConverter { protected static SnapshotPvDataType getDataType(VType vType) { if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Class<?> clazz = vNumber.getValue().getClass(); if(clazz.equals(Byte.class)) { return SnapshotPvDataType.BYTE; } else if(clazz.equals(UByte.class)) { return SnapshotPvD...
@Test public void compute() { ArrayInverseScalarDivisionFunction arrayScalarDivisionFunction = new ArrayInverseScalarDivisionFunction(); assertEquals("arrayDivScalarInv", arrayScalarDivisionFunction.getName()); assertEquals("array", arrayScalarDivisionFunction.getCategory()); VType array = VNumberArray.of(ArrayDouble.o...
@Override public VType compute(VType... args) { if(args[0] instanceof VNumber && VTypeHelper.isNumericArray(args[1])){ VNumberArray array = (VNumberArray)args[1]; VNumber factor = (VNumber) args[0]; return VNumberArray.of( ListMath.inverseRescale(array.getData(), factor.getValue().doubleValue(), 0), Alarm.none(), Time....
ArrayInverseScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumber && VTypeHelper.isNumericArray(args[1])){ VNumberArray array = (VNumberArray)args[1]; VNumber factor = (VNumber) args[0]; return VNumberArray.of( ListMath.inverseRescale(array.getD...
ArrayInverseScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumber && VTypeHelper.isNumericArray(args[1])){ VNumberArray array = (VNumberArray)args[1]; VNumber factor = (VNumber) args[0]; return VNumberArray.of( ListMath.inverseRescale(array.getD...
ArrayInverseScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumber && VTypeHelper.isNumericArray(args[1])){ VNumberArray array = (VNumberArray)args[1]; VNumber factor = (VNumber) args[0]; return VNumberArray.of( ListMath.inverseRescale(array.getD...
ArrayInverseScalarDivisionFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(args[0] instanceof VNumber && VTypeHelper.isNumericArray(args[1])){ VNumberArray array = (VNumberArray)args[1]; VNumber factor = (VNumber) args[0]; return VNumberArray.of( ListMath.inverseRescale(array.getD...
@Test public void compute() { ArrayPowFunction arrayPowFunction = new ArrayPowFunction(); assertEquals("arrayPow", arrayPowFunction.getName()); assertEquals("array", arrayPowFunction.getCategory()); VType exponent = VDouble.of(2.0, Alarm.none(), Time.now(), Display.none()); VType array = VNumberArray.of(ArrayDouble.of(...
@Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber exponent = (VNumber)args[1]; return VNumberArray.of( ListMath.pow(array.getData(), exponent.getValue().doubleValue()), Alarm.none(), Time.now(), Disp...
ArrayPowFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber exponent = (VNumber)args[1]; return VNumberArray.of( ListMath.pow(array.getData(), exponent.getValue().d...
ArrayPowFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber exponent = (VNumber)args[1]; return VNumberArray.of( ListMath.pow(array.getData(), exponent.getValue().d...
ArrayPowFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber exponent = (VNumber)args[1]; return VNumberArray.of( ListMath.pow(array.getData(), exponent.getValue().d...
ArrayPowFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if(VTypeHelper.isNumericArray(args[0]) && args[1] instanceof VNumber){ VNumberArray array = (VNumberArray)args[0]; VNumber exponent = (VNumber)args[1]; return VNumberArray.of( ListMath.pow(array.getData(), exponent.getValue().d...
@Test public void compute() { HistogramOfFunction function = new HistogramOfFunction(); assertEquals("histogramOf", function.getName()); assertEquals("array", function.getCategory()); double[] data = new double[1000]; for(int i = 0; i < 1000; i++){ data[i] = 1.0 * i; } VDoubleArray vDoubleArray = VDoubleArray.of(ArrayD...
@Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { VNumberArray numberArray = (VNumberArray) args[0]; if (numberArray == null) { return null; } VNumberArray previousValue = null; VNumberArray previousResult = null; Range previousXRange = null; if (previousValue == numberArray) { ...
HistogramOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { VNumberArray numberArray = (VNumberArray) args[0]; if (numberArray == null) { return null; } VNumberArray previousValue = null; VNumberArray previousResult = null; Range previousXRa...
HistogramOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { VNumberArray numberArray = (VNumberArray) args[0]; if (numberArray == null) { return null; } VNumberArray previousValue = null; VNumberArray previousResult = null; Range previousXRa...
HistogramOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { VNumberArray numberArray = (VNumberArray) args[0]; if (numberArray == null) { return null; } VNumberArray previousValue = null; VNumberArray previousResult = null; Range previousXRa...
HistogramOfFunction extends BaseArrayFunction { @Override public VType compute(VType... args) { if (VTypeHelper.isNumericArray(args[0])) { VNumberArray numberArray = (VNumberArray) args[0]; if (numberArray == null) { return null; } VNumberArray previousValue = null; VNumberArray previousResult = null; Range previousXRa...
@Test public void compute() throws Exception{ SubArrayFunction subArrayFunction = new SubArrayFunction(); assertEquals("subArray", subArrayFunction.getName()); assertEquals("array", subArrayFunction.getCategory()); VType array = VNumberArray.of(ArrayDouble.of(1.0, 2.0, 3.0, 4.0, 5.0), Alarm.none(), Time.now(), Display....
@Override public VType compute(VType... args) throws Exception { VNumber fromIndex = (VNumber) args[1]; VNumber toIndex = (VNumber) args[2]; if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; if(fromIndex.getValue().intValue() < 0 || (fromIndex.getValue().intValue() > toIndex.getValue(...
SubArrayFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { VNumber fromIndex = (VNumber) args[1]; VNumber toIndex = (VNumber) args[2]; if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; if(fromIndex.getValue().intValue() < 0 || (fromIn...
SubArrayFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { VNumber fromIndex = (VNumber) args[1]; VNumber toIndex = (VNumber) args[2]; if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; if(fromIndex.getValue().intValue() < 0 || (fromIn...
SubArrayFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { VNumber fromIndex = (VNumber) args[1]; VNumber toIndex = (VNumber) args[2]; if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; if(fromIndex.getValue().intValue() < 0 || (fromIn...
SubArrayFunction extends BaseArrayFunction { @Override public VType compute(VType... args) throws Exception { VNumber fromIndex = (VNumber) args[1]; VNumber toIndex = (VNumber) args[2]; if(VTypeHelper.isNumericArray(args[0])){ VNumberArray array = (VNumberArray)args[0]; if(fromIndex.getValue().intValue() < 0 || (fromIn...
@Test public void testEmpty() throws Exception { FieldRequest request = new FieldRequest(""); System.out.println(request); ByteBuffer buffer = encode(request); System.out.println(Hexdump.toHexdump(buffer)); }
public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
@Test public void testPlainFields() throws Exception { FieldRequest request = new FieldRequest("field(proton_charge,pixel)"); System.out.println(request); ByteBuffer buffer = encode(request); System.out.println(Hexdump.toHexdump(buffer)); }
public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
@Test public void testSubFields() throws Exception { FieldRequest request = new FieldRequest("field(value, timeStamp.userTag)"); System.out.println(request); ByteBuffer buffer = encode(request); System.out.println(Hexdump.toHexdump(buffer)); request = new FieldRequest("field(proton_charge,pixel,timeStamp.userTag)"); Sy...
public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
@Test public void testPipeline() throws Exception { FieldRequest request = new FieldRequest(10, "field(value)"); System.out.println(request); ByteBuffer buffer = encode(request); System.out.println(Hexdump.toHexdump(buffer)); }
public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
FieldRequest { public void encode(final ByteBuffer buffer) throws Exception { desc.encode(buffer); } FieldRequest(final String request); FieldRequest(final int pipeline, final String request); void encodeType(final ByteBuffer buffer); void encode(final ByteBuffer buffer); @Override String toString(); }
@Test public void testToDouble(){ VDouble doubleValue = VDouble.of(7.7, Alarm.none(), Time.now(), Display.none()); double result = VTypeHelper.toDouble(doubleValue); assertEquals(7.7, result, 0); VString stringValue = VString.of("7.7", Alarm.none(), Time.now()); result = VTypeHelper.toDouble(doubleValue); assertEquals(...
final public static double toDouble(final VType value) { return toDouble(value, 0); }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
@Test public void testArrayToDoubleWithValidIndex(){ VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); double result = VTypeHelper.toDouble(doubleArray, 0); assertEquals(7.7, result, 0); result = VTypeHelper.toDouble(doubleArray, 1); assertEquals(8.8, result...
final public static double toDouble(final VType value) { return toDouble(value, 0); }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
@Test(expected = RuntimeException.class) public void testUnsupportedType() { VEnumArray vEnumArray = VEnumArray.of(ArrayInteger.of(1, 2, 3), EnumDisplay.of("a", "b", "c"), Alarm.none(), Time.now()); SnapshotDataConverter.fromVType(vEnumArray); }
public static SnapshotPv fromVType(VType vType) { SnapshotPvDataType dataType = getDataType(vType); if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Alarm alarm = vNumber.getAlarm(); Instant instant = vNumber.getTime().getTimestamp(); return SnapshotPv.builder() .alarmSeverity(alarm.getSeverity()) .alar...
SnapshotDataConverter { public static SnapshotPv fromVType(VType vType) { SnapshotPvDataType dataType = getDataType(vType); if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Alarm alarm = vNumber.getAlarm(); Instant instant = vNumber.getTime().getTimestamp(); return SnapshotPv.builder() .alarmSeverity(al...
SnapshotDataConverter { public static SnapshotPv fromVType(VType vType) { SnapshotPvDataType dataType = getDataType(vType); if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Alarm alarm = vNumber.getAlarm(); Instant instant = vNumber.getTime().getTimestamp(); return SnapshotPv.builder() .alarmSeverity(al...
SnapshotDataConverter { public static SnapshotPv fromVType(VType vType) { SnapshotPvDataType dataType = getDataType(vType); if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Alarm alarm = vNumber.getAlarm(); Instant instant = vNumber.getTime().getTimestamp(); return SnapshotPv.builder() .alarmSeverity(al...
SnapshotDataConverter { public static SnapshotPv fromVType(VType vType) { SnapshotPvDataType dataType = getDataType(vType); if(vType instanceof VNumber) { VNumber vNumber = (VNumber)vType; Alarm alarm = vNumber.getAlarm(); Instant instant = vNumber.getTime().getTimestamp(); return SnapshotPv.builder() .alarmSeverity(al...
@Test public void testArrayToDoubleWithInvalidIndex1(){ VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); double result = VTypeHelper.toDouble(doubleArray, 7); assertEquals(result, Double.NaN, 0); }
final public static double toDouble(final VType value) { return toDouble(value, 0); }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
@Test public void testArrayToDoubleWithInvalidIndex2(){ VEnumArray enumArray = VEnumArray.of(ArrayInteger.of(0, 1), EnumDisplay.of("a", "b"), Alarm.none(), Time.now()); double result = VTypeHelper.toDouble(enumArray, 7); assertEquals(result, Double.NaN, 0); }
final public static double toDouble(final VType value) { return toDouble(value, 0); }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
@Test public void testArrayToDoubleWithInvalidIndex3(){ VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); double result = VTypeHelper.toDouble(doubleArray, -1); assertEquals(result, Double.NaN, 0); }
final public static double toDouble(final VType value) { return toDouble(value, 0); }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } }
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
VTypeHelper { final public static double toDouble(final VType value) { return toDouble(value, 0); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, final int index); static boolean isNume...
@Test public void testToDoubles(){ VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); double[] result = VTypeHelper.toDoubles(doubleArray); assertEquals(2, result.length); assertEquals(7.7, result[0], 0); assertEquals(8.8, result[1], 0); VDouble doubleValue =...
public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0]; return array;...
VTypeHelper { public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0];...
VTypeHelper { public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0];...
VTypeHelper { public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0];...
VTypeHelper { public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0];...
@Test public void testGetString(){ assertEquals("null", VTypeHelper.toString(null)); VTable table = VTable.of(Arrays.asList(VDouble.class), Arrays.asList("name"), Arrays.asList(ArrayDouble.of(7.7))); assertNotNull(VTypeHelper.toString(table)); VDouble vDouble = VDouble.of(7.7, Alarm.disconnected(), Time.now(), Display....
public static String toString(final VType value) { if (value == null) { return "null"; } if (isDisconnected(value)) { return null; } if (value instanceof VNumber) { return ((VNumber) value).getValue().toString(); } if (value instanceof VEnum) { return ((VEnum) value).getValue(); } if (value instanceof VString) { return...
VTypeHelper { public static String toString(final VType value) { if (value == null) { return "null"; } if (isDisconnected(value)) { return null; } if (value instanceof VNumber) { return ((VNumber) value).getValue().toString(); } if (value instanceof VEnum) { return ((VEnum) value).getValue(); } if (value instanceof VSt...
VTypeHelper { public static String toString(final VType value) { if (value == null) { return "null"; } if (isDisconnected(value)) { return null; } if (value instanceof VNumber) { return ((VNumber) value).getValue().toString(); } if (value instanceof VEnum) { return ((VEnum) value).getValue(); } if (value instanceof VSt...
VTypeHelper { public static String toString(final VType value) { if (value == null) { return "null"; } if (isDisconnected(value)) { return null; } if (value instanceof VNumber) { return ((VNumber) value).getValue().toString(); } if (value instanceof VEnum) { return ((VEnum) value).getValue(); } if (value instanceof VSt...
VTypeHelper { public static String toString(final VType value) { if (value == null) { return "null"; } if (isDisconnected(value)) { return null; } if (value instanceof VNumber) { return ((VNumber) value).getValue().toString(); } if (value instanceof VEnum) { return ((VEnum) value).getValue(); } if (value instanceof VSt...