Example usage for java.lang Integer MIN_VALUE

List of usage examples for java.lang Integer MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MIN_VALUE.

Prototype

int MIN_VALUE

To view the source code for java.lang Integer MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value an int can have, -231.

Usage

From source file:com.baystep.jukeberry.JsonConfiguration.java

public static int castLongToInt(long l) {
    if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE)
        throw new IllegalArgumentException(l + " cannot be cast to integer safely.");
    return (int) l;
}

From source file:com.linkedin.pinot.core.segment.index.ColumnMetadataTest.java

public void verifySegmentAfterLoading(SegmentMetadataImpl metadata) {
    // Multi-value numeric dimension column.
    ColumnMetadata col7Meta = metadata.getColumnMetadataFor("column7");
    Assert.assertEquals(col7Meta.getColumnName(), "column7");
    Assert.assertEquals(col7Meta.getCardinality(), 359);
    Assert.assertEquals(col7Meta.getTotalDocs(), 100000);
    Assert.assertEquals(col7Meta.getTotalRawDocs(), 100000);
    Assert.assertEquals(col7Meta.getTotalAggDocs(), 0);
    Assert.assertEquals(col7Meta.getDataType(), FieldSpec.DataType.INT);
    Assert.assertEquals(col7Meta.getBitsPerElement(), 9);
    Assert.assertEquals(col7Meta.getStringColumnMaxLength(), 0);
    Assert.assertEquals(col7Meta.getFieldType(), FieldSpec.FieldType.DIMENSION);
    Assert.assertFalse(col7Meta.isSorted());
    Assert.assertFalse(col7Meta.hasNulls());
    Assert.assertTrue(col7Meta.hasDictionary());
    Assert.assertTrue(col7Meta.hasInvertedIndex());
    Assert.assertFalse(col7Meta.isSingleValue());
    Assert.assertEquals(col7Meta.getMaxNumberOfMultiValues(), 24);
    Assert.assertEquals(col7Meta.getTotalNumberOfEntries(), 134090);
    Assert.assertFalse(col7Meta.isAutoGenerated());
    Assert.assertEquals(col7Meta.getDefaultNullValueString(), String.valueOf(Integer.MIN_VALUE));

    // Single-value string dimension column.
    ColumnMetadata col3Meta = metadata.getColumnMetadataFor("column3");
    Assert.assertEquals(col3Meta.getColumnName(), "column3");
    Assert.assertEquals(col3Meta.getCardinality(), 5);
    Assert.assertEquals(col3Meta.getTotalDocs(), 100000);
    Assert.assertEquals(col3Meta.getTotalRawDocs(), 100000);
    Assert.assertEquals(col3Meta.getTotalAggDocs(), 0);
    Assert.assertEquals(col3Meta.getDataType(), FieldSpec.DataType.STRING);
    Assert.assertEquals(col3Meta.getBitsPerElement(), 3);
    Assert.assertEquals(col3Meta.getStringColumnMaxLength(), 4);
    Assert.assertEquals(col3Meta.getFieldType(), FieldSpec.FieldType.DIMENSION);
    Assert.assertFalse(col3Meta.isSorted());
    Assert.assertFalse(col3Meta.hasNulls());
    Assert.assertTrue(col3Meta.hasDictionary());
    Assert.assertTrue(col3Meta.hasInvertedIndex());
    Assert.assertTrue(col3Meta.isSingleValue());
    Assert.assertEquals(col3Meta.getMaxNumberOfMultiValues(), 0);
    Assert.assertEquals(col3Meta.getTotalNumberOfEntries(), 100000);
    Assert.assertFalse(col3Meta.isAutoGenerated());
    Assert.assertEquals(col3Meta.getDefaultNullValueString(), "null");

    // Time column.
    ColumnMetadata timeColumn = metadata.getColumnMetadataFor("daysSinceEpoch");
    Assert.assertEquals(timeColumn.getColumnName(), "daysSinceEpoch");
    Assert.assertEquals(timeColumn.getCardinality(), 1);
    Assert.assertEquals(timeColumn.getTotalDocs(), 100000);
    Assert.assertEquals(timeColumn.getTotalRawDocs(), 100000);
    Assert.assertEquals(timeColumn.getTotalAggDocs(), 0);
    Assert.assertEquals(timeColumn.getDataType(), FieldSpec.DataType.INT);
    Assert.assertEquals(timeColumn.getBitsPerElement(), 1);
    Assert.assertEquals(timeColumn.getStringColumnMaxLength(), 0);
    Assert.assertEquals(timeColumn.getFieldType(), FieldSpec.FieldType.DIMENSION);
    Assert.assertTrue(timeColumn.isSorted());
    Assert.assertFalse(timeColumn.hasNulls());
    Assert.assertTrue(timeColumn.hasDictionary());
    Assert.assertTrue(timeColumn.hasInvertedIndex());
    Assert.assertTrue(timeColumn.isSingleValue());
    Assert.assertEquals(timeColumn.getMaxNumberOfMultiValues(), 0);
    Assert.assertEquals(timeColumn.getTotalNumberOfEntries(), 100000);
    Assert.assertFalse(timeColumn.isAutoGenerated());
    Assert.assertEquals(timeColumn.getDefaultNullValueString(), String.valueOf(Integer.MIN_VALUE));
}

From source file:com.salesmanager.core.entity.catalog.ProductDescription.java

/**
 * Set the unique identifier of this class
 * //from  ww w.j  a  va 2 s  . c  om
 * @param id
 *            the new ID
 */
public void setId(com.salesmanager.core.entity.catalog.ProductDescriptionId id) {
    this.id = id;
    this.hashCode = Integer.MIN_VALUE;
}

From source file:io.pravega.controller.store.stream.ZKStreamMetadataStore.java

@Override
@SneakyThrows//from w w w  .  j a v  a  2  s. com
public void registerBucketOwnershipListener(BucketOwnershipListener listener) {
    Preconditions.checkNotNull(listener);

    PathChildrenCacheListener bucketListener = (client, event) -> {
        switch (event.getType()) {
        case CHILD_ADDED:
            // no action required
            break;
        case CHILD_REMOVED:
            int bucketId = Integer.parseInt(ZKPaths.getNodeFromPath(event.getData().getPath()));
            listener.notify(
                    new BucketNotification(bucketId, BucketNotification.NotificationType.BucketAvailable));
            break;
        case CONNECTION_LOST:
            listener.notify(new BucketNotification(Integer.MIN_VALUE,
                    BucketNotification.NotificationType.ConnectivityError));
            break;
        default:
            log.warn("Received unknown event {}", event.getType());
        }
    };

    bucketOwnershipCacheRef.compareAndSet(null,
            new PathChildrenCache(storeHelper.getClient(), ZKStoreHelper.BUCKET_OWNERSHIP_PATH, true));

    bucketOwnershipCacheRef.get().getListenable().addListener(bucketListener);
    bucketOwnershipCacheRef.get().start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
    log.info("bucket ownership listener registered");
}

From source file:io.pivotal.strepsirrhini.chaosloris.web.EventControllerTest.java

@Test
public void read() throws Exception {
    Application application = new Application(UUID.randomUUID());
    application.setId(-1L);//w  w w .  ja v  a 2  s.c o  m

    Schedule schedule = new Schedule("0 0 * * * *", "hourly");
    schedule.setId(-2L);

    Chaos chaos = new Chaos(application, 0.2, schedule);
    chaos.setId(-3L);

    Event event = new Event(chaos, Instant.EPOCH, Arrays.asList(0, 1), Integer.MIN_VALUE);
    event.setId(-4L);

    when(this.eventRepository.getOne(schedule.getId())).thenReturn(event);

    this.mockMvc.perform(get("/events/{id}", schedule.getId()).accept(HAL_JSON)).andExpect(status().isOk())
            .andExpect(jsonPath("$.executedAt").value(Instant.EPOCH.toString()))
            .andExpect(jsonPath("$.terminatedInstances").value(contains(0, 1)))
            .andExpect(jsonPath("$.totalInstanceCount").value(Integer.MIN_VALUE))
            .andExpect(jsonPath("$._links.self").exists()).andExpect(jsonPath("$._links.chaos").exists());
}

From source file:org.netxilia.server.rest.HomeResource.java

private DataSourceConfigurationId getMostUsedDataSource() throws StorageException {
    Map<DataSourceConfigurationId, Integer> dataSourceWorkbookCount = new HashMap<DataSourceConfigurationId, Integer>();

    List<Pair<WorkbookId, DataSourceConfigurationId>> workbooksAndConfigs = dataSourceConfigurationService
            .findAllWorkbooksConfigurations();
    for (Pair<WorkbookId, DataSourceConfigurationId> wkCfg : workbooksAndConfigs) {
        Integer count = dataSourceWorkbookCount.get(wkCfg.getSecond());
        dataSourceWorkbookCount.put(wkCfg.getSecond(), count != null ? count + 1 : 0);
    }//from  w  ww  . j a v a 2 s  .c o  m

    DataSourceConfigurationId maxEntry = null;
    int max = Integer.MIN_VALUE;
    for (Map.Entry<DataSourceConfigurationId, Integer> entry : dataSourceWorkbookCount.entrySet()) {
        if (entry.getValue() > max) {
            maxEntry = entry.getKey();
            max = entry.getValue();
        }
    }
    return maxEntry;
}

From source file:hudson.model.RunMap.java

/**
 * This is the oldest build (with the smallest build number)
 */
public R oldestValue() {
    return search(Integer.MIN_VALUE, ASC);
}

From source file:gov.nih.nci.cabig.caaers.accesscontrol.query.impl.AbstractIdFetcher.java

protected Integer getStudyAllSiteAccessRoles(String loginId) {
    AbstractQuery query = new HQLQuery(
            "select role from StudyIndex oi where loginId=:LOGIN_ID and study.id = " + Integer.MIN_VALUE);
    query.getParameterMap().put("LOGIN_ID", loginId);
    List<Integer> ids = (List<Integer>) search(query);
    if (!ids.isEmpty())
        return ids.get(0);
    return 0;//from  w  w w  .  j av a  2s  .  com
}

From source file:com.sakisds.icymonitor.activities.ConnectionActivity.java

/**
 * Gets the current registration id for application on GCM service.
 * <p/>/*  w w  w.  jav  a2  s . c  o m*/
 * If result is empty, the registration has failed.
 *
 * @return registration id, or empty string if the registration is not
 * complete.
 */
private String getRegistrationId(Context context) {
    final SharedPreferences prefs = getGCMPreferences(context);
    String registrationId = prefs.getString(PROPERTY_REG_ID, "");
    if (registrationId.length() == 0) {
        Log.v("gcm", "Registration not found.");
        return "";
    }
    // check if app was updated; if so, it must clear registration id to
    // avoid a race condition if GCM sends a message
    int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE);
    int currentVersion = getAppVersion(context);
    if (registeredVersion != currentVersion || isRegistrationExpired()) {
        Log.v("gcm", "App version changed or registration expired.");
        return "";
    }
    return registrationId;
}

From source file:com.ankang.report.config.ReportConfig.java

private static <K, V> void convertMap(Map<? extends K, ? extends V> m) {
    if (null == m) {
        logger.error("map is null");
        return;//from   w  ww .ja v a2s  .c  o  m
    }

    synchronized (FILETERS) {
        for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {

            String key = e.getKey().toString().toLowerCase();

            Object value = e.getValue();

            if (ReportConfigItem.FILETER.getConfigName().equalsIgnoreCase(key)) {

                Class<?> filterzz = null;
                Fileter fileter = null;
                String[] clazzs = null;
                int i = 0;
                try {

                    if (value != null && value.toString().contains(",")) {
                        clazzs = value.toString().trim().split(",");
                    } else {
                        clazzs = new String[] { value.toString() };
                    }
                    for (; i < clazzs.length; i++) {
                        filterzz = Class.forName(clazzs[i]);
                        Activate activate = filterzz.getAnnotation(Activate.class);
                        if (!FILETERS.containsValue((fileter = (Fileter) ReportCabinet.getBean(filterzz)))) {
                            Integer order = activate != null && activate.order() >= Integer.MIN_VALUE
                                    && activate.order() <= Integer.MAX_VALUE ? activate.order()
                                            : Integer.MIN_VALUE;
                            if (FILETERS.containsKey(order)) { // ?key??,??
                                if (order < (Integer.MAX_VALUE >> 1) + 1) {
                                    while (FILETERS.containsKey(order)) {
                                        order++;
                                    }
                                } else if (order > (Integer.MAX_VALUE >> 1)) {
                                    while (FILETERS.containsKey(order)) {
                                        order--;
                                    }
                                }
                            }
                            FILETERS.put(order, fileter);
                            logger.debug("load fileter.[" + filterzz + "]");
                            continue;
                        }
                    }
                } catch (ClassNotFoundException c) {

                    logger.error("fileter load fial:" + clazzs[i], c);
                    throw new ReportException("fileter load fial.[%s]", clazzs[i]);
                }
            } else {
                containsKey(key, value, true);
            }
        }
    }
}