Skip to content

Commit

Permalink
Beta 8 interface sections
Browse files Browse the repository at this point in the history
  • Loading branch information
David Berneda committed Feb 12, 2016
1 parent 3ef1639 commit d8333bd
Show file tree
Hide file tree
Showing 71 changed files with 362 additions and 655 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ tests/TestInsightSettings.ini
*.~1~
demos/delphi/vcl/Import/__history/
demos/delphi/vcl/Import/__recovery/__recovery.ini
*.~2~
*.~3~
4 changes: 4 additions & 0 deletions src/delphi/Algorithms/BI.Algorithm.Model.pas
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ TDataSplit=record
TPredictedData=class(TDataItem)
private
FConfusion : TDataItem;
FPredicted : TDataItem;
FReal : TDataItem;

function GetConfusion:TDataItem;
function GetCorrect:TInteger;
Expand All @@ -99,6 +101,8 @@ TPredictedData=class(TDataItem)

property Confusion:TDataItem read GetConfusion;
property Correct:TInteger read GetCorrect;
property Predicted:TDataItem read FPredicted;
property Real:TDataItem read FReal;
end;

TSupervisedModelClass=class of TSupervisedModel;
Expand Down
2 changes: 1 addition & 1 deletion src/delphi/Algorithms/BI.Plugins.R.Command.pas
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TRCommand=class(TBIREngine)

procedure Start; override;
procedure Statement(const AStatement:String); override;
function Version:String;
function Version:String; override;
end;

implementation
1 change: 1 addition & 0 deletions src/delphi/Algorithms/BI.Plugins.R.opaR.pas
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TopaR=class(TBIREngine)
procedure ParseOutput(const ADest:TDataItem); override;
procedure ParseRawMap(const AMap,ADest:TDataItem); override;
procedure Statement(const AStatement:String); override;
function Version:String; override;
end;

implementation
1 change: 1 addition & 0 deletions src/delphi/Algorithms/BI.Plugins.R.pas
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ TBIREngine=class(TBIPlugin)
procedure ParseOutput(const ADest:TDataItem); virtual; abstract;
procedure ParseRawMap(const AMap,ADest:TDataItem); virtual; abstract;
procedure Statement(const AStatement:String); virtual; abstract;
function Version:String; virtual; abstract;

class property Engine:TBIREngine read FEngine write SetEngine;
end;
Expand Down
76 changes: 43 additions & 33 deletions src/delphi/BI.Arrays.pas
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,14 @@ TDateTimeMap=class(TDataMap)
property Item[const Index:TInteger]:TDateTime read GetItem; default;
end;

TTextItem=record
Text : String;
end;

TTextItemArray=Array of TTextItem;

TTextMap=class(TDataMap)
private
type
TCompareProc=function(const S1, S2: string): Integer;

function GetItem(const Index:TInteger):String; inline;
public
Items : TTextItemArray;
Items : TTextArray;
IgnoreCase : Boolean;

procedure AddMap(const Value:String);
Expand Down Expand Up @@ -273,16 +267,18 @@ TBooleanArrayHelper=record helper for TBooleanArray
procedure Append(const Value:Boolean); overload;
procedure Append(const Value:TBooleanArray); overload;
function Compare(const A,B:TInteger):SmallInt; inline;
function Copy:TBooleanArray;
function Copy:TBooleanArray; overload; inline;
function Copy(const AIndex,ACount:TInteger):TBooleanArray; overload; inline;
function Count:TInteger; inline;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
function Map(const Missing:TBooleanArray):TBooleanMap;
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending:Boolean=True); overload;
procedure Sort(const Ascending:Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TBooleanStats;
procedure Swap(const A,B:TInteger);
function Stats:TBooleanStats; inline;
procedure Swap(const A,B:TInteger); inline;
procedure Zero(const Value:Boolean=False);
end;

Expand All @@ -292,18 +288,20 @@ TTextArrayHelper=record helper for TTextArray
public
procedure Append(const Value:String); overload;
procedure Append(const Value:TTextArray); overload;
function Copy:TTextArray;
function Copy:TTextArray; overload;
function Copy(const AIndex,ACount:TInteger):TTextArray; overload;
function Count:TInteger; inline;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
function IndexOf(const Value:String):TInteger;
function Map(const Missing:TBooleanArray; const IgnoreCase:Boolean=False):TTextMap;
function MaxLength:Integer;
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending:Boolean=True; const IgnoreCase:Boolean=False); overload;
procedure Sort(const Ascending,IgnoreCase:Boolean; const Swap:TSwapProc); overload;
function Stats:TTextStats;
procedure Swap(const A,B:TInteger);
function Stats:TTextStats; inline;
procedure Swap(const A,B:TInteger); inline;
procedure Zero;
end;

Expand All @@ -312,23 +310,25 @@ TDateTimeArrayHelper=record helper for TDateTimeArray
function Distribution(const Mean:TDateTime; const StdDeviation:TFloat; const Exponent:Integer):TFloat;
function GuessOrder:TDataOrder;
public
procedure Append(const Value:TDateTime); overload;
procedure Append(const Value:TDateTime); overload; inline;
procedure Append(const Value:TDateTimeArray); overload;
function Copy:TDateTimeArray;
function Copy:TDateTimeArray; overload; inline;
function Copy(const AIndex,ACount:TInteger):TDateTimeArray; overload; inline;
function Count:TInteger; inline;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
procedure Insert(const Index:TInteger; const Value:TDateTime);
function Map(const Missing:TBooleanArray; out Median,Mode:TDateTime):TDateTimeMap; overload;
function Maximum:TDateTime;
function Mean:TDateTime;
function Minimum:TDateTime;
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending:Boolean=True); overload;
procedure Sort(const Ascending:Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TDateTimeStats;
function StdDeviation(const Mean:TDateTime):TFloat;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:TDateTime):TFloat;
procedure Zero;
end;
Expand All @@ -340,12 +340,14 @@ TInt32ArrayHelper=record helper for TInt32Array
public
procedure Append(const Value:Integer); overload;
procedure Append(const Value:TInt32Array); overload;
function Copy:TInt32Array;
function Copy:TInt32Array; overload; inline;
function Copy(const AIndex,ACount:TInteger):TInt32Array; overload; inline;
function Count:TInteger; inline;
function Correlation(const Y: TInt32Array; const XMean,YMean: TFloat): TFloat;
function CoVariance(const Y: TInt32Array; const XMean,YMean: TFloat):TFloat;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
function IndexOf(const Value:Integer):TInteger;
function IndexOfMax:TInteger;
procedure Insert(const Index:TInteger; const Value:Integer);
Expand All @@ -355,13 +357,13 @@ TInt32ArrayHelper=record helper for TInt32Array
function Minimum:Integer;
procedure RemoveValue(const Value:Integer);
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending:Boolean=True); overload;
procedure Sort(const Ascending:Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TInt32Stats;
function StdDeviation(const Mean:TFloat):TFloat;
function Sum:TFloat;
function SumOfSquares: TFloat;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:TFloat):TFloat;
procedure Zero;
end;
Expand All @@ -373,12 +375,14 @@ TInt64ArrayHelper=record helper for TInt64Array
public
procedure Append(const Value:Int64); overload;
procedure Append(const Value:TInt64Array); overload;
function Copy:TInt64Array;
function Copy:TInt64Array; overload; inline;
function Copy(const AIndex,ACount:TInteger):TInt64Array; overload; inline;
function Count:TInteger; inline;
function Correlation(const Y: TInt64Array; const XMean,YMean: TFloat): TFloat;
function CoVariance(const Y: TInt64Array; const XMean,YMean: TFloat):TFloat;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
function IndexOf(const Value:Int64):TInteger;
function IndexOfMax:TInteger;
procedure Insert(const Index:TInteger; const Value:Int64);
Expand All @@ -388,13 +392,13 @@ TInt64ArrayHelper=record helper for TInt64Array
function Minimum:Int64;
procedure RemoveValue(const Value:Int64);
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending:Boolean=True); overload;
procedure Sort(const Ascending:Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TInt64Stats;
function StdDeviation(const Mean:TFloat):TFloat;
function Sum:TFloat;
function SumOfSquares: TFloat;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:TFloat):TFloat;
procedure Zero;
end;
Expand All @@ -406,26 +410,28 @@ TSingleArrayHelper=record helper for TSingleArray
public
procedure Append(const Value:Single); overload;
procedure Append(const Value:TSingleArray); overload;
function Copy:TSingleArray;
function Copy:TSingleArray; overload; inline;
function Copy(const AIndex,ACount:TInteger):TSingleArray; overload; inline;
function Count:TInteger; inline;
function Correlation(const Y: TSingleArray; const XMean,YMean: Single): Single;
function CoVariance(const Y: TSingleArray; const XMean,YMean: Single):Single;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
procedure Insert(const Index:TInteger; const Value:Single);
function Map(const Missing:TBooleanArray; out Median,Mode:Single):TSingleMap; overload;
function Maximum:Single;
function Mean:Single;
function Minimum:Single;
procedure Normalize(const Mean:Single);
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending: Boolean=True); overload;
procedure Sort(const Ascending: Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TSingleStats;
function StdDeviation(const Mean:Single):Single;
function Sum:Single;
function SumOfSquares: Single;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:Single):Single;
procedure Zero;
end;
Expand All @@ -437,26 +443,28 @@ TDoubleArrayHelper=record helper for TDoubleArray
public
procedure Append(const Value:Double); overload;
procedure Append(const Value:TDoubleArray); overload;
function Copy:TDoubleArray;
function Copy:TDoubleArray; overload; inline;
function Copy(const AIndex,ACount:TInteger):TDoubleArray; overload; inline;
function Count:TInteger; inline;
function Correlation(const Y: TDoubleArray; const XMean,YMean: Double): Double;
function CoVariance(const Y: TDoubleArray; const XMean,YMean: Double):Double;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
procedure Insert(const Index:TInteger; const Value:Double);
function Map(const Missing:TBooleanArray; out Median,Mode:Double):TDoubleMap; overload;
function Maximum:Double;
function Mean:Double;
function Minimum:Double;
procedure Normalize(const Mean:Double);
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending: Boolean=True); overload;
procedure Sort(const Ascending: Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TDoubleStats;
function StdDeviation(const Mean:Double):Double;
function Sum:Double;
function SumOfSquares: Double;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:Double):Double;
procedure Zero;
end;
Expand All @@ -469,26 +477,28 @@ TExtendedArrayHelper=record helper for TExtendedArray
public
procedure Append(const Value:Extended); overload;
procedure Append(const Value:TExtendedArray); overload;
function Copy:TExtendedArray;
function Copy:TExtendedArray; overload; inline;
function Copy(const AIndex,ACount:TInteger):TExtendedArray; overload; inline;
function Count:TInteger; inline;
function Correlation(const Y: TExtendedArray; const XMean,YMean: Extended): Extended;
function CoVariance(const Y: TExtendedArray; const XMean,YMean: Extended):Extended;
procedure Delete(const Index:TInteger; const ACount:TInteger=1); {$IFDEF DELETEARRAY}inline;{$ENDIF}
procedure Empty; inline;
function ExistsBefore(const AIndex:TInteger):Boolean;
procedure Insert(const Index:TInteger; const Value:Extended);
function Map(const Missing:TBooleanArray; out Median,Mode:Extended):TExtendedMap; overload;
function Maximum:Extended;
function Mean:Extended;
function Minimum:Extended;
procedure Normalize(const Mean:Extended);
procedure Resize(const Count:TInteger); inline;
procedure Sort(const Ascending: Boolean=True); overload;
procedure Sort(const Ascending: Boolean=True); overload; inline;
procedure Sort(const Ascending:Boolean; const Swap:TSwapProc); overload;
function Stats:TExtendedStats;
function StdDeviation(const Mean:Extended):Extended;
function Sum:Extended;
function SumOfSquares: Extended;
procedure Swap(const A,B:TInteger);
procedure Swap(const A,B:TInteger); inline;
function Variance(const Mean:Extended):Extended;
procedure Zero;
end;
Expand Down
6 changes: 5 additions & 1 deletion src/delphi/BI.Data.CSV.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ EBICSV=class(EBIException);

TCSVHeader=record
private
Detected : Boolean;
HasHeader : TTextHeaders;
public
Count : Integer;
Detected : Boolean;
Headers : TTextHeaders;
end;

Expand All @@ -43,6 +43,8 @@ TBICSV=class(TBITextSource)
Data : TDataItem;
Start : TInteger;

FItems : TDataItems;

t1 : TStopwatch;

class function BISplitString(const AString:String; const ADelimiter,AQuote:Char):TStringDynArray;
Expand Down Expand Up @@ -72,6 +74,8 @@ TBICSV=class(TBITextSource)

function Import(const Folder:String; Recursive:Boolean=False):TDataArray; overload;
function Import(const Strings:TStrings):TDataArray; override;
function ImportFile(const AFileName:String):TDataArray; override;
function ImportText(const AText:String):TDataItem;

class function Supports(const Extension:String):Boolean; override;
end;
Expand Down
8 changes: 8 additions & 0 deletions src/delphi/BI.Data.DB.Tester.pas
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface

{$DEFINE HASFIREDAC_SQLite}
{$DEFINE HASFIREDAC_IB}
{$DEFINE HASFIREDAC_ADS}

{$IFNDEF ANDROID}
{$DEFINE HASFIREDAC_MSSQL}
Expand Down Expand Up @@ -117,6 +118,13 @@ interface
{$IF CompilerVersion>27}
FireDAC.Phys.SQLiteDef,
{$ENDIF}
{$ENDIF}

{$IFDEF HASFIREDAC_ADS} // ADS
FireDAC.Phys.ADS,
{$IF CompilerVersion>27}
FireDAC.Phys.ADSMeta,
{$ENDIF}
{$ENDIF}

// Pending:
Expand Down
8 changes: 5 additions & 3 deletions src/delphi/BI.Data.Excel.pas
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface
{$IFDEF MSWINDOWS}
WinAPI.ActiveX, System.Win.ComObj,
{$ENDIF}
BI.DataSource, BI.Data, BI.Arrays;
BI.DataSource, BI.Data, BI.Arrays, BI.Persist;

type
EExcelException=class(EBIException);
Expand All @@ -22,9 +22,11 @@ TBIExcel=class(TBITextSource)
protected
function DoImportFile(const FileName:String):TDataArray; override;
public
WorkSheet : String;
HeaderCount : Integer;
Range : String;
TitleCount : Integer;
WorkSheet : String;

Constructor Create(const Definition:TDataDefinition=nil; const MultiThread:Boolean=False); override;

class function ExportFormat:TBIExport; override;
function Import(const Folder:String; Recursive:Boolean=False):TDataArray; overload;
Expand Down
Loading

0 comments on commit d8333bd

Please sign in to comment.