打印本文 打印本文 关闭窗口 关闭窗口
设计模式、用Delphi描述--Lock pattern
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1677  更新时间:2009/4/23 18:40:54  文章录入:mintao  责任编辑:mintao
    Unlock;

  end;

end;

 

procedure TBag.Change;

begin

  if not Locked then

    if Assigned(FOnChange) then FOnChange(Self);

end;

 

procedure TBag.SetLocking(Updating: Boolean);

begin

  if Updating then { Bag has become unlocked }

    Change;

end;

Delphi实例:TStringTstringList

TStrings = class(TPersistent)

  private

FUpdateCount: Integer;

  Protected

procedure Exchange(Index1, Index2: Integer); virtual;

procedure SetUpdateState(Updating: Boolean); virtual;

public

  procedure BeginUpdate;

  procedure EndUpdate;

procedure Changed; virtual;

       procedure Changing; virtual;

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口