Example usage for java.lang Character MIN_VALUE

List of usage examples for java.lang Character MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Character MIN_VALUE.

Prototype

char MIN_VALUE

To view the source code for java.lang Character MIN_VALUE.

Click Source Link

Document

The constant value of this field is the smallest value of type char , '\u005Cu0000' .

Usage

From source file:jp.terasoluna.fw.file.dao.standard.AbstractFileLineWriter.java

/**
 * ??????/*  w  w w.j  a v a 2 s  .c om*/
 * @param t ???
 */
@Override
public void printDataLine(T t) {
    checkWriteTrailer();
    // ?????
    StringBuilder fileLineBuilder = new StringBuilder();

    // ??
    // (?????????)
    if (getDelimiter() == Character.MIN_VALUE && getEncloseChar() == Character.MIN_VALUE) {
        for (int i = 0; i < fields.length; i++) {
            fileLineBuilder.append(getColumn(t, i));
        }
    } else {
        for (int i = 0; i < fields.length; i++) {
            // ????
            if (columnEncloseChar[i] != Character.MIN_VALUE) {
                fileLineBuilder.append(columnEncloseChar[i]);
                fileLineBuilder.append(getColumn(t, i));
                fileLineBuilder.append(columnEncloseChar[i]);
            } else {
                fileLineBuilder.append(getColumn(t, i));
            }
            fileLineBuilder.append(getDelimiter());
        }
        // ??
        if (fileLineBuilder.length() > 0) {
            fileLineBuilder.deleteCharAt(fileLineBuilder.length() - 1);
        }
    }

    // ?
    fileLineBuilder.append(getLineFeedChar());

    // ??????
    try {
        getWriter().write(fileLineBuilder.toString());
    } catch (IOException e) {
        throw new FileException("Processing of writer was failed.", e, fileName);
    }
    currentLineCount++;
    setWriteData(true);
}

From source file:com.tesora.dve.sql.parser.InvokeParser.java

public static PlanningResult buildPlan(SchemaContext pc, byte[] line, Charset cs, String pstmtID)
        throws PEException {
    boolean isPrepare = (pstmtID != null);
    if (pc != null)
        SchemaContext.threadContext.set(pc);
    preparse(pc);//from w  w w  .j av  a2s.  c om
    ParserOptions options = ParserOptions.NONE.setDebugLog(true).setResolve().setFailEarly();
    if (isPrepare)
        options = options.setPrepare().setActualLiterals();

    PlanningResult result = null;

    String lineStr = PECharsetUtils.getString(line, cs, true);
    if (lineStr == null) {
        // bad characters - not a candidate for caching
        // if we get this for a prepared stmt, just give up for now
        if (isPrepare)
            throw new PEException("Invalid prepare request: bad characters");
        ParseResult pr = parameterizeAndParse(pc, options, line, cs);
        List<Statement> stmts = pr.getStatements();
        List<ExecutionPlan> plans = new ArrayList<ExecutionPlan>();
        ConnectionValuesMap cvm = new ConnectionValuesMap();
        for (Statement s : stmts) {
            PlanningResult epr = Statement.getExecutionPlan(pc, s, pc.getBehaviorConfiguration(), lineStr,
                    pr.getInputState());
            plans.addAll(epr.getPlans());
            cvm.take(epr.getValues());
        }
        result = new PlanningResult(plans, cvm, pr.getInputState(), lineStr);
    } else {
        lineStr = StringUtils.strip(lineStr, new String(Character.toString(Character.MIN_VALUE)));

        logParse(pc, lineStr, pstmtID);

        InputState input = buildInputState(lineStr, pc);

        if (isPrepare) {
            if (input.getCommand() == null)
                throw new PEException(
                        "Prepare stmt is too long (greater than " + input.getThreshold() + " characters)");
            result = preparePlan(pc, input, options, pstmtID);
        } else
            result = buildPlan(pc, input, options, null);
    }
    for (ExecutionPlan ep : result.getPlans())
        if (ep.isRoot()) {
            SqlStatistics.incrementCounter(((RootExecutionPlan) ep).getStatementType());
        }
    return result;
}

From source file:net.sf.jasperreports.engine.data.JRCsvDataSource.java

/**
 * Reads a row from the stream. A row is a sequence of characters separated by the record delimiter.
 *//*from  www  .ja  va2  s.co  m*/
private String getRow() throws IOException {
    StringBuilder row = new StringBuilder();
    char c;

    while (true) {
        try {
            c = getChar();

            // searches for the first character of the record delimiter
            if (c == recordDelimiter.charAt(0) || c == Character.MIN_VALUE) {
                int i;
                char[] temp = new char[recordDelimiter.length()];
                temp[0] = c;
                boolean isDelimiter = true;
                // checks if the following characters in the stream form the record delimiter
                for (i = 1; i < recordDelimiter.length() && isDelimiter; i++) {
                    temp[i] = getChar();
                    if (temp[i] != recordDelimiter.charAt(i)) {
                        isDelimiter = false;
                    }
                }

                if (isDelimiter) {
                    return row.toString();
                }
                row.append(temp, 0, i);
            }

            row.append(c);
        } catch (JRException e) {
            if (row.length() == 0) {
                return null;
            } else {
                return row.toString();
            }
        }

    } // end while
}

From source file:com.kegare.caveworld.plugin.mceconomy.GuiShopEntry.java

@Override
protected void keyTyped(char c, int code) {
    if (editMode) {
        for (GuiTextField textField : editFieldList) {
            if (code == Keyboard.KEY_ESCAPE) {
                textField.setFocused(false);
            } else if (textField.isFocused()) {
                if (textField != itemField) {
                    if (!CharUtils.isAsciiControl(c) && !CharUtils.isAsciiNumeric(c)) {
                        continue;
                    }/*w  w w .  java  2 s  .c  o  m*/
                }

                textField.textboxKeyTyped(c, code);
            }
        }
    } else {
        if (filterTextField.isFocused()) {
            if (code == Keyboard.KEY_ESCAPE) {
                filterTextField.setFocused(false);
            }

            String prev = filterTextField.getText();

            filterTextField.textboxKeyTyped(c, code);

            String text = filterTextField.getText();
            boolean changed = text != prev;

            if (Strings.isNullOrEmpty(text) && changed) {
                productList.setFilter(null);
            } else if (instantFilter.isChecked() && changed || code == Keyboard.KEY_RETURN) {
                productList.setFilter(text);
            }
        } else {
            if (code == Keyboard.KEY_ESCAPE) {
                actionPerformed(doneButton);
            } else if (code == Keyboard.KEY_BACK) {
                productList.selected = null;
            } else if (code == Keyboard.KEY_TAB) {
                if (++productList.nameType > 2) {
                    productList.nameType = 0;
                }
            } else if (code == Keyboard.KEY_UP) {
                if (isCtrlKeyDown()) {
                    productList.contents.swapTo(productList.contents.indexOf(productList.selected), -1);
                    productList.products.swapTo(productList.products.indexOf(productList.selected), -1);

                    productList.scrollToSelected();
                } else {
                    productList.scrollUp();
                }
            } else if (code == Keyboard.KEY_DOWN) {
                if (isCtrlKeyDown()) {
                    productList.contents.swapTo(productList.contents.indexOf(productList.selected), 1);
                    productList.products.swapTo(productList.products.indexOf(productList.selected), 1);

                    productList.scrollToSelected();
                } else {
                    productList.scrollDown();
                }
            } else if (code == Keyboard.KEY_HOME) {
                productList.scrollToTop();
            } else if (code == Keyboard.KEY_END) {
                productList.scrollToEnd();
            } else if (code == Keyboard.KEY_SPACE) {
                productList.scrollToSelected();
            } else if (code == Keyboard.KEY_PRIOR) {
                productList.scrollToPrev();
            } else if (code == Keyboard.KEY_NEXT) {
                productList.scrollToNext();
            } else if (code == Keyboard.KEY_F || code == mc.gameSettings.keyBindChat.getKeyCode()) {
                filterTextField.setFocused(true);
            } else if (code == Keyboard.KEY_DELETE && productList.selected != null) {
                actionPerformed(removeButton);
            } else if (code == Keyboard.KEY_C && isCtrlKeyDown()) {
                productList.copied = productList.selected == null ? null
                        : new ShopProduct(productList.selected.getProductItem(),
                                productList.selected.getcost());
            } else if (code == Keyboard.KEY_X && isCtrlKeyDown()) {
                keyTyped(Character.MIN_VALUE, Keyboard.KEY_C);
                actionPerformed(removeButton);
            } else if (code == Keyboard.KEY_V && isCtrlKeyDown() && productList.copied != null) {
                ShopProduct entry = new ShopProduct(productList.copied.getProductItem(),
                        productList.copied.getcost());

                if (productList.products.addIfAbsent(entry)) {
                    productList.contents.addIfAbsent(entry);

                    if (productList.selected != null) {
                        productList.contents.swap(productList.contents.indexOf(productList.selected) + 1,
                                productList.contents.size() - 1);
                        productList.products.swap(productList.products.indexOf(productList.selected) + 1,
                                productList.products.size() - 1);
                    }

                    productList.selected = entry;
                    productList.scrollToSelected();
                }
            }
        }
    }
}

From source file:jp.terasoluna.fw.file.dao.standard.AbstractFileLineIterator.java

/**
 * InputFileColumn????? ????<br>//from  ww  w .  j a v  a 2s .  c  o  m
 * ???????<br>
 * ????{@link InputFileColumn#columnIndex()}????? ?????<br>
 * ???{@link InputFileColumn#columnIndex()}???????? ???<br>
 * ???????? InputFileColumn?????????<br>
 * @throws FileException ?????
 */
private void buildFields() {
    // ?
    List<Field[]> allFields = new ArrayList<Field[]>();

    // ?
    Class<?> tempClass = clazz;
    Field[] declaredFieldArray = null;
    int allFieldCount = 0;
    while (tempClass != null) {
        declaredFieldArray = tempClass.getDeclaredFields();
        allFields.add(declaredFieldArray);
        allFieldCount += declaredFieldArray.length;
        tempClass = tempClass.getSuperclass();
    }

    // ?????
    Field[] dataColumnFields = new Field[allFieldCount];

    InputFileColumn inputFileColumn = null;
    int maxColumnIndex = -1;
    int columnIndex = -1;
    int columnCount = 0;

    for (Field[] fields : allFields) {
        for (Field field : fields) {
            inputFileColumn = field.getAnnotation(InputFileColumn.class);
            if (inputFileColumn != null) {
                // ????????
                if (columnParserMap.get(field.getType().getName()) == null) {
                    throw new FileException(
                            "There is a type which isn't supported in a "
                                    + "mapping target field in FileLineObject.",
                            new IllegalStateException(), fileName);
                }

                columnIndex = inputFileColumn.columnIndex();
                // Index??????
                if (columnIndex < 0) {
                    throw new FileException("Column Index in FileLineObject is the minus " + "number.",
                            new IllegalStateException(), fileName);
                }
                // Index?????????
                if (dataColumnFields.length <= columnIndex) {
                    throw new FileException(
                            "Column Index in FileLineObject is bigger than " + "the total number of the field.",
                            new IllegalStateException(), fileName);
                }
                // Index??????????
                if (dataColumnFields[columnIndex] == null) {
                    dataColumnFields[columnIndex] = field;
                    if (maxColumnIndex < columnIndex) {
                        maxColumnIndex = columnIndex;
                    }
                    columnCount++;
                } else {
                    throw new FileException("Column Index is duplicate : " + columnIndex, fileName);
                }
            }
        }
    }

    // columnIndex????????
    if (columnCount != (maxColumnIndex + 1)) {
        throw new FileException("columnIndex in FileLineObject is not sequential order.",
                new IllegalStateException(), fileName);
    }

    // (null?)
    if (dataColumnFields.length == columnCount) {
        this.fields = dataColumnFields;
    } else {
        this.fields = new Field[columnCount];
        System.arraycopy(dataColumnFields, 0, this.fields, 0, columnCount);
    }

    // InputFileColumn???StringConverter
    inputFileColumns = new InputFileColumn[fields.length];
    columnIndexs = new int[fields.length];
    columnFormats = new String[fields.length];
    columnBytes = new int[fields.length];
    paddingTypes = new PaddingType[fields.length];
    paddingChars = new char[fields.length];
    trimTypes = new TrimType[fields.length];
    trimChars = new char[fields.length];

    // ???FileFormat???
    columnEncloseChar = new char[fields.length];
    if (getEncloseChar() != Character.MIN_VALUE) {
        enclosed = true;
        for (int index = 0; index < fields.length; index++) {
            columnEncloseChar[index] = getEncloseChar();
        }
    }

    for (int i = 0; i < fields.length; i++) {
        inputFileColumns[i] = fields[i].getAnnotation(InputFileColumn.class);
        columnIndexs[i] = inputFileColumns[i].columnIndex();
        columnFormats[i] = inputFileColumns[i].columnFormat();
        columnBytes[i] = inputFileColumns[i].bytes();
        totalBytes += columnBytes[i];
        paddingTypes[i] = inputFileColumns[i].paddingType();
        paddingChars[i] = inputFileColumns[i].paddingChar();
        trimTypes[i] = inputFileColumns[i].trimType();
        trimChars[i] = inputFileColumns[i].trimChar();

        // ?inputFileColumns?????
        if (inputFileColumns[i].columnEncloseChar() != Character.MIN_VALUE) {
            columnEncloseChar[i] = inputFileColumns[i].columnEncloseChar();
            enclosed = true;
        }
    }
}

From source file:com.sun.faces.util.Util.java

/**
 * @return true if and only if the argument
 *         <code>attributeVal</code> is an instance of a wrapper for a
 *         primitive type and its value is equal to the default value for
 *         that type as given in the spec.
 *///from  w  w  w  .  ja  v a  2 s .  c  o  m

private static boolean shouldRenderAttribute(Object attributeVal) {
    if (attributeVal instanceof Boolean
            && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) {
        return false;
    } else if (attributeVal instanceof Integer && ((Integer) attributeVal).intValue() == Integer.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Double && ((Double) attributeVal).doubleValue() == Double.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Character
            && ((Character) attributeVal).charValue() == Character.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Float && ((Float) attributeVal).floatValue() == Float.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Short && ((Short) attributeVal).shortValue() == Short.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Byte && ((Byte) attributeVal).byteValue() == Byte.MIN_VALUE) {
        return false;
    } else if (attributeVal instanceof Long && ((Long) attributeVal).longValue() == Long.MIN_VALUE) {
        return false;
    }
    return true;
}

From source file:com.kegare.caveworld.client.config.GuiVeinsEntry.java

@Override
protected void keyTyped(char c, int code) {
    if (editMode) {
        for (GuiTextField textField : editFieldList) {
            if (code == Keyboard.KEY_ESCAPE) {
                textField.setFocused(false);
            } else if (textField.isFocused()) {
                if (textField != blockField && textField != targetField && textField != biomesField) {
                    if (!CharUtils.isAsciiControl(c) && !CharUtils.isAsciiNumeric(c)) {
                        continue;
                    }//from   ww  w.j  a v a2  s  . co  m
                }

                textField.textboxKeyTyped(c, code);
            }
        }
    } else {
        if (filterTextField.isFocused()) {
            if (code == Keyboard.KEY_ESCAPE) {
                filterTextField.setFocused(false);
            }

            String prev = filterTextField.getText();

            filterTextField.textboxKeyTyped(c, code);

            String text = filterTextField.getText();
            boolean changed = text != prev;

            if (Strings.isNullOrEmpty(text) && changed) {
                veinList.setFilter(null);
            } else if (instantFilter.isChecked() && changed || code == Keyboard.KEY_RETURN) {
                veinList.setFilter(text);
            }
        } else {
            if (code == Keyboard.KEY_ESCAPE) {
                actionPerformed(doneButton);
            } else if (code == Keyboard.KEY_BACK) {
                veinList.selected = null;
            } else if (code == Keyboard.KEY_TAB) {
                if (++veinList.nameType > 2) {
                    veinList.nameType = 0;
                }
            } else if (code == Keyboard.KEY_UP) {
                if (isCtrlKeyDown()) {
                    veinList.contents.swapTo(veinList.contents.indexOf(veinList.selected), -1);
                    veinList.veins.swapTo(veinList.veins.indexOf(veinList.selected), -1);

                    veinList.scrollToSelected();
                } else {
                    veinList.scrollUp();
                }
            } else if (code == Keyboard.KEY_DOWN) {
                if (isCtrlKeyDown()) {
                    veinList.contents.swapTo(veinList.contents.indexOf(veinList.selected), 1);
                    veinList.veins.swapTo(veinList.veins.indexOf(veinList.selected), 1);

                    veinList.scrollToSelected();
                } else {
                    veinList.scrollDown();
                }
            } else if (code == Keyboard.KEY_HOME) {
                veinList.scrollToTop();
            } else if (code == Keyboard.KEY_END) {
                veinList.scrollToEnd();
            } else if (code == Keyboard.KEY_SPACE) {
                veinList.scrollToSelected();
            } else if (code == Keyboard.KEY_PRIOR) {
                veinList.scrollToPrev();
            } else if (code == Keyboard.KEY_NEXT) {
                veinList.scrollToNext();
            } else if (code == Keyboard.KEY_F || code == mc.gameSettings.keyBindChat.getKeyCode()) {
                filterTextField.setFocused(true);
            } else if (code == Keyboard.KEY_DELETE && veinList.selected != null) {
                actionPerformed(removeButton);
            } else if (code == Keyboard.KEY_C && isCtrlKeyDown()) {
                veinList.copied = veinList.selected == null ? null
                        : new CaveVein(veinList.selected.getBlock(), veinList.selected.getGenBlockCount(),
                                veinList.selected.getGenWeight(), veinList.selected.getGenRate(),
                                veinList.selected.getGenMinHeight(), veinList.selected.getGenMaxHeight(),
                                veinList.selected.getGenTargetBlock(), veinList.selected.getGenBiomes());
            } else if (code == Keyboard.KEY_X && isCtrlKeyDown()) {
                keyTyped(Character.MIN_VALUE, Keyboard.KEY_C);
                actionPerformed(removeButton);
            } else if (code == Keyboard.KEY_V && isCtrlKeyDown() && veinList.copied != null) {
                ICaveVein entry = new CaveVein(veinList.copied.getBlock(), veinList.copied.getGenBlockCount(),
                        veinList.copied.getGenWeight(), veinList.selected.getGenRate(),
                        veinList.copied.getGenMinHeight(), veinList.copied.getGenMaxHeight(),
                        veinList.copied.getGenTargetBlock(), veinList.copied.getGenBiomes());

                if (veinList.veins.addIfAbsent(entry)) {
                    veinList.contents.addIfAbsent(entry);

                    if (veinList.selected != null) {
                        veinList.contents.swap(veinList.contents.indexOf(veinList.selected) + 1,
                                veinList.contents.size() - 1);
                        veinList.veins.swap(veinList.veins.indexOf(veinList.selected) + 1,
                                veinList.veins.size() - 1);
                    }

                    veinList.selected = entry;
                    veinList.scrollToSelected();
                }
            }
        }
    }
}

From source file:net.yacy.cora.language.phonetic.DoubleMetaphone.java

/**
 * Gets the character at index <code>index</code> if available, otherwise
 * it returns <code>Character.MIN_VALUE</code> so that there is some sort
 * of a default/*from  ww  w  . j a  va  2  s .  c  o m*/
 */
protected char charAt(String value, int index) {
    if (index < 0 || index >= value.length()) {
        return Character.MIN_VALUE;
    }
    return value.charAt(index);
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 * 
 *
 * @param c
 */
public TreeObject(Character c) {
    _object = c != null ? c.charValue() : Character.MIN_VALUE;
    _type = TYPE_CHAR;
}

From source file:net.ymate.platform.core.lang.TreeObject.java

public TreeObject(Character c) {
    _object = c != null ? c : Character.MIN_VALUE;
    _type = TYPE_CHAR;
}