Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package org.litesoft.commonfoundation.typeutils;

public class Booleans
{
    public static boolean areNonArraysEqual( boolean pThis, boolean pThat )
    {
        return (pThis == pThat);
    }

    public static boolean isBooleanNotTrue( Object pObject )
    {
        return pObject == null || Boolean.FALSE.equals( pObject );
    }

    public static Boolean fromString( String pInput )
    {
        if ( "YES".equalsIgnoreCase( pInput ) || "Y".equalsIgnoreCase( pInput ) || "TRUE".equalsIgnoreCase( pInput ) || "T".equalsIgnoreCase( pInput ) )
        {
            return Boolean.TRUE;
        }
        if ( "NO".equalsIgnoreCase( pInput ) || "N".equalsIgnoreCase( pInput ) || "FALSE".equalsIgnoreCase( pInput ) || "F".equalsIgnoreCase( pInput ) )
        {
            return Boolean.FALSE;
        }
        return null;
    }

    public static void assertTrue( String pValueDescription, boolean pActual )
            throws IllegalArgumentException
    {
        if ( !pActual )
        {
            throw new IllegalArgumentException( pValueDescription + ": Expected to be true" );
        }
    }

    public static String displayFormatFlag( boolean pFlag, String pTrueString )
    {
        return pFlag ? pTrueString : "";
    }

    public static boolean isAnyTrue( Boolean... pToSearch )
    {
        if ( pToSearch != null )
        {
            for ( Boolean zBoolean : pToSearch )
            {
                if ( Boolean.TRUE.equals( zBoolean ) )
                {
                    return true;
                }
            }
        }
        return false;
    }
}

Commits for litesoft/trunk/Java/core/Anywhere/src/org/litesoft/commonfoundation/typeutils/Booleans.java

Diff revisions: vs.
Revision Author Commited Message
939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

822 Diff Diff GeorgeS picture GeorgeS Sun 19 Aug, 2012 01:03:51 +0000
819 GeorgeS picture GeorgeS Sat 18 Aug, 2012 18:09:40 +0000