Example usage for java.lang Boolean TRUE

List of usage examples for java.lang Boolean TRUE

Introduction

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

Prototype

Boolean TRUE

To view the source code for java.lang Boolean TRUE.

Click Source Link

Document

The Boolean object corresponding to the primitive value true .

Usage

From source file:menusearch.logic.RecipeSearch.java

public static RecipeSummaryList search(String searchPhrase, String aIngredients, String eIngredients,
        String aAllergy, String aDiet, String aCuisines, String eCuisines, String aCourses, String eCourses,
        String aHollidays, String eHollidays, String nutrition, int nmax, int nmin, String flavor, int m) {
    System.err.println("The search phrase really is: " + searchPhrase);
    System.err.println("The ingredients were " + aIngredients + " " + eIngredients + " " + aAllergy + " "
            + aDiet + " " + aCuisines + " " + eCuisines + " " + aHollidays);
    ArrayList<RecipeSummaryList> recipeList = null;
    JSONProcessor jsonp = new JSONProcessor();
    Parameters p = new Parameters();
    String result;/*from   w w w .  j ava 2s.  c  o m*/
    RecipeSummaryList recipe = null;
    System.err.println("We're in the RecipeSearch class");
    if (!searchPhrase.equals(""))
        p.setSearchPhrase(searchPhrase);
    if (!aIngredients.equals(""))
        p.addAllowedIngredients(aIngredients);
    if (!eIngredients.equals(""))
        p.addExcludedIngredients(eIngredients);
    if (!aAllergy.equals(""))
        p.addAllowedAllergy(aAllergy);
    if (!aDiet.equals(""))
        p.addAllowedDiet(aDiet);
    if (!aCuisines.equals(""))
        p.addAllowedCourses(aCuisines);
    if (!eCuisines.equals(""))
        p.addExcludedCuisines(eCuisines);
    if (!aCourses.equals(""))
        p.addAllowedCourses(aCourses);
    if (!eCourses.equals(""))
        p.addExcludedCourses(eCourses);
    if (!aHollidays.equals(""))
        p.addAllowedHoliday(aHollidays);
    if (!eHollidays.equals(""))
        p.addExcludedHoliday(eHollidays);
    if (!nutrition.equals(""))
        p.addNutritionAttributes(nutrition, nmin, nmax);
    if (!flavor.equals(""))
        p.setFlavorAttributes(flavor, Boolean.TRUE, m);

    try {
        System.err.println("The search phrase was: " + p.getSearchPhrase());
        System.err.println();
        result = JSONProcessor.buildQuery(p);
        System.err.println("-----------------------------------------------------------------");
        System.err.println(result);

        recipe = JSONProcessor.parseRecipeMatches(result);
        System.err.println("-----Your search reulsts are! ----------");
        for (RecipeSummary x : recipe.getMatches()) {
            System.err.println(x.getId() + ", " + x.getRecipeName());
        }

    } catch (IOException | JSONException e) {
        System.err.println("Error: " + e.getMessage());
    }

    return recipe;
}

From source file:org.cleverbus.core.common.asynch.queue.JobStarterForMessagePooling.java

public void start() throws Exception {
    synchronized (lock) {
        if (isRunning) {
            Log.debug("Job hasn't been started because previous job has still been running.");
            return;
        }//from   ww w. j a va 2s.  com

        isRunning = Boolean.TRUE;
    }

    try {
        messageExecutor.run();
    } catch (Exception ex) {
        Log.error("Error occurred during polling messages.", ex);
    } finally {
        isRunning = Boolean.FALSE;
    }
}

From source file:NumberUtil.java

/**
 * Optimisation Code/*w ww  .  ja v  a 2 s  .  c o m*/
 */
public static Boolean getBoolean(boolean bool) {
    return bool ? Boolean.TRUE : Boolean.FALSE;
}

From source file:com.programmingskillz.SampleApplication.java

public SampleApplication() {
    setApplicationName("Jersey RESTful Webapp");

    String[] packages = { this.getClass().getPackage().getName(), "io.swagger.jaxrs.listing" };

    packages(packages);/*from  w  ww  . j  a va  2s .  c  o m*/

    LOGGER.debug("Registering JAX-RS Components...");

    register(SampleObjectMapperProvider.class);
    register(jacksonXMLProvider());
    register(uriConnegFilter());
    register(LoggingFeature.class);

    setUpSwagger();

    property(ServerProperties.MONITORING_ENABLED, Boolean.TRUE);
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
    property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "INFO");
    property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_SERVER, LoggingFeature.Verbosity.HEADERS_ONLY);
}

From source file:Main.java

/**
 * Normalize and pretty-print XML so that it can be compared using string
 * compare. The following code does the following: - Removes comments -
 * Makes sure attributes are ordered consistently - Trims every element -
 * Pretty print the document/*  w  w  w .j a va2s  .  c  o  m*/
 *
 * @param xml The XML to be normalized
 * @return The equivalent XML, but now normalized
 */
public static String normalizeXML(String xml) throws Exception {
    // Remove all white space adjoining tags ("trim all elements")
    xml = xml.replaceAll("\\s*<", "<");
    xml = xml.replaceAll(">\\s*", ">");

    DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
    DOMImplementationLS domLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
    LSParser lsParser = domLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);

    LSInput input = domLS.createLSInput();
    input.setStringData(xml);
    Document document = lsParser.parse(input);

    LSSerializer lsSerializer = domLS.createLSSerializer();
    lsSerializer.getDomConfig().setParameter("comments", Boolean.FALSE);
    lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
    return lsSerializer.writeToString(document);
}

From source file:edu.umd.cs.findbugs.detect.LpPreCompileRegCheck.java

@Override
public void visit(Code obj) {
    String methodName = getMethodName();
    // this.get/*from   www. java2  s. c  om*/
    // (springinitset)
    if (StringUtils.isNotBlank(methodName) && (!"<clinit>".equals(methodName) && !"<init>".equals(methodName)
            && !methodName.startsWith("init") && !methodName.startsWith("set"))) {
        isMethod = Boolean.TRUE;
        super.visit(obj);
    } else {
        isMethod = Boolean.FALSE;
        return;
    }
}

From source file:de.hybris.platform.b2b.punchout.PunchOutUtils.java

public static void removeStandalone(final Marshaller marshaller) throws PropertyException {
    marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
}

From source file:io.cloudslang.lang.runtime.bindings.ScriptEvaluator.java

public Serializable evalExpr(String expr, Map<String, ? extends Serializable> context) {
    ScriptContext scriptContext = new SimpleScriptContext();
    for (Map.Entry<String, ? extends Serializable> entry : context.entrySet()) {
        scriptContext.setAttribute(entry.getKey(), entry.getValue(), ScriptContext.ENGINE_SCOPE);
    }/*ww w .  ja  va2  s  . co  m*/
    if (scriptContext.getAttribute(TRUE) == null)
        scriptContext.setAttribute(TRUE, Boolean.TRUE, ScriptContext.ENGINE_SCOPE);
    if (scriptContext.getAttribute(FALSE) == null)
        scriptContext.setAttribute(FALSE, Boolean.FALSE, ScriptContext.ENGINE_SCOPE);
    try {
        return (Serializable) engine.eval(expr, scriptContext);
    } catch (ScriptException e) {
        ScriptException scriptException = new ScriptException(e);
        throw new RuntimeException("Error in running script expression or variable reference, for expression: '"
                + expr + "',\n\tScript exception is: " + scriptException.getMessage(), scriptException);
    }
}

From source file:org.openscore.lang.runtime.bindings.ScriptEvaluator.java

public Serializable evalExpr(String expr, Map<String, ? extends Serializable> context) {
    ScriptContext scriptContext = new SimpleScriptContext();
    for (Map.Entry<String, ? extends Serializable> entry : context.entrySet()) {
        scriptContext.setAttribute(entry.getKey(), entry.getValue(), ScriptContext.ENGINE_SCOPE);
    }/*  w w  w. ja  v  a2 s. co  m*/
    if (scriptContext.getAttribute(TRUE) == null)
        scriptContext.setAttribute(TRUE, Boolean.TRUE, ScriptContext.ENGINE_SCOPE);
    if (scriptContext.getAttribute(FALSE) == null)
        scriptContext.setAttribute(FALSE, Boolean.FALSE, ScriptContext.ENGINE_SCOPE);
    try {
        return (Serializable) engine.eval(expr, scriptContext);
    } catch (ScriptException e) {
        ScriptException scriptException = new ScriptException(e);
        throw new RuntimeException("Error in running script expression or variable reference, for expression: '"
                + expr + "', Script exception is: \n" + scriptException.getMessage(), scriptException);
    }
}

From source file:org.cleverbus.core.common.asynch.confirm.JobStarterForConfirmationPooling.java

public void start() throws Exception {
    synchronized (lock) {
        if (isRunning) {
            Log.debug("Job hasn't been started because previous job has still been running.");
            return;
        }//from  w ww .ja v  a 2s. c  om

        isRunning = Boolean.TRUE;
    }

    try {
        pollExecutor.run();
    } catch (Exception ex) {
        Log.error("Error occurred during polling confirmations.", ex);
    } finally {
        isRunning = Boolean.FALSE;
    }
}