java.lang.Long Java Examples

The following examples show how to use java.lang.Long. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheUtil.java    From MicroReader with MIT License 6 votes vote down vote up
/**
 * 判断缓存的byte数据是否到期
 *
 * @param data
 * @return true:到期了 false:还没有到期
 */
private static boolean isDue(byte[] data) {
    String[] strs = getDateInfoFromDate(data);
    if (strs != null && strs.length == 2) {
        String saveTimeStr = strs[0];
        while (saveTimeStr.startsWith("0")) {
            saveTimeStr = saveTimeStr.substring(1, saveTimeStr.length());
        }
        long saveTime = Long.parseLong(saveTimeStr);
        long deleteAfter = Long.parseLong(strs[1]);
        if (System.currentTimeMillis() > saveTime + deleteAfter * 1000) {
            return true;
        }
    }
    return false;
}
 
Example #2
Source File: BgReadingMessage.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #3
Source File: MaxFloatingPointTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void testDoubleNarrowing() {
  if (System.getProperty("os.arch").equals("armv7")) {
    return;
  }
  double dmin = Double.NEGATIVE_INFINITY;
  double dmax = Double.POSITIVE_INFINITY;
  assertEquals("dmin as long failed", Long.MIN_VALUE, (long) dmin);
  assertEquals("dmax as long failed", Long.MAX_VALUE, (long) dmax);
  assertEquals("dmin as int failed", Integer.MIN_VALUE, (int) dmin);
  assertEquals("dmax as int failed", Integer.MAX_VALUE, (int) dmax);
  assertEquals("dmin as char failed", Character.MIN_VALUE, (char) dmin);
  assertEquals("dmax as char failed", Character.MAX_VALUE, (char) dmax);

  assertEquals("dmin as short failed", 0, (short) dmin);
  assertEquals("dmax as short failed", -1, (short) dmax);
  assertEquals("dmin as byte failed", 0, (byte) dmin);
  assertEquals("dmax as byte failed", -1, (byte) dmax);
}
 
Example #4
Source File: MaxFloatingPointTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void testCompoundOperators() {
  int i = Integer.MAX_VALUE;
  i += 1.0;
  assertEquals(Integer.MAX_VALUE, i);
  i *= 1.5;
  assertEquals(Integer.MAX_VALUE, i);
  i -= -1.0;
  assertEquals(Integer.MAX_VALUE, i);
  i /= 0.5;
  assertEquals(Integer.MAX_VALUE, i);
  long l = Long.MAX_VALUE;
  l += 1.0;
  assertEquals(Long.MAX_VALUE, l);
  l *= 1.5;
  assertEquals(Long.MAX_VALUE, l);
  l -= -1.0;
  assertEquals(Long.MAX_VALUE, l);
  l /= 0.5;
  assertEquals(Long.MAX_VALUE, l);
}
 
Example #5
Source File: DAbstractMetricIO.java    From blueflood with Apache License 2.0 6 votes vote down vote up
/**
 * Fetch values for a list of {@link com.rackspacecloud.blueflood.types.Locator}
 * from the specified column family and range.
 *
 * This is a base behavior for most rollup types. IO subclasses can override
 * this behavior as they see fit.
 *
 * @param locators
 * @param columnFamily
 * @param range
 * @return
 */
protected <T extends Object> Table<Locator, Long, T> getValuesForLocators( final List<Locator> locators,
                                                                           String columnFamily,
                                                                           Range range ) {

    Table<Locator, Long, T> locatorTimestampRollup = HashBasedTable.create();

    Map<Locator, List<ResultSetFuture>> resultSetFuturesMap = selectForLocatorListAndRange(columnFamily, locators, range);

    for (Map.Entry<Locator, List<ResultSetFuture>> entry : resultSetFuturesMap.entrySet() ) {
        Locator locator = entry.getKey();
        List<ResultSetFuture> futures = entry.getValue();

        Table<Locator, Long, T> result = toLocatorTimestampValue(futures, locator,
                                                columnFamily,
                                                range);
        locatorTimestampRollup.putAll(result);
    }
    return locatorTimestampRollup;
}
 
Example #6
Source File: Example16Test.java    From AnDevCon-RxPatterns with Apache License 2.0 6 votes vote down vote up
@Test
public void should_test_observable_interval() {
    TestScheduler scheduler = new TestScheduler();
    final List<Long> result = new ArrayList<>();
    Observable.interval(1, TimeUnit.SECONDS, scheduler)
            .take(5)
            .subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    result.add(aLong);
                }
            });
    assertTrue(result.isEmpty());
    scheduler.advanceTimeBy(2, TimeUnit.SECONDS);
    assertEquals(2, result.size());
    scheduler.advanceTimeBy(10, TimeUnit.SECONDS);
    assertEquals(5, result.size());
}
 
Example #7
Source File: BgReadingMessage.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #8
Source File: MaxFloatingPointTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void testFloatNarrowing() {
  if (System.getProperty("os.arch").equals("armv7")) {
    return;
  }
  float fmin = Float.NEGATIVE_INFINITY;
  float fmax = Float.POSITIVE_INFINITY;
  assertEquals("fmin as long failed", Long.MIN_VALUE, (long) fmin);
  assertEquals("fmax as long failed", Long.MAX_VALUE, (long) fmax);
  assertEquals("fmin as int failed", Integer.MIN_VALUE, (int) fmin);
  assertEquals("fmax as int failed", Integer.MAX_VALUE, (int) fmax);
  assertEquals("fmin as char failed", Character.MIN_VALUE, (char) fmin);
  assertEquals("fmax as char failed", Character.MAX_VALUE, (char) fmax);

  // Surprising values for shorts and bytes, but that's what's specified.
  assertEquals("fmin as short failed", 0, (short) fmin);
  assertEquals("fmax as short failed", -1, (short) fmax);
  assertEquals("fmin as byte failed", 0, (byte) fmin);
  assertEquals("fmax as byte failed", -1, (byte) fmax);
}
 
Example #9
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 
 * 40-49: Mesh proprietary 
 */
@MavlinkFieldInfo(
        position = 17,
        unitSize = 4,
        arraySize = 6,
        description = "Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary"
)
public final List<Long> linkType() {
    return this.linkType;
}
 
Example #10
Source File: BoxedTypesPrivateFieldsStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesPrivateFields mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesPrivateFields object = new BoxedTypesPrivateFields(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #11
Source File: AqEscTelemetry.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Data bits 1-32 for each ESC. 
 */
@MavlinkFieldInfo(
        position = 8,
        unitSize = 4,
        arraySize = 4,
        description = "Data bits 1-32 for each ESC."
)
public final List<Long> data0() {
    return this.data0;
}
 
Example #12
Source File: BoxedTypesPrivateFieldsIgnoreNullStorIOContentResolverGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesPrivateFieldsIgnoreNull mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesPrivateFieldsIgnoreNull object = new BoxedTypesPrivateFieldsIgnoreNull(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #13
Source File: AqEscTelemetry.java    From mavlink with MIT License 5 votes vote down vote up
private AqEscTelemetry(long timeBootMs, int seq, int numMotors, int numInSeq, byte[] escid,
        List<Integer> statusAge, byte[] dataVersion, List<Long> data0, List<Long> data1) {
    this.timeBootMs = timeBootMs;
    this.seq = seq;
    this.numMotors = numMotors;
    this.numInSeq = numInSeq;
    this.escid = escid;
    this.statusAge = statusAge;
    this.dataVersion = dataVersion;
    this.data0 = data0;
    this.data1 = data1;
}
 
Example #14
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
private OnboardComputerStatus(BigInteger timeUsec, long uptime, int type, byte[] cpuCores,
        byte[] cpuCombined, byte[] gpuCores, byte[] gpuCombined, int temperatureBoard,
        List<Integer> temperatureCore, List<Integer> fanSpeed, long ramUsage, long ramTotal,
        List<Long> storageType, List<Long> storageUsage, List<Long> storageTotal,
        List<Long> linkType, List<Long> linkTxRate, List<Long> linkRxRate, List<Long> linkTxMax,
        List<Long> linkRxMax) {
    this.timeUsec = timeUsec;
    this.uptime = uptime;
    this.type = type;
    this.cpuCores = cpuCores;
    this.cpuCombined = cpuCombined;
    this.gpuCores = gpuCores;
    this.gpuCombined = gpuCombined;
    this.temperatureBoard = temperatureBoard;
    this.temperatureCore = temperatureCore;
    this.fanSpeed = fanSpeed;
    this.ramUsage = ramUsage;
    this.ramTotal = ramTotal;
    this.storageType = storageType;
    this.storageUsage = storageUsage;
    this.storageTotal = storageTotal;
    this.linkType = linkType;
    this.linkTxRate = linkTxRate;
    this.linkRxRate = linkRxRate;
    this.linkTxMax = linkTxMax;
    this.linkRxMax = linkRxMax;
}
 
Example #15
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A 
 * value of UINT32_MAX implies the field is unused. 
 */
@MavlinkFieldInfo(
        position = 14,
        unitSize = 4,
        arraySize = 4,
        description = "Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused."
)
public final List<Long> storageType() {
    return this.storageType;
}
 
Example #16
Source File: UniqueIndexJumpUnboundedCompositeKeyIT.java    From sql-layer with GNU Affero General Public License v3.0 5 votes vote down vote up
private void checkRows(List<Row> actual, long expected[][])
{
    List<List<Long>> actualList = new ArrayList<>();
    for (Row row : actual)
        actualList.add(Arrays.asList(getLong(row, ID1),
                                     getLong(row, ID2)));
    
    List<List<Long>> expectedList = new ArrayList<>();
    for (long idPair[] : expected)
        expectedList.add(Arrays.asList(idPair[0], idPair[1]));
    
    assertEquals(expectedList, actualList);
}
 
Example #17
Source File: BoxedTypesMethodsConstructorIgnoreNullStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #18
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Network traffic from the component system. A value of UINT32_MAX implies the field is unused. 
 */
@MavlinkFieldInfo(
        position = 18,
        unitSize = 4,
        arraySize = 6,
        description = "Network traffic from the component system. A value of UINT32_MAX implies the field is unused."
)
public final List<Long> linkTxRate() {
    return this.linkTxRate;
}
 
Example #19
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Total amount of storage space on the component system. A value of UINT32_MAX implies the field 
 * is unused. 
 */
@MavlinkFieldInfo(
        position = 16,
        unitSize = 4,
        arraySize = 4,
        description = "Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused."
)
public final List<Long> storageTotal() {
    return this.storageTotal;
}
 
Example #20
Source File: BoxedTypesMethodsFactoryMethodStorIOContentResolverGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #21
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Network capacity from the component system. A value of UINT32_MAX implies the field is unused. 
 */
@MavlinkFieldInfo(
        position = 20,
        unitSize = 4,
        arraySize = 6,
        description = "Network capacity from the component system. A value of UINT32_MAX implies the field is unused."
)
public final List<Long> linkTxMax() {
    return this.linkTxMax;
}
 
Example #22
Source File: OnboardComputerStatus.java    From mavlink with MIT License 5 votes vote down vote up
/**
 * Network capacity to the component system. A value of UINT32_MAX implies the field is unused. 
 */
@MavlinkFieldInfo(
        position = 21,
        unitSize = 4,
        arraySize = 6,
        description = "Network capacity to the component system. A value of UINT32_MAX implies the field is unused."
)
public final List<Long> linkRxMax() {
    return this.linkRxMax;
}
 
Example #23
Source File: BloodTestMessage.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public BloodTestMessage(Long timestamp, Double mgdl, Long created_timestamp, Long state, String source, String uuid, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.mgdl = mgdl;
  this.created_timestamp = created_timestamp;
  this.state = state;
  this.source = source;
  this.uuid = uuid;
}
 
Example #24
Source File: BoxedTypesPrivateFieldsIgnoreNullStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesPrivateFieldsIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesPrivateFieldsIgnoreNull object = new BoxedTypesPrivateFieldsIgnoreNull(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #25
Source File: MaxFloatingPointTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testFloatConversions() {
  if (System.getProperty("os.arch").equals("armv7")) {
    return;
  }
  Float maxFloat = Float.MAX_VALUE;
  assertEquals(Integer.MAX_VALUE, maxFloat.intValue());
  assertEquals(Long.MAX_VALUE, maxFloat.longValue());
}
 
Example #26
Source File: BloodTestMessage.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public BloodTestMessage(Long timestamp, Double mgdl, Long created_timestamp, Long state, String source, String uuid, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.mgdl = mgdl;
  this.created_timestamp = created_timestamp;
  this.state = state;
  this.source = source;
  this.uuid = uuid;
}
 
Example #27
Source File: GameController.java    From eb-java-scorekeep with Apache License 2.0 5 votes vote down vote up
/** PUT /game/SESSION/GAME/endtime/ENDTIME **/
@RequestMapping(value="/{gameId}/endtime/{endTime}",method=RequestMethod.PUT)
public void setEndTime(@PathVariable String sessionId, @PathVariable String gameId, @PathVariable String endTime) throws SessionNotFoundException, GameNotFoundException, NumberFormatException {
  Game game = gameFactory.getGame(sessionId, gameId);
  Long seconds = Long.parseLong(endTime);
  Date date = new Date(seconds);
  game.setEndTime(date);
  model.saveGame(game);
}
 
Example #28
Source File: CacheUtil.java    From MicroReader with MIT License 5 votes vote down vote up
private static String createDateInfo(int second) {
    String currentTime = Long.toString(System.currentTimeMillis());
    while (currentTime.length() < 13) {
        currentTime = "0" + currentTime;
    }
    return currentTime + "-" + second + mSeparator;
}
 
Example #29
Source File: BoxedTypesMethodsFactoryMethodStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #30
Source File: RunningExecutionPlanRepository.java    From score with Apache License 2.0 4 votes vote down vote up
@Query("select executionPlanZipped from RunningExecutionPlan r where r.id = :exeId")
byte[] getZippedExecutionPlan(@Param("exeId") Long exeId);