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.reecedunn.espeak.VoiceSettings.java

public int getRate() {
    int min = mEngine.Rate.getMinValue();
    int max = mEngine.Rate.getMaxValue();

    int rate = getPreferenceValue(PREF_RATE, Integer.MIN_VALUE);
    if (rate == Integer.MIN_VALUE) {
        rate = (int) ((float) getPreferenceValue(PREF_DEFAULT_RATE, 100) / 100
                * (float) mEngine.Rate.getDefaultValue());
    }/*from  w w  w  .  j  av  a  2  s.co  m*/

    if (rate > max)
        rate = max;
    if (rate < min)
        rate = min;
    return rate;
}

From source file:com.github.nlloyd.hornofmongo.adaptor.NumberLong.java

@JSFunction
@Override/*from w  ww  .  j  av  a2s .  co m*/
public String toString() {
    String toString;
    // reproduction of what v8_db.cpp has
    if ((realLong <= Integer.MIN_VALUE) || (Integer.MAX_VALUE <= realLong))
        toString = "NumberLong(\"" + realLong + "\")";
    else
        toString = "NumberLong(" + realLong + ")";
    return toString;
}

From source file:edu.cornell.med.icb.goby.alignments.perms.QueryIndexPermutation.java

public void reset() {
    smallestIndex = Integer.MAX_VALUE;
    biggestSmallIndex = Integer.MIN_VALUE;
    smallIndexCounter = 0;/* w w  w. j av a  2 s.c  o m*/
    queryIndexPermutation.clear();
    queryIndexPermutation.defaultReturnValue(-1);
    timesRequested.defaultReturnValue((byte) 1);
    if (permutationWriter != null) {
        permutationWriter.close();
    }
    permutationWriter = new PermutationWriter(basename);
    isSafeMode = doc().getBoolean("safe-mode");
}

From source file:net.audumla.scheduler.quartz.AstronomicTriggerImpl.java

@Override
public Date getFireTimeAfter(Date now) {
    Date fireTime = null;/*ww  w .  j a  v a  2 s  .co  m*/
    //seed the start time
    schedule.startTime.calculateEventFrom(now);
    // honor the count for the number of events to repeat on
    if (schedule.eventCount == Integer.MIN_VALUE || eventCount < schedule.eventCount) {
        // Ensure that we only execute a number of times equal to the repeat count during start and end events
        boolean nextEvent = false;
        if (schedule.interval > 0 && (schedule.repeat == Integer.MIN_VALUE || count <= schedule.repeat)) {
            fireTime = org.apache.commons.lang3.time.DateUtils.addSeconds(now, schedule.interval);
            Date end = null;
            if (schedule.endTime == null) {
                // if there is no end event then use the next start event instead so that we dont overlap with recurring events
                end = org.apache.commons.lang3.time.DateUtils.addSeconds(
                        schedule.startTime.getNextEvent().getCalculatedEventTime(), (int) schedule.startOffset);
            } else {
                // if an end event has been set then use it, but ensure that the event we use is after the current start event
                end = schedule.endTime.calculateEventFrom(now);
                while (end.before(org.apache.commons.lang3.time.DateUtils
                        .addSeconds(schedule.startTime.getCalculatedEventTime(), (int) schedule.startOffset))) {
                    schedule.endTime = schedule.endTime.getNextEvent();
                    end = org.apache.commons.lang3.time.DateUtils
                            .addSeconds(schedule.endTime.getCalculatedEventTime(), (int) schedule.endOffset);
                }
            }
            // make sure that the next fire is not passed the end event time
            if (end.before(fireTime)) {
                nextEvent = true;
            }
        } else {
            nextEvent = true;
        }

        if (nextEvent) {
            // if the next fire time is after the calculated end time then we need to reseed the start time to the next scheduled event
            schedule.startTime = schedule.startTime.getNextEvent();
            // increment the event count as we have passed an entire event cycle if we enter this section. We also need to reset the count to 0 as the count applies for each individual triggered event
            ++eventCount;
            count = 0;
            fireTime = org.apache.commons.lang3.time.DateUtils
                    .addSeconds(schedule.startTime.getCalculatedEventTime(), (int) schedule.startOffset);
        }
        // adjust the fire time based on the calendar
        if (fireTime != null && calendar != null && !calendar.isTimeIncluded(fireTime.getTime())) {
            Date nextValid = new Date(calendar.getNextIncludedTime(fireTime.getTime()));
            fireTime = getFireTimeAfter(nextValid);
        }
    } else {
        mayFireAgain = false;
    }
    return fireTime;

}

From source file:com.sillelien.dollar.api.types.DollarInfinity.java

@NotNull
@Override
public Integer toInteger() {
    return positive ? Integer.MAX_VALUE : Integer.MIN_VALUE;
}

From source file:org.pdfsam.ui.module.ProgressPane.java

@EventListener(priority = Integer.MIN_VALUE)
public void onTaskExecutionStarted(TaskExecutionStartedEvent event) {
    statusLabel.setText(DefaultI18nContext.getInstance().i18n("Running"));
}

From source file:com.martinkampjensen.thesis.barriers.neighborhood.AbstractNeighborhood.java

private static final double calculateNeighborMeasures(int[][] neighbors) {
    final int nModels = neighbors.length;
    int sum = 0;/* w w w . j a va  2 s .co m*/
    int max = Integer.MIN_VALUE;
    int min = Integer.MAX_VALUE;

    for (int i = 0; i < nModels; i++) {
        final int nNeighbors = neighbors[i].length;

        sum += nNeighbors;

        // TODO: This is wrong: 1) max is set, 2) max is set again, but min is not set to former max
        if (nNeighbors > max) {
            max = nNeighbors;
        } else if (nNeighbors < min) {
            min = nNeighbors;
        }
    }

    // Avoid insane measures in borderline cases.
    double avg;
    double inPercent;
    if (nModels == 0) {
        avg = min = max = 0;
        inPercent = 1;
    } else if (nModels == 1) {
        avg = min = max;
        inPercent = 1;
    } else {
        avg = sum / (double) nModels;
        inPercent = (double) (nModels - 1) / 100;
    }

    Debug.line("Neighbors per model: min. %d (%f%%), max. %d (%f%%), " + "avg. %f (%f%%)", min, min / inPercent,
            max, max / inPercent, avg, avg / inPercent);

    return avg;
}

From source file:de.robbers.dashclock.stackextension.StackExtension.java

@Override
protected void onUpdateData(int reason) {
    Log.i(TAG, "onUpdateData");
    clean();//from  w w w.  j av  a  2 s.c o m

    loadPreferences();

    if (TextUtils.isEmpty(mSite) || TextUtils.isEmpty(mUserId)) {
        Log.e(TAG, "Data missing");
        return;
    }

    performUserRequest();

    if (mReputation == Integer.MIN_VALUE) {
        Log.e(TAG, "Unable to fetch reputation.");
        return;
    }

    performReputationRequest();

    publishUpdate();
}

From source file:net.sf.sprockets.util.SparseArrays.java

/**
 * Get the first key of the SparseBooleanArray which has the value.
 *
 * @return {@link Integer#MIN_VALUE} if the value is not found
 *//*from   w  ww  .  ja  v a  2  s . c  o  m*/
private static int firstKey(SparseBooleanArray array, boolean value) {
    int size = array.size();
    for (int i = 0; i < size; i++) {
        if (array.valueAt(i) == value) {
            return array.keyAt(i);
        }
    }
    return Integer.MIN_VALUE;
}

From source file:org.trustedanalytics.servicebroker.gearpump.service.externals.helpers.ExternalProcessExecutor.java

public ExternalProcessExecutorResult run(String[] command, String workingDir, Map<String, String> properties) {

    String lineToRun = Arrays.asList(command).stream().collect(Collectors.joining(" "));

    LOGGER.info("===================");
    LOGGER.info("Command to invoke: {}", lineToRun);

    ProcessBuilder processBuilder = new ProcessBuilder(command);
    updateEnvOfProcessBuilder(processBuilder.environment(), properties);

    if (workingDir != null) {
        processBuilder.directory(new File(workingDir));
    }//from  w  ww . j  a v  a 2s .  c  o m
    processBuilder.redirectErrorStream(true);

    StringBuilder processOutput = new StringBuilder();
    Process process;
    BufferedReader stdout = null;

    try {
        process = processBuilder.start();
        stdout = new BufferedReader(new InputStreamReader(process.getInputStream()));

        String line;
        while ((line = stdout.readLine()) != null) {
            LOGGER.debug(":::::: " + line);
            processOutput.append(line);
            processOutput.append('\n');
        }

        try {
            process.waitFor();
        } catch (InterruptedException e) {
            LOGGER.error("Command '" + lineToRun + "' interrupted.", e);
        }
    } catch (IOException e) {
        LOGGER.error("Problem executing external process.", e);
        return new ExternalProcessExecutorResult(Integer.MIN_VALUE, "", e);
    } finally {
        closeReader(stdout);
    }

    ExternalProcessExecutorResult result = new ExternalProcessExecutorResult(process.exitValue(),
            processOutput.toString(), null);

    LOGGER.info("Exit value: {}", result.getExitCode());
    LOGGER.info("===================");
    return result;
}