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.undercouch.bson4jackson.BsonParserTest.java

@Test
public void parseComplex() throws Exception {
    BSONObject o = new BasicBSONObject();
    o.put("Timestamp", new BSONTimestamp(0xAABB, 0xCCDD));
    o.put("Symbol", new Symbol("Test"));
    o.put("ObjectId", new org.bson.types.ObjectId(Integer.MAX_VALUE, -2, Integer.MIN_VALUE));
    Pattern p = Pattern.compile(".*",
            Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE | Pattern.UNICODE_CASE);
    o.put("Regex", p);

    Map<?, ?> data = parseBsonObject(o);
    assertEquals(new Timestamp(0xAABB, 0xCCDD), data.get("Timestamp"));
    assertEquals(new de.undercouch.bson4jackson.types.Symbol("Test"), data.get("Symbol"));
    ObjectId oid = (ObjectId) data.get("ObjectId");
    assertEquals(Integer.MAX_VALUE, oid.getTime());
    assertEquals(-2, oid.getMachine());// w  w w  .  j av a 2 s .com
    assertEquals(Integer.MIN_VALUE, oid.getInc());
    Pattern p2 = (Pattern) data.get("Regex");
    assertEquals(p.flags(), p2.flags());
    assertEquals(p.pattern(), p2.pattern());
}

From source file:hivemall.recommend.SlimUDTF.java

@Override
public StructObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    final int numArgs = argOIs.length;

    if (numArgs == 1 && HiveUtils.isConstString(argOIs[0])) {// for -help option
        String rawArgs = HiveUtils.getConstString(argOIs[0]);
        parseOptions(rawArgs);/* w  w w.  ja v a 2  s. co m*/
    }

    if (numArgs != 5 && numArgs != 6) {
        throw new UDFArgumentException(
                "_FUNC_ takes 5 or 6 arguments: int i, map<int, double> r_i, map<int, map<int, double>> topKRatesOfI, int j, map<int, double> r_j [, constant string options]: "
                        + Arrays.toString(argOIs));
    }

    this.itemIOI = HiveUtils.asIntCompatibleOI(argOIs[0]);

    this.riOI = HiveUtils.asMapOI(argOIs[1]);
    this.riKeyOI = HiveUtils.asIntCompatibleOI((riOI.getMapKeyObjectInspector()));
    this.riValueOI = HiveUtils.asPrimitiveObjectInspector((riOI.getMapValueObjectInspector()));

    this.knnItemsOI = HiveUtils.asMapOI(argOIs[2]);
    this.knnItemsKeyOI = HiveUtils.asIntCompatibleOI(knnItemsOI.getMapKeyObjectInspector());
    this.knnItemsValueOI = HiveUtils.asMapOI(knnItemsOI.getMapValueObjectInspector());
    this.knnItemsValueKeyOI = HiveUtils.asIntCompatibleOI(knnItemsValueOI.getMapKeyObjectInspector());
    this.knnItemsValueValueOI = HiveUtils.asDoubleCompatibleOI(knnItemsValueOI.getMapValueObjectInspector());

    this.itemJOI = HiveUtils.asIntCompatibleOI(argOIs[3]);

    this.rjOI = HiveUtils.asMapOI(argOIs[4]);
    this.rjKeyOI = HiveUtils.asIntCompatibleOI((rjOI.getMapKeyObjectInspector()));
    this.rjValueOI = HiveUtils.asPrimitiveObjectInspector((rjOI.getMapValueObjectInspector()));

    processOptions(argOIs);

    this._observedTrainingExamples = 0L;
    this._previousItemId = Integer.MIN_VALUE;
    this._weightMatrix = null;
    this._dataMatrix = null;

    List<String> fieldNames = new ArrayList<>();
    List<ObjectInspector> fieldOIs = new ArrayList<>();

    fieldNames.add("j");
    fieldOIs.add(PrimitiveObjectInspectorFactory.writableIntObjectInspector);
    fieldNames.add("nn");
    fieldOIs.add(PrimitiveObjectInspectorFactory.writableIntObjectInspector);
    fieldNames.add("w");
    fieldOIs.add(PrimitiveObjectInspectorFactory.writableFloatObjectInspector);

    return ObjectInspectorFactory.getStandardStructObjectInspector(fieldNames, fieldOIs);
}

From source file:LongVector.java

/**
 * Searches for the first occurence of the given argument, beginning the
 * search at index, and testing for equality using the equals method.
 * /*from   www .  j a  v a  2s .  c  o m*/
 * @param elem
 *            Object to look for
 * @return the index of the first occurrence of the object argument in this
 *         vector at position index or later in the vector; returns -1 if
 *         the object is not found.
 */
public final int lastIndexOf(long elem) {

    for (int i = (_size - 1); i >= 0; i--) {
        if (_data[i] == elem)
            return i;
    }

    return java.lang.Integer.MIN_VALUE;
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.diagnostics.ApproximationSetViewer.java

/**
 * Initializes this window.  This method is invoked in the constructor, and
 * should not be invoked again.//from   ww  w.  j  ava2 s  .  c o m
 */
protected void initialize() {
    //initialize the NFE slider
    int minimumNFE = Integer.MAX_VALUE;
    int maximumNFE = Integer.MIN_VALUE;

    for (Accumulator accumulator : accumulators) {
        minimumNFE = Math.min(minimumNFE, (Integer) accumulator.get("NFE", 0));
        maximumNFE = Math.max(maximumNFE, (Integer) accumulator.get("NFE", accumulator.size("NFE") - 1));
    }

    slider = new JSlider(minimumNFE, maximumNFE, minimumNFE);
    slider.setPaintTicks(true);
    slider.setMinorTickSpacing(100);
    slider.setMajorTickSpacing(1000);
    slider.addChangeListener(this);

    //initializes the options available for axis plotting
    Solution solution = (Solution) ((List<?>) accumulators.get(0).get("Approximation Set", 0)).get(0);
    Vector<String> objectives = new Vector<String>();

    for (int i = 0; i < solution.getNumberOfObjectives(); i++) {
        objectives.add(localization.getString("text.objective", i + 1));
    }

    for (int i = 0; i < solution.getNumberOfConstraints(); i++) {
        objectives.add(localization.getString("text.constraint", i + 1));
    }

    for (int i = 0; i < solution.getNumberOfVariables(); i++) {
        objectives.add(localization.getString("text.variable", i + 1));
    }

    xAxisSelection = new JComboBox(objectives);
    yAxisSelection = new JComboBox(objectives);

    xAxisSelection.setSelectedIndex(0);
    yAxisSelection.setSelectedIndex(1);

    xAxisSelection.addActionListener(this);
    yAxisSelection.addActionListener(this);

    //initialize the reference set bounds
    initializeReferenceSetBounds();

    //initialize plotting controls
    useInitialBounds = new JRadioButton(localization.getString("action.useInitialBounds.name"));
    useReferenceSetBounds = new JRadioButton(localization.getString("action.useReferenceSetBounds.name"));
    useDynamicBounds = new JRadioButton(localization.getString("action.useDynamicBounds.name"));
    useZoomBounds = new JRadioButton(localization.getString("action.useZoom.name"));

    useInitialBounds.setToolTipText(localization.getString("action.useInitialBounds.description"));
    useReferenceSetBounds.setToolTipText(localization.getString("action.useReferenceSetBounds.description"));
    useDynamicBounds.setToolTipText(localization.getString("action.useDynamicBounds.description"));
    useZoomBounds.setToolTipText(localization.getString("action.useZoom.description"));

    ButtonGroup rangeButtonGroup = new ButtonGroup();
    rangeButtonGroup.add(useInitialBounds);
    rangeButtonGroup.add(useReferenceSetBounds);
    rangeButtonGroup.add(useDynamicBounds);
    rangeButtonGroup.add(useZoomBounds);

    if (referenceSet == null) {
        useReferenceSetBounds.setEnabled(false);
    }

    useInitialBounds.setSelected(true);
    useInitialBounds.addActionListener(this);
    useReferenceSetBounds.addActionListener(this);
    useDynamicBounds.addActionListener(this);
    useZoomBounds.addActionListener(this);

    //initialize the seed list
    String[] seeds = new String[accumulators.size()];

    for (int i = 0; i < accumulators.size(); i++) {
        seeds[i] = localization.getString("text.seed", i + 1);
    }

    seedList = new JList(seeds);
    seedList.addListSelectionListener(this);

    selectAll = new JButton(new AbstractAction() {

        private static final long serialVersionUID = -3709557130361259485L;

        {
            putValue(Action.NAME, localization.getString("action.selectAll.name"));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            seedList.getSelectionModel().setSelectionInterval(0, seedList.getModel().getSize() - 1);
        }

    });

    //initialize miscellaneous components
    paintHelper = new PaintHelper();
    paintHelper.set(localization.getString("text.referenceSet"), Color.BLACK);

    chartContainer = new JPanel(new BorderLayout());
}

From source file:IntVector.java

/**
 * Searches for the first occurence of the given argument, beginning the
 * search at index, and testing for equality using the equals method.
 * //from w  ww.  ja  v  a  2 s.  c  om
 * @param elem
 *            Object to look for
 * @return the index of the first occurrence of the object argument in this
 *         vector at position index or later in the vector; returns -1 if
 *         the object is not found.
 */
public final int lastIndexOf(int elem) {

    for (int i = (_size - 1); i >= 0; i--) {
        if (_data[i] == elem)
            return i;
    }

    return java.lang.Integer.MIN_VALUE;
}

From source file:com.moz.fiji.schema.util.TestJsonEntityIdParser.java

@Test
public void testShouldWorkWithRKF2SuppressedLayout() throws Exception {
    final TableLayoutDesc desc = FijiTableLayouts
            .getLayout(FijiTableLayouts.HASH_PREFIXED_FORMATTED_MULTI_COMPONENT);
    final FijiTableLayout layout = FijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]", JSONObject.quote(UNUSUAL_STRING_EID),
            JSONObject.quote(UNUSUAL_STRING_EID), JSONObject.quote(UNUSUAL_STRING_EID), Integer.MIN_VALUE,
            Long.MAX_VALUE);//from   ww w  . j a v  a2 s.  c  om
    final EntityId originalEid = ToolUtils.createEntityIdFromUserInputs(eidString, layout);
    final JsonEntityIdParser restEid1 = JsonEntityIdParser.create(originalEid, layout);
    final JsonEntityIdParser restEid2 = JsonEntityIdParser.create(eidString, layout);
    final JsonEntityIdParser restEid3 = JsonEntityIdParser.create(
            String.format("hbase_hex=%s", new String(Hex.encodeHex((originalEid.getHBaseRowKey())))), layout);
    final JsonEntityIdParser restEid4 = JsonEntityIdParser
            .create(String.format("hbase=%s", Bytes.toStringBinary(originalEid.getHBaseRowKey())), layout);

    // Resolved entity id should match origin entity id.
    assertEquals(originalEid, restEid1.getEntityId());
    assertEquals(originalEid, restEid2.getEntityId());
    assertEquals(originalEid, restEid3.getEntityId());
    assertEquals(originalEid, restEid4.getEntityId());
}

From source file:org.kiji.rest.TestKijiRestEntityId.java

@Test
public void testShouldWorkWithRKF2SuppressedLayout() throws Exception {
    final TableLayoutDesc desc = KijiTableLayouts.getLayout("org/kiji/rest/layouts/rkf2_suppressed.json");
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]", JSONObject.quote(UNUSUAL_STRING_EID),
            JSONObject.quote(UNUSUAL_STRING_EID), JSONObject.quote(UNUSUAL_STRING_EID), Integer.MIN_VALUE,
            Long.MAX_VALUE);/*  w  w  w. ja v a2  s.  c  om*/
    final EntityId originalEid = ToolUtils.createEntityIdFromUserInputs(eidString, layout);
    final KijiRestEntityId restEid1 = KijiRestEntityId.create(originalEid, layout);
    final KijiRestEntityId restEid2 = KijiRestEntityId.createFromUrl(eidString, layout);
    final KijiRestEntityId restEid3 = KijiRestEntityId
            .create(String.format("hbase_hex=%s", new String(Hex.encodeHex((originalEid.getHBaseRowKey())))));
    final KijiRestEntityId restEid4 = KijiRestEntityId
            .create(String.format("hbase=%s", Bytes.toStringBinary(originalEid.getHBaseRowKey())));

    // Resolved entity id should match origin entity id.
    assertEquals(originalEid, restEid1.resolve(layout));
    assertEquals(originalEid, restEid2.resolve(layout));
    assertEquals(originalEid, restEid3.resolve(layout));
    assertEquals(originalEid, restEid4.resolve(layout));
}

From source file:com.wabacus.config.component.ComponentConfigLoadAssistant.java

public Object[] parseIncludeApplicationids(IComponentConfigBean ccbeanOwner,
        List<String> lstConfigApplicationids) {
    if (ccbeanOwner instanceof AbsContainerConfigBean) {
        if (lstConfigApplicationids == null || lstConfigApplicationids.size() == 0) {//?include??ID
            lstConfigApplicationids = ((AbsContainerConfigBean) ccbeanOwner).getLstAllChildApplicationIds(true);
        }//from  w ww . j  a va  2  s  . c o m
    } else if (lstConfigApplicationids == null || lstConfigApplicationids.size() == 0) {
        lstConfigApplicationids = new ArrayList<String>();
        lstConfigApplicationids.add(ccbeanOwner.getId());
    }
    StringBuffer appidsBuf = new StringBuffer();
    List<String> lstAppids = new ArrayList<String>();
    Map<String, Integer> mReportidsAndPagesize = new HashMap<String, Integer>();
    for (String appidTmp : lstConfigApplicationids) {
        if (appidTmp == null || appidTmp.trim().equals("") || lstAppids.contains(appidTmp.trim()))
            continue;
        appidTmp = appidTmp.trim();
        int idxLeft = appidTmp.indexOf("{");
        int idxRight = appidTmp.indexOf("}");
        int ipagesize = Integer.MIN_VALUE;
        if (idxLeft > 0 && idxRight == appidTmp.length() - 1) {
            String pagesize = appidTmp.substring(idxLeft + 1, idxRight).trim();
            appidTmp = appidTmp.substring(0, idxLeft).trim();
            if (appidTmp.equals(""))
                continue;
            if (!pagesize.equals(""))
                ipagesize = Integer.parseInt(pagesize);
        }
        ReportBean rbean = ccbeanOwner.getPageBean().getReportChild(appidTmp, true);
        if (rbean != null)
            mReportidsAndPagesize.put(appidTmp, ipagesize);//?
        if (ccbeanOwner.getPageBean().getApplicationChild(appidTmp, true) == null) {
            throw new WabacusConfigLoadingException("" + ccbeanOwner.getPath()
                    + "??include?ID" + appidTmp + "?");
        }
        lstAppids.add(appidTmp);
        appidsBuf.append(appidTmp + ";");
    }
    //        {//includeid
    //            mReportidsAndPagesize.put(ccbeanOwner.getId(),Integer.MIN_VALUE);//
    return new Object[] { appidsBuf.toString(), lstAppids, mReportidsAndPagesize };
}

From source file:com.screenslicer.common.CommonUtil.java

public static int max(List<Integer> ints) {
    int max = Integer.MIN_VALUE;
    for (Integer curInt : ints) {
        if (curInt.intValue() > max) {
            max = curInt.intValue();//from  w  ww.  j a v  a  2 s.  com
        }
    }
    return max;
}

From source file:edu.indiana.d2i.sloan.utils.SSHProxy.java

/**
 * execute a list of commands in blocking way
 * /*w w  w . ja va2  s. c  o m*/
 * @param cmds
 * @param requireSudo
 * @return
 * @throws JSchException
 * @throws IOException
 * @throws Exception
 */
public CmdsExecResult execCmdSync(Commands cmds) throws JSchException, IOException {
    String command = cmds.getConcatenatedForm();
    int exitCode = Integer.MIN_VALUE;

    if (cmds.isSudoCmds)
        command = SUDO_PREFIX + command;
    logger.info("ssh execute: " + command);

    StringBuilder screenOutput = new StringBuilder();

    Channel channel = session.openChannel("exec");

    ((ChannelExec) channel).setCommand(command);
    ((ChannelExec) channel).setErrStream(System.err);

    channel.connect();

    InputStream is = channel.getInputStream();

    byte[] buf = new byte[BUFFER_SIZE];

    while (true) {

        while (is.available() > 0) {
            int bytesRead = is.read(buf, 0, 1024);

            if (bytesRead < 0)
                break;

            screenOutput.append(new String(buf, 0, bytesRead));
        }

        if (channel.isClosed()) {
            exitCode = channel.getExitStatus();
            break;
        }

        /**
         * sleep a while waiting for more outputs
         */
        try {
            Thread.sleep(THREAD_SLEEP_DURATION);
        } catch (InterruptedException e) {
            logger.error(e.getMessage());
        }
    }

    // disconnect
    channel.disconnect();

    return new CmdsExecResult(cmds, hostname, exitCode, screenOutput.toString());
}