asn1boolean.java

来自「CmisJavaApi」· Java 代码 · 共 114 行

JAVA
114
字号
/* * The contents of this file are subject to the Dyade Public License,  * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package  * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA.  * All Rights Reserved. *//*      Copyright 1996-2000 by Institut National de Recherche en Informatique  *                             et en Automatique (INRIA) *          All rights reserved.  See COPYRIGHT in top-level directory. * *      Authors: Laurent Andrey, Eric Dillon, Olivier Festor *///---------------------------------------------------------------------------////  CVS Info//---------------------------------------------------------------------------//////  $Id: ASN1Boolean.java,v 1.2 2000/09/05 13:30:23 festor Exp $////---------------------------------------------------------------------------////  Todo//---------------------------------------------------------------------------////package fr.dyade.cmis.api.types;import java.io.ObjectStreamException;/**  *  Java representation of the ASN.1 Boolean type.  *  <p>  *  The implementation is done by encapsulating a simple Java boolean value into this class.  *  * @see fr.dyade.cmis.api.types.ASN1Integer  */public class ASN1Boolean  extends Value {      /** Unique ASN1Boolean instance for true.	* You can use expression such as myASN1BooleanRef == ASN1Boolean.TRUE	* This is a singleton-like pattern.	*/      public static final ASN1Boolean TRUE= new ASN1Boolean(true);      /** Unique ASN1Boolean instance for false	* This is a singleton-like pattern.	*/      public static final ASN1Boolean FALSE=new ASN1Boolean(false);      /** Pseudo static constructor to access the singleton.	* @param pValueBool the java primitive boolean associated the wanted singleton.	* You write expression like:	*/      public static final ASN1Boolean ASN1_BOOLEAN(boolean pValueBool) {	 return pValueBool?TRUE:FALSE;      }      /**	*  Creates a new instance of ASN1Boolean class.	*  This is a private constructor as user should access "Singleton TRUE & FALSE"	*  @param pValue The Java boolean value to set the ASN1Boolean with.	*/      private ASN1Boolean(boolean pValue) {	 super(VALUE_BOOLEAN);	 fValue = pValue;      }      /**	*  Returns the Java boolean value of this ASN1Boolean object.	*  @return The boolean value of the ASN1Boolean.	*/      public boolean getValue(){	 return fValue;      }            /**	*  Returns the Java boolean value of this ASN1Boolean object.	*  This is an alias for getValue, a-la java.lang naning 	*  @return The boolean value of the ASN1Boolean.	*/      public boolean toBoolean(){	 return fValue;      }      public final ASN1Boolean and( ASN1Boolean b ) {	 return ASN1_BOOLEAN(fValue && b.fValue);      }      public final ASN1Boolean or( ASN1Boolean b ) {	 return ASN1_BOOLEAN(fValue || b.fValue);      }      public final ASN1Boolean not() {	 return ASN1_BOOLEAN(!fValue);      }      public String toString() {	 return fValue ? "TRUE":"FALSE";      }      private boolean fValue;       /** Filtering instance created after deserialization.	* <a HREF="http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/input.doc6.html">	* Read javasof doc</a> about this method. We are exactly is the example shown here:	* "The readResolve method would be implemented to determine if that symbol was already defined 	* and substitute the preexisting equivalent Symbol object to maintain the identity constraint...",	* where Symbol objects are ASN1_TRUE/FALSE objects.	*/      public Object readResolve() throws ObjectStreamException {	 return ASN1_BOOLEAN(fValue);      }} // ASN1Boolean

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?