Example usage for java.lang Boolean equals

List of usage examples for java.lang Boolean equals

Introduction

In this page you can find the example usage for java.lang Boolean equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.

Usage

From source file:com.twosigma.beaker.core.rest.UtilRest.java

/**
 * This function returns a Boolean setting as string. If the setting is null in the preference,
 * it will use the setting in the config, otherwise, what is set in preference is used.
 * @param settingsListName/*  w w w .  j a  va 2s. c o m*/
 * @param configs
 * @param prefs
 * @return
 */
private static String mergeBooleanSetting(String settingName, JSONObject configs, JSONObject prefs) {
    Boolean sc = (Boolean) configs.get(settingName);
    Boolean sp = (Boolean) prefs.get(settingName);
    Boolean s = (sp != null) ? sp : sc;
    String setting = null;
    if (s != null) {
        if (s.equals(Boolean.TRUE)) {
            setting = "true";
        } else if (s.equals(Boolean.FALSE)) {
            setting = "false";
        }
    }
    return setting;
}

From source file:edu.ku.brc.specify.tasks.services.PickListUtils.java

public static boolean equals(Boolean v1, Boolean v2) {
    return (v1 == null ? v2 == null : v1.equals(v2));
}

From source file:jef.tools.Assert.java

/**
 * ?//w  ww. j  a  v  a2s.  c o  m
 * @param obj
 */
public static void isFalse(Boolean obj) {
    if (obj.equals(Boolean.TRUE))
        throw new RuntimeException();
}

From source file:jef.tools.Assert.java

/**
 * /*from  w ww.  j  a  v a2  s  .c  o  m*/
 * @param obj
 */
public static void isTrue(Boolean obj) {
    if (obj.equals(Boolean.FALSE))
        throw new RuntimeException();
}

From source file:jef.tools.Assert.java

/**
 * ?/*from w  w  w  .  j  a v a  2s  .co m*/
 * @param obj
 * @param string
 */
public static void isFalse(Boolean obj, String string) {
    if (obj.equals(Boolean.TRUE))
        throw new RuntimeException(string);
}

From source file:jef.tools.Assert.java

/**
 * //from w w w  .java  2s.  com
 * @param obj
 * @param string
 */
public static void isTrue(Boolean obj, String string) {
    if (obj.equals(Boolean.FALSE))
        throw new RuntimeException(string);
}

From source file:org.sonar.plugins.gosu.jacoco.JaCoCoReportMerger.java

private static boolean loadSourceFiles(ISessionInfoVisitor infoStore, IExecutionDataVisitor dataStore,
        File... reports) {/*from   w w  w .  j  a v a  2 s.  c  o m*/
    Boolean isCurrentVersionFormat = null;
    for (File report : reports) {
        if (report.isFile()) {
            JaCoCoReportReader jacocoReportReader = new JaCoCoReportReader(report).readJacocoReport(dataStore,
                    infoStore);
            boolean reportFormatIsCurrent = jacocoReportReader.useCurrentBinaryFormat();
            if (isCurrentVersionFormat == null) {
                isCurrentVersionFormat = reportFormatIsCurrent;
            } else if (!isCurrentVersionFormat.equals(reportFormatIsCurrent)) {
                throw new IllegalStateException(
                        "You are trying to merge two different JaCoCo binary formats. Please use only one version of JaCoCo.");
            }
        }
    }
    return BooleanUtils.isNotFalse(isCurrentVersionFormat);
}

From source file:org.sonar.plugins.jacoco.JaCoCoReportMerger.java

private static boolean loadSourceFiles(ExecutionDataVisitor executionDataVisitor, File... reports) {
    Boolean isCurrentVersionFormat = null;
    for (File report : reports) {
        if (report.isFile()) {
            JacocoReportReader jacocoReportReader = new JacocoReportReader(report)
                    .readJacocoReport(executionDataVisitor, executionDataVisitor);
            boolean reportFormatIsCurrent = jacocoReportReader.useCurrentBinaryFormat();
            if (isCurrentVersionFormat == null) {
                isCurrentVersionFormat = reportFormatIsCurrent;
            } else if (!isCurrentVersionFormat.equals(reportFormatIsCurrent)) {
                throw new IllegalStateException(
                        "You are trying to merge two different JaCoCo binary formats. Please use only one version of JaCoCo.");
            }//  w w w .  jav  a 2  s .  c  o m
        }
    }
    return BooleanUtils.isNotFalse(isCurrentVersionFormat);
}

From source file:org.apache.hadoop.hive.ql.optimizer.pcr.PcrExprProcFactory.java

static Boolean opAnd(Boolean... ops) {
    // When people forget to quote a string, op1/op2 is null.
    // For example, select * from some_table where ds > 2012-12-1 and ds < 2012-12-2 .
    boolean anyNull = false;
    for (Boolean op : ops) {
        if (op == null) {
            anyNull = true;/* w ww  .j a v a  2 s  .com*/
            continue;
        }
        if (op.equals(Boolean.FALSE)) {
            return Boolean.FALSE;
        }
    }
    if (anyNull) {
        return null;
    }
    return Boolean.TRUE;
}

From source file:org.apache.hadoop.hive.ql.optimizer.pcr.PcrExprProcFactory.java

static Boolean opOr(Boolean... ops) {
    // When people forget to quote a string, op1/op2 is null.
    // For example, select * from some_table where ds > 2012-12-1 or ds < 2012-12-2 .
    boolean anyNull = false;
    for (Boolean op : ops) {
        if (op == null) {
            anyNull = true;// w  w  w  .ja  va2s.  c  o m
            continue;
        }
        if (op.equals(Boolean.TRUE)) {
            return Boolean.TRUE;
        }
    }
    if (anyNull) {
        return null;
    }
    return Boolean.FALSE;
}