vbs(asp)的栈类

 网站首页 > 电脑技术 > 脚本编码 asp技术 网络编程

vbs(asp)的栈类 内容简介:

          用js可以用array对象很容易的实现栈的功能,但在vbs中没有相应的功能,没办法,只有自己动手了:(  如果你的栈不了解请查看数据结构的相关内容。这个栈类是参照c++的栈类写的,用法一样。用这个类你也可以很方便的修改出队列的类:)&
vbs(asp)的栈类 祥细内容:
  用js可以用array对象很容易的实现栈的功能,但在vbs中没有相应的功能,没办法,只有自己动手了:(
  如果你的栈不了解请查看数据结构的相关内容。这个栈类是参照c++的栈类写的,用法一样。用这个类你也可以很方便的修改出队列的类:)

<%
‘**********************************************
‘        vbs栈类
‘        push(string)进栈
‘        getTop取栈顶元素
‘        pop去掉栈顶元素
‘        isempty是否栈空
‘        isfull是否栈满(pMax设置了大小,可自行修改)

‘        木鸟  2002.10.10
‘        http://www.aspsky.net/
‘**********************************************

class Stack
        private pArr, pString, pMax
        private tab
        private sub class_initialize()
                tab=chr(9)
                pMax=1000        ‘最大容量
        end sub
        private sub class_terminate()
                if isarray(pArr) then
                        erase pArr
                end if
        end sub
       
        public function push(str)
                if str<>"" and instr(str,tab)<1 and not Isfull then
                        if isarray(pArr) then
                                pString=join(pArr,tab)
                        end if
                        pString=pString & tab & str
                        pArr=split(pString,tab)
                        push=true
                else
                        push=false
                end if
        end function
       
        public function GetTop()
                if not isarray(pArr)<0 then
                        GetTop=null
                else
                        if ubound(pArr)<0 then
                                GetTop=null
                        else
                                GetTop=pArr(Ubound(pArr))
                        end if
                end if
        end function
       
        public function Pop()
                if not isArray(pArr) then
                        Pop=false
                else
                        if Ubound(pArr)<0 then
                                Pop=false
                        else
                                pString=join(pArr,tab)
                                pString=left(pString,inStrRev(pString,tab)-1)
                                pArr=split(pString,tab)
                                Pop=true
                        end if
                end if
        end function
       
        public function Isempty()
                 if not isArray(pArr) then
                         Isempty=true
                 else
                         if Ubound(pArr)<0 then
                                 isempty=true
                         else
                                 isempty=false
                         end if
                 end if
        end function
       
        public function Isfull()
                if not isArray(pArr) then
                        Isfull=false
                else
                        if ubound(pArr)<pMax then
                                Isfull=false
                        else
                                Isfull=true
                        end if
                end if
        end function
end class
%>
更新时间:2005-5-26 11:18:21 查看次数: 添加人:采集器
下载: 采集信息

关键字: vbs(asp)的栈类 脚本编码 asp技术 网络编程 

相关连接: vbs(asp)的栈类  一个用来画图的组件(画饼图,条形图,各种形状图象的)  在VB组件中使用串缓冲  利用JS在页面上动态生成直线  通过地址栏传递参数.通过url传递参数  怎么在html中include一个文件内容  确认是否关闭浏览器或转到其它页面(JavaScript)  一段对密码进行加密的脚本  一个查看ASP的JavaScript程序,方便大家学习ASP程序(J  一全很经典的堆积演示程序(JavaScript)  用Cookie实现仅弹出一次窗口(JavaScript)  一种函数的计算方法并给出相应的曲线图片  asp自动生成javascript检验函数  把一张图片变形扭曲成各种不同的长宽  图片渐渐显示(谈入)  一组JavaScript绘图函数 
E路同行 版权所有; 2002-2005 Xiaoqi.net! Inc. 保留所有权利。