/** * @since 0.10.0 */ private static Object normalize(Object o) { if (o instanceof Integer) { o = ((Integer) o).longValue(); } return o; }
@Override Integer offset(Integer origin, long distance) { checkNonnegative(distance, "distance"); return Ints.checkedCast(origin.longValue() + distance); }
@Override public Long map(Integer value) throws Exception { return value.longValue(); } };
@JsonCreator public static RowBasedKey fromJsonArray(final Object[] key) { // Type info is lost during serde: // Floats may be deserialized as doubles, Longs may be deserialized as integers, convert them back for (int i = 0; i < key.length; i++) { if (key[i] instanceof Integer) { key[i] = ((Integer) key[i]).longValue(); } else if (key[i] instanceof Double) { key[i] = ((Double) key[i]).floatValue(); } } return new RowBasedKey(key); }
@Override Integer offset(Integer origin, long distance) { checkNonnegative(distance, "distance"); return Ints.checkedCast(origin.longValue() + distance); }
/** * @return <tt>null</tt> if there is no timeout value, otherwise the * watchdog instance. * * @throws BuildException under unspecified circumstances * @since Ant 1.2 */ protected ExecuteWatchdog createWatchdog() /*throws BuildException*/ { if(m_timeout == null) { return null; } return new ExecuteWatchdog(m_timeout.longValue()); }
@Override Integer offset(Integer origin, long distance) { checkNonnegative(distance, "distance"); return Ints.checkedCast(origin.longValue() + distance); }
public void setValue(Object value, ValueFields valueFields) { if (value != null) { valueFields.setLongValue(((Integer) value).longValue()); valueFields.setTextValue(value.toString()); } else { valueFields.setLongValue(null); valueFields.setTextValue(null); } }
private static MapBasedInputRow getLongRow(long timestamp, int rowID, int dimensionCount) { List<String> dimensionList = new ArrayList<String>(dimensionCount); ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); for (int i = 0; i < dimensionCount; i++) { String dimName = StringUtils.format("Dim_%d", i); dimensionList.add(dimName); builder.put(dimName, new Integer(rowID).longValue()); } return new MapBasedInputRow(timestamp, dimensionList, builder.build()); }
private String format(Number o) { if (o instanceof Float) { return format(((Float) o).doubleValue()); } else if (o instanceof Double) { return format(((Double) o).doubleValue()); } else if (o instanceof Short) { return format(((Short) o).longValue()); } else if (o instanceof Integer) { return format(((Integer) o).longValue()); } else if (o instanceof Long) { return format(((Long) o).longValue()); } return null; }
@Override public void process( Integer integer, TimeWindow window, InternalWindowContext ctx, Iterable<Integer> input, Collector<Void> out) throws Exception { Integer inputValue = input.iterator().next(); ctx.output(integerOutputTag, inputValue); ctx.output(longOutputTag, inputValue.longValue()); }
private NativeInput.MotionEvent getNativeMotionEvent() { long nativePtr; if (RuntimeEnvironment.getApiLevel() <= KITKAT_WATCH) { Integer nativePtrInt = ReflectionHelpers.getField(realMotionEvent, "mNativePtr"); nativePtr = nativePtrInt.longValue(); } else { nativePtr = ReflectionHelpers.getField(realMotionEvent, "mNativePtr"); } return nativeMotionEventRegistry.getNativeObject(nativePtr); }
@Override public Entry<KeyType> apply(Entry<KeyType> entry) { final Object[] deserializedValues = new Object[entry.getValues().length]; for (int i = 0; i < deserializedValues.length; i++) { deserializedValues[i] = aggregatorFactories[i].deserialize(entry.getValues()[i]); if (deserializedValues[i] instanceof Integer) { // Hack to satisfy the groupBy unit tests; perhaps we could do better by adjusting Jackson config. deserializedValues[i] = ((Integer) deserializedValues[i]).longValue(); } } return new Entry<>(entry.getKey(), deserializedValues); } }
@Override public void processElement(Integer value, Context ctx, Collector<String> out) throws Exception { out.collect("IN:" + value); ctx.output(INTEGER_OUTPUT_TAG, value); ctx.output(LONG_OUTPUT_TAG, value.longValue()); } }
@Override public void processElement(Integer value, Context ctx, Collector<String> out) throws Exception { out.collect("IN:" + value); ctx.output(INTEGER_OUTPUT_TAG, value); ctx.output(LONG_OUTPUT_TAG, value.longValue()); } }
public void eval(Integer a, Long b, Long c) { collect(a.longValue()); collect(b); collect(c); } }
@Override public void processElement(Integer value, Context ctx, Collector<String> out) throws Exception { out.collect("IN:" + value); ctx.output(INTEGER_OUTPUT_TAG, value); ctx.output(LONG_OUTPUT_TAG, value.longValue()); } }
@Test public void testMaybeRequestUpdate() { TopicPartition tp = new TopicPartition("topic-1", 0); metadata.update(emptyMetadataResponse(), 0L); assertTrue(metadata.updateLastSeenEpochIfNewer(tp, 1)); assertEquals(metadata.lastSeenLeaderEpoch(tp).get().longValue(), 1); metadata.update(emptyMetadataResponse(), 1L); assertFalse(metadata.updateLastSeenEpochIfNewer(tp, 1)); assertEquals(metadata.lastSeenLeaderEpoch(tp).get().longValue(), 1); metadata.update(emptyMetadataResponse(), 2L); assertFalse(metadata.updateLastSeenEpochIfNewer(tp, 0)); assertEquals(metadata.lastSeenLeaderEpoch(tp).get().longValue(), 1); metadata.update(emptyMetadataResponse(), 3L); assertTrue(metadata.updateLastSeenEpochIfNewer(tp, 2)); assertEquals(metadata.lastSeenLeaderEpoch(tp).get().longValue(), 2); }
@Test public void testExpiryOfUnsentBatchesShouldNotCauseUnresolvedSequences() throws Exception { final long producerId = 343434L; TransactionManager transactionManager = new TransactionManager(); setupWithTransactionState(transactionManager); prepareAndReceiveInitProducerId(producerId, Errors.NONE); assertTrue(transactionManager.hasProducerId()); assertEquals(0, transactionManager.sequenceNumber(tp0).longValue()); // Send first ProduceRequest Future<RecordMetadata> request1 = accumulator.append(tp0, 0L, "key".getBytes(), "value".getBytes(), null, null, MAX_BLOCK_TIMEOUT).future; Node node = metadata.fetch().nodes().get(0); time.sleep(10000L); client.disconnect(node.idString()); client.blackout(node, 10); sender.run(time.milliseconds()); assertFutureFailure(request1, TimeoutException.class); assertFalse(transactionManager.hasUnresolvedSequence(tp0)); }
@Test @Order(26) void testServiceImplInnerLambdaQuery() { H2User tomcat = userService.lambdaQuery().eq(H2User::getName, "Tomcat").one(); Assertions.assertNotNull(tomcat); Assertions.assertNotEquals(0L, userService.lambdaQuery().like(H2User::getName, "a").count().longValue()); userService.lambdaQuery().like(H2User::getName, "T") .ne(H2User::getAge, AgeEnum.TWO) .ge(H2User::getVersion, 1) .isNull(H2User::getPrice) .list(); }