⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generalizedtime.java

📁 CmisJavaApi
💻 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 *///  $Id: GeneralizedTime.java,v 1.2 2000/09/05 13:30:44 festor Exp $//  $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/api/types/GeneralizedTime.java,v $//---------------------------------------------------------------------------////  Todo//---------------------------------------------------------------------------//// * Use Calendar, DateFormat stuff to implement the tostring method.// * Check and implement the time offsets business (ASN1)// * Adds accessors ?package fr.dyade.cmis.api.types;import java.util.Calendar;/**  *  * @see fr.dyade.cmis.api.types.UTCTime  * @version cvs $Id: GeneralizedTime.java,v 1.2 2000/09/05 13:30:44 festor Exp $  */public class GeneralizedTime extends Value {      public GeneralizedTime() {	 this(VALUE_GENTIME, LOCAL_TIME_FORMAT);      }      public GeneralizedTime( int pMsec, int pSec, int pMinute, int pHour, int pMday, int pMon, int pYear ) {	 this(VALUE_GENTIME, LOCAL_TIME_FORMAT, pMsec, pSec, pMinute, pMday, pHour, pMon, pYear);      }      /** Constructor for derived classes.	* @see fr.dyade.cmis.api.types.UTCTime	*/      protected GeneralizedTime( short pValueType, short pTimeFormat ) {	 super(pValueType);	 fTimeFormat=pTimeFormat;      }      protected GeneralizedTime( short pValueType,				 short pTimeFormat,				 int pMsec, int pSec, int pMinute, int pHour, int pMday, int pMon, int pYear ) {	 super(pValueType);	 fTimeFormat=pTimeFormat;	 fUseCurrent=false;	 fMsec=pMsec;	 fSec=pSec;	 fMinute=pMinute;	 fHour=pHour;	 fMday=pMday;	 fMon=pMon;	 fYear=pYear;      }      public void setUseCurrent( boolean pUseCurrent ) {	 fUseCurrent=pUseCurrent;      }      public void ensureFields() {	 if (fUseCurrent) {	    // switch(fTimeFormat)	    Calendar rightNow = Calendar.getInstance();	    fMsec=rightNow.get(Calendar.MILLISECOND);	    fSec=rightNow.get(Calendar.SECOND);	    fMinute=rightNow.get(Calendar.MINUTE);	    fHour=rightNow.get(Calendar.HOUR);	    fMday=rightNow.get(Calendar.DAY_OF_MONTH);	    fMon=rightNow.get(Calendar.MONTH);	    fYear=rightNow.get(Calendar.YEAR);	 }      }      protected int fMsec;      protected int fSec;      protected int fMinute;      protected int fHour;      protected int fMday;      protected int fMon;      protected int fYear;      /** use current system time, not fields. 	* ensureFields() method is provided if actual asn1 support does not	* provide a kind of default values.	* @see fr.dyade.cmis.api.types.GeneralizedTime#ensureFields	*/      protected boolean fUseCurrent=true;      // the discriminant... time format... used by the JNI.      protected static final short UTC_TIME_FORMAT = 0;      protected static final short LOCAL_TIME_MINUS_FORMAT = -1;      protected static final short LOCAL_TIME_PLUS_FORMAT = 1;      protected static final short LOCAL_TIME_FORMAT = 2;            protected short fTimeFormat;      /**	*  Returns a Java <code>String</code> representation of the <code>GeneralizedTime</code>.	* This is based on the <code>Date</code> representation on which the <code>toString()</code> 	* method is called.	* @return A <code>String</code> representation of the <code>GeneralizedTime</code>.	*/      public String toString() {	  String lFormatStr;	  switch (fTimeFormat) {	     case UTC_TIME_FORMAT: lFormatStr="UTC"; break;	     case LOCAL_TIME_MINUS_FORMAT: lFormatStr="LOCAL-"; break;	     case LOCAL_TIME_PLUS_FORMAT:  lFormatStr="LOCAL+"; break;	     case LOCAL_TIME_FORMAT:  lFormatStr="LOCAL"; break;	     default: lFormatStr="Bad time format code"; break;	  }	  return lFormatStr + ", Year="+ Integer.toString(fYear) + ", Mon="+ Integer.toString(fMon) 	     + ", Mday="+ Integer.toString(fMday) + ", Hour="+ Integer.toString(fHour) 	     + ", Minute="+ Integer.toString(fMinute) + ", Sec="+ Integer.toString(fSec);      }      }

⌨️ 快捷键说明

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