?? _algorithms_base.inc_h
字號:
(*
* DGL(The Delphi Generic Library)
*
* Copyright (c) 2004
* HouSisong@263.net
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*)
//------------------------------------------------------------------------------
// DGL庫的算法的聲明
// Create by HouSisong, 2004.09.01
//------------------------------------------------------------------------------
//_Algorithms_Base.inc_h ; _Algorithms_Base.inc_pas
//_TAlgorithms_Base = class(TObject)
public
//返回兩個迭代器之間的元素個數
class function Distance(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ):integer; overload;
//返回兩個元素列是否相等
class function IsEquals(const ItBegin0,ItEnd0,ItBegin1,ItEnd1: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ):boolean; overload;
//遍歷
class procedure ForEach(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const VisitProc:TVisitProc); overload;
class procedure ForEach(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const VisitProc:TVisitProcOfObject); overload;
//查找 //失敗返回位置等于ItEnd
class function Find(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Value:_ValueType): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function FindIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestFunction:TTestFunction): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function FindIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestFunction:TTestFunctionOfObject): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function FindIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Value:_ValueType;const TestBinaryFunction:TTestBinaryFunction): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function FindIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Value:_ValueType;const TestBinaryFunction:TTestBinaryFunctionOfObject): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
//統計元素個數
class function Count(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Value:_ValueType):integer; overload;
class function CountIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestFunction:TTestFunction):integer;overload;
class function CountIf(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestFunction:TTestFunctionOfObject):integer;overload;
//尋找子串
class function Search(const ItBegin,ItEnd,ItBeginSub,ItEndSub: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function Search(const ItBegin,ItEnd,ItBeginSub,ItEndSub: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunction): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function Search(const ItBegin,ItEnd,ItBeginSub,ItEndSub: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunctionOfObject): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
//最值
class function MinElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function MinElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunction): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function MinElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunctionOfObject): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function MaxElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function MaxElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunction): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
class function MaxElement(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TestBinaryFunction:TTestBinaryFunctionOfObject): {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ; overload;
//////////////////////////////////////////////
//交換值
class procedure SwapValue(const It0,It1: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} );overload; //todo: Warning inline on if _ValueType if "object" then error!!!
class procedure SwapValue(const It0: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Index0: integer;const It1: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Index1: integer);overload; //todo: Warning inline on if _ValueType if "object" then error!!!
class procedure SwapValue(const It: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const Index0,Index1: integer);overload; //{$ifdef _DGL_Inline} inline; {$endif}
//將ItBeginSrc,ItEndSrc區間內的數據拷貝到ItBeginDest開始的區域中
class procedure Copy(const ItBeginSrc,ItEndSrc,ItBeginDest: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ); overload;
//利用TansfromFunction函數進行轉換
class procedure Tansfrom(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TansfromFunction:TTansfromFunction); overload;
class procedure Tansfrom(const ItBegin,ItEnd: {$ifdef _DGL_VectorItType}_IVectorIterator{$else}_IIterator{$endif} ;const TansfromFunction:TTansfromFunctionOfObject);overload;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -