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

📄 slist_class.pas

📁 用于制作和整理(文件搜索方式)编程技术文档和各类源代码, 可以如编程工具一样分色显示程序(C++, Delphi , java, Vb, SQL ……)(用算法实现), 主要用于查找相应的类和函数
💻 PAS
字号:
unit slist_class;

interface
type Tdata = array [0..199] of string;
type slist = class
private
  Fmaxsize:smallint;
  Flines:tdata;
  Fcount:smallint;
  Ftop:smallint;
  Fisrun:boolean;
public
  constructor Create;
  function push(elem: string):boolean;
  procedure endback;
  function  isview:boolean;
  function isempty:boolean;
  function isfull:boolean;
  function back(var elem:string):boolean;
  function next(var elem:string):boolean;
  function getelem(var elem:string):boolean;
  property lines:  tdata read  Flines  write flines;
  property count: smallint read Fcount;
  property top:smallint read Ftop;
  property isrun:boolean read Fisrun write Fisrun;
end;


implementation

{ slist }

function slist.back(var elem:string): boolean;
begin
if Ftop=-1 then
    result:=false
else
  begin
   elem:= Flines[Ftop];
   Ftop:=Ftop-1;
   result:=true;
  end;
end;

constructor slist.Create;
begin
inherited create;
fmaxsize:=200;
Ftop:=-1;
Fcount:=0;
end;

procedure slist.endback;
begin
Fcount:=Ftop+1; 
end;

function slist.getelem(var elem: string): boolean;
begin
if ftop>-1 then
   begin
   elem:=Flines[ftop];
   result:=true;
   end
else
  result:=false;
end;

function slist.isempty: boolean;
begin
result:=false;
if Ftop=-1 then
    result:=true;
end;

function slist.isfull: boolean;
begin
 result:=false;
 if ftop=Fmaxsize then
    result:=true;
end;

function slist.isview: boolean;
begin
if Ftop<Fcount-1 then
   result:=true
else result:=false;
end;

function slist.next(var elem: string): boolean;
begin
if ftop=fcount-1 then
   result:=false
  else
  begin
   Ftop:=Ftop+1;
   elem:= Flines[Ftop];
   result:=true;
  end;
end;

function slist.push(elem: string):boolean;
begin
 if not isview and not isfull then
  begin
 Ftop:=Ftop+1;
 fcount:=Fcount+1;
 Flines[Ftop]:=elem;
 result:=true;
 end
 else result:=false;
end;

end.

⌨️ 快捷键说明

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