All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.evosuite.utils.TriBoolean Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2010-2018 Gordon Fraser, Andrea Arcuri and EvoSuite
 * contributors
 *
 * This file is part of EvoSuite.
 *
 * EvoSuite is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3.0 of the License, or
 * (at your option) any later version.
 *
 * EvoSuite is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with EvoSuite. If not, see .
 */
package org.evosuite.utils;
public enum TriBoolean {
	True, False, Maybe;

	/**
	 * 

fromBoolean

* * @param value a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public static TriBoolean fromBoolean(boolean value) { return value ? True : False; } /** *

and

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean and(TriBoolean other) { if (this == False || other == False) return False; if (this == Maybe || other == Maybe) return Maybe; return True; } /** *

and

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean and(boolean other) { return and(fromBoolean(other)); } /** *

or

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean or(TriBoolean other) { if (this == True || other == True) return True; if (this == Maybe || other == Maybe) return Maybe; return False; } /** *

or

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean or(boolean other) { return or(fromBoolean(other)); } /** *

negated

* * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean negated() { return (this == Maybe) ? Maybe : fromBoolean(this == False); } /** *

andNot

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean andNot(TriBoolean other) { return and(other.negated()); } /** *

andNot

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean andNot(boolean other) { return andNot(fromBoolean(other)); } /** *

orNot

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean orNot(TriBoolean other) { return or(other.negated()); } /** *

orNot

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean orNot(boolean other) { return orNot(fromBoolean(other)); } /** *

notAnd

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean notAnd(TriBoolean other) { return and(other).negated(); } /** *

notAnd

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean notAnd(boolean other) { return notAnd(fromBoolean(other)); } /** *

notOr

* * @param other a {@link org.evosuite.utils.TriBoolean} object. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean notOr(TriBoolean other) { return or(other).negated(); } /** *

notOr

* * @param other a boolean. * @return a {@link org.evosuite.utils.TriBoolean} object. */ public TriBoolean notOr(boolean other) { return notOr(fromBoolean(other)); } /** *

isPossiblyTrue

* * @return a boolean. */ public boolean isPossiblyTrue() { return this == True || this == Maybe; } /** *

isPossiblyFalse

* * @return a boolean. */ public boolean isPossiblyFalse() { return this == False || this == Maybe; } /** *

isCertainlyTrue

* * @return a boolean. */ public boolean isCertainlyTrue() { return this == True; } /** *

isCertainlyFalse

* * @return a boolean. */ public boolean isCertainlyFalse() { return this == False; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy