List of usage examples for java.lang Long MIN_VALUE
long MIN_VALUE
To view the source code for java.lang Long MIN_VALUE.
Click Source Link
From source file:com.clustercontrol.maintenance.view.action.HinemosPropertyCopyAction.java
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???//from w w w . j av a2s . c o m this.viewPart = HandlerUtil.getActivePart(event); HinemosPropertyView view = null; try { view = (HinemosPropertyView) this.viewPart.getAdapter(HinemosPropertyView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } HinemosPropertyComposite composite = (HinemosPropertyComposite) view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); @SuppressWarnings("rawtypes") List<?> list = (List) selection.getFirstElement(); String key = null; String managerName = null; int valueType = 0; if (list != null && list.size() > 0) { key = (String) list.get(GetHinemosPropertyTableDefine.KEY); String valueTypeStr = (String) list.get(GetHinemosPropertyTableDefine.VALUE_TYPE); managerName = (String) list.get(GetHinemosPropertyTableDefine.MANAGER_NAME); valueType = HinemosPropertyTypeMessage.stringToType(valueTypeStr); } Table table = composite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, null, table); //??????? if (key != null) { try { HinemosPropertyInfo info = new HinemosPropertyInfo(); info.setKey(key); info.setValueType(valueType); if (valueType == HinemosPropertyTypeConstant.TYPE_STRING) { String value = (String) list.get(GetHinemosPropertyTableDefine.VALUE); info.setValueString(value); } else if (valueType == HinemosPropertyTypeConstant.TYPE_NUMERIC) { Long value = (Long) list.get(GetHinemosPropertyTableDefine.VALUE); try { info.setValueNumeric(value); } catch (NumberFormatException e) { m_log.info("run() setValueNumeric(), " + e.getMessage()); Object[] args = { Messages.getString("hinemos.property.key"), Long.MIN_VALUE, Long.MAX_VALUE }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.common.4", args)); } } else { boolean value = Boolean.parseBoolean((String) list.get(GetHinemosPropertyTableDefine.VALUE)); info.setValueBoolean(value); } info.setDescription((String) list.get(GetHinemosPropertyTableDefine.DESCRIPTION)); // ? HinemosPropertyDialog dialog = new HinemosPropertyDialog(this.viewPart.getSite().getShell(), managerName, valueType, PropertyDefineConstant.MODE_ADD, info); if (dialog.open() == IDialogConstants.OK_ID) { int selectIndex = table.getSelectionIndex(); view.update(); table.setSelection(selectIndex); } } catch (Exception e1) { m_log.warn("run(), " + e1.getMessage(), e1); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.hinemos.property.11")); } return null; }
From source file:com.haulmont.chile.core.datatypes.impl.AdaptiveNumberDatatype.java
protected void checkLongRange(String value, Number result) throws ParseException { if (result instanceof Double && (result.doubleValue() > Long.MAX_VALUE || result.doubleValue() < Long.MIN_VALUE)) throw new ParseException(String.format("Long range exceeded: \"%s\"", value), 0); }
From source file:net.aksingh.owmjapis.CurrentWeather.java
/** * @return <code>true</code> if city code is available, otherwise <code>false</code>. */// ww w . j a v a2 s. c o m public boolean hasCityCode() { return this.cityId != Long.MIN_VALUE; }
From source file:com.loop81.fxcomparer.FXComparerController.java
/** * Initiate the table by setting the correct width of the columns and adding a custom value-factory for the * size column. /*from w ww. j av a 2 s .co m*/ */ private void initiateTable() { columnName.prefWidthProperty().bind(compareTable.widthProperty().divide(5).multiply(3)); columnName.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<ComparisonEntry, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ComparisonEntry, String> cell) { return new SimpleStringProperty(cell.getValue().getOriginalEntry().getEntryName()); } }); columnState.prefWidthProperty().bind(compareTable.widthProperty().divide(5)); columnState.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<ComparisonEntry, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ComparisonEntry, String> cell) { return new SimpleObjectProperty<>(MessageBundle.getString( "result.state." + cell.getValue().getChangeState().toString().toLowerCase())); } }); columnChange.prefWidthProperty().bind(compareTable.widthProperty().divide(5)); columnChange.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<ComparisonEntry, ChangeWrapper>, ObservableValue<ChangeWrapper>>() { @Override public ObservableValue<ChangeWrapper> call( CellDataFeatures<ComparisonEntry, ChangeWrapper> cell) { long sizeChange = cell.getValue().getSizeChange(); if (sizeChange == 0) { return new SimpleObjectProperty<ChangeWrapper>(new ChangeWrapper()); } else if (sizeChange == Long.MIN_VALUE) { return new SimpleObjectProperty<ChangeWrapper>( new ChangeWrapper(MessageBundle.getString("general.not_avalible"), 0)); } else { return new SimpleObjectProperty<ChangeWrapper>( new ChangeWrapper(convertdifferenceToReadableString(sizeChange), sizeChange)); } } }); columnChange.setComparator(new Comparator<ChangeWrapper>() { @Override public int compare(ChangeWrapper wrapper1, ChangeWrapper wrapper2) { return wrapper1.compareTo(wrapper2); } }); }
From source file:org.apache.camel.dataformat.bindy.BindyAbstractFactory.java
public static Object getDefaultValueForPrimitive(Class<?> clazz) throws Exception { if (clazz == byte.class) { return Byte.MIN_VALUE; } else if (clazz == short.class) { return Short.MIN_VALUE; } else if (clazz == int.class) { return Integer.MIN_VALUE; } else if (clazz == long.class) { return Long.MIN_VALUE; } else if (clazz == float.class) { return Float.MIN_VALUE; } else if (clazz == double.class) { return Double.MIN_VALUE; } else if (clazz == char.class) { return Character.MIN_VALUE; } else if (clazz == boolean.class) { return false; } else {/*from w w w . ja v a2 s. c om*/ return null; } }
From source file:com.scvngr.levelup.core.model.util.JsonUtils.java
/** * Gets an optional {@link MonetaryValue} object from the JSON at the key passed. * * @param json the {@link JSONObject} to get the {@link MonetaryValue} from. * @param key the key in the {@link JSONObject} to get the {@link MonetaryValue} from. * @return a {@link MonetaryValue} from the parsed long or null. * @throws JSONException if the parsing fails. *///w ww.ja v a 2s .com @Nullable public static MonetaryValue optMonetaryValue(@NonNull final JSONObject json, @NonNull final String key) throws JSONException { final MonetaryValue value; final Long amount = json.optLong(key, Long.MIN_VALUE); if (Long.MIN_VALUE != amount) { value = new MonetaryValue(amount); } else { value = null; } return value; }
From source file:com.streamsets.pipeline.stage.origin.jdbc.table.AllTypesIT.java
private static void populateRecords() { Record record = RecordCreator.create(); LinkedHashMap<String, Field> fields; AtomicInteger id_field = new AtomicInteger(0); //CHAR_AND_BINARY fields = new LinkedHashMap<>(); createIdField(fields, id_field);//from w ww. j a v a 2 s . c o m fields.put("char1", Field.create("abcdefghij")); fields.put("varchar1", Field.create(UUID.randomUUID().toString())); fields.put("clob1", Field.create(UUID.randomUUID().toString())); fields.put("varbinary1", Field.create(UUID.randomUUID().toString().getBytes())); fields.put("blob1", Field.create(UUID.randomUUID().toString().getBytes())); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("CHAR_AND_BINARY").getRight().add(record); //Date and time record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); fields.put("date1", Field.create(Field.Type.DATE, calendar.getTime())); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.MILLISECOND, 0); fields.put("timestamp1", Field.create(Field.Type.DATETIME, calendar.getTime())); fields.put("datetime1", Field.create(Field.Type.DATETIME, calendar.getTime())); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.YEAR, 1970); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MILLISECOND, 0); fields.put("time1", Field.create(Field.Type.TIME, calendar.getTime())); calendar.setTimeInMillis(System.currentTimeMillis()); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DATE_AND_TIME").getRight().add(record); //DIFFERENT_INTS record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("int1", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE)); fields.put("int2", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE)); fields.put("mediumint1", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE)); fields.put("tinyint1", Field.create(Field.Type.SHORT, -128)); fields.put("smallint1", Field.create(Field.Type.SHORT, Short.MIN_VALUE)); fields.put("bigint1", Field.create(Field.Type.LONG, Long.MIN_VALUE)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DIFFERENT_INTS").getRight().add(record); record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("int1", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE)); fields.put("int2", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE)); fields.put("mediumint1", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE)); fields.put("tinyint1", Field.create(Field.Type.SHORT, 127)); fields.put("smallint1", Field.create(Field.Type.SHORT, Short.MAX_VALUE)); fields.put("bigint1", Field.create(Field.Type.LONG, Long.MAX_VALUE)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DIFFERENT_INTS").getRight().add(record); //FLOATING_PT_INTS record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("decimal1", Field.create(Field.Type.DECIMAL, new BigDecimal("12.345"))); fields.put("number1", Field.create(Field.Type.DECIMAL, new BigDecimal("0.12345"))); fields.put("double1", Field.create(Field.Type.DOUBLE, 123.456)); fields.put("real1", Field.create(Field.Type.FLOAT, 12.34)); fields.put("floatdouble1", Field.create(Field.Type.DOUBLE, Double.MAX_VALUE)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("FLOATING_PT_INTS").getRight().add(record); record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("decimal1", Field.create(Field.Type.DECIMAL, new BigDecimal("-12.345"))); fields.put("number1", Field.create(Field.Type.DECIMAL, new BigDecimal("-0.12345"))); fields.put("double1", Field.create(Field.Type.DOUBLE, -123.456)); fields.put("real1", Field.create(Field.Type.FLOAT, -12.34)); fields.put("floatdouble1", Field.create(Field.Type.DOUBLE, Double.MIN_VALUE)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("FLOATING_PT_INTS").getRight().add(record); //OTHER_TYPES record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("boolean1", Field.create(Field.Type.BOOLEAN, true)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("OTHER_TYPES").getRight().add(record); record = RecordCreator.create(); fields = new LinkedHashMap<>(); createIdField(fields, id_field); fields.put("boolean1", Field.create(Field.Type.BOOLEAN, false)); record.set(Field.createListMap(fields)); TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("OTHER_TYPES").getRight().add(record); }
From source file:com.gsma.mobileconnect.cache.DiscoveryCacheHashMapImplTest.java
@Test public void get_withExpiredTtl_shouldReturnNull() { // GIVEN//from w w w . jav a 2s .c o m ObjectMapper objectMapper = new ObjectMapper(); DiscoveryCacheKey key = DiscoveryCacheKey.newWithDetails("a", "a"); IDiscoveryCache cache = Factory.getDefaultDiscoveryCache(); DiscoveryCacheValue value = new DiscoveryCacheValue(new Date(Long.MIN_VALUE), objectMapper.createObjectNode()); // WHEN cache.add(key, value); boolean cacheIsEmptyAfterAdd = cache.isEmpty(); DiscoveryCacheValue cachedValue = cache.get(key); boolean cacheIsEmptyAfterGet = cache.isEmpty(); // THEN assertFalse(cacheIsEmptyAfterAdd); assertNull(cachedValue); assertTrue(cacheIsEmptyAfterGet); }
From source file:eu.stratosphere.nephele.io.channels.DistributedChannelWithAccessInfo.java
@Override public void disposeSilently() { this.referenceCounter.set(Integer.MIN_VALUE); this.reservedWritePosition.set(Long.MIN_VALUE); if (this.channel.isOpen()) { try {// www . j a v a2 s .c om this.channel.close(); if (this.deleteOnClose.get()) { this.fs.delete(this.checkpointFile, false); } } catch (Throwable t) { } } }
From source file:com.android.messaging.datamodel.NotificationState.java
public long getLatestReceivedTimestamp() { return Long.MIN_VALUE; }