Example usage for java.lang Character valueOf

List of usage examples for java.lang Character valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Character valueOf(char c) 

Source Link

Document

Returns a Character instance representing the specified char value.

Usage

From source file:org.apache.fop.fonts.SingleByteFont.java

private char mapUnencodedChar(char ch) {
    if (this.unencodedCharacters != null) {
        UnencodedCharacter unencoded = this.unencodedCharacters.get(Character.valueOf(ch));
        if (unencoded != null) {
            if (this.additionalEncodings == null) {
                this.additionalEncodings = new ArrayList<SimpleSingleByteEncoding>();
            }/*w  ww .  j  a v a  2 s . c o  m*/
            SimpleSingleByteEncoding encoding = null;
            char mappedStart = 0;
            int additionalsCount = this.additionalEncodings.size();
            for (int i = 0; i < additionalsCount; i++) {
                mappedStart += 256;
                encoding = getAdditionalEncoding(i);
                char alt = encoding.mapChar(ch);
                if (alt != 0) {
                    return (char) (mappedStart + alt);
                }
            }
            if (encoding != null && encoding.isFull()) {
                encoding = null;
            }
            if (encoding == null) {
                encoding = new SimpleSingleByteEncoding(
                        getFontName() + "EncodingSupp" + (additionalsCount + 1));
                this.additionalEncodings.add(encoding);
                mappedStart += 256;
            }
            return (char) (mappedStart + encoding.addCharacter(unencoded.getCharacter()));
        }
    }
    return 0;
}

From source file:com.itemanalysis.psychometrics.statistics.TwoWayTable.java

public double getRowPct(char rowValue) {
    return getRowPct(Character.valueOf(rowValue));
}

From source file:com.edgenius.wiki.search.service.AbstractSearchService.java

private Sort createSort(String[] advance) {
    if (advance != null) {
        //parse all possible type
        for (String str : advance) {
            if (str.length() < 2)
                continue;
            if (str.charAt(0) == SearchService.ADV_GROUP_BY) {
                if (NumberUtils
                        .toInt(Character.valueOf(str.charAt(1)).toString()) == SearchService.GROUP_SPACE) {
                    return new Sort(new SortField(FieldName.UNSEARCH_SPACE_UNIXNAME, SortField.STRING));
                } else if (NumberUtils
                        .toInt(Character.valueOf(str.charAt(1)).toString()) == SearchService.GROUP_TYPE) {
                    return new Sort(new SortField(FieldName.DOC_TYPE, SortField.INT));
                }//  ww w.  j  a  v  a 2  s.  com
            }
        }
    }
    return null;
}

From source file:com.neovisionaries.security.DigestTest.java

@Test
public void test10() {
    ByteBuffer byteBuffer = ByteBuffer.allocate(10);
    byteBuffer.put(new byte[] { 1, 2, 3, 4, 5 });
    byteBuffer.flip();//from www. jav a  2s  . c o  m

    // Ensure there is no infinite loop.
    Digest.getInstanceSHA256().update("Hello, world.", new String[] { "Hello", "world" },

            Boolean.TRUE, new boolean[] { true, false }, new Boolean[] { Boolean.TRUE, Boolean.FALSE },

            Byte.valueOf((byte) 0), new byte[] { (byte) 0, (byte) 1 },
            new Byte[] { Byte.valueOf((byte) 0), Byte.valueOf((byte) 1) }, byteBuffer,

            Character.valueOf('b'), new char[] { 'a', 'b' },
            new Character[] { Character.valueOf('a'), Character.valueOf('b') },

            Double.valueOf(0.0), new double[] { 0.0, 1.0 },
            new Double[] { Double.valueOf(0.0), Double.valueOf(1.0) },

            Float.valueOf(0.0F), new float[] { 0.0F, 1.0F },
            new Float[] { Float.valueOf(0.0F), Float.valueOf(1.0F) },

            Integer.valueOf(1), new int[] { 1, 2 }, new Integer[] { Integer.valueOf(0), Integer.valueOf(1) },

            Long.valueOf(0L), new long[] { 0L, 1L }, new Long[] { Long.valueOf(0L), Long.valueOf(1L) },

            Short.valueOf((short) 0), new short[] { (short) 0, (short) 1 },
            new Short[] { Short.valueOf((short) 0), Short.valueOf((short) 1) },

            new Object[] { new boolean[] { true, false }, new byte[] { (byte) 0, (byte) 1 } },
            new Object[] { new Object[] { new char[] { 'a', 'b' }, new short[] { 10, 20 } },
                    new Object[] { new float[] { 1.0F, 2.0F }, new double[] { 3.0, 4.0 } } });

    assertTrue(true);
}

From source file:gobblin.ingestion.google.webmaster.UrlTriePrefixGrouperTest.java

@Test
public void testWhenTrieSizeLessThanGroupSize1() {
    List<String> pages = Arrays.asList(_property + "13");
    UrlTrie trie1 = new UrlTrie(_property, pages);
    UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie1, 1);
    Triple<String, FilterOperator, UrlTrieNode> next = grouper.next();
    Assert.assertEquals(next.getLeft(), _property);
    Assert.assertEquals(next.getMiddle(), FilterOperator.CONTAINS);
    Assert.assertEquals(next.getRight().getValue(), Character.valueOf('/'));
    Assert.assertFalse(next.getRight().isExist());
    Assert.assertFalse(grouper.hasNext());
}

From source file:org.wso2.carbon.identity.sso.saml.common.Util.java

private static String normalizeUrlEncoding(String text) {

    if (text == null)
        return null;

    int len = text.length();
    StringBuilder normalized = new StringBuilder(len);

    for (int i = 0; i < len; i++) {
        char current = text.charAt(i);
        if (current == '%' && i < len - 2) {
            String percentCode = text.substring(i, i + 3).toUpperCase();
            try {
                String str = URLDecoder.decode(percentCode, "ISO-8859-1");
                char chr = str.charAt(0);
                if (UNRESERVED_CHARACTERS.contains(Character.valueOf(chr)))
                    normalized.append(chr);
                else
                    normalized.append(percentCode);
            } catch (UnsupportedEncodingException e) {
                if (log.isDebugEnabled()) {
                    log.debug("Url Encoding not supported.", e);
                }//from   w  w  w  .j  a  va 2s  . com
                normalized.append(percentCode);
            }
            i += 2;
        } else {
            normalized.append(current);
        }
    }
    return normalized.toString();
}

From source file:pt.ist.expenditureTrackingSystem.presentationTier.actions.statistics.ChartGenerator.java

public static CategoryDataset refundProcessStatisticsChart(
        final RefundProcessStatistics refundProcessStatistics) {
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    final Map<RefundProcessStateType, Integer> map = refundProcessStatistics
            .getNumberOfProcessesByRefundProcessStateType();
    char c = 'A';
    for (final Entry<RefundProcessStateType, Integer> entry : map.entrySet()) {
        final RefundProcessStateType refundProcessStateType = entry.getKey();
        final Integer numberOfProcesses = entry.getValue();

        if (numberOfProcesses.intValue() > 0) {
            dataset.addValue(numberOfProcesses, "" + c + " - " + refundProcessStateType.getLocalizedName(),
                    Character.valueOf(c++));
        }//  ww w.j a  v a 2  s  .c  o  m
    }

    return dataset;
}

From source file:org.eel.kitchen.jsonschema.ref.JsonPointer.java

/**
 * Grab a (cooked) reference token from an input string
 *
 * <p>This method is only called from
 * {@link #decode(String, ImmutableList.Builder)}, after a delimiter
 * ({@code /}) has been swallowed up. The input string is therefore
 * guaranteed to start with a reference token, which may be empty.
 * </p>//ww w  . j  a v  a  2  s  .c  om
 *
 * @param input the input string
 * @return the cooked reference token
 * @throws JsonSchemaException the string is malformed
 */
private static String getNextRefToken(final String input) throws JsonSchemaException {
    final StringBuilder sb = new StringBuilder();

    final char[] array = input.toCharArray();

    /*
     * If we encounter a /, this is the end of the current token.
     *
     * If we encounter a ~, ensure that what follows is either 0 or 1.
     *
     * If we encounter any other character, append it.
     */

    boolean inEscape = false;

    for (final char c : array) {
        if (inEscape) {
            if (!ESCAPED.matches(c)) {
                final Message.Builder msg = newMsg(
                        "bad escape sequence: " + "'~' not followed by a valid token")
                                .addInfo("allowed", ESCAPE_REPLACEMENT_MAP.keySet())
                                .addInfo("found", Character.valueOf(c));
                throw new JsonSchemaException(msg.build());
            }
            sb.append(c);
            inEscape = false;
            continue;
        }
        if (SLASH.matches(c))
            break;
        if (ESCAPE_CHAR.matches(c))
            inEscape = true;
        sb.append(c);
    }

    if (inEscape)
        throw new JsonSchemaException(
                newMsg("bad escape sequence: '~' " + "not followed by any token").build());
    return sb.toString();
}

From source file:org.apache.ranger.plugin.util.RangerResourceTrie.java

private final Character getLookupChar(char ch) {
    if (optIgnoreCase) {
        ch = Character.toLowerCase(ch);
    }//from   ww  w  .  java 2 s.c o  m

    return Character.valueOf(ch);
}

From source file:com.prowidesoftware.swift.model.field.FieldTest.java

@Test
public void testLetterOption() throws Exception {
    assertEquals(Character.valueOf('A'), new Field59A().letterOption());
    assertEquals(null, new Field59().letterOption());
}