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:statistic.graph.gui.Charts.java

private static void initXAxis(XYPlot plot, XYDataset dataset) {
    plot.setDomainAxis(new NumberAxis(plot.getDomainAxis().getLabel()));
    XYSeriesCollection collection = (XYSeriesCollection) dataset;
    double max = Double.NEGATIVE_INFINITY;
    double min = Double.POSITIVE_INFINITY;
    if (collection != null) {
        for (int s = 0; s < collection.getSeriesCount(); s++) {
            for (int d = 0; d < collection.getItemCount(s); d++) {
                XYDataItem data = collection.getSeries(s).getDataItem(d);
                if (data.getX().longValue() == Integer.MAX_VALUE
                        || data.getX().longValue() == Integer.MIN_VALUE) {
                    continue;
                }/*from w  ww .ja  va 2 s.com*/
                if (data.getX().doubleValue() > max) {
                    max = data.getX().doubleValue();
                }
                if (data.getX().doubleValue() < min) {
                    min = data.getX().doubleValue();
                }
            }
        }
        if (min < max) {
            plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
            plot.getDomainAxis().setRange(min - 0.5, max + 0.5);
            for (int s = 0; s < collection.getSeriesCount(); s++) {
                XYSeries series = collection.getSeries(s);
                if (series.indexOf(Integer.MIN_VALUE) >= 0) {
                    XYDataItem item = series.remove((Number) Integer.MIN_VALUE);
                    if (series.indexOf(min) < 0) {
                        series.add(min, item.getY());
                    }
                }
                if (series.indexOf(Integer.MAX_VALUE) >= 0) {
                    XYDataItem item = series.remove((Number) Integer.MAX_VALUE);
                    if (series.indexOf(max) < 0) {
                        series.add(max, item.getY());
                    }
                }
            }
        } else {
            plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
            plot.getDomainAxis().setRange(0 - 0.5, 1 + 0.5);
        }
    } else {
        plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        plot.getDomainAxis().setRange(0 - 0.5, 1 + 0.5);
    }
}

From source file:epgtools.dumpepgfromts.dataextractor.programme.ProgrammeDataExtractor.java

@Override
public void makeDataSet(Section s) throws IllegalStateException {
    final boolean isPutMessage = false;

    this.checkSection(s);

    this.checkSectionBodyType(s);

    EventInformationTableBody b = (EventInformationTableBody) s.getSectionBody();

    final TABLE_ID tid = s.getTable_id_const();

    boolean this_or_other = false;
    if (tid == TABLE_ID.EIT_THIS_STREAM_8_DAYS || tid == TABLE_ID.EIT_THIS_STREAM_NOW_AND_NEXT) {
        this_or_other = true;
    } else if (tid == TABLE_ID.EIT_OTHER_STREAM_NOW_AND_NEXT || tid == TABLE_ID.EIT_OTHER_STREAM_8_DAYS) {
        this_or_other = false;
    }//from   w w w  .jav  a  2s  .co m

    int transport_stream_id = b.getTransport_stream_id();

    int original_network_id = b.getOriginal_network_id();

    int service_id = b.getService_id();

    int event_id = Integer.MIN_VALUE;

    Timestamp start_Time = null;

    Timestamp stop_Time = null;

    String event_name = null;

    String description = null;

    List<Nibble> nibbles = null;

    final List<EventInformationTableRepeatingPart> rp = b.getEITRepeatingPartList();

    for (EventInformationTableRepeatingPart rpart : rp) {
        boolean sdtFlag = false;
        REPEATING_PART: {
            event_id = rpart.getEvent_id();

            start_Time = rpart.getStart_time_Object();
            if (start_Time == null) {
                LOG.warn(
                        "??????? ?????????? = "
                                + Hex.encodeHexString(s.getData()));
                break REPEATING_PART;
            }
            if (LOG.isInfoEnabled() && isPutMessage) {
                LOG.info(start_Time);
            }

            stop_Time = rpart.getStop_Time_Object();
            if (stop_Time == null) {
                LOG.warn(
                        "?????????????????  = "
                                + Hex.encodeHexString(s.getData()));
                break REPEATING_PART;
            }
            if (LOG.isInfoEnabled() && isPutMessage) {
                LOG.info(stop_Time);
            }

            for (Descriptor desc : rpart.getDescriptors_loop().getDescriptors_loopList()) {
                //???(????)
                if (desc.getDescriptor_tag_const() == DESCRIPTOR_TAG.SHORT_EVENT_DESCRIPTOR) {

                    ShortEventDescriptor sedesc = (ShortEventDescriptor) desc;

                    event_name = sedesc.getEvent_name_String();
                    if (LOG.isInfoEnabled() && isPutMessage) {
                        LOG.info(event_name);
                    }

                    description = sedesc.getText_String();
                    event_name = sedesc.getEvent_name_String();
                    if (LOG.isInfoEnabled() && isPutMessage) {
                        LOG.info(description);
                    }
                    sdtFlag = true;
                }

                //???
                if (desc.getDescriptor_tag_const() == DESCRIPTOR_TAG.CONTENT_DESCRIPTOR) {

                    ContentDescriptor cdesc = (ContentDescriptor) desc;
                    try {
                        nibbles = cdesc.getNibbles();
                    } catch (IllegalStateException ex) {
                        LOG.error(
                                "????????????????",
                                ex);
                        nibbles = new ArrayList<>();
                    }
                }

            }

            //sdt??EIT????????????????
            if (sdtFlag == true) {
                //?
                final Programme p = new Programme(event_id, start_Time, stop_Time, event_name, description,
                        nibbles, transport_stream_id, original_network_id, service_id, this_or_other);

                if (p != null) {
                    boolean ret = this.getDataSet().add(p);
                    if ((ret == false) && LOG.isInfoEnabled() && isPutMessage) {
                        LOG.info("?\n" + p);
                    }
                } else {
                    LOG.error("?null??  = "
                            + Hex.encodeHexString(s.getData()));
                }
            }
        }
    }
}

From source file:de.escalon.hypermedia.action.ActionInputParameter.java

/**
 * Creates input parameter descriptor./*from  ww w  .ja  va2  s.  c  o m*/
 *
 * @param methodParameter   to describe
 * @param value             used during sample invocation
 * @param conversionService to apply to value
 */
public ActionInputParameter(MethodParameter methodParameter, Object value,
        ConversionService conversionService) {
    this.methodParameter = methodParameter;
    this.value = value;
    this.requestBody = methodParameter.getParameterAnnotation(RequestBody.class);
    this.requestParam = methodParameter.getParameterAnnotation(RequestParam.class);
    this.pathVariable = methodParameter.getParameterAnnotation(PathVariable.class);
    // always determine input constraints,
    // might be a nested property which is neither requestBody, requestParam nor pathVariable
    this.inputAnnotation = methodParameter.getParameterAnnotation(Input.class);
    if (inputAnnotation != null) {
        putInputConstraint(MIN, Integer.MIN_VALUE, inputAnnotation.min());
        putInputConstraint(MAX, Integer.MAX_VALUE, inputAnnotation.max());
        putInputConstraint(MIN_LENGTH, Integer.MIN_VALUE, inputAnnotation.minLength());
        putInputConstraint(MAX_LENGTH, Integer.MAX_VALUE, inputAnnotation.maxLength());
        putInputConstraint(STEP, 0, inputAnnotation.step());
        putInputConstraint(PATTERN, "", inputAnnotation.pattern());
    }

    this.conversionService = conversionService;
    this.typeDescriptor = TypeDescriptor.nested(methodParameter, 0);
}

From source file:de.tudarmstadt.ukp.experiments.dip.wp1.documents.Step1PrepareContainers.java

/**
 * Parses the file with relevance/non-relevance information to each query, i.e.
 * <pre>/*  www. ja v a  2s .co  m*/
 * QID: 1021
 * Query: School dealing with bullying.
 * 1 Physical harm that occurs in an educational setting, performed intentionally by kids to other kids.
 * 1 Sexual harm that occurs in an educational setting, performed intentionally by kids to other kids.
 * 0 Bullying outside school.
 * 0 Bullying by adults.
 *
 * QID: 1022
 * Query: Signs of bullied kids.
 * 1 How to identify kids suffering from bulling by other kids.
 * [...]
 * </pre>
 *
 * @param file file
 * @return map (queryID, (0 = non-relevant list, 1 = relevant list))
 * @throws IOException exception
 */
public static Map<Integer, Map<Integer, List<String>>> parseRelevantInformationFile(File file)
        throws IOException {
    LineIterator lineIterator = FileUtils.lineIterator(file, "utf-8");

    Map<Integer, Map<Integer, List<String>>> result = new HashMap<>();

    int currentQueryId = Integer.MIN_VALUE;

    while (lineIterator.hasNext()) {
        String line = lineIterator.next().trim();

        if (line.isEmpty()) {
            currentQueryId = Integer.MIN_VALUE;
        }

        // new query id
        if (line.startsWith("QID: ")) {
            currentQueryId = Integer.valueOf(line.split("\\s", 2)[1]);

            // add to the result
            if (!result.containsKey(currentQueryId)) {
                result.put(currentQueryId, new HashMap<>());
                // and two empty lists
                result.get(currentQueryId).put(0, new ArrayList<>());
                result.get(currentQueryId).put(1, new ArrayList<>());
            }
        }

        if (line.startsWith("0 ")) {
            String nonRelevantInformation = line.split("\\s", 2)[1];

            if (currentQueryId == Integer.MIN_VALUE) {
                throw new IOException("Input file has a wrong format, no QUI provided");
            }

            // add to the result
            result.get(currentQueryId).get(0).add(nonRelevantInformation);
        }

        if (line.startsWith("1 ")) {
            String relevantInformation = line.split("\\s", 2)[1];

            if (currentQueryId == Integer.MIN_VALUE) {
                throw new IOException("Input file has a wrong format, no QUI provided");
            }

            // add to the result
            result.get(currentQueryId).get(1).add(relevantInformation);
        }
    }

    // debug
    for (Map.Entry<Integer, Map<Integer, List<String>>> entry : result.entrySet()) {
        System.out.println("QID: " + entry.getKey());
        for (Map.Entry<Integer, List<String>> innerEntry : entry.getValue().entrySet()) {
            for (String info : innerEntry.getValue()) {
                System.out.printf("%d %s%n", innerEntry.getKey(), info);
            }
        }
        System.out.println();
    }

    return result;
}

From source file:io.pivotal.strepsirrhini.chaosloris.data.EventRepositoryTest.java

@Test
public void findByExecutedAtBefore() throws ExecutionException, InterruptedException {
    Schedule schedule = new Schedule("test-schedule", "test-name");
    this.scheduleRepository.saveAndFlush(schedule);

    Application application = new Application(UUID.randomUUID());
    this.applicationRepository.saveAndFlush(application);

    Chaos chaos = new Chaos(application, 0.1, schedule);
    this.chaosRepository.saveAndFlush(chaos);

    Instant now = Instant.now();

    Event event1 = new Event(chaos, now.minus(1, DAYS), Collections.emptyList(), Integer.MIN_VALUE);
    this.eventRepository.saveAndFlush(event1);

    Event event2 = new Event(chaos, now, Collections.emptyList(), Integer.MIN_VALUE);
    this.eventRepository.saveAndFlush(event2);

    Event event3 = new Event(chaos, now.plus(1, DAYS), Collections.emptyList(), Integer.MIN_VALUE);
    this.eventRepository.saveAndFlush(event3);

    List<Event> events = this.eventRepository.findByExecutedAtBefore(now.minus(1, HOURS));
    assertThat(events).containsExactly(event1);
}

From source file:com.jillesvangurp.geo.GeoGeometry.java

/**
 * @param lineString line/* w  ww .  java2s  .  c om*/
 * @return bounding box that contains the lineString as a double array of
 *         [minLat,maxLat,minLon,maxLon}
 */
public static double[] boundingBox(double[][] lineString) {
    double minLat = Integer.MAX_VALUE;
    double minLon = Integer.MAX_VALUE;
    double maxLat = Integer.MIN_VALUE;
    double maxLon = Integer.MIN_VALUE;

    for (int i = 0; i < lineString.length; i++) {
        minLat = min(minLat, lineString[i][1]);
        minLon = min(minLon, lineString[i][0]);
        maxLat = max(maxLat, lineString[i][1]);
        maxLon = max(maxLon, lineString[i][0]);
    }

    return new double[] { minLat, maxLat, minLon, maxLon };
}

From source file:io.github.karols.hocr4j.Bounds.java

/**
 * Returns the semiplane on the right of the vertical line with the given coordinate.
 *
 * @param x the left edge coordinate/*from www  .j  a v  a 2s.  c o  m*/
 * @return the semiplane
 */
public static Bounds getRightSemiplane(int x) {
    return new Bounds(x, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
}

From source file:eu.stratosphere.nephele.io.channels.DistributedChannelWithAccessInfo.java

@Override
public int decrementReferences() {

    int current = this.referenceCounter.get();
    while (true) {
        if (current <= 0) {
            // this is actually an error case, because the channel was deleted before
            throw new IllegalStateException("The references to the file were already at zero.");
        }//from w  ww . j av  a 2 s .  c o  m

        if (current == 1) {
            // this call decrements to zero, so mark it as deleted
            if (this.referenceCounter.compareAndSet(current, Integer.MIN_VALUE)) {
                current = 0;
                break;
            }
        } else if (this.referenceCounter.compareAndSet(current, current - 1)) {
            current = current - 1;
            break;
        }
        current = this.referenceCounter.get();
    }

    if (current > 0) {
        return current;
    } else if (current == 0) {
        // delete the channel
        this.referenceCounter.set(Integer.MIN_VALUE);
        this.reservedWritePosition.set(Long.MIN_VALUE);
        try {
            this.channel.close();
            if (this.deleteOnClose.get()) {
                this.fs.delete(this.checkpointFile, false);
            }

        } catch (IOException ioex) {
            if (LOG.isErrorEnabled()) {
                LOG.error("Error while closing spill file for file buffers: " + ioex.getMessage(), ioex);
            }
        }
        return current;
    } else {
        throw new IllegalStateException("The references to the file were already at zero.");
    }
}

From source file:com.sisrni.managedbean.EscuelaDepartamentoMB.java

/** 
 * Metodo para guardar una instancia de 'EscuelaDepartamento' en la tabla 
 * correspondiente de la base de datos//from   www.  j a v  a  2 s . co m
 */
public void guardarEscuelaDepartamento() {
    String msg = "Registro Almacenado Exitosamente!";
    try {
        escuelaDepartamento.setIdEscuelaDepto(Integer.MIN_VALUE);
        escuelaDepartamento.setIdFacultad(facultadService.findById(facultad.getIdFacultad()));
        escuelaDepartamentoService.save(escuelaDepartamento);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardado!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar el Registro!");
        e.printStackTrace();
    }
    cargarEscuelaDepartamento();
}

From source file:com.digipom.manteresting.android.processor.json.JsonProcessor.java

public final Meta executeMethodAndApply() throws RestException {
    try {//from w  w  w  .  j  av  a2s  .  c  o m
        final Meta metaToReturn = new Meta();
        final byte[] response = method.executeGet();
        final JSONObject object = new JSONObject(new String(response));
        final JSONObject meta = object.getJSONObject("meta");
        final String next = meta.getString("next");
        final JSONArray objects = object.getJSONArray("objects");
        final int objectsLength = objects.length();

        if (next != null) {
            try {
                final Uri nextUri = Uri.parse(next);

                final int nextOffset = Integer.parseInt(nextUri.getQueryParameter("offset"));
                final int nextLimit = Integer.parseInt(nextUri.getQueryParameter("limit"));

                metaToReturn.count = objectsLength;
                metaToReturn.nextOffset = nextOffset;
                metaToReturn.nextLimit = nextLimit;
            } catch (NumberFormatException e) {
                throw new RestException("Problem parsing meta 'next' URL");
            }
        }

        int greatestId = Integer.MIN_VALUE;
        int smallestId = Integer.MAX_VALUE;

        try {
            for (int i = 0; i < objectsLength; i++) {
                final int currentId = Integer.parseInt(objects.getJSONObject(i).getString("id"));

                if (greatestId < currentId)
                    greatestId = currentId;
                if (smallestId > currentId)
                    smallestId = currentId;
            }
        } catch (NumberFormatException e) {
            throw new RestException("Problem parsing ids");
        }

        metaToReturn.greatestId = greatestId;
        metaToReturn.smallestId = smallestId;

        final ArrayList<ContentProviderOperation> batch = parse(object, metaToReturn);
        resolver.applyBatch(ManterestingContract.CONTENT_AUTHORITY, batch);
        return metaToReturn;
    } catch (RemoteException e) {
        throw new RestException("Problem applying batch operation", e);
    } catch (OperationApplicationException e) {
        throw new RestException("Problem applying batch operation", e);
    } catch (JSONException e) {
        throw new RestException("Problem parsing JSON", e);
    } catch (ClientProtocolException e) {
        throw new RestException("Problem sending request", e);
    } catch (IOException e) {
        throw new RestException("Problem sending request", e);
    }
}