Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

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

Prototype

int MAX_VALUE

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

Click Source Link

Document

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

Usage

From source file:com.od.jtimeseries.ui.visualizer.chart.creator.EfficientXYLineAndShapeRenderer.java

public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data,
        PlotRenderingInfo info) {/* w  w  w . j a va 2 s  .  c  o  m*/

    minY = Integer.MAX_VALUE;
    maxY = Integer.MIN_VALUE;
    storedLine = false;
    linesDrawn = 0;
    return super.initialise(g2, dataArea, plot, data, info);
}

From source file:ch.aonyx.broker.ib.api.util.InputStreamUtils.java

public static final int readIntMax(final InputStream inputStream) {
    final String string = readString(inputStream);
    return string == null ? Integer.MAX_VALUE : Integer.parseInt(string);
}

From source file:LVCoref.MentionBrowser.java

public static Mention getFirstFromSintax(Mention s, Expression expression, JexlContext jexlContext) {
    Mention t = null;/*w w  w.  j a  v  a  2  s.  c o m*/
    int minDist = Integer.MAX_VALUE;
    Mention prev = s.prev();
    while (prev != null) {
        if (s.type == Dictionaries.MentionType.NOMINAL
                && Filter.sentenceDistance(s, prev) > Constants.SENTENCE_WINDOW) {
            break;
        }
        if (s.type == Dictionaries.MentionType.PRONOMINAL && Filter.sentenceDistance(s, prev) > 3) {
            break;
        }

        if (s != prev && _filterAgree(s, prev, expression, jexlContext)) {
            int dist = s.node.minDistance(prev.node);
            if (t == null || dist < minDist) {
                t = prev;
                minDist = dist;
            }
        }
        prev = prev.prev();
    }
    return t;
}

From source file:com.microsoft.windowsazure.core.pipeline.jersey.RetryPolicyFilter.java

@Override
public ServiceResponseContext handle(ServiceRequestContext request, Next next) throws Exception {
    // Only the last added retry policy should be active
    if (request.getProperty("RetryPolicy") != null) {
        return next.handle(request);
    }//from   w  w w  . j a va  2  s.  c  om

    request.setProperty("RetryPolicy", this);

    // Retry the operation as long as retry policy tells us to do so
    for (int retryCount = 0;; ++retryCount) {
        // Mark the stream before passing the request through
        if (getEntityStream(request) != null) {
            getEntityStream(request).mark(Integer.MAX_VALUE);
        }

        // Pass the request to the next handler
        ServiceResponseContext response = null;
        Exception error = null;
        try {
            response = next.handle(request);
        } catch (Exception e) {
            error = e;
        }

        // Determine if we should retry according to retry policy
        boolean shouldRetry = retryPolicy.shouldRetry(retryCount, response, error);
        if (!shouldRetry) {
            if (error != null) {
                throw error;
            }

            return response;
        }

        // Reset the stream before retrying
        if (getEntityStream(request) != null) {
            getEntityStream(request).reset();
        }

        // Backoff for some time according to retry policy
        int backoffTime = retryPolicy.calculateBackoff(retryCount, response, error);
        LOG.info(String.format(
                "Request failed. Backing off for %1s milliseconds before retrying (retryCount=%2d)",
                backoffTime, retryCount));
        backoff(backoffTime);
    }
}

From source file:com.github.cambierr.lorawanpacket.semtech.Stat.java

private Stat() {
    time = null;//from w ww . jav a 2s.  c om
    lati = Double.MAX_VALUE;
    longi = Double.MAX_VALUE;
    alti = Integer.MAX_VALUE;
    rxnb = Integer.MAX_VALUE;
    rxok = Integer.MAX_VALUE;
    rxfw = Integer.MAX_VALUE;
    ackr = Integer.MAX_VALUE;
    dwnb = Integer.MAX_VALUE;
    txnb = Integer.MAX_VALUE;
}

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

public void upgrade(String basename, AlignmentReaderImpl reader) throws IOException {
    if (!"1.9.5-".equals(reader.getGobyVersion()))
        return;//from www .java2  s .  com

    final GZIPInputStream indexStream = new GZIPInputStream(new RepositionableInputStream(basename + ".index"));

    final CodedInputStream codedInput = CodedInputStream.newInstance(indexStream);
    codedInput.setSizeLimit(Integer.MAX_VALUE);
    final Alignments.AlignmentIndex index = Alignments.AlignmentIndex.parseFrom(codedInput);

    LongArrayList indexOffsets = new LongArrayList();
    LongArrayList upgradedOffsets = new LongArrayList();
    LongArrayList indexAbsolutePositions = new LongArrayList();
    LongArrayList upgradedIndexAbsolutePositions = new LongArrayList();

    for (final long offset : index.getOffsetsList()) {
        indexOffsets.add(offset);
    }
    for (final long absolutePosition : index.getAbsolutePositionsList()) {
        indexAbsolutePositions.add(absolutePosition);
    }
    // trimming is essential for the binary search to work reliably with the result of elements():
    indexAbsolutePositions.trim();
    indexOffsets.trim();
    long[] targetPositionOffsets;
    int[] targetLengths = reader.getTargetLength();

    //prepare according to new indexing scheme:
    targetPositionOffsets = new long[targetLengths.length];
    targetPositionOffsets[0] = 0;
    for (int targetIndex = 1; targetIndex < targetLengths.length; targetIndex++) {
        targetPositionOffsets[targetIndex] = targetLengths[targetIndex - 1]
                + targetPositionOffsets[targetIndex - 1];
    }
    long previousAbsolutePosition = -1;
    ProgressLogger progress = new ProgressLogger(LOG);
    progress.expectedUpdates = indexOffsets.size();
    progress.priority = Level.INFO;
    progress.start();
    // push the very first entry to the index at offset zero. This is necessary because 1.9.5 did not include
    // offset information and absolute position for the very first entry of the alignment.
    Alignments.AlignmentEntry entry = reader.next();
    previousAbsolutePosition = pushEntryToIndex(upgradedOffsets, upgradedIndexAbsolutePositions,
            targetPositionOffsets, previousAbsolutePosition, 0, entry);

    for (long indexOffset : indexOffsets) {
        // for each offset in the entries file, obtain the first entry then recode absolute position:

        entry = fetchFirstEntry(reader, indexOffset);
        previousAbsolutePosition = pushEntryToIndex(upgradedOffsets, upgradedIndexAbsolutePositions,
                targetPositionOffsets, previousAbsolutePosition, indexOffset, entry);

        progress.lightUpdate();
    }
    progress.stop();
    writeIndex(basename, upgradedOffsets, upgradedIndexAbsolutePositions);
    upgradeHeaderVersion(basename);
    if (verbose) {
        System.out.printf("alignment %s upgraded successfully.%n", basename);
    }
}

From source file:com.imag.nespros.network.routing.Topology.java

public List<ComLink> getPath(Device from, Device to) {
    ArrayList<ComLink> path = new ArrayList<>();
    Transformer<ComLink, Integer> wtTransformer = new Transformer<ComLink, Integer>() {
        @Override/*w w w  .  ja  v  a 2s. co  m*/
        public Integer transform(ComLink link) {
            if (link.isDown()) {
                return Integer.MAX_VALUE;
            }
            return link.getLatency() * (link.getPendingPackets().size() + 1);
        }
    };
    DijkstraShortestPath<Device, ComLink> alg = new DijkstraShortestPath(graph, wtTransformer);
    return alg.getPath(from, to);
}

From source file:SwingThreadTest.java

public SwingThreadFrame() {
    setTitle("SwingThreadTest");

    final JComboBox combo = new JComboBox();
    combo.insertItemAt(Integer.MAX_VALUE, 0);
    combo.setPrototypeDisplayValue(combo.getItemAt(0));
    combo.setSelectedIndex(0);/*w  ww  .jav a2s.  c  o  m*/

    JPanel panel = new JPanel();

    JButton goodButton = new JButton("Good");
    goodButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            new Thread(new GoodWorkerRunnable(combo)).start();
        }
    });
    panel.add(goodButton);
    JButton badButton = new JButton("Bad");
    badButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            new Thread(new BadWorkerRunnable(combo)).start();
        }
    });
    panel.add(badButton);

    panel.add(combo);
    add(panel);
    pack();
}

From source file:gate.Utils.java

/**
 * Return the length of the document content covered by an Annotation as an
 * int -- if the content is too long for an int, the method will throw
 * a GateRuntimeException. Use getLengthLong(SimpleAnnotation ann) if
 * this situation could occur.//w  w w.  jav  a 2s.co m
 * @param ann the annotation for which to determine the length
 * @return the length of the document content covered by this annotation.
 */
public static int length(SimpleAnnotation ann) {
    long len = lengthLong(ann);
    if (len > java.lang.Integer.MAX_VALUE) {
        throw new GateRuntimeException("Length of annotation too big to be returned as an int: " + len);
    } else {
        return (int) len;
    }
}

From source file:com.opengamma.elsql.OffsetFetchSqlFragment.java

@Override
protected void toSQL(StringBuilder buf, ElSqlBundle bundle, SqlParameterSource paramSource) {
    int offset = 0;
    int fetchLimit = 0;
    if (_offsetVariable != null && paramSource.hasValue(_offsetVariable)) {
        offset = ((Number) paramSource.getValue(_offsetVariable)).intValue();
    }/*  ww w.j  av a  2s  . c  o m*/
    if (paramSource.hasValue(_fetchVariable)) {
        fetchLimit = ((Number) paramSource.getValue(_fetchVariable)).intValue();
    } else if (StringUtils.containsOnly(_fetchVariable, "0123456789")) {
        fetchLimit = Integer.parseInt(_fetchVariable);
    }
    buf.append(bundle.getConfig().getPaging(offset, fetchLimit == Integer.MAX_VALUE ? 0 : fetchLimit));
}