📄 mode.java
字号:
/* * 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: Mode.java,v 1.2 2000/09/05 13:30:49 festor Exp $// $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/api/types/Mode.java,v $//---------------------------------------------------------------------------//// Todo//---------------------------------------------------------------------------////package fr.dyade.cmis.api.types;import java.io.ObjectStreamException;/** Type for confirmation mode parameter. * In X710, some operations (set, action, event-report) can be confirmed or not. * The selection is made thru a "MODE" parameter. Where is no asn1 support for it because * where TWO set of ROSE operation ids to separate confirmed and unconfirmed calls. * So the type of this parameter is a strict local matter. * <p> * This is a kind of <i>enumerate</i> type with two values (confirmed, non-confirmed). * Mode instances are unmutable. * <p> * User has only access to "constant" object, constructor is <b>private</b>. * Two constant objects are defined: * <menu> * <li> CONFIRMED, * <li> UNCONFIRMED. * </menu> * These objects can then be referenced by the user as shown below:<br> * <code>Mode myMode = Mode.CONFIRMED</code> * @see fr.dyade.cmis.api.types.Scope * @see fr.dyade.cmis.api.types.Synchronization * @version cvs $Id: Mode.java,v 1.2 2000/09/05 13:30:49 festor Exp $ */public class Mode extends CMISType { // confirmed or not public static final short CONFIRMED_CODE = 1; public static final short UNCONFIRMED_CODE = 2; /** * To compare two Modes * @return <code>true</code> if both modes are the same. */ public boolean equals( Object obj ){ if (obj instanceof Mode) { return ((Mode)obj).fModeCode==this.fModeCode; } else { return false; } } /** * Users can only use built-in modes... */ private Mode( short pModeCode ) { fModeCode=pModeCode; } private static String toString( short pMode ) { switch (pMode) { case CONFIRMED_CODE: return "CONFIRMED"; case UNCONFIRMED_CODE: return "UNCONFIRMED"; default: return "unknown"; } } /** * Returns a <code>String</code> representation of the <code>Mode</code> * @return one of the "CONFIRMED" or "UNCONFIRMED" <code>String</code>s. */ public String toString() { return Mode.toString(fModeCode); } /** * Returns the current <code>Mode</code> of the instance. * @return one the CONFIRMED_CODE or UNCONFIRMED_CODE values */ public short getMode() { return fModeCode; } /** Filtering instance created after deserialization. * <a HREF="http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/input.doc6.html"> * Read javasoft doc</a> about this method. We are exactly case demonstrated by this example: * "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..." */ public Object readResolve() throws ObjectStreamException { System.out.println("readResolve for: "+this); switch(fModeCode) { case CONFIRMED_CODE: return CONFIRMED; case UNCONFIRMED_CODE: return UNCONFIRMED; default: System.err.println("Mode.readResolve: bad code: "+fModeCode); return this; } } // The built-in Mode public static final Mode CONFIRMED = new Mode(CONFIRMED_CODE); public static final Mode UNCONFIRMED = new Mode(UNCONFIRMED_CODE); // by default.... private short fModeCode=CONFIRMED_CODE; // init. not useful indeed}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -