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

📄 jfversion.java

📁 用Java开发的、实现类似Visio功能的应用程序源码
💻 JAVA
字号:
/**
 *    $Id:JFVersion.java $
 *
 *    Copyright 2004 ~ 2005  JingFei International Cooperation LTD. All rights reserved. *
 */
package com.jfimagine.jfgraph.shape.base;


 /**
 * JFVersion class is used to define and manage file verions.
 *
 * @author     CookieMaker    
 *
 * @version $Revision: 1.00 $
 */  
 public class JFVersion{

   /**  A XML string tag represents a version    */
   public  static final String	 XML_VERSION	="Version";
   /**  A XML string tag represents a producer    */
   public  static final String	 XML_PRODUCER	="producer";
   /**  A XML string tag represents a author    */
   public  static final String	 XML_AUTHOR	="author";


   /** producer of this page */
   public static final String PRODUCER		="JingFei International";

   /** version 1.0.0 */
   private static final String[] VERSION	={"1.0.0","1.1.0","1.1.1","1.4.1","1.6.0","1.7.0","1.7.0.1","1.8.0","1.8.0.1"};

   /** id of version 1.0.0 */
   public static final int VERSIONID_100	=1;  
   /** id of version 1.1.0 */
   public static final int VERSIONID_110	=2;  
   /** id of version 1.1.1 */
   public static final int VERSIONID_111	=3;  
   /** id of version 1.4.1 */
   public static final int VERSIONID_141	=4;  
   /** id of version 1.6.0 */
   public static final int VERSIONID_160	=5;  
   /** id of version 1.7.0 */
   public static final int VERSIONID_170	=6;  
   /** id of version 1.7.0.1 */
   public static final int VERSIONID_1701	=7;  
   /** id of version 1.8.0 */
   public static final int VERSIONID_180	=8;  
   /** id of version 1.8.0.1 */
   public static final int VERSIONID_1801	=9;  


   /**
    *   This is a leading key for a page, since Version 1.8.0, we added some new 
    *   attributes to AbstractObject, so we need a valid JFVersion object to
    *   indicate if it's needed to read those attributes.
    *
    *   But a JFVersion attribute is stored in a page after loading the super AbstractObject 
    *   attributes.
    *
    *   So we add a leading key here in the top of a page, to indicate if the current version
    *   of JFPage is greater than 1.8.0, or not.
    */
   public static final int  LEADINGKEY_180	=0xfffff0;




   /** get version string by id **/
   public static String getVersion(int versionId){
   	versionId--;
   	if (versionId<0 || versionId>=VERSION.length)
   		return VERSION[0];
   	else
   		return VERSION[versionId];
   }

   /** get version id by version string **/
   public static int getVersionId(String version){
   	
   	for (int i=0; i<VERSION.length; i++){
   		if (VERSION[i].equals(version))
   			return ++i;
   	}
   	
   	return 1;
   }


   /** get current version string**/
   public static String getCurrentVersion(){
   	return VERSION[VERSION.length-1];
   }

  //******************************************************  
  //local variables and methods for JFVersion
  //******************************************************  
   private String  m_version=getCurrentVersion();

   /** constructor **/
   public JFVersion(){
   }

   /** constructor **/
   public JFVersion(String version){
   	m_version	=version;
   }

   /** constructor **/
   public JFVersion(int versionId){
   	m_version	=getVersion(versionId);
   }

   
   /** get version that assigned before **/
   public String getVersion(){
   	return m_version;
   }

   /** assign a new version string **/
   public void setVersion(String version){
   	if (version==null) version="";
   	m_version	=version;
   }

   /** get version id that assigned before**/
   public int getVersionId(){
	return getVersionId(m_version);
   }

   /** assign a new version id**/
   public void setVersionId(int versionId){
	m_version =getVersion(versionId);
   }

   /** if current version less than specified version id**/
   public boolean lowerVersionOf(int versionId){
   	return getVersionId()<versionId;
   }
	
   /**
    *   Set new value for this version object.
    *
    *   @param version A new version object.
    *
    */ 	
   public void setValue(JFVersion version){
   	if (version!=null){
   		this.m_version	=version.m_version;
   	}
   }   	

}

⌨️ 快捷键说明

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