merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / runner / lib / SimpleStatus.java
blobd4a5f6cbff6e74b0da7fa00ce4d4e47d813d8672
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SimpleStatus.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package lib;
33 /**
34 * The class is a simple implementation of Status class. It implements simple
35 * Status behaviour: its state, reason and log are defined when creating
36 * the SimpleSTatus instance.
38 class SimpleStatus {
39 /* Run states. */
41 /**
42 * The constatnt represents PASSED runtime state.
44 public final static int PASSED = 0;
46 /**
47 * The constant represents EXCEPTION runtime state.
49 public final static int EXCEPTION = 3;
51 /**
52 * The constant represents EXCLUDED runtime state.
54 public final static int EXCLUDED = 2;
56 /**
57 * The constant represents SKIPPED runtime state.
59 public final static int SKIPPED = 1;
61 /**
62 * This is a private indicator for a user defined runtime state
64 private final static int USER_DEFINED = 4;
66 /* Test states */
68 /**
69 * The constant represents FAILED state.
71 public final static boolean FAILED = false;
73 /**
74 * The constant represents OK state.
76 public final static boolean OK = true;
78 /**
79 * The field is holding state of the status.
81 protected final boolean state;
83 /**
84 * The field is holding reason of the status.
86 protected final int runState;
88 /**
89 * This is the run state: either SKIPPED, PASSED, etc.
90 * or user defined. Deriving classes can overwrite it for own run states.
92 protected String runStateString;
94 /**
95 * The constructor initialize state and reason field.
97 protected SimpleStatus( int runState, boolean state ) {
98 this.state = state;
99 this.runState = runState;
100 if ( runState == PASSED ) {
101 runStateString = "PASSED";
102 } else if ( runState == EXCLUDED ) {
103 runStateString = "EXCLUDED";
104 } else if ( runState == SKIPPED ) {
105 runStateString = "SKIPPED";
106 } else if ( runState == EXCEPTION ) {
107 runStateString = "EXCEPTION";
108 } else {
109 runStateString = "UNKNOWN";
114 * The constructor initialize state and reson field.
116 protected SimpleStatus(String runStateString, boolean state) {
117 this.state = state;
118 this.runState = USER_DEFINED;
119 this.runStateString = runStateString;
123 * getState implementation. Just returns the state field value.
125 public boolean getState() {
126 return state;
130 * getRunState() implementation. Just returns th runState field value.
132 public int getRunState() {
133 return runState;
137 * getReason implementation. Just returns the reason field value.
139 public String getRunStateString() {
140 return runStateString;
144 * Get the ressult: passed or failed.
146 public String getStateString() {
147 if (state)
148 return "OK";
149 return "FAILED";