Example usage for java.lang Character toLowerCase

List of usage examples for java.lang Character toLowerCase

Introduction

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

Prototype

public static int toLowerCase(int codePoint) 

Source Link

Document

Converts the character (Unicode code point) argument to lowercase using case mapping information from the UnicodeData file.

Usage

From source file:org.wrml.runtime.format.text.html.WrmldocFormatter.java

protected ArrayNode buildReferencesArrayNode(final ObjectMapper objectMapper,
        final Map<URI, ObjectNode> schemaNodes, final Map<URI, LinkRelation> linkRelationCache,
        final Resource resource, final Prototype defaultPrototype) {

    final Context context = getContext();
    final SchemaLoader schemaLoader = context.getSchemaLoader();
    final SyntaxLoader syntaxLoader = context.getSyntaxLoader();

    final URI defaultSchemaUri = (defaultPrototype != null) ? defaultPrototype.getSchemaUri() : null;
    final String defaultSchemaName = (defaultPrototype != null)
            ? defaultPrototype.getUniqueName().getLocalName()
            : null;//from  w ww  . j  av  a2 s.  co  m

    final ArrayNode referencesNode = objectMapper.createArrayNode();

    final ConcurrentHashMap<URI, LinkTemplate> referenceTemplates = resource.getReferenceTemplates();
    final Set<URI> referenceRelationUris = referenceTemplates.keySet();

    if (referenceTemplates != null && !referenceTemplates.isEmpty()) {

        String selfResponseSchemaName = null;

        List<String> resourceParameterList = null;
        final UriTemplate uriTemplate = resource.getUriTemplate();
        final String[] parameterNames = uriTemplate.getParameterNames();
        if (parameterNames != null && parameterNames.length > 0) {

            resourceParameterList = new ArrayList<>();

            for (int i = 0; i < parameterNames.length; i++) {
                final String parameterName = parameterNames[i];

                URI keyedSchemaUri = null;

                if (defaultPrototype != null) {
                    final Set<String> allKeySlotNames = defaultPrototype.getAllKeySlotNames();
                    if (allKeySlotNames != null && allKeySlotNames.contains(parameterName)) {
                        keyedSchemaUri = defaultSchemaUri;
                    }
                }

                if (keyedSchemaUri == null) {

                    final Set<URI> referenceLinkRelationUris = resource
                            .getReferenceLinkRelationUris(Method.Get);
                    if (referenceLinkRelationUris != null && !referenceLinkRelationUris.isEmpty()) {
                        for (URI linkRelationUri : referenceLinkRelationUris) {
                            final LinkTemplate referenceTemplate = referenceTemplates.get(linkRelationUri);
                            final URI responseSchemaUri = referenceTemplate.getResponseSchemaUri();
                            final Prototype responseSchemaPrototype = schemaLoader
                                    .getPrototype(responseSchemaUri);
                            if (responseSchemaPrototype != null) {
                                final Set<String> allKeySlotNames = responseSchemaPrototype
                                        .getAllKeySlotNames();
                                if (allKeySlotNames != null && allKeySlotNames.contains(parameterName)) {
                                    keyedSchemaUri = responseSchemaUri;
                                    break;
                                }
                            }
                        }
                    }
                }

                String parameterTypeString = "?";

                if (keyedSchemaUri != null) {

                    final Prototype keyedPrototype = schemaLoader.getPrototype(keyedSchemaUri);
                    final ProtoSlot keyProtoSlot = keyedPrototype.getProtoSlot(parameterName);
                    if (keyProtoSlot instanceof PropertyProtoSlot) {
                        final PropertyProtoSlot keyPropertyProtoSlot = (PropertyProtoSlot) keyProtoSlot;
                        final ValueType parameterValueType = keyPropertyProtoSlot.getValueType();
                        final Type parameterHeapType = keyPropertyProtoSlot.getHeapValueType();
                        switch (parameterValueType) {
                        case Text: {
                            if (!String.class.equals(parameterHeapType)) {
                                final Class<?> syntaxClass = (Class<?>) parameterHeapType;
                                parameterTypeString = syntaxClass.getSimpleName();
                            } else {
                                parameterTypeString = parameterValueType.name();
                            }

                            break;
                        }
                        case SingleSelect: {
                            final Class<?> choicesEnumClass = (Class<?>) parameterHeapType;

                            if (choicesEnumClass.isEnum()) {
                                parameterTypeString = choicesEnumClass.getSimpleName();
                            } else {
                                // ?
                                parameterTypeString = parameterValueType.name();
                            }

                            break;
                        }
                        default: {
                            parameterTypeString = parameterValueType.name();
                            break;
                        }
                        }
                    }

                }

                resourceParameterList.add(parameterTypeString + " " + parameterName);
            }
        }

        for (final Method method : Method.values()) {
            for (final URI linkRelationUri : referenceRelationUris) {

                final LinkTemplate referenceTemplate = referenceTemplates.get(linkRelationUri);
                final LinkRelation linkRelation = getLinkRelation(linkRelationCache, linkRelationUri);

                if (method != linkRelation.getMethod()) {
                    continue;
                }

                final ObjectNode referenceNode = objectMapper.createObjectNode();
                referencesNode.add(referenceNode);

                referenceNode.put(PropertyName.method.name(), method.getProtocolGivenName());
                referenceNode.put(PropertyName.rel.name(), syntaxLoader.formatSyntaxValue(linkRelationUri));

                final String relationTitle = linkRelation.getTitle();
                referenceNode.put(PropertyName.relationTitle.name(), relationTitle);

                final URI responseSchemaUri = referenceTemplate.getResponseSchemaUri();
                String responseSchemaName = null;
                if (responseSchemaUri != null) {
                    final ObjectNode responseSchemaNode = getSchemaNode(objectMapper, schemaNodes,
                            responseSchemaUri, schemaLoader);
                    referenceNode.put(PropertyName.responseSchema.name(), responseSchemaNode);

                    responseSchemaName = responseSchemaNode
                            .get(SchemaDesignFormatter.PropertyName.localName.name()).asText();
                }

                final URI requestSchemaUri = referenceTemplate.getRequestSchemaUri();

                String requestSchemaName = null;
                if (requestSchemaUri != null) {
                    final ObjectNode requestSchemaNode = getSchemaNode(objectMapper, schemaNodes,
                            requestSchemaUri, schemaLoader);
                    referenceNode.put(PropertyName.requestSchema.name(), requestSchemaNode);

                    requestSchemaName = requestSchemaNode
                            .get(SchemaDesignFormatter.PropertyName.localName.name()).asText();
                }

                final StringBuilder signatureBuilder = new StringBuilder();

                if (responseSchemaName != null) {
                    signatureBuilder.append(responseSchemaName);
                } else {
                    signatureBuilder.append("void");
                }

                signatureBuilder.append(" ");

                String functionName = relationTitle;

                if (SystemLinkRelation.self.getUri().equals(linkRelationUri)) {
                    functionName = "get" + responseSchemaName;
                    selfResponseSchemaName = responseSchemaName;
                } else if (SystemLinkRelation.save.getUri().equals(linkRelationUri)) {
                    functionName = "save" + responseSchemaName;
                } else if (SystemLinkRelation.delete.getUri().equals(linkRelationUri)) {
                    functionName = "delete";
                    if (defaultSchemaName != null) {
                        functionName += defaultSchemaName;
                    } else if (selfResponseSchemaName != null) {
                        functionName += selfResponseSchemaName;
                    }
                }

                signatureBuilder.append(functionName).append(" ( ");

                String parameterString = null;
                if (resourceParameterList != null) {
                    final StringBuilder parameterStringBuilder = new StringBuilder();
                    final int parameterCount = resourceParameterList.size();
                    for (int i = 0; i < parameterCount; i++) {
                        final String parameter = resourceParameterList.get(i);
                        parameterStringBuilder.append(parameter);
                        if (i < parameterCount - 1) {
                            parameterStringBuilder.append(" , ");
                        }
                    }

                    parameterString = parameterStringBuilder.toString();
                    signatureBuilder.append(parameterString);
                }

                if (requestSchemaName != null) {
                    if (StringUtils.isNotBlank(parameterString)) {
                        signatureBuilder.append(" , ");
                    }

                    signatureBuilder.append(requestSchemaName);

                    signatureBuilder.append(" ");

                    final String parameterName = Character.toLowerCase(requestSchemaName.charAt(0))
                            + requestSchemaName.substring(1);
                    signatureBuilder.append(parameterName);
                }

                signatureBuilder.append(" ) ");

                final String signature = signatureBuilder.toString();
                referenceNode.put(PropertyName.signature.name(), signature);
            }

        }

    }

    return referencesNode;
}

From source file:org.celllife.idart.gui.patient.AddPatient.java

/**
 * This method initializes grpParticulars
 * //from  w  ww .  j  a va2 s .  c o m
 */
private void createGrpParticulars() {

    int col2x = 105;

    // grpParticulars
    grpParticulars = new Group(compPatientInfo, SWT.NONE);
    grpParticulars.setBounds(new Rectangle(30, 40, 400, 255));
    grpParticulars.setText(Messages.getString("patient.group.particulars")); //$NON-NLS-1$
    grpParticulars.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    // Patient ID
    Label lblPatientId = new Label(grpParticulars, SWT.NONE);
    lblPatientId.setBounds(new Rectangle(7, 25, 84, 20));
    lblPatientId.setText(
            Messages.getString("common.compulsory.marker") + Messages.getString("patient.label.patientid")); //$NON-NLS-1$ //$NON-NLS-2$
    lblPatientId.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    /*if(iDartProperties.country.equalsIgnoreCase("Nigeria")){
       txtPatientId = new CustomIdField(grpParticulars, SWT.BORDER);
        txtPatientId.setBounds(new Rectangle(col2x, 25, 270, 20));
    } else {
       txtPatientId = new TextAdapter(grpParticulars, SWT.BORDER);
       txtPatientId.setBounds(new Rectangle(col2x, 25, 150, 20));
    }*/
    txtPatientId = new TextAdapter(grpParticulars, SWT.BORDER);
    txtPatientId.setBounds(new Rectangle(col2x, 25, 150, 20));
    txtPatientId.setData(iDartProperties.SWTBOT_KEY, "txtPatientId"); //$NON-NLS-1$
    txtPatientId.setFocus();
    txtPatientId.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    txtPatientId.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if ((btnSearch != null) && (btnSearch.getEnabled())) {
                if ((e.character == SWT.CR)
                        || (e.character == (char) iDartProperties.intValueOfAlternativeBarcodeEndChar)) {
                    cmdSearchWidgetSelected();
                }
            }
        }
    });

    if (isAddnotUpdate) {
        txtPatientId.setEnabled(false);
    }

    btnSearch = new Button(grpParticulars, SWT.NONE);
    btnSearch.setBounds(new Rectangle(270, 20, 119, 28));
    /*if(iDartProperties.country.equalsIgnoreCase("Nigeria")){
       btnSearch.setBounds(new Rectangle(270, 47, 110, 28));
    } else {
       btnSearch.setBounds(new Rectangle(270, 20, 110, 28));
    }*/

    btnSearchByName = new Button(grpParticulars, SWT.NONE);
    btnSearchByName.setBounds(new Rectangle(270, 50, 119, 28));

    if (!isAddnotUpdate) {
        btnSearchByName.setVisible(false);
    }

    if (isAddnotUpdate) {
        btnSearch.setText(Messages.getString("patient.button.editid")); //$NON-NLS-1$
        btnSearch.setToolTipText(Messages.getString("patient.button.editid.tooltip")); //$NON-NLS-1$

        btnSearchByName.setText(Messages.getString("patient.button.editid.nome")); //$NON-NLS-1$
        btnSearchByName.setToolTipText(Messages.getString("patient.button.editid.tooltip.nome")); //$NON-NLS-1$
    } else {
        btnSearch.setText(Messages.getString("patient.button.search")); //$NON-NLS-1$
        btnSearch.setToolTipText(Messages.getString("patient.button.search.tooltip")); //$NON-NLS-1$
    }

    btnSearch.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnSearch.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            cmdSearchWidgetSelected();
        }
    });

    btnSearchByName.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnSearchByName.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            cmdSearchWidgetSelectedSearchByName();
        }
    });

    btnEkapaSearch = new Button(grpParticulars, SWT.NONE);
    btnEkapaSearch.setBounds(new Rectangle(270, 47, 110, 28));
    btnEkapaSearch.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnEkapaSearch.setText(Messages.getString("patient.button.ekapasearch")); //$NON-NLS-1$
    if (!iDartProperties.isEkapaVersion || isAddnotUpdate) {
        btnEkapaSearch.setVisible(false);
    }

    btnEkapaSearch.setToolTipText(Messages.getString("patient.button.ekapasearch.tooltip")); //$NON-NLS-1$
    btnEkapaSearch.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            cmdEkapaSearchWidgetSelected();
        }
    });

    // FirstNames
    Label lblFirstNames = new Label(grpParticulars, SWT.NONE);
    lblFirstNames.setBounds(new Rectangle(7, 55, 84, 20));
    lblFirstNames.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    lblFirstNames.setText(
            Messages.getString("common.compulsory.marker") + Messages.getString("patient.label.firstname")); //$NON-NLS-1$ //$NON-NLS-2$
    txtFirstNames = new Text(grpParticulars, SWT.BORDER);
    txtFirstNames.setBounds(new Rectangle(col2x, 55, 150, 20));
    txtFirstNames.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    // Surname
    Label lblSurname = new Label(grpParticulars, SWT.NONE);
    lblSurname.setBounds(new Rectangle(7, 85, 84, 20));
    lblSurname.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    lblSurname.setText(
            Messages.getString("common.compulsory.marker") + Messages.getString("patient.label.surname")); //$NON-NLS-1$ //$NON-NLS-2$
    txtSurname = new Text(grpParticulars, SWT.BORDER);
    txtSurname.setBounds(new Rectangle(col2x, 85, 150, 20));
    txtSurname.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    lblOtherPatientsWithThisID = new Label(grpParticulars, SWT.NONE);
    lblOtherPatientsWithThisID.setBounds(new Rectangle(355, 140, 40, 40));
    lblOtherPatientsWithThisID.setImage(ResourceUtils.getImage(iDartImage.PATIENTDUPLICATES_30X26));
    lblOtherPatientsWithThisID.setVisible(false);

    // Date of Birth
    Label lbldob = new Label(grpParticulars, SWT.NONE);
    lbldob.setBounds(new Rectangle(7, 115, 84, 20));
    lbldob.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    lbldob.setText(Messages.getString("common.compulsory.marker") + Messages.getString("patient.label.dob")); //$NON-NLS-1$ //$NON-NLS-2$

    cmbDOBDay = new Combo(grpParticulars, SWT.BORDER);
    cmbDOBDay.setBounds(new Rectangle(col2x, 112, 50, 18));
    cmbDOBDay.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    cmbDOBDay.setBackground(ResourceUtils.getColor(iDartColor.WHITE));
    cmbDOBDay.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            String theText = cmbDOBDay.getText();
            if (cmbDOBDay.indexOf(theText) == -1) {
                cmbDOBDay.setText(cmbDOBDay.getItem(0));
            }
        }
    });

    cmbDOBMonth = new Combo(grpParticulars, SWT.BORDER);
    cmbDOBMonth.setBounds(new Rectangle(col2x + 50, 112, 97, 18));
    cmbDOBMonth.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    cmbDOBMonth.setBackground(ResourceUtils.getColor(iDartColor.WHITE));
    cmbDOBMonth.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            String theText = cmbDOBMonth.getText();
            if (theText.length() > 2) {
                String s = theText.substring(0, 1);
                String t = theText.substring(1, theText.length());
                theText = s.toUpperCase() + t;
                String[] items = cmbDOBMonth.getItems();
                for (int i = 0; i < items.length; i++) {
                    if (items[i].substring(0, 3).equalsIgnoreCase(theText)) {
                        cmbDOBMonth.setText(items[i]);
                        cmbDOBYear.setFocus();
                    }
                }
            }
        }
    });

    cmbDOBYear = new Combo(grpParticulars, SWT.BORDER);
    cmbDOBYear.setBounds(new Rectangle(col2x + 148, 112, 60, 18));
    cmbDOBYear.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    cmbDOBYear.setBackground(ResourceUtils.getColor(iDartColor.WHITE));
    cmbDOBYear.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            String theText = cmbDOBYear.getText();
            if ((cmbDOBYear.indexOf(theText) == -1) && (theText.length() >= 4)) {
                cmbDOBYear.setText(EMPTY);
            }
        }
    });

    cmbDOBDay.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            cmdUpdateAge();
        }
    });
    cmbDOBMonth.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            cmdUpdateAge();
        }
    });
    cmbDOBYear.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            cmdUpdateAge();
        }
    });

    // populate the comboboxes
    ComboUtils.populateDateCombos(cmbDOBDay, cmbDOBMonth, cmbDOBYear, false, false);
    cmbDOBDay.setVisibleItemCount(cmbDOBDay.getItemCount());
    cmbDOBMonth.setVisibleItemCount(cmbDOBMonth.getItemCount());
    cmbDOBYear.setVisibleItemCount(31);

    // Sex
    Label lblSex = new Label(grpParticulars, SWT.NONE);
    lblSex.setBounds(new Rectangle(7, 152, 84, 20));
    lblSex.setText(Messages.getString("patient.label.sex")); //$NON-NLS-1$
    lblSex.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    cmbSex = new Combo(grpParticulars, SWT.BORDER);
    cmbSex.setBounds(new Rectangle(col2x, 145, 150, 18));
    cmbSex.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    cmbSex.setBackground(ResourceUtils.getColor(iDartColor.WHITE));
    // cmbSex.setEditable(false);
    //cmbSex.add(Messages.getString("common.unknown")); //$NON-NLS-1$
    cmbSex.add(Messages.getString("patient.sex.female")); //$NON-NLS-1$
    cmbSex.add(Messages.getString("patient.sex.male")); //$NON-NLS-1$
    //cmbSex.setText(Messages.getString("common.unknown")); //$NON-NLS-1$
    cmbSex.select(0);
    cmbSex.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            e.doit = false;
            Character keyPressed = new Character(Character.toLowerCase(e.character));
            getLog().debug("The char pressed in cmbSex: " + keyPressed); //$NON-NLS-1$
            if (Character.isLetter(keyPressed)) {
                if (keyPressed.equals('f')) {
                    cmbSex.select(1);
                } else if (keyPressed.equals('m')) {
                    cmbSex.select(2);
                } else {
                    cmbSex.select(0);
                }
                updateClinicInfoTab();
            }
        }
    });

    /*
     * add TraverseListener to allow traversal out of combo see JavaDoc for
     * org.eclipse.swt.events.KeyEvent
     */
    cmbSex.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = true;
            } else {
                e.doit = false;
            }
        }

    });
    cmbSex.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent se) {
            updateClinicInfoTab();
        }
    });

    // Age
    Label lblAge = new Label(grpParticulars, SWT.NONE);
    lblAge.setBounds(new Rectangle(col2x + 212, 117, 33, 20));
    lblAge.setText(Messages.getString("patient.label.age")); //$NON-NLS-1$
    lblAge.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    txtAge = new Text(grpParticulars, SWT.BORDER);
    txtAge.setBounds(new Rectangle(col2x + 249, 114, 35, 20));
    txtAge.setEditable(false);
    txtAge.setEnabled(false);
    txtAge.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    // Child Icon
    lblPicChild = new Label(grpParticulars, SWT.NONE);
    lblPicChild.setBounds(new Rectangle(255, 140, 50, 43));
    lblPicChild.setImage(ResourceUtils.getImage(iDartImage.CHILD_50X43));
    lblPicChild.setVisible(false);

    transito = new Button(grpParticulars, SWT.CHECK);
    transito.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
    transito.setBounds(new Rectangle(col2x, 150, 150, 18));
    transito.setText("Paciente Em Transito");
    transito.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    transito.setSelection(false);

    // Phone Cell
    Label lblPhoneCell = new Label(grpParticulars, SWT.NONE);
    lblPhoneCell.setBounds(new Rectangle(7, 207, 85, 20));
    lblPhoneCell.setText(Messages.getString("patient.label.cellphone")); //$NON-NLS-1$
    lblPhoneCell.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    txtCellphone = new Text(grpParticulars, SWT.BORDER);
    txtCellphone.setBounds(new Rectangle(col2x, 205, 150, 20));
    txtCellphone.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    txtCellphone.setEnabled(false);

    Label lblARVStartDate = new Label(grpParticulars, SWT.NONE);
    lblARVStartDate.setBounds(new Rectangle(7, 233, 90, 20));
    lblARVStartDate.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    lblARVStartDate.setText(Messages.getString("patient.label.arvstartdate")); //$NON-NLS-1$

    btnARVStart = new DateButton(grpParticulars, DateButton.ZERO_TIMESTAMP,
            new DateInputValidator(DateRuleFactory.beforeNowInclusive(true)));
    btnARVStart.setBounds(new Rectangle(col2x, 230, 150, 20));
    btnARVStart.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnARVStart.setText(Messages.getString("common.unknown")); //$NON-NLS-1$

    btnPatientHistoryReport = new Button(grpParticulars, SWT.NONE);
    btnPatientHistoryReport.setBounds(new Rectangle(310, 140, 40, 40));
    btnPatientHistoryReport.setToolTipText(Messages.getString("patient.button.report.tooltip")); //$NON-NLS-1$
    btnPatientHistoryReport.setImage(ResourceUtils.getImage(iDartImage.REPORT_PATIENTHISTORY_30X26));

    btnPatientHistoryReport.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent mu) {
            cmdPatientHistoryWidgetSelected();
        }
    });

}

From source file:ch.randelshofer.cubetwister.HTMLExporter.java

/**
 * Converts a String, so that it only contains lower case ASCII characters.
 *///from   w ww  .ja  va 2 s . c  om
private String toID(String str) {
    StringBuilder buf = new StringBuilder();
    for (int i = 0; i < str.length(); i++) {
        char ch = Character.toLowerCase(str.charAt(i));
        if (Character.isJavaIdentifierPart(ch)) {
            buf.append(ch);
        } else if (Character.isWhitespace(ch)) {
            buf.append('_');
        }
    }
    return buf.toString();
}

From source file:StringUtil.java

/**
 * Tests if this string starts with the specified prefix with ignored case
 * and with the specified prefix beginning a specified index.
 *
 * @param src        source string to test
 * @param subS       starting substring//from  w w  w  .j  a  v a2 s . c om
 * @param startIndex index from where to test
 *
 * @return <code>true</code> if the character sequence represented by the argument is
 *         a prefix of the character sequence represented by this string;
 *         <code>false</code> otherwise.
 */
public static boolean startsWithIgnoreCase(String src, String subS, int startIndex) {
    String sub = subS.toLowerCase();
    int sublen = sub.length();
    if (startIndex + sublen > src.length()) {
        return false;
    }
    int j = 0;
    int i = startIndex;
    while (j < sublen) {
        char source = Character.toLowerCase(src.charAt(i));
        if (sub.charAt(j) != source) {
            return false;
        }
        j++;
        i++;
    }
    return true;
}

From source file:br.msf.commons.text.EnhancedStringBuilder.java

public EnhancedStringBuilder toLowerCase(final int start, final int end) {
    ArgumentUtils.rejectIfLessThan(start, 0);
    ArgumentUtils.rejectIfGreaterEqual(start, end);
    for (int i = start; i < length() && i < end; i++) {
        setCharAt(i, Character.toLowerCase(charAt(i)));
    }/*w w w  .  ja va2  s.c  o  m*/
    return this;
}

From source file:StringUtil.java

/**
 * Tests if this string ends with the specified suffix.
 *
 * @param src    String to test/* ww  w .  j  ava2s. c o  m*/
 * @param subS   suffix
 *
 * @return <code>true</code> if the character sequence represented by the argument is
 *         a suffix of the character sequence represented by this object;
 *         <code>false</code> otherwise.
 */
public static boolean endsWithIgnoreCase(String src, String subS) {
    String sub = subS.toLowerCase();
    int sublen = sub.length();
    int j = 0;
    int i = src.length() - sublen;
    if (i < 0) {
        return false;
    }
    while (j < sublen) {
        char source = Character.toLowerCase(src.charAt(i));
        if (sub.charAt(j) != source) {
            return false;
        }
        j++;
        i++;
    }
    return true;
}

From source file:com.hihframework.core.utils.StringHelpers.java

/**
 * Index of ignore case.//www.j a va 2s  .c o m
 *
 * @param src the src
 * @param subS the sub s
 * @param startIndex the start index
 * @return the int
 */
public static int indexOfIgnoreCase(final String src, final String subS, final int startIndex) {
    final String sub = subS.toLowerCase();
    final int sublen = sub.length();
    final int total = src.length() - sublen + 1;

    for (int i = startIndex; i < total; i++) {
        int j = 0;

        while (j < sublen) {
            final char source = Character.toLowerCase(src.charAt(i + j));

            if (sub.charAt(j) != source) {
                break;
            }

            j++;
        }

        if (j == sublen) {
            return i;
        }
    }

    return -1;
}

From source file:com.android.ide.eclipse.adt.internal.editors.layout.gre.ClientRulesEngine.java

@Override
public @NonNull String getUniqueId(@NonNull String fqcn) {
    UiDocumentNode root = mRulesEngine.getEditor().getModel();
    String prefix = fqcn.substring(fqcn.lastIndexOf('.') + 1);
    prefix = Character.toLowerCase(prefix.charAt(0)) + prefix.substring(1);
    return DescriptorsUtils.getFreeWidgetId(root, prefix);
}

From source file:org.apache.uima.ruta.resource.MultiTreeWordList.java

/**
 * Returns true, if the MultiTreeWordList contains the string text, false otherwise.
 * /*from  ww  w.  j  a  v a 2  s .c o  m*/
 * @param pointer
 *          The MultiTextNode we are looking at.
 * @param text
 *          The string which is contained or not.
 * @param index
 *          The index of the string text we checked until now.
 * @param ignoreCase
 *          Indicates whether we search case sensitive or not.
 * @param fragment
 *          Indicates whether we are looking for a prefix of the string text.
 * @param ignoreChars
 *          Characters which can be ignored.
 * @param maxIgnoreChars
 *          Maximum number of characters which are allowed to be ignored.
 * @return True, if the TreeWordList contains the string text, false otherwise.
 */
private boolean recursiveContains(MultiTextNode pointer, String text, int index, boolean ignoreCase,
        boolean fragment, char[] ignoreChars, int maxIgnoreChars) {

    if (pointer == null) {
        return false;
    }

    if (index == text.length()) {
        return fragment || pointer.isWordEnd();
    }

    char charAt = text.charAt(index);
    boolean charAtIgnored = false;

    if (ignoreChars != null) {
        for (char each : ignoreChars) {
            if (each == charAt) {
                charAtIgnored = true;
                break;
            }
        }
        charAtIgnored &= index != 0;
    }

    int next = ++index;

    if (ignoreCase) {

        // Lower Case Node.
        MultiTextNode childNodeL = pointer.getChildNode(Character.toLowerCase(charAt));

        // Upper Case Node.
        MultiTextNode childNodeU = pointer.getChildNode(Character.toUpperCase(charAt));

        if (charAtIgnored && childNodeL == null && childNodeU == null) {
            // Character is ignored and does not appear.
            return recursiveContains(pointer, text, next, ignoreCase, fragment, ignoreChars, maxIgnoreChars);
        } else {
            // Recursion.
            return recursiveContains(childNodeL, text, next, ignoreCase, fragment, ignoreChars, maxIgnoreChars)
                    || recursiveContains(childNodeU, text, next, ignoreCase, fragment, ignoreChars,
                            maxIgnoreChars);
        }

    } else {
        // Case sensitive.
        MultiTextNode childNode = pointer.getChildNode(charAt);

        if (charAtIgnored && childNode == null) {
            // Recursion with incremented index.
            return recursiveContains(pointer, text, next, ignoreCase, fragment, ignoreChars, maxIgnoreChars);
        } else {
            // Recursion with new node.
            return recursiveContains(childNode, text, next, ignoreCase, fragment, ignoreChars, maxIgnoreChars);
        }
    }
}

From source file:com.aiblockchain.api.StringUtils.java

/**
 * Changes case of the first character of the string.
 *
 * @param string the given string//from ww w.j a  v  a2 s  .  c o m
 * @param isCapitalized whether to capitalize the first character
 *
 * @return the transformed string
 */
private static String changeFirstCharacterCase(final String string, final boolean isCapitalized) {
    if (string == null || string.length() == 0) {
        return string;
    }
    final StringBuilder stringBuilder = new StringBuilder(string.length());
    if (isCapitalized) {
        stringBuilder.append(Character.toUpperCase(string.charAt(0)));
    } else {
        stringBuilder.append(Character.toLowerCase(string.charAt(0)));
    }
    stringBuilder.append(string.substring(1));
    return stringBuilder.toString();
}