Example usage for java.lang String compareTo

List of usage examples for java.lang String compareTo

Introduction

In this page you can find the example usage for java.lang String compareTo.

Prototype

public int compareTo(String anotherString) 

Source Link

Document

Compares two strings lexicographically.

Usage

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

public void rateSelected(String r) {
    if (r.compareTo(new String("All")) == 0) {
        setNamedData("sappVersion-ratingData", "");
    } else {//from  www .  ja v a  2  s.co  m
        setNamedData("sappVersion-ratingData", r);
    }
}

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

public void licenseSelected(String r) {
    if (r.compareTo(new String("All")) == 0) {
        setNamedData("sappVersion-licenseData", "");
    } else {/*ww  w.j a  v  a2 s. c om*/
        setNamedData("sappVersion-licenseData", r);
    }
}

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

public void placementSelected(String r) {
    if (r.compareTo(new String("contains")) == 0) {
        setNamedData("iappFamily-appNameOp", "2");
    } else if (r.compareTo(new String("starts with")) == 0) {
        setNamedData("iappFamily-appNameOp", "3");
    } else if (r.compareTo(new String("ends with")) == 0) {
        setNamedData("iappFamily-appNameOp", "4");
    }//w  w w  .  ja  v  a 2 s.c o  m
}

From source file:org.jtotus.database.NetworkGoogle.java

public BigDecimal fetchData(String stockName, DateTime date, String type) {

    if (type.compareTo("OPEN") == 0) {
        return this.fetchDataInternal(stockName, date, openInd);
    } else if (type.compareTo("HIGH") == 0) {
        return this.fetchDataInternal(stockName, date, highInd);
    } else if (type.compareTo("LOW") == 0) {
        return this.fetchDataInternal(stockName, date, lowhInd);
    } else if (type.compareTo("CLOSE") == 0) {
        return this.fetchDataInternal(stockName, date, closehInd);
    } else if (type.compareTo("VOLUME") == 0) {
        return this.fetchDataInternal(stockName, date, volumeInd);
    }// ww w.  j ava  2s.  co m
    return null;
}

From source file:edu.uci.ics.asterix.optimizer.rules.IntroduceMaterializationForInsertWithSelfScanRule.java

private boolean checkIfInsertAndScanDatasetsSame(AbstractLogicalOperator op, String insertDatasetName) {
    boolean sameDataset = false;
    for (int i = 0; i < op.getInputs().size(); ++i) {
        AbstractLogicalOperator descendantOp = (AbstractLogicalOperator) op.getInputs().get(i).getValue();

        if (descendantOp.getOperatorTag() == LogicalOperatorTag.UNNEST_MAP) {
            UnnestMapOperator unnestMapOp = (UnnestMapOperator) descendantOp;
            ILogicalExpression unnestExpr = unnestMapOp.getExpressionRef().getValue();
            if (unnestExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
                AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) unnestExpr;
                FunctionIdentifier fid = f.getFunctionIdentifier();
                if (!fid.equals(AsterixBuiltinFunctions.INDEX_SEARCH)) {
                    throw new IllegalStateException();
                }/*from  w ww  .  j  a v a 2s .c o m*/
                AccessMethodJobGenParams jobGenParams = new AccessMethodJobGenParams();
                jobGenParams.readFromFuncArgs(f.getArguments());
                boolean isPrimaryIndex = jobGenParams.isPrimaryIndex();
                String indexName = jobGenParams.getIndexName();
                if (isPrimaryIndex && indexName.compareTo(insertDatasetName) == 0) {
                    return true;
                }
            }
        } else if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
            DataSourceScanOperator dataSourceScanOp = (DataSourceScanOperator) descendantOp;
            AqlDataSource ds = (AqlDataSource) dataSourceScanOp.getDataSource();
            if (ds.getDatasourceType() != AqlDataSourceType.FEED
                    && ds.getDatasourceType() != AqlDataSourceType.LOADABLE) {
                if (((DatasetDataSource) ds).getDataset().getDatasetName().compareTo(insertDatasetName) == 0) {
                    return true;
                }
            }
        }
        sameDataset = checkIfInsertAndScanDatasetsSame(descendantOp, insertDatasetName);
        if (sameDataset) {
            break;
        }
    }
    return sameDataset;
}

From source file:annis.model.Annotation.java

@Override
public int compareTo(Annotation o) {
    String name1 = getQualifiedName();
    String name2 = o.getQualifiedName();
    return name1.compareTo(name2);
}

From source file:com.prowidesoftware.swift.model.SwiftBlock4.java

/**
 * Sets the block name. Will cause an exception unless setting block number to "4".
 * @param blockName the block name to set
 * @throws IllegalArgumentException if parameter blockName is not the string "4"
 * @since 5.0/* ww w.  j  av  a  2  s.  c o  m*/
 */
protected void setBlockName(String blockName) {
    // sanity check
    Validate.notNull(blockName, "parameter 'blockName' cannot be null");
    Validate.isTrue(blockName.compareTo("4") == 0, "blockName must be string '4'");
}

From source file:com.snowplowanalytics.hive.serde.CfLogStruct.java

/**
 * Implicit conversion from String to Integer. To deal with the fact that
 * AWS uses a single "-"" for null./*w w w.j  a  va2 s. c o m*/
 * 
 * @param s
 *            The String to check
 * @return The Integer, or null if the String was "-"
 */
private Integer toInt(String s) {
    return (s.compareTo("-") == 0) ? null : Integer.valueOf(s);
}

From source file:com.snowplowanalytics.hive.serde.CfLogStruct.java

/**
 * Explicit conversion to turn a "-" String into null. Useful for "-" URIs
 * (URI is set to "-" if e.g. S3 is accessed from a file:// protocol).
 * //  w ww .j  a  va2  s.co m
 * @param s
 *            The String to check
 * @return The original String, or null if the String was "-"
 */
private String nullifyHyphen(String s) {
    return (s.compareTo("-") == 0) ? null : s;
}

From source file:technology.tikal.gae.system.service.imp.SystemAccountServiceImp.java

@Override
@RequestMapping(value = "/{user}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)/*from  w  w w  .  j av a 2s . c  o m*/
public void deleteSystemAccount(@PathVariable final String user) {
    SystemUser account = systemUserDao.consultar(user);
    String username = SecurityContextHolder.getContext().getAuthentication().getName();
    if (username.compareTo(user) == 0) { //No se puede borrar a si mismo
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "SelfDelete.SystemAccountServiceImp.deleteSystemAccount" },
                new String[] { user }, "Can't delete yourself"));
    } else {
        systemUserDao.borrar(account);
    }
}