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.wabacus.config.print.AbsPrintProviderConfigBean.java

public int getPrintPageSize(String reportid) {
    if (this.mReportidAndPagesize == null || this.mReportidAndPagesize.get(reportid) == null
            || mReportidAndPagesize.get(reportid) == Integer.MIN_VALUE)
        return 0;
    return this.mReportidAndPagesize.get(reportid).intValue();
}

From source file:net.rptools.maptool.model.LightSource.java

public int compareTo(LightSource o) {
    if (o != this) {
        Integer nameLong = NumberUtils.toInt(name, Integer.MIN_VALUE);
        Integer onameLong = NumberUtils.toInt(o.name, Integer.MIN_VALUE);
        if (nameLong != Integer.MIN_VALUE && onameLong != Integer.MIN_VALUE)
            return nameLong - onameLong;
        return name.compareTo(o.name);
    }//w  w  w . j a  va 2  s.c  o  m
    return 0;
}

From source file:ch.christofbuechi.testgcm.MainActivity.java

/**
 * Gets the current registration ID for application on GCM service, if there is one.
 * <p>/* w ww  . j  av  a 2s  .c  o m*/
 * If result is empty, the app needs to register.
 *
 * @return registration ID, or empty string if there is no existing
 *         registration ID.
 */
private String getRegistrationId(Context context) {
    final SharedPreferences prefs = getGcmPreferences(context);
    String registrationId = prefs.getString(PROPERTY_REG_ID, "");
    if (registrationId.isEmpty()) {
        Log.i(TAG, "Registration not found.");
        return "";
    }
    // Check if app was updated; if so, it must clear the registration ID
    // since the existing regID is not guaranteed to work with the new
    // app version.
    int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE);
    int currentVersion = getAppVersion(context);
    if (registeredVersion != currentVersion) {
        Log.i(TAG, "App version changed.");
        return "";
    }
    return registrationId;
}

From source file:org.grails.datastore.bson.json.JsonWriter.java

@Override
protected void doWriteInt64(long value) {
    try {/*w  w  w . ja v  a 2 s.c  om*/
        writeNameHelper(getName());
        if (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE) {
            writer.write(Long.toString(value));
        } else {
            writer.write(JsonToken.QUOTE);
            writer.write(Long.toString(value));
            writer.write(JsonToken.QUOTE);
        }
    } catch (IOException e) {
        throwBsonException(e);
    }
}

From source file:com.cburch.draw.shapes.Rectangular.java

@Override
public Handle moveHandle(HandleGesture gesture) {
    Handle[] oldHandles = getHandleArray(null);
    Handle[] newHandles = getHandleArray(gesture);
    Handle moved = gesture == null ? null : gesture.getHandle();
    Handle result = null;//  ww  w.j a va 2 s .  c o  m
    int x0 = Integer.MAX_VALUE;
    int x1 = Integer.MIN_VALUE;
    int y0 = Integer.MAX_VALUE;
    int y1 = Integer.MIN_VALUE;
    int i = -1;
    for (Handle h : newHandles) {
        i++;
        if (oldHandles[i].equals(moved)) {
            result = h;
        }
        int hx = h.getX();
        int hy = h.getY();
        if (hx < x0)
            x0 = hx;
        if (hx > x1)
            x1 = hx;
        if (hy < y0)
            y0 = hy;
        if (hy > y1)
            y1 = hy;
    }
    bounds = Bounds.create(x0, y0, x1 - x0, y1 - y0);
    return result;
}

From source file:io.pivotal.strepsirrhini.chaosloris.docs.EventDocumentation.java

@Test
public void eventRead() throws Exception {
    Application application = new Application(UUID.randomUUID());
    application.setId(-1L);//  w  w  w  .  j av  a 2s  .  c om

    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)).andDo(document(
            pathParameters(parameterWithName("id").description("The event's id")),
            responseFields(
                    fieldWithPath("executedAt")
                            .description("An ISO-8601 timestamp for when the event occurred"),
                    fieldWithPath("terminatedInstances")
                            .description("The instances terminated during the event"),
                    fieldWithPath("totalInstanceCount").description(
                            "The total number of instances that were candidates for termination during the event"),
                    fieldWithPath("terminatedInstanceCount")
                            .description("The total number of instances terminated during the event")),
            links(linkWithRel("chaos").description("The [Chaos](#chaoses) that triggered the event"))));
}

From source file:com.alibaba.simpleimage.util.ImageUtils.java

public static final int clampRoundInt(double in) {
    return (in > Integer.MAX_VALUE ? Integer.MAX_VALUE
            : (in >= Integer.MIN_VALUE ? (int) Math.floor(in + 0.5) : Integer.MIN_VALUE));
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.PieChartExpression.java

protected void configureExplode(final PiePlot pp) {
    final PieDataset pieDS = pp.getDataset();

    final int explodeType = computeExplodeType();
    if (explodeType == EXPLODE_VALUE) {
        try {//from  w  w w  .  j a v a 2 s  .  c o m
            final int actualSegment = Integer.parseInt(explodeSegment);
            if (actualSegment >= 0) {
                pp.setExplodePercent(pieDS.getKey(actualSegment), explodePct.doubleValue());
            }
        } catch (Exception ignored) {
        }
        return;
    }

    // Calculate min and max...
    if (pieDS != null) {
        final int itemCount = pieDS.getItemCount();
        Number maxNum = new Double(Integer.MIN_VALUE);
        Number minNum = new Double(Integer.MAX_VALUE);
        int maxSegment = -1;
        int minSegment = -1;
        for (int i = 0; i < itemCount; i++) {
            final Number nbr = pieDS.getValue(i);
            if (nbr.doubleValue() > maxNum.doubleValue()) {
                maxNum = nbr;
                maxSegment = i;
            }
            if (nbr.doubleValue() < minNum.doubleValue()) {
                minNum = nbr;
                minSegment = i;
            }
        }

        if (explodeType == EXPLODE_MIN) { //$NON-NLS-1$
            if (minSegment >= 0) {
                pp.setExplodePercent(pieDS.getKey(minSegment), explodePct.doubleValue());
            }
        } else {
            if (maxSegment >= 0) {
                pp.setExplodePercent(pieDS.getKey(maxSegment), explodePct.doubleValue());
            }
        }
    }

}

From source file:easyJ.common.validate.GenericTypeValidator.java

/**
 * Checks if the value can safely be converted to an int primitive.
 * //ww  w  .  j a  va 2  s.  c  o m
 * @param value
 *                The value validation is being performed on.
 * @param locale
 *                The locale to use to parse the number (system default if
 *                null)
 * @return the converted Integer value.
 */
public static Integer formatInt(String value, Locale locale) {
    Integer result = null;

    if (value != null) {
        NumberFormat formatter = null;
        if (locale != null) {
            formatter = NumberFormat.getNumberInstance(locale);
        } else {
            formatter = NumberFormat.getNumberInstance(Locale.getDefault());
        }
        formatter.setParseIntegerOnly(true);
        ParsePosition pos = new ParsePosition(0);
        Number num = formatter.parse(value, pos);

        // If there was no error and we used the whole string
        if (pos.getErrorIndex() == -1 && pos.getIndex() == value.length()) {
            if (num.doubleValue() >= Integer.MIN_VALUE && num.doubleValue() <= Integer.MAX_VALUE) {
                result = new Integer(num.intValue());
            }
        }
    }

    return result;
}

From source file:fr.immotronic.ubikit.pems.enocean.impl.item.data.EEPD201xxDataImpl.java

public EEPD201xxDataImpl(int EEPType, SwitchState[] switchStates, Date[] switchStateDates, int value,
        MeasurementUnit unit, Date valueDate, Mode mode) {
    this(EEPType, switchStates, Integer.MIN_VALUE, switchStateDates, value, unit, valueDate, mode);
}