View Javadoc
1   /*
2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3    *
4    * This code is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU General Public License version 2 only, as
6    * published by the Free Software Foundation.  Oracle designates this
7    * particular file as subject to the "Classpath" exception as provided
8    * by Oracle in the LICENSE file that accompanied this code.
9    *
10   * This code is distributed in the hope that it will be useful, but WITHOUT
11   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13   * version 2 for more details (a copy is included in the LICENSE file that
14   * accompanied this code).
15   *
16   * You should have received a copy of the GNU General Public License version
17   * 2 along with this work; if not, write to the Free Software Foundation,
18   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19   *
20   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21   * or visit www.oracle.com if you need additional information or have any
22   * questions.
23   */
24  
25  /*
26   * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
27   */
28  
29  /*
30   * $Id: FeatureState.java 3024 2011-03-01 03:46:13Z joehw $
31   */
32  
33  package com.sun.org.apache.xerces.internal.util;
34  
35  public class FeatureState {
36  
37      public final Status status;
38      public final boolean state;
39  
40      public static final FeatureState SET_ENABLED = new FeatureState(Status.SET, true);
41      public static final FeatureState SET_DISABLED = new FeatureState(Status.SET, false);
42      public static final FeatureState UNKNOWN = new FeatureState(Status.UNKNOWN, false);
43      public static final FeatureState RECOGNIZED = new FeatureState(Status.RECOGNIZED, false);
44      public static final FeatureState NOT_SUPPORTED = new FeatureState(Status.NOT_SUPPORTED, false);
45      public static final FeatureState NOT_RECOGNIZED = new FeatureState(Status.NOT_RECOGNIZED, false);
46      public static final FeatureState NOT_ALLOWED = new FeatureState(Status.NOT_ALLOWED, false);
47  
48      public FeatureState(Status status, boolean state) {
49          this.status = status;
50          this.state = state;
51      }
52  
53      public static FeatureState of(Status status) {
54          return new FeatureState(status, false);
55      }
56  
57      public static FeatureState is(boolean value) {
58          return new FeatureState(Status.SET, value);
59      }
60  
61      public boolean isExceptional() {
62          return this.status.isExceptional();
63      }
64  }