001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005: * // Copyright (c) 2004, 2006, Oracle. All rights reserved.
006: *
007: *
008: * The contents of this file are subject to the terms of either the GNU
009: * General Public License Version 2 only ("GPL") or the Common Development
010: * and Distribution License("CDDL") (collectively, the "License"). You
011: * may not use this file except in compliance with the License. You can obtain
012: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
013: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
014: * language governing permissions and limitations under the License.
015: *
016: * When distributing the software, include this License Header Notice in each
017: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
018: * Sun designates this particular file as subject to the "Classpath" exception
019: * as provided by Sun in the GPL Version 2 section of the License file that
020: * accompanied this code. If applicable, add the following below the License
021: * Header, with the fields enclosed by brackets [] replaced by your own
022: * identifying information: "Portions Copyrighted [year]
023: * [name of copyright owner]"
024: *
025: * Contributor(s):
026: *
027: * If you wish your version of this file to be governed by only the CDDL or
028: * only the GPL Version 2, indicate your decision by adding "[Contributor]
029: * elects to include this software in this distribution under the [CDDL or GPL
030: * Version 2] license." If you don't indicate a single choice of license, a
031: * recipient has the option to distribute your version of this file under
032: * either the CDDL, the GPL Version 2 or to extend the choice of license to
033: * its licensees as provided above. However, if you add GPL Version 2 code
034: * and therefore, elected the GPL Version 2 license, then the option applies
035: * only if the new code is made subject to such option by the copyright
036: * holder.
037: */
038:
039: /*
040: DESCRIPTION
041: <short description of component this file declares/defines>
042:
043: PRIVATE CLASSES
044: <list of private classes defined - with one-line descriptions>
045:
046: NOTES
047: <other useful comments, qualifications, etc.>
048:
049: MODIFIED (MM/DD/YY)
050: pkrogh 10/07/05 -
051: pkrogh 09/29/05 -
052: gyorke 08/09/05 - gyorke_10-essentials-directory-creation_050808
053: dmahar 08/04/05 -
054: pkrogh 08/28/04 - codeformat
055: smcritch 05/14/04 - smcritch_refactor_session_read031604
056: smcritch 04/25/04 - Creation
057: */
058: package oracle.toplink.essentials.internal.helper;
059:
060: /**
061: * <b>Purpose</b>:Stores the answer to a simple yes/no question.
062: * <p>
063: * Superior to Boolean in that you can pass it to a method as a parameter,
064: * that method sets the value to either true or false, and then see the
065: * answer after.
066: * <p>
067: * I.e. if a method finds the answer to a question while doing some calculations,
068: * it can mark the answer so another method doesn't need to do those calculations
069: * again just to see what the answer is.
070: * <p>
071: * I.e. in a method that gets something, might want some clue after as to
072: * from where that something was gotten from.
073: *
074: * @author Stephen McRitchie
075: * @since release specific (what release of product did this appear in)
076: */
077: public class Answer {
078: int answer;
079:
080: public Answer() {
081: answer = FalseUndefinedTrue.Undefined;
082: }
083:
084: public void setFalse() {
085: answer = FalseUndefinedTrue.False;
086: }
087:
088: public void setTrue() {
089: answer = FalseUndefinedTrue.True;
090: }
091:
092: public void setUndefined() {
093: answer = FalseUndefinedTrue.Undefined;
094: }
095:
096: public boolean isFalse() {
097: return (answer == FalseUndefinedTrue.False);
098: }
099:
100: public boolean isTrue() {
101: return (answer == FalseUndefinedTrue.True);
102: }
103:
104: public boolean isUndefined() {
105: return (answer == FalseUndefinedTrue.Undefined);
106: }
107:
108: public int getAnswer() {
109: return answer;
110: }
111: }
|