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

📄 bigstring.java

📁 简易模拟电梯系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
package ulang;
/**
 *  File name: BigString.java
 *  @auther caiwanfu
 *  @auther jiaben02@software.nju.edu.cn
 *  @Copyright Jiaben software_nju 2004-04-27
 *  @Team member:jiaben
 *               may i
 *               icecreame
 *               yymycabbage
 */
 /**
  *  It is the mainly class and onlythis class 
  *  Canbe used by the user.
  */
import java.io.*;
import java.util.Vector;
import ulang.*;
import myException.*;


public class BigString
{
	   /**
	    *  Constrctors.
	    */
	    /**
	     *  Empty constrctor.
	     *  And Set the all the member veriable to be null or 0;
	     */
        public BigString()
        {
            StringLength = 0;
            treeLimit = 0;
            start=0;
            bt = new BTreeString("");
        }
        
        /**
         *  Constructs a new BigString use a string as its Parameter.
         *  @param str
         *  And the method set the str into the BTreeString.
         *  Set the imformation as the str itself. 
         */
        public BigString(String str)
        {
        	start=0;
            StringLength = str.length();      
            if (StringLength == 0)
            treeLimit = 0;
            else
            treeLimit = StringLength - 1;
            bt = new BTreeString(str);
        }
        
        /**
         *  Constructs a new BigString use a char array as its Parameter.
         *  @param value
         *  It is a char array type.
         *  First we set a string use the constructor
         *  And then.
         *  We set the method set the str in to the BTreeString.
         *  Set the imformation as the str. 
         *  @see java.lang.String
         *  @see java.lang.String#String(char [] value).
         */
        public BigString(char [] value)
        {
        	start=0;
            String str=new String(value);
            StringLength = str.length();
            if (StringLength == 0)
            treeLimit = 0;
            else
            treeLimit = StringLength - 1;
            bt = new BTreeString(str);
        }
        
        /**
         *  Class constructor uses a StringBuffer as its parameter.
         *  @param sb
         *  It is a StringBuffer type.
         *  And the parameter should not be null.
         */
        public BigString(StringBuffer sb)
        {
        	start=0;
        	this.StringLength=sb.length();
        	this.treeLimit=StringLength-1;
        	bt=new BTreeString(sb.toString());
        }
        
        /**
         *  Copy constructor
         *  @param Value
         *  It is a BigString value.
         *  We just copy a value of a even exist BigString.
         *  The same as trim()
         *  @see BigString#trim()
         */
        public BigString(BigString Value)throws m_Exception
        {
            if(Value == null) 
            {
                m_Exception ne = new m_Exception("Null value.");
                throw ne;
            }

            this.bt = Value.getMyBTree();
            this.start=Value.getStart();
            treeLimit = Value.getTreeLim();
            if(bt.getLength()-this.start > Value.Length() )
            {
                StringLength = Value.Length();
            }
            else 
            {
                StringLength = bt.getLength()-this.start;
            }
        }
        
        /**
         *  Private constructor.
         *  It is use to concat to BigString togeither.
         *  @param b1, b2
         */
	private BigString(BigString b1, BigString b2) {
		StringLength = 0;
		setMyContents(b1,b2);
		//System.out.println(StringLength);
		StringLength = b1.Length() + b2.Length();
	}
        
        /**
         *  Private constructor.
         *  It is use to concat to BigString togeither use a Vector
         *  @see java.lang.Vector
         *  @param b1, b2, v
         */
        private BigString (BigString b1, BigString b2, Vector v)
        {
            StringLength = 0;
            setMyContents(b1,b2);
            //System.out.println(StringLength);
            copyVector(v, v.size());
            StringLength = b1.Length() + b2.Length();
        } 
        
        /**
         *  Get a copy of the actual BigString.
         */
        public BigString trim()
        {
            BigString copy=this;
            return copy;
        }
        
        /**
         *  Compare two BigStrings whether there the same.
         *  @return int
         *  <br>If they two are the same return 0,else if greater

⌨️ 快捷键说明

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