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:de.escalon.hypermedia.spring.ActionInputParameter.java

/**
 * Creates action input parameter.//from   ww  w.  j  av  a2s.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);
    this.requestHeader = methodParameter.getParameterAnnotation(RequestHeader.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(Input.MIN, Integer.MIN_VALUE, inputAnnotation.min());
        putInputConstraint(Input.MAX, Integer.MAX_VALUE, inputAnnotation.max());
        putInputConstraint(Input.MIN_LENGTH, Integer.MIN_VALUE, inputAnnotation.minLength());
        putInputConstraint(Input.MAX_LENGTH, Integer.MAX_VALUE, inputAnnotation.maxLength());
        putInputConstraint(Input.STEP, 0, inputAnnotation.step());
        putInputConstraint(Input.PATTERN, "", inputAnnotation.pattern());
    }
    this.conversionService = conversionService;
    this.typeDescriptor = TypeDescriptor.nested(methodParameter, 0);
}

From source file:de.escalon.hypermedia.spring.SpringActionInputParameter.java

/**
 * Creates action input parameter.//from  w  ww.j  a va  2s . co m
 *
 * @param methodParameter
 *         to describe
 * @param value
 *         used during sample invocation
 * @param conversionService
 *         to apply to value
 */
public SpringActionInputParameter(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);
    this.requestHeader = methodParameter.getParameterAnnotation(RequestHeader.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(Input.MIN, Integer.MIN_VALUE, inputAnnotation.min());
        putInputConstraint(Input.MAX, Integer.MAX_VALUE, inputAnnotation.max());
        putInputConstraint(Input.MIN_LENGTH, Integer.MIN_VALUE, inputAnnotation.minLength());
        putInputConstraint(Input.MAX_LENGTH, Integer.MAX_VALUE, inputAnnotation.maxLength());
        putInputConstraint(Input.STEP, 0, inputAnnotation.step());
        putInputConstraint(Input.PATTERN, "", inputAnnotation.pattern());
    }
    this.conversionService = conversionService;
    this.typeDescriptor = TypeDescriptor.nested(methodParameter, 0);
}

From source file:main.export.sql.DocBuilder.java

@SuppressWarnings("unchecked")
public void execute() throws ClassNotFoundException, InstantiationException, IllegalAccessException,
        SQLException, UnsupportedEncodingException, IOException, HttpException {

    String url = importer.getConfig().dataSources.get(null).getProperty("url");
    String user = importer.getConfig().dataSources.get(null).getProperty("user");
    String password = importer.getConfig().dataSources.get(null).getProperty("password");
    batchSize = Integer.valueOf(importer.getConfig().dataSources.get(null).getProperty("batch-size"));
    Entity rootEntity = importer.getConfig().document.entities.get(0);
    String driverName = importer.getConfig().dataSources.get(null).getProperty(DRIVER);

    // Set the fetch size depending on SQL type
    if (batchSize == -1 && driverName.contains("mysql"))
        batchSize = Integer.MIN_VALUE;
    else if (batchSize == -1)
        batchSize = 0;//w w w . j  av  a2  s. c  om

    Class.forName(driverName).newInstance();
    conn = DriverManager.getConnection(url, user, password);
    subConnection = DriverManager.getConnection(url, user, password);

    // set the PK for future use
    importer.getWriter().setPrimaryKey(rootEntity.pk);

    if (rootEntity != null && rootEntity.isDocRoot) {
        String rootQuery = rootEntity.allAttributes.get("query");
        stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        stmt.setMaxRows(0);
        stmt.setFetchSize(batchSize);
        rs = stmt.executeQuery(rootQuery);
        int i = 0;
        List<Map<String, Object>> entityList = new ArrayList<Map<String, Object>>();

        long t1 = System.currentTimeMillis();
        while (rs.next()) {
            if (i == importer.getAutoCommitSize()) {
                long t2 = System.currentTimeMillis();
                log.info("Time taken to Read " + i + " documents from SQL : " + (t2 - t1) + " ms");
                // FIXME Remove ouput
                System.out.println("Time taken to Read " + i + " documents from SQL : " + (t2 - t1) + " ms");
                importer.getWriter().writeToNoSQL(entityList);
                entityList = new ArrayList<Map<String, Object>>();

                i = 0;
                t1 = System.currentTimeMillis();

            }
            params = new HashMap<String, String>();
            entityList.add(getFields(processor.toMap(rs), rs, rootEntity, null, null));
            i++;
        }

        importer.getWriter().writeToNoSQL(entityList);
    }

    conn.close();
    subConnection.close();
}

From source file:com.github.veqryn.net.Ip4.java

/**
 * Constructor that takes a packed integer value
 *
 * @param ipIntegerValue IPv4 integer//  w  ww. j  av  a 2  s . c  om
 * @param binary false if using a sortable packed integer,
 *        where Integer.MIN_VALUE = 0.0.0.0
 *        and 0 = 128.0.0.0
 *        and Integer.MAX_VALUE = 255.255.255.255<br>
 *        true if using a binary integer,
 *        where Integer.MIN_VALUE = 128.0.0.0
 *        and 0 = 0.0.0.0
 *        and Integer.MAX_VALUE = 127.255.255.255
 *        and -1 = 255.255.255.255
 */
protected Ip4(final int ipIntegerValue, final boolean binary) {
    address = binary ? ipIntegerValue ^ Integer.MIN_VALUE : ipIntegerValue;
}

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

@Test
public void list() throws Exception {
    Application application = new Application(UUID.randomUUID());
    application.setId(-1L);//from  www . j  av 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, Collections.emptyList(), Integer.MIN_VALUE);
    event.setId(-4L);

    when(this.eventRepository.findAll(new PageRequest(0, 20)))
            .thenReturn(new PageImpl<>(Collections.singletonList(event)));

    this.mockMvc.perform(get("/events").accept(HAL_JSON)).andExpect(status().isOk())
            .andExpect(jsonPath("$.page").exists()).andExpect(jsonPath("$._embedded.events").value(hasSize(1)))
            .andExpect(jsonPath("$._links.self").exists());
}

From source file:cn.newgxu.android.bbs.ui.UserFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    new LoadUser().execute(getArguments().getInt(Consts.UID, Integer.MIN_VALUE));
}

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

/**
 * Returns the semiplane on the top of the horizontal line with the given coordinate.
 *
 * @param y the bottom edge coordinate//  ww w. j  a va 2 s .  co  m
 * @return the semiplane
 */
public static Bounds getTopSemiplane(int y) {
    return new Bounds(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, y);
}

From source file:de.fau.cs.osr.hddiff.utils.HDDiffTreeVisualizer.java

private int drawNode(PrintStream ps, String prefix, DiffNode node, int i) {
    int weight = node.getWeight();

    if (node.isTextLeaf()) {
        String color = getColor(node, null);

        String text = node.getTextContent();

        String label = abbreviateNodeRep(text);

        String shape = "box";
        if (node.isSplit())
            shape = "parallelogram";
        else if (node.isSubtreeMatched())
            shape = "box, peripheries=2";
        else if (weight <= 0)
            shape = "diamond";

        String stats = "";
        if (node.getCommon() != Integer.MIN_VALUE)
            stats = String.format("%d/%d\\n", node.getCommon(), weight);

        ps.println(String.format("%s_%d [label=\"%s\\\"%s\\\"\", shape=%s, fontsize=8%s];", prefix, i, stats,
                label, shape, color));/*from  w  w  w  .  j av a2  s  .  c  om*/
    } else {
        String name = node.getLabel();
        String label = name;

        if (node.getCommon() != Integer.MIN_VALUE) {
            label = String.format("%d/%d=%d\\n%s", node.getCommon(), weight,
                    (int) (node.getCommon() / (float) weight * 100), name);
        }

        String color = getColor(node, "gray");

        String shape = "plaintext";
        if (node.isSubtreeMatched())
            shape = "box, peripheries=2";

        ps.println(String.format("%s_%d [label=\"%s\", shape=%s, fontsize=10%s];", prefix, i, label, shape,
                color));
    }

    int j = i + 1;
    for (DiffNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
        ps.println(String.format("%s_%d -> %s_%d", prefix, i, prefix, j));

        j = drawNode(ps, prefix, child, j);
    }

    return j;
}

From source file:de.dmxcontrol.device.EntityDevice.java

public static EntityDevice Receive(JSONObject o) {
    EntityDevice entity = null;/*  w w w . j a  v a  2 s . co  m*/
    try {
        if (o.getString("Type").equals(NetworkID)) {
            entity = new EntityDevice(o.getInt("Number"), o.getString("Name"), o.getString("Image"));
            entity.guid = o.getString("GUID");
            if (o.has("Channel")) {
                if (!o.getString("Channel").equals("null")) {
                    entity.channel = o.getInt("Channel");
                } else {
                    entity.channel = Integer.MIN_VALUE;
                }
            }
            if (o.has("ChannelCount")) {
                entity.channelCount = o.getInt("ChannelCount");
            }
            if (o.has("Color")) {
                entity.color = o.getInt("Color");
            }
            if (o.has("Model")) {
                entity.model = o.getString("Model");
            }
            if (o.has("Vendor")) {
                entity.vendor = o.getString("Vendor");
            }
            if (o.has("Author")) {
                entity.author = o.getString("Author");
            }
            if (o.has("Enabled")) {
                entity.enabled = o.getBoolean("Enabled");
            }
            if (o.has("Image")) {
                if (!o.getString("Image").equals("null")) {
                    entity.image = o.getString("Image");
                } else {
                    entity.setImage(defaultDeviceIcon);
                }
            }

            entity.Propertys = new DevicePropertyCollection(o);
            entity.Procedures = new DeviceProcedureCollection(o);
        }
        o = null;
    } catch (Exception e) {
        Log.e("Entity device", e.getMessage());
        DMXControlApplication.SaveLog();
    }
    o = null;
    if (o == null) {
        ;
    }
    return entity;
}

From source file:com.nebhale.devoxx2013.web.DoorControllerTest.java

@Test
public void modifyDoorDoesNotExist() throws Exception {
    this.mockMvc/*from ww  w. j  a  v a2  s . co  m*/
            .perform(put("/games/{game}/doors/{door}", Integer.MIN_VALUE, Integer.MIN_VALUE + 1)
                    .content("{ \"status\" : \"SELECTED\" }").contentType(MediaType.APPLICATION_JSON))
            .andExpect(status().isNotFound());
}