diff --git a/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dpr b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dpr
new file mode 100644
index 0000000..b16df43
--- /dev/null
+++ b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dpr
@@ -0,0 +1,45 @@
+program Behavioral.ChainOfResponsibility.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ Director: IApprover;
+ VicePresident: IApprover;
+ President: IApprover;
+ Purchase: TPurchase;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ Director := TDirector.Create;
+ VicePresident := TVicePresident.Create;
+ President := TPresident.Create;
+
+ try
+ Director.SetSuccessor(VicePresident);
+ VicePresident.SetSuccessor(President);
+
+ Purchase := TPurchase.Create(2034, 350.00, 'Supplies');
+ Director.ProcessRequest(Purchase);
+
+ Purchase.Free;
+ Purchase := TPurchase.Create(2035, 32590.10, 'Project X');
+ Director.ProcessRequest(Purchase);
+
+ Purchase.Free;
+ Purchase := TPurchase.Create(2036, 122100.00, 'Project Y');
+ Director.ProcessRequest(Purchase);
+
+ ReadLn;
+ finally
+ Purchase.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dproj b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dproj
new file mode 100644
index 0000000..e346e71
--- /dev/null
+++ b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {64d2c46a-efdb-409a-bf95-d6d49bf3049e}
+ Debug
+ DCC32
+ Behavioral.ChainOfResponsibility.Pattern.exe
+ Behavioral.ChainOfResponsibility.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_ChainOfResponsibility_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.ChainOfResponsibility.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.res b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.res differ
diff --git a/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.stat b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.stat
new file mode 100644
index 0000000..5d9d8af
--- /dev/null
+++ b/Behavioral.ChainOfResponsibility/Behavioral.ChainOfResponsibility.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=280
+OtherSecs=6
+StartTime=12/31/15 2:42:37 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.ChainOfResponsibility/Pattern.pas b/Behavioral.ChainOfResponsibility/Pattern.pas
new file mode 100644
index 0000000..c9b58f5
--- /dev/null
+++ b/Behavioral.ChainOfResponsibility/Pattern.pas
@@ -0,0 +1,91 @@
+unit Pattern;
+
+interface
+
+uses SysUtils;
+
+type
+
+ TPurchase = class
+ public
+ Number: integer;
+ Amount: Double;
+ Purpose: string;
+ constructor Create(num: integer; am: Double; pur: string);
+ end;
+
+ IApprover = interface
+ ['{3ACA3967-FFCF-48A1-AC45-9A9B98A8DD96}']
+ procedure SetSuccessor(successor: IApprover);
+ procedure ProcessRequest(purchase: TPurchase);
+ end;
+
+ TApprover = class(TInterfacedObject, IApprover)
+ protected
+ FSuccessor: IApprover;
+ public
+ procedure SetSuccessor(successor: IApprover);
+ procedure ProcessRequest(purchase: TPurchase); virtual; abstract;
+ end;
+
+ TDirector = class(TApprover)
+ procedure ProcessRequest(purchase: TPurchase); override;
+ end;
+
+ TVicePresident = class(TApprover)
+ procedure ProcessRequest(purchase: TPurchase); override;
+ end;
+
+ TPresident = class(TApprover)
+ procedure ProcessRequest(purchase: TPurchase); override;
+ end;
+
+implementation
+
+{ TApprover }
+
+procedure TApprover.SetSuccessor(successor: IApprover);
+begin
+ FSuccessor := successor;
+end;
+
+{ TDirector }
+
+procedure TDirector.ProcessRequest(purchase: TPurchase);
+begin
+ if purchase.Amount < 10000.0 then
+ WriteLn(Format('Director approved request # %d', [purchase.Number]))
+ else if FSuccessor <> nil then
+ FSuccessor.ProcessRequest(purchase);
+end;
+
+{ TVicePresident }
+
+procedure TVicePresident.ProcessRequest(purchase: TPurchase);
+begin
+ if purchase.Amount < 25000.0 then
+ WriteLn(Format('VicePresident approved request # %d', [purchase.Number]))
+ else if FSuccessor <> nil then
+ FSuccessor.ProcessRequest(purchase);
+end;
+
+{ TPresident }
+
+procedure TPresident.ProcessRequest(purchase: TPurchase);
+begin
+ if purchase.Amount < 100000.0 then
+ WriteLn(Format('President approved request # %d', [purchase.Number]))
+ else
+ WriteLn(Format('Request# %d requires an executive meeting!', [purchase.Number]))
+end;
+
+{ TPurchase }
+
+constructor TPurchase.Create(num: integer; am: Double; pur: string);
+begin
+ Number := num;
+ Amount := am;
+ Purpose := pur;
+end;
+
+end.
diff --git a/Behavioral.Command/Behavioral.Command.Pattern.dpr b/Behavioral.Command/Behavioral.Command.Pattern.dpr
new file mode 100644
index 0000000..7211619
--- /dev/null
+++ b/Behavioral.Command/Behavioral.Command.Pattern.dpr
@@ -0,0 +1,34 @@
+program Behavioral.Command.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ user: TUser;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ user := TUser.Create;
+ try
+ user.Compute('+', 100);
+ user.Compute('-', 50);
+ user.Compute('*', 10);
+ user.Compute('/', 2);
+
+ user.Undo(4);
+
+ user.Redo(3);
+
+ ReadLn;
+ finally
+ user.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Command/Behavioral.Command.Pattern.dproj b/Behavioral.Command/Behavioral.Command.Pattern.dproj
new file mode 100644
index 0000000..3fe5a2d
--- /dev/null
+++ b/Behavioral.Command/Behavioral.Command.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {07a0dc45-5437-4012-97b3-8f56029a3307}
+ Debug
+ DCC32
+ Behavioral.Command.Pattern.exe
+ Behavioral.Command.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Command_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Command.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Command/Behavioral.Command.Pattern.res b/Behavioral.Command/Behavioral.Command.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Command/Behavioral.Command.Pattern.res differ
diff --git a/Behavioral.Command/Behavioral.Command.Pattern.stat b/Behavioral.Command/Behavioral.Command.Pattern.stat
new file mode 100644
index 0000000..9eb6f58
--- /dev/null
+++ b/Behavioral.Command/Behavioral.Command.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=360
+OtherSecs=5
+StartTime=12/31/15 2:42:43 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Command/Pattern.pas b/Behavioral.Command/Pattern.pas
new file mode 100644
index 0000000..6050f9b
--- /dev/null
+++ b/Behavioral.Command/Pattern.pas
@@ -0,0 +1,157 @@
+unit Pattern;
+
+interface
+
+uses SysUtils, Classes;
+
+type
+
+ TCalculator = class
+ private
+ FCurr: Double;
+ public
+ constructor Create;
+ procedure Operation(oper: char; operand: integer);
+ end;
+
+ ICommand = interface
+ ['{19AEB63B-144F-46E7-A452-64713080D7A2}']
+ procedure Execute();
+ procedure UnExecute();
+ end;
+
+ TCalculatorCommand = class(TInterfacedObject, ICommand)
+ private
+ FOperator: char;
+ FOperand: integer;
+ FCalculator: TCalculator;
+ function Undo(oper: char): char;
+ public
+ constructor Create(calc: TCalculator; oper: char; operand: integer);
+ procedure Execute();
+ procedure UnExecute();
+ end;
+
+ TUser = class
+ private
+ FCalculator: TCalculator;
+ FCommands: TInterfaceList;
+ FCurrent: integer;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ procedure Redo(levels: integer);
+ procedure Undo(levels: integer);
+ procedure Compute(oper: char; operand: integer);
+ end;
+
+implementation
+
+{ TCalculator }
+
+constructor TCalculator.Create;
+begin
+ inherited;
+ FCurr := 0;
+end;
+
+procedure TCalculator.Operation(oper: char; operand: integer);
+begin
+ case oper of
+ '+': FCurr := FCurr + operand;
+ '-': FCurr := FCurr - operand;
+ '*': FCurr := FCurr * operand;
+ '/': FCurr := FCurr / operand;
+ end;
+ WriteLn(Format('Current Value = %f (following %s, %d)', [FCurr, oper, operand]));
+end;
+
+{ TCalculatorCommand }
+
+constructor TCalculatorCommand.Create(calc: TCalculator; oper: char;
+ operand: integer);
+begin
+ FCalculator := calc;
+ FOperator := oper;
+ FOperand := operand;
+end;
+
+procedure TCalculatorCommand.Execute;
+begin
+ FCalculator.Operation(FOperator, FOperand);
+end;
+
+function TCalculatorCommand.Undo(oper: char): char;
+begin
+ case oper of
+ '+': Result := '-';
+ '-': Result := '+';
+ '*': Result := '/';
+ '/': Result := '*';
+ else
+ raise Exception.Create(Format('%s is not a valid operator', [oper]));
+ end;
+end;
+
+procedure TCalculatorCommand.UnExecute;
+begin
+ FCalculator.Operation(Undo(FOperator), FOperand);
+end;
+
+{ TUser }
+
+constructor TUser.Create;
+begin
+ FCalculator := TCalculator.Create;
+ FCommands := TInterfaceList.Create;
+ FCurrent := 0;
+end;
+
+destructor TUser.Destroy;
+begin
+ FCalculator.Free;
+ FCommands.Free;
+ inherited;
+end;
+
+procedure TUser.Redo(levels: integer);
+var
+ i: integer;
+ command: ICommand;
+begin
+ WriteLn(#10 + Format('----- Redo %d levels ', [levels]));
+ for i := 0 to levels - 1 do begin
+ if FCurrent < FCommands.Count - 1 then begin
+ FCurrent := FCurrent + 1;
+ command := FCommands[FCurrent] as ICommand;
+ command.Execute;
+ end;
+ end;
+end;
+
+procedure TUser.Undo(levels: integer);
+var
+ i: integer;
+ command: ICommand;
+begin
+ WriteLn(#10 + Format('----- Undo %d levels ', [levels]));
+ for i := 0 to levels - 1 do begin
+ if FCurrent > 0 then begin
+ FCurrent := FCurrent - 1;
+ command := FCommands[FCurrent] as ICommand;
+ command.UnExecute;
+ end;
+ end;
+end;
+
+procedure TUser.Compute(oper: char; operand: integer);
+var
+ command: ICommand;
+begin
+ command := TCalculatorCommand.Create(FCalculator, oper, operand);
+ command.Execute;
+ FCommands.Add(command);
+ FCurrent := FCurrent + 1;
+end;
+
+end.
diff --git a/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dpr b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dpr
new file mode 100644
index 0000000..0bc75cc
--- /dev/null
+++ b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dpr
@@ -0,0 +1,45 @@
+program Behavioral.Interpreter.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Classes,
+ Pattern in 'Pattern.pas';
+
+var
+ roman: string;
+ context: TContext;
+ tree: TList;
+ i: integer;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ roman := 'MCMXXVIII';
+ context := TContext.Create(roman);
+ tree := TList.Create;
+ try
+ tree.Add(TTousandExpression.Create);
+ tree.Add(THundredExpression.Create);
+ tree.Add(TTenExpression.Create);
+ tree.Add(TOneExpression.Create);
+
+ for i := 0 to tree.Count - 1 do begin
+ TExpression(tree[i]).Interpret(context);
+ end;
+
+ WriteLn(Format('%s = %d',[roman, context.FOutput]));
+ finally
+ context.Free;
+ for I := 0 to tree.Count - 1 do begin
+ TExpression(tree[i]).Free;
+ end;
+ tree.Free;
+ ReadLn;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dproj b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dproj
new file mode 100644
index 0000000..520004e
--- /dev/null
+++ b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {032377e1-7134-4800-8cc3-94aad7d2b5e6}
+ Debug
+ DCC32
+ Behavioral.Interpreter.Pattern.exe
+ Behavioral.Interpreter.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Interpreter_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Interpreter.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.res b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.res differ
diff --git a/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.stat b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.stat
new file mode 100644
index 0000000..b444c73
--- /dev/null
+++ b/Behavioral.Interpreter/Behavioral.Interpreter.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=384
+OtherSecs=5
+StartTime=12/31/15 2:43:24 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Interpreter/Pattern.pas b/Behavioral.Interpreter/Pattern.pas
new file mode 100644
index 0000000..016c437
--- /dev/null
+++ b/Behavioral.Interpreter/Pattern.pas
@@ -0,0 +1,207 @@
+unit Pattern;
+
+interface
+
+uses
+ SysUtils, StrUtils;
+
+type
+
+ TContext = class
+ public
+ FInput: string;
+ FOutput: integer;
+ constructor Create(input: string);
+ end;
+
+ TExpression = class
+ public
+ procedure Interpret(context: TContext);
+ function One(): string; virtual; abstract;
+ function Four(): string; virtual; abstract;
+ function Five(): string; virtual; abstract;
+ function Nine(): string; virtual; abstract;
+ function Multiplier(): integer; virtual; abstract;
+ end;
+
+ TTousandExpression = class(TExpression)
+ function One(): string; override;
+ function Four(): string; override;
+ function Five(): string; override;
+ function Nine(): string; override;
+ function Multiplier(): integer; override;
+ end;
+
+ THundredExpression = class(TExpression)
+ function One(): string; override;
+ function Four(): string; override;
+ function Five(): string; override;
+ function Nine(): string; override;
+ function Multiplier(): integer; override;
+ end;
+
+ TTenExpression = class(TExpression)
+ function One(): string; override;
+ function Four(): string; override;
+ function Five(): string; override;
+ function Nine(): string; override;
+ function Multiplier(): integer; override;
+ end;
+
+ TOneExpression = class(TExpression)
+ function One(): string; override;
+ function Four(): string; override;
+ function Five(): string; override;
+ function Nine(): string; override;
+ function Multiplier(): integer; override;
+ end;
+
+implementation
+
+{ TExpression }
+
+procedure TExpression.Interpret(context: TContext);
+var
+ start2chars: string;
+begin
+ if (Length(context.FInput) = 0) then
+ exit;
+
+ start2chars := Copy(context.FInput, 0, 2);
+
+ if (LeftStr(context.FInput,1) = Nine) or (start2chars = Nine) then begin
+ context.FOutput := context.FOutput + (9 * Multiplier);
+ context.FInput := Copy(context.FInput, 3, Length(context.FInput) - 1);
+ end
+ else if (LeftStr(context.FInput,1) = Four) or (start2chars = Four) then begin
+ context.FOutput := context.FOutput + (4 * Multiplier);
+ context.FInput := Copy(context.FInput, 3, Length(context.FInput) - 1);
+ end
+ else if (LeftStr(context.FInput,1) = Five) or (start2chars = Five) then begin
+ context.FOutput := context.FOutput + (5 * Multiplier);
+ context.FInput := Copy(context.FInput, 2, Length(context.FInput) - 1);
+ end;
+
+ while (LeftStr(context.FInput,1) = One) or (start2chars = One) do begin
+ context.FOutput := context.FOutput + (1 * Multiplier);
+ context.FInput := Copy(context.FInput, 2, Length(context.FInput) - 1);
+ end;
+end;
+
+{ TTousandExpression }
+
+function TTousandExpression.Five: string;
+begin
+ Result := '';
+end;
+
+function TTousandExpression.Four: string;
+begin
+ Result := '';
+end;
+
+function TTousandExpression.Multiplier: integer;
+begin
+ Result := 1000;
+end;
+
+function TTousandExpression.Nine: string;
+begin
+ Result := '';
+end;
+
+function TTousandExpression.One: string;
+begin
+ Result := 'M';
+end;
+
+{ THundredExpression }
+
+function THundredExpression.Five: string;
+begin
+ Result := 'D';
+end;
+
+function THundredExpression.Four: string;
+begin
+ Result := 'CD';
+end;
+
+function THundredExpression.Multiplier: integer;
+begin
+ Result := 100;
+end;
+
+function THundredExpression.Nine: string;
+begin
+ Result := 'CM';
+end;
+
+function THundredExpression.One: string;
+begin
+ Result := 'C';
+end;
+
+{ TTenExpression }
+
+function TTenExpression.Five: string;
+begin
+ Result := 'L';
+end;
+
+function TTenExpression.Four: string;
+begin
+ Result := 'XL';
+end;
+
+function TTenExpression.Multiplier: integer;
+begin
+ Result := 10;
+end;
+
+function TTenExpression.Nine: string;
+begin
+ Result := 'XC';
+end;
+
+function TTenExpression.One: string;
+begin
+ Result := 'X';
+end;
+
+{ TOneExpression }
+
+function TOneExpression.Five: string;
+begin
+ Result := 'V';
+end;
+
+function TOneExpression.Four: string;
+begin
+ Result := 'IV';
+end;
+
+function TOneExpression.Multiplier: integer;
+begin
+ Result := 1;
+end;
+
+function TOneExpression.Nine: string;
+begin
+ Result := 'IX';
+end;
+
+function TOneExpression.One: string;
+begin
+ Result := 'I';
+end;
+
+{ TContext }
+
+constructor TContext.Create(input: string);
+begin
+ inherited Create;
+ FInput := input;
+end;
+
+end.
diff --git a/Behavioral.Iterator/Behavioral.Iterator.Pattern.dpr b/Behavioral.Iterator/Behavioral.Iterator.Pattern.dpr
new file mode 100644
index 0000000..591c582
--- /dev/null
+++ b/Behavioral.Iterator/Behavioral.Iterator.Pattern.dpr
@@ -0,0 +1,36 @@
+program Behavioral.Iterator.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ list: TCustomList;
+ obj: TCustomObject;
+ i: integer;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ list := TCustomList.Create;
+ try
+ for i := 0 to 9 do begin
+ list.Add(TCustomObject.Create('' + IntToStr(i)));
+ end;
+ for obj in list do begin
+ obj.WriteName;
+ end;
+ ReadLn;
+ finally
+ for obj in list do begin
+ obj.Free;
+ end;
+ list.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Iterator/Behavioral.Iterator.Pattern.dproj b/Behavioral.Iterator/Behavioral.Iterator.Pattern.dproj
new file mode 100644
index 0000000..1401b5f
--- /dev/null
+++ b/Behavioral.Iterator/Behavioral.Iterator.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {d81ffd9c-93a9-467f-b280-f5386b92de44}
+ Debug
+ DCC32
+ Behavioral.Iterator.Pattern.exe
+ Behavioral.Iterator.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Iterator_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Iterator.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Iterator/Behavioral.Iterator.Pattern.res b/Behavioral.Iterator/Behavioral.Iterator.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Iterator/Behavioral.Iterator.Pattern.res differ
diff --git a/Behavioral.Iterator/Behavioral.Iterator.Pattern.stat b/Behavioral.Iterator/Behavioral.Iterator.Pattern.stat
new file mode 100644
index 0000000..2fd669d
--- /dev/null
+++ b/Behavioral.Iterator/Behavioral.Iterator.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=375
+OtherSecs=5
+StartTime=12/31/15 2:42:48 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Iterator/Pattern.pas b/Behavioral.Iterator/Pattern.pas
new file mode 100644
index 0000000..d2d1053
--- /dev/null
+++ b/Behavioral.Iterator/Pattern.pas
@@ -0,0 +1,83 @@
+unit Pattern;
+
+interface
+
+uses
+ Classes;
+
+type
+
+ TCustomObject = class(TObject)
+ public
+ FName: string;
+ constructor Create(name: string);
+ procedure WriteName;
+ end;
+
+ TCustomList = class;
+
+ TCustomListEnumerator = class
+ private
+ FIndex: Integer;
+ FCustomList: TCustomList;
+ public
+ constructor Create(ACustomList: TCustomList);
+ function MoveNext: Boolean;
+ function GetCurrent: TCustomObject;
+ property Current: TCustomObject read GetCurrent;
+ end;
+
+ TCustomList = class(TList)
+ public
+ procedure Add(ACustomObject: TCustomObject);
+ function GetEnumerator: TCustomListEnumerator;
+ end;
+
+implementation
+
+{ TCustomObject }
+
+constructor TCustomObject.Create(name: string);
+begin
+ FName := name;
+end;
+
+procedure TCustomObject.WriteName;
+begin
+ WriteLn('List member ' + FName);
+end;
+
+{ TCustomList }
+
+procedure TCustomList.Add(ACustomObject: TCustomObject);
+begin
+ inherited Add(ACustomObject);
+end;
+
+function TCustomList.GetEnumerator: TCustomListEnumerator;
+begin
+ Result := TCustomListEnumerator.Create(Self);
+end;
+
+{ TCustomListEnumerator }
+
+constructor TCustomListEnumerator.Create(ACustomList: TCustomList);
+begin
+ inherited Create;
+ FIndex := -1;
+ FCustomList := ACustomList;
+end;
+
+function TCustomListEnumerator.GetCurrent: TCustomObject;
+begin
+ Result := FCustomList.List[FIndex];
+end;
+
+function TCustomListEnumerator.MoveNext: Boolean;
+begin
+ Result := FIndex < FCustomList.Count - 1;
+ if Result then
+ Inc(FIndex);
+end;
+
+end.
diff --git a/Behavioral.Mediator/Behavioral.Mediator.Pattern.dpr b/Behavioral.Mediator/Behavioral.Mediator.Pattern.dpr
new file mode 100644
index 0000000..1569cc4
--- /dev/null
+++ b/Behavioral.Mediator/Behavioral.Mediator.Pattern.dpr
@@ -0,0 +1,36 @@
+program Behavioral.Mediator.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ mediator: TConcreteMediator;
+ coll1: TConcreteColleague1;
+ coll2: TConcreteColleague2;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ mediator := TConcreteMediator.Create;
+ coll1 := TConcreteColleague1.Create(mediator);
+ coll2 := TConcreteColleague2.Create(mediator);
+ try
+ mediator.FColleague1 := coll1;
+ mediator.FColleague2 := coll2;
+
+ coll1.Send('How are you?');
+ coll2.Send('Fine, thanks');
+
+ ReadLn;
+ finally
+ coll1.Free;
+ coll2.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Mediator/Behavioral.Mediator.Pattern.dproj b/Behavioral.Mediator/Behavioral.Mediator.Pattern.dproj
new file mode 100644
index 0000000..b1d5af0
--- /dev/null
+++ b/Behavioral.Mediator/Behavioral.Mediator.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {93d16669-5973-46fe-b164-2918b568ce5f}
+ Debug
+ DCC32
+ Behavioral.Mediator.Pattern.exe
+ Behavioral.Mediator.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Mediator_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Mediator.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Mediator/Behavioral.Mediator.Pattern.res b/Behavioral.Mediator/Behavioral.Mediator.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Mediator/Behavioral.Mediator.Pattern.res differ
diff --git a/Behavioral.Mediator/Behavioral.Mediator.Pattern.stat b/Behavioral.Mediator/Behavioral.Mediator.Pattern.stat
new file mode 100644
index 0000000..192c294
--- /dev/null
+++ b/Behavioral.Mediator/Behavioral.Mediator.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=292
+OtherSecs=6
+StartTime=12/31/15 2:42:53 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Mediator/Pattern.pas b/Behavioral.Mediator/Pattern.pas
new file mode 100644
index 0000000..aee3295
--- /dev/null
+++ b/Behavioral.Mediator/Pattern.pas
@@ -0,0 +1,93 @@
+unit Pattern;
+
+interface
+
+type
+
+ IMediator = interface
+ ['{930530D1-A22C-4F46-8B06-066ED153C28C}']
+ procedure Send(mess: string; colleague: TObject);
+ end;
+
+ TColleague = class
+ protected
+ FMediator: IMediator;
+ public
+ constructor Create(mediator: IMediator);
+ end;
+
+ TConcreteColleague1 = class(TColleague)
+ public
+ constructor Create(mediator: IMediator);
+ procedure Send(mess: string);
+ procedure Notify(mess: string);
+ end;
+
+ TConcreteColleague2 = class(TColleague)
+ public
+ constructor Create(mediator: IMediator);
+ procedure Send(mess: string);
+ procedure Notify(mess: string);
+ end;
+
+ TConcreteMediator = class(TInterfacedObject, IMediator)
+ public
+ FColleague1: TConcreteColleague1;
+ FColleague2: TConcreteColleague2;
+ procedure Send(mess: string; colleague: TObject);
+ end;
+
+implementation
+
+{ TColleagueBase }
+
+constructor TColleague.Create(mediator: IMediator);
+begin
+ FMediator := mediator;
+end;
+
+{ TConcreteColleague1 }
+
+constructor TConcreteColleague1.Create(mediator: IMediator);
+begin
+ inherited Create(mediator);
+end;
+
+procedure TConcreteColleague1.Notify(mess: string);
+begin
+ WriteLn('Colleague1 gets message:' + mess);
+end;
+
+procedure TConcreteColleague1.Send(mess: string);
+begin
+ FMediator.Send(mess, Self);
+end;
+
+{ TConcreteColleague2 }
+
+constructor TConcreteColleague2.Create(mediator: IMediator);
+begin
+ inherited Create(mediator);
+end;
+
+procedure TConcreteColleague2.Notify(mess: string);
+begin
+ WriteLn('Colleague2 gets message:' + mess);
+end;
+
+procedure TConcreteColleague2.Send(mess: string);
+begin
+ FMediator.Send(mess, Self);
+end;
+
+{ TConcreteMediator }
+
+procedure TConcreteMediator.Send(mess: string; colleague: TObject);
+begin
+ if colleague = FColleague2 then
+ FColleague1.Notify(mess)
+ else
+ FColleague2.Notify(mess);
+end;
+
+end.
diff --git a/Behavioral.Memento/Behavioral.Memento.Pattern.dpr b/Behavioral.Memento/Behavioral.Memento.Pattern.dpr
new file mode 100644
index 0000000..589cfd8
--- /dev/null
+++ b/Behavioral.Memento/Behavioral.Memento.Pattern.dpr
@@ -0,0 +1,40 @@
+program Behavioral.Memento.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ s: TSalesProspect;
+ m: TProspectMemory;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ s := TSalesProspect.Create;
+ m := TProspectMemory.Create;
+ try
+ s.Name := 'Noel van Halen';
+ s.Phone := '(412) 256-0990';
+ s.Budget := 25000.0;
+
+ m.FMemento := s.SaveMemento;
+
+ s.Name := 'Leo Welch';
+ s.Phone := '(310) 209-7111';
+ s.Budget := 1000000.0;
+
+ s.RestoreMemento(m.FMemento);
+
+ ReadLn;
+ finally
+ m.Free;
+ s.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Memento/Behavioral.Memento.Pattern.dproj b/Behavioral.Memento/Behavioral.Memento.Pattern.dproj
new file mode 100644
index 0000000..b1bd890
--- /dev/null
+++ b/Behavioral.Memento/Behavioral.Memento.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {beba0f1e-b262-4406-8103-8e65d454f04e}
+ Debug
+ DCC32
+ Behavioral.Memento.Pattern.exe
+ Behavioral.Memento.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Memento_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Memento.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Memento/Behavioral.Memento.Pattern.res b/Behavioral.Memento/Behavioral.Memento.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Memento/Behavioral.Memento.Pattern.res differ
diff --git a/Behavioral.Memento/Pattern.pas b/Behavioral.Memento/Pattern.pas
new file mode 100644
index 0000000..0991001
--- /dev/null
+++ b/Behavioral.Memento/Pattern.pas
@@ -0,0 +1,92 @@
+unit Pattern;
+
+interface
+
+uses SysUtils;
+
+type
+
+ TMemento = class
+ public
+ FName: string;
+ FPhone: string;
+ FBudget: Double;
+ constructor Create(name: string; phone: string; budget: Double);
+ end;
+
+ TSalesProspect = class
+ private
+ FName: string;
+ FPhone: string;
+ FBudget: Double;
+ procedure SetName(value: string);
+ procedure SetPhone(value: string);
+ procedure SetBudget(value: Double);
+ public
+ property Name: string read FName write SetName;
+ property Phone: string read FPhone write SetPhone;
+ property Budget: Double read FBudget write SetBudget;
+ function SaveMemento: TMemento;
+ procedure RestoreMemento(memento: TMemento);
+ end;
+
+ TProspectMemory = class
+ public
+ FMemento: TMemento;
+ destructor Destroy; override;
+ end;
+
+implementation
+
+{ TMemento }
+
+constructor TMemento.Create(name, phone: string; budget: Double);
+begin
+ FName := name;
+ FPhone := phone;
+ FBudget := budget;
+end;
+
+{ TSalesProspect }
+
+procedure TSalesProspect.RestoreMemento(memento: TMemento);
+begin
+ WriteLn(#10 + ' Restoring State ---' + #10);
+ Name := memento.FName;
+ Phone := memento.FPhone;
+ Budget := memento.FBudget;
+end;
+
+function TSalesProspect.SaveMemento: TMemento;
+begin
+ WriteLn(#10 + ' Saving State ---' + #10);
+ Result := TMemento.Create(FName, FPhone, FBudget);
+end;
+
+procedure TSalesProspect.SetBudget(value: Double);
+begin
+ FBudget := value;
+ WriteLn('Budget = ' + FloatToStr(FBudget));
+end;
+
+procedure TSalesProspect.SetName(value: string);
+begin
+ FName := value;
+ WriteLn('Name = ' + FName);
+end;
+
+procedure TSalesProspect.SetPhone(value: string);
+begin
+ FPhone := value;
+ WriteLn('Phone = ' + FPhone);
+end;
+
+{ TProspectMemory }
+
+destructor TProspectMemory.Destroy;
+begin
+ FMemento.Free;
+ inherited;
+end;
+
+end.
diff --git a/Behavioral.Observer/Behavioral.Observer.Pattern.dpr b/Behavioral.Observer/Behavioral.Observer.Pattern.dpr
new file mode 100644
index 0000000..0b62afd
--- /dev/null
+++ b/Behavioral.Observer/Behavioral.Observer.Pattern.dpr
@@ -0,0 +1,46 @@
+program Behavioral.Observer.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ stock: TStock;
+ investor1, investor2: TInvestor;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ stock := TStock.Create('IBM', 120.0);
+ investor1 := TInvestor.Create('Sorros');
+ investor2 := TInvestor.Create('Berkshire');
+ try
+ stock.Attach(investor1);
+ stock.Attach(investor2);
+
+ stock.Price := 120.10;
+ stock.Price := 121.0;
+ stock.Price := 120.50;
+ stock.Price := 120.750;
+
+ WriteLn(#10 + 'Remove investor');
+ stock.Detach(investor1);
+
+ stock.Price := 120.10;
+ stock.Price := 121.0;
+ stock.Price := 120.50;
+ stock.Price := 120.750;
+
+ stock.Detach(investor2);
+
+ ReadLn;
+ finally
+ stock.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Observer/Behavioral.Observer.Pattern.dproj b/Behavioral.Observer/Behavioral.Observer.Pattern.dproj
new file mode 100644
index 0000000..e0f937d
--- /dev/null
+++ b/Behavioral.Observer/Behavioral.Observer.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {94dd8a05-86e3-41ca-86ad-7516245bbab9}
+ Debug
+ DCC32
+ Behavioral.Observer.Pattern.exe
+ Behavioral.Observer.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Observer_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Observer.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Observer/Behavioral.Observer.Pattern.res b/Behavioral.Observer/Behavioral.Observer.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Observer/Behavioral.Observer.Pattern.res differ
diff --git a/Behavioral.Observer/Behavioral.Observer.Pattern.stat b/Behavioral.Observer/Behavioral.Observer.Pattern.stat
new file mode 100644
index 0000000..40f8528
--- /dev/null
+++ b/Behavioral.Observer/Behavioral.Observer.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=358
+OtherSecs=4
+StartTime=12/31/15 2:42:59 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Observer/Pattern.pas b/Behavioral.Observer/Pattern.pas
new file mode 100644
index 0000000..c6753e1
--- /dev/null
+++ b/Behavioral.Observer/Pattern.pas
@@ -0,0 +1,123 @@
+unit Pattern;
+
+interface
+
+uses Classes, SysUtils;
+
+type
+
+ IObserver = interface
+ ['{A3208B98-3F48-40C6-9986-43B6CB8F4A7E}']
+ procedure Update(Subject: TObject);
+ end;
+
+ ISubject = interface
+ ['{CA063853-73A8-4AFE-8CAA-50600996ADEB}']
+ procedure Attach(Observer: IObserver);
+ procedure Detach(Observer: IObserver);
+ procedure Notify;
+ end;
+
+ TStock = class(TInterfacedObject, ISubject)
+ private
+ FSymbol: string;
+ FPrice: Double;
+ FInvestors: TInterfaceList;
+ function ReadSymbol: string;
+ function ReadPrice: Double;
+ procedure SetPrice(value: Double);
+ public
+ constructor Create(symbol: string; price: Double);
+ destructor Destroy; override;
+ procedure Attach(Observer: IObserver);
+ procedure Detach(Observer: IObserver);
+ procedure Notify;
+ property Symbol: string read ReadSymbol;
+ property Price: Double read ReadPrice write SetPrice;
+ end;
+
+ TInvestor = class(TINterfacedObject, IObserver)
+ private
+ FName: string;
+ public
+ constructor Create(name: string);
+ procedure Update(Subject: TObject);
+ end;
+
+implementation
+
+{ TStock }
+
+procedure TStock.Attach(Observer: IObserver);
+begin
+ if FInvestors = nil then
+ FInvestors := TInterfaceList.Create;
+ if FInvestors.IndexOf(Observer) < 0 then
+ FInvestors.Add(Observer);
+end;
+
+constructor TStock.Create(symbol: string; price: Double);
+begin
+ FSymbol := symbol;
+ FPrice := price;
+end;
+
+destructor TStock.Destroy;
+begin
+ FInvestors.Free;
+ inherited;
+end;
+
+procedure TStock.Detach(Observer: IObserver);
+begin
+ if FInvestors <> nil then
+ begin
+ FInvestors.Remove(Observer);
+ if FInvestors.Count = 0 then
+ begin
+ FInvestors.Free;
+ FInvestors := nil;
+ end;
+ end;
+end;
+
+procedure TStock.Notify;
+var
+ i: Integer;
+begin
+ if FInvestors <> nil then
+ for i := 0 to Pred(FInvestors.Count) do
+ IObserver(FInvestors[i]).Update(Self);
+end;
+
+function TStock.ReadPrice: Double;
+begin
+ Result := FPrice;
+end;
+
+function TStock.ReadSymbol: string;
+begin
+ Result := FSymbol
+end;
+
+procedure TStock.SetPrice(value: Double);
+begin
+ if value <> FPrice then begin
+ FPrice := value;
+ Notify;
+ end;
+end;
+
+{ TInvestor }
+
+constructor TInvestor.Create(name: string);
+begin
+ FName := name;
+end;
+
+procedure TInvestor.Update(Subject: TObject);
+begin
+ WriteLn(Format('Notified %s of %s change to %g', [FName, TStock(Subject).Symbol, TStock(Subject).Price]));
+end;
+
+end.
diff --git a/Behavioral.State/Behavioral.State.Pattern.dpr b/Behavioral.State/Behavioral.State.Pattern.dpr
new file mode 100644
index 0000000..ec82e0b
--- /dev/null
+++ b/Behavioral.State/Behavioral.State.Pattern.dpr
@@ -0,0 +1,32 @@
+program Behavioral.State.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ context: TContext;
+ state: IState;
+ r, i: integer;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ context := TContext.Create;
+ try
+ context.FState := TNormalState.Create;
+ for i := 0 to 30 do begin
+ r := Random(3);
+ Write(IntToStr(context.Request(r)) + ' ');
+ end;
+ ReadLn;
+ finally
+ context.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.State/Behavioral.State.Pattern.dproj b/Behavioral.State/Behavioral.State.Pattern.dproj
new file mode 100644
index 0000000..206ba9b
--- /dev/null
+++ b/Behavioral.State/Behavioral.State.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {22536a44-3444-4781-bb31-ce80a0a11c0b}
+ Debug
+ DCC32
+ Behavioral.State.Pattern.exe
+ Behavioral.State.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_State_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.State.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.State/Behavioral.State.Pattern.res b/Behavioral.State/Behavioral.State.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.State/Behavioral.State.Pattern.res differ
diff --git a/Behavioral.State/Behavioral.State.Pattern.stat b/Behavioral.State/Behavioral.State.Pattern.stat
new file mode 100644
index 0000000..0805e84
--- /dev/null
+++ b/Behavioral.State/Behavioral.State.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=247
+OtherSecs=5
+StartTime=12/31/15 2:42:02 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.State/Pattern.pas b/Behavioral.State/Pattern.pas
new file mode 100644
index 0000000..48cbbbd
--- /dev/null
+++ b/Behavioral.State/Pattern.pas
@@ -0,0 +1,91 @@
+unit Pattern;
+
+interface
+
+type
+
+ TContext = class;
+
+ IState = interface
+ ['{2E995182-8FA5-4AF2-9994-6E5B7F273A0B}']
+ function MoveUp(c: TContext): integer;
+ function MoveDown(c: TContext): integer;
+ end;
+
+ TNormalState = class(TInterfacedObject, IState)
+ public
+ function MoveUp(c: TContext): integer;
+ function MoveDown(c: TContext): integer;
+ end;
+
+ TFastState = class(TInterfacedObject, IState)
+ public
+ function MoveUp(c: TContext): integer;
+ function MoveDown(c: TContext): integer;
+ end;
+
+ TContext = class
+ const
+ LIMIT = 10;
+ public
+ FState: IState;
+ FCounter: integer;
+ constructor Create;
+ function Request(i: integer): integer;
+ end;
+
+implementation
+
+{ TNormalState }
+
+function TNormalState.MoveDown(c: TContext): integer;
+begin
+ if c.FCounter < c.LIMIT then begin
+ c.FState := TFastState.Create;
+ WriteLn('|| ');
+ end;
+ c.FCounter := c.FCounter - 2;
+ Result := c.FCounter;
+end;
+
+function TNormalState.MoveUp(c: TContext): integer;
+begin
+ c.FCounter := c.FCounter + 2;
+ Result := c.FCounter;
+end;
+
+{ TFastState }
+
+function TFastState.MoveDown(c: TContext): integer;
+begin
+ if c.FCounter < c.LIMIT then begin
+ c.FState := TNormalState.Create;
+ WriteLn('|| ');
+ end;
+ c.FCounter := c.FCounter - 5;
+ Result := c.FCounter;
+end;
+
+function TFastState.MoveUp(c: TContext): integer;
+begin
+ c.FCounter := c.FCounter + 5;
+ Result := c.FCounter;
+end;
+
+{ TContext }
+
+constructor TContext.Create;
+begin
+ inherited;
+ FCounter := LIMIT;
+end;
+
+function TContext.Request(i: integer): integer;
+begin
+ if i = 2 then
+ Result := FState.MoveUp(Self)
+ else
+ Result := FState.MoveDown(Self);
+end;
+
+end.
diff --git a/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dpr b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dpr
new file mode 100644
index 0000000..34b725a
--- /dev/null
+++ b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dpr
@@ -0,0 +1,27 @@
+program Behavioral.TemplateMethod.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ m: TAlgorithm;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ m := TAlgorithm.Create;
+ try
+ m.TemplateMethod(TClasA.Create);
+ m.TemplateMethod(TClasB.Create);
+ ReadLn;
+ finally
+ m.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dproj b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dproj
new file mode 100644
index 0000000..f50de82
--- /dev/null
+++ b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {b451067e-c041-4423-954e-fb10b58f7181}
+ Debug
+ DCC32
+ Behavioral.TemplateMethod.Pattern.exe
+ Behavioral.TemplateMethod.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_TemplateMethod_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.TemplateMethod.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.res b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.res differ
diff --git a/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.stat b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.stat
new file mode 100644
index 0000000..784857e
--- /dev/null
+++ b/Behavioral.TemplateMethod/Behavioral.TemplateMethod.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=269
+OtherSecs=6
+StartTime=12/31/15 2:42:18 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.TemplateMethod/Pattern.pas b/Behavioral.TemplateMethod/Pattern.pas
new file mode 100644
index 0000000..820a3f4
--- /dev/null
+++ b/Behavioral.TemplateMethod/Pattern.pas
@@ -0,0 +1,63 @@
+unit Pattern;
+
+interface
+
+type
+
+ IPrimitives = interface
+ ['{FDD3A7B4-D02B-4F84-8428-C70DED215E42}']
+ function Operation1: string;
+ function Operation2: string;
+ end;
+
+ TClasA = class(TInterfacedObject, IPrimitives)
+ function Operation1: string;
+ function Operation2: string;
+ end;
+
+ TClasB = class(TInterfacedObject, IPrimitives)
+ function Operation1: string;
+ function Operation2: string;
+ end;
+
+ TAlgorithm = class
+ procedure TemplateMethod(a: IPrimitives);
+ end;
+
+implementation
+
+{ TClasA }
+
+function TClasA.Operation1: string;
+begin
+ Result := 'ClassA:Op1 ';
+end;
+
+function TClasA.Operation2: string;
+begin
+ Result := 'ClassA:Op2 ';
+end;
+
+{ TClasB }
+
+function TClasB.Operation1: string;
+begin
+ Result := 'ClassB:Op1 ';
+end;
+
+function TClasB.Operation2: string;
+begin
+ Result := 'ClassB:Op2 ';
+end;
+
+{ TAlgorithm }
+
+procedure TAlgorithm.TemplateMethod(a: IPrimitives);
+var
+ s: string;
+begin
+ s := a.Operation1 + a.Operation2;
+ WriteLn(s);
+end;
+
+end.
diff --git a/Behavioral.Visitor/Behavioral.Visitor.Pattern.dpr b/Behavioral.Visitor/Behavioral.Visitor.Pattern.dpr
new file mode 100644
index 0000000..7f994f4
--- /dev/null
+++ b/Behavioral.Visitor/Behavioral.Visitor.Pattern.dpr
@@ -0,0 +1,33 @@
+program Behavioral.Visitor.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ e: TEmployees;
+
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ e := TEmployees.Create;
+ try
+ e.Attach(TClerk.Create);
+ e.Attach(TDirector.Create);
+ e.Attach(TPresident.Create);
+
+ e.Accept(TIncomeVisitor.Create);
+ e.Accept(TVacationVisitor.Create);
+
+ ReadLn;
+ finally
+ e.free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavioral.Visitor/Behavioral.Visitor.Pattern.dproj b/Behavioral.Visitor/Behavioral.Visitor.Pattern.dproj
new file mode 100644
index 0000000..03371b9
--- /dev/null
+++ b/Behavioral.Visitor/Behavioral.Visitor.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {032411bd-6d26-49f2-bf2a-8d4c5867ee5e}
+ Debug
+ DCC32
+ Behavioral.Visitor.Pattern.exe
+ Behavioral.Visitor.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Visitor_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Visitor.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavioral.Visitor/Behavioral.Visitor.Pattern.res b/Behavioral.Visitor/Behavioral.Visitor.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavioral.Visitor/Behavioral.Visitor.Pattern.res differ
diff --git a/Behavioral.Visitor/Behavioral.Visitor.Pattern.stat b/Behavioral.Visitor/Behavioral.Visitor.Pattern.stat
new file mode 100644
index 0000000..06a4809
--- /dev/null
+++ b/Behavioral.Visitor/Behavioral.Visitor.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=390
+OtherSecs=6
+StartTime=12/31/15 2:43:06 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavioral.Visitor/Pattern.pas b/Behavioral.Visitor/Pattern.pas
new file mode 100644
index 0000000..cd4b1de
--- /dev/null
+++ b/Behavioral.Visitor/Pattern.pas
@@ -0,0 +1,160 @@
+unit Pattern;
+
+interface
+
+uses
+ Classes, SysUtils;
+
+type
+
+ IVisitor = interface;
+
+ TEmployee = class
+ public
+ FName: string;
+ FIncome: Double;
+ FVacationDays: integer;
+ constructor Create(nm: string; incm: Double; vacdays: integer);
+ procedure Accept(visitor: IVisitor);
+ end;
+
+ IVisitor = interface
+ procedure Visit(element: TEmployee);
+ end;
+
+ TIncomeVisitor = class(TInterfacedObject, IVisitor)
+ public
+ procedure Visit(element: TEmployee);
+ end;
+
+ TVacationVisitor = class(TInterfacedObject, IVisitor)
+ public
+ procedure Visit(element: TEmployee);
+ end;
+
+ TEmployees = class
+ private
+ FEmployees: TList;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ procedure Attach(employee: TEmployee);
+ procedure Detach(employee: TEmployee);
+ procedure Accept(visitor: IVisitor);
+ end;
+
+ TClerk = class(TEmployee)
+ public
+ constructor Create;
+ end;
+
+ TDirector = class(TEmployee)
+ public
+ constructor Create;
+ end;
+
+ TPresident = class(TEmployee)
+ public
+ constructor Create;
+ end;
+
+implementation
+
+{ TElement }
+
+procedure TEmployee.Accept(visitor: IVisitor);
+begin
+ visitor.Visit(Self);
+end;
+
+constructor TEmployee.Create(nm: string; incm: Double; vacdays: integer);
+begin
+ FName := nm;
+ FIncome := incm;
+ FVacationDays := vacdays;
+end;
+
+
+{ TIncomeVisitor }
+
+procedure TIncomeVisitor.Visit(element: TEmployee);
+var
+ employee: TEmployee;
+begin
+ employee := TEmployee(element);
+ employee.FIncome := employee.FIncome * 1.10;
+ WriteLn(Format('%s new income: %g',[employee.FName, employee.FIncome]));
+end;
+
+{ TVacationVisitor }
+
+procedure TVacationVisitor.Visit(element: TEmployee);
+var
+ employee: TEmployee;
+begin
+ employee := TEmployee(element);
+ employee.FVacationDays := employee.FVacationDays + 3;
+ WriteLn(Format('%s new vacation days: %d',[employee.FName, employee.FVacationDays]));
+end;
+
+{ TEmployees }
+
+procedure TEmployees.Accept(visitor: IVisitor);
+var
+ i: integer;
+begin
+ for i := 0 to FEmployees.Count - 1 do begin
+ TEmployee(FEmployees[i]).Accept(visitor);
+ WriteLn;
+ end;
+end;
+
+procedure TEmployees.Attach(employee: TEmployee);
+begin
+ FEmployees.Add(employee);
+end;
+
+constructor TEmployees.Create;
+begin
+ inherited;
+ FEmployees := TList.Create;
+end;
+
+destructor TEmployees.Destroy;
+var
+ i: integer;
+begin
+ for i := 0 to FEmployees.Count - 1 do begin
+ TEmployee(FEmployees[i]).Free;
+ end;
+ FEmployees.Free;
+ inherited;
+end;
+
+procedure TEmployees.Detach(employee: TEmployee);
+begin
+ FEmployees.Remove(employee);
+end;
+
+{ TClerk }
+
+constructor TClerk.Create;
+begin
+ inherited Create('Hank', 25000.0, 14);
+end;
+
+{ TDirector }
+
+constructor TDirector.Create;
+begin
+ inherited Create('Elly', 35000.0, 16);
+end;
+
+{ TPresident }
+
+constructor TPresident.Create;
+begin
+ inherited Create('Dick', 45000.0, 21);
+end;
+
+end.
diff --git a/Behavoral.Strategy/Behavioral.Strategy.Pattern.dpr b/Behavoral.Strategy/Behavioral.Strategy.Pattern.dpr
new file mode 100644
index 0000000..33a2893
--- /dev/null
+++ b/Behavoral.Strategy/Behavioral.Strategy.Pattern.dpr
@@ -0,0 +1,35 @@
+program Behavioral.Strategy.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ context: TContext;
+ strategy: IStrategy;
+ i: integer;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ context := TContext.Create;
+ context.SetStrategy(TStrategy1.Create);
+ try
+ for i := 0 to 30 do begin
+ if i = 15 then begin
+ WriteLn(#10 + '|| ');
+ context.SetStrategy(TStrategy2.Create);
+ end;
+ Write(IntToStr(context.Algorithm) + ' ');
+ end;
+ ReadLn;
+ finally
+ context.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Behavoral.Strategy/Behavioral.Strategy.Pattern.dproj b/Behavoral.Strategy/Behavioral.Strategy.Pattern.dproj
new file mode 100644
index 0000000..bc6cb95
--- /dev/null
+++ b/Behavoral.Strategy/Behavioral.Strategy.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {6aeb06f8-a613-4792-a67e-e006723bee0b}
+ Debug
+ DCC32
+ Behavioral.Strategy.Pattern.exe
+ Behavioral.Strategy.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Behavioral_Strategy_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Behavioral.Strategy.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Behavoral.Strategy/Behavioral.Strategy.Pattern.res b/Behavoral.Strategy/Behavioral.Strategy.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Behavoral.Strategy/Behavioral.Strategy.Pattern.res differ
diff --git a/Behavoral.Strategy/Behavioral.Strategy.Pattern.stat b/Behavoral.Strategy/Behavioral.Strategy.Pattern.stat
new file mode 100644
index 0000000..8a4b935
--- /dev/null
+++ b/Behavoral.Strategy/Behavioral.Strategy.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=256
+OtherSecs=7
+StartTime=12/31/15 2:41:56 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Behavoral.Strategy/Pattern.pas b/Behavoral.Strategy/Pattern.pas
new file mode 100644
index 0000000..ff863fb
--- /dev/null
+++ b/Behavoral.Strategy/Pattern.pas
@@ -0,0 +1,71 @@
+unit Pattern;
+
+interface
+
+type
+
+ TContext = class;
+
+ IStrategy = interface
+ ['{7F63C143-98D0-4B8C-A02B-894D145BB745}']
+ function Move(c: TContext): integer;
+ end;
+
+ TStrategy1 = class(TInterfacedObject, IStrategy)
+ public
+ function Move(c: TContext): integer;
+ end;
+
+ TStrategy2 = class(TInterfacedObject, IStrategy)
+ public
+ function Move(c: TContext): integer;
+ end;
+
+ TContext = class
+ private
+ FStrategy: IStrategy;
+ public
+ FCounter: integer;
+ constructor Create;
+ function Algorithm: integer;
+ procedure SetStrategy(s: IStrategy);
+ end;
+
+implementation
+
+{ TStrategy1 }
+
+function TStrategy1.Move(c: TContext): integer;
+begin
+ c.FCounter := c.FCounter + 1;
+ Result := c.FCounter;
+end;
+
+{ TStrategy2 }
+
+function TStrategy2.Move(c: TContext): integer;
+begin
+ c.FCounter := c.FCounter - 1;
+ Result := c.FCounter;
+end;
+
+{ TContext }
+
+function TContext.Algorithm: integer;
+begin
+ Result := FStrategy.Move(Self)
+end;
+
+constructor TContext.Create;
+begin
+ inherited;
+ FCounter := 5;
+ FStrategy := TStrategy1.Create;
+end;
+
+procedure TContext.SetStrategy(s: IStrategy);
+begin
+ FStrategy := s;
+end;
+
+end.
diff --git a/BuildProcessTemplates/DefaultTemplate.11.1.xaml b/BuildProcessTemplates/DefaultTemplate.11.1.xaml
new file mode 100644
index 0000000..bf54edf
--- /dev/null
+++ b/BuildProcessTemplates/DefaultTemplate.11.1.xaml
@@ -0,0 +1,543 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()]
+ [False]
+ [New Microsoft.TeamFoundation.Build.Workflow.Activities.TestSpecList(New Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec("**\*test*.dll"))]
+ ["$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"]
+ [False]
+ [True]
+ [True]
+ [Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]
+
+
+
+ [Microsoft.TeamFoundation.Build.Workflow.Activities.CodeAnalysisOption.AsConfigured]
+ [True]
+ [Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]
+ [True]
+ [New Microsoft.TeamFoundation.Build.Workflow.Activities.SourceAndSymbolServerSettings(True, Nothing)]
+ [True]
+
+
+
+ [New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]
+ [Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]
+
+
+
+
+
+
+ All
+ 11.0
+ Assembly references and imported namespaces serialized as XML namespaces
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BuildProcessTemplates/LabDefaultTemplate.11.xaml b/BuildProcessTemplates/LabDefaultTemplate.11.xaml
new file mode 100644
index 0000000..9e1fb0b
--- /dev/null
+++ b/BuildProcessTemplates/LabDefaultTemplate.11.xaml
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 11.0
+
+
+
+
+
+ 920,3702
+ Assembly references and imported namespaces serialized as XML namespaces
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+
+
+
+
+
+
+ [LabWorkflowParameters.BuildDetails.BuildUri]
+
+
+ [ChildBuildDetail.Uri]
+
+
+
+
+
+
+
+
+
+
+
+ [BuildLocation]
+
+
+ [If(LabWorkflowParameters.BuildDetails.Configuration Is Nothing, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsEmpty Or (SelectedBuildDetail.Information.GetNodesByType(Microsoft.TeamFoundation.Build.Common.InformationTypes.ConfigurationSummary, True)).Count = 1, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsPlatformEmptyOrAnyCpu, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Platform + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration)))]
+
+
+
+
+
+
+
+
+
+
+
+ [LabEnvironmentUri]
+
+
+ [LabWorkflowParameters.EnvironmentDetails.LabEnvironmentUri.ToString()]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [PostDeploymentSnapshotName]
+
+
+ [If(LabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True,String.Format("{0}_{1}_{2}", LabWorkflowParameters.DeploymentDetails.PostDeploymentSnapshotName, BuildNumber,BuildDetail.BuildNumber),String.Format("{0}_{1}", LabWorkflowParameters.DeploymentDetails.PostDeploymentSnapshotName, BuildDetail.BuildNumber))]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [BuildStatus]
+
+
+ [Microsoft.TeamFoundation.Build.Client.BuildStatus.PartiallySucceeded]
+
+
+
+
+
+
+ [BuildStatus]
+
+
+ [Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildProcessTemplates/UpgradeTemplate.xaml b/BuildProcessTemplates/UpgradeTemplate.xaml
new file mode 100644
index 0000000..b3ee07f
--- /dev/null
+++ b/BuildProcessTemplates/UpgradeTemplate.xaml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]
+
+
+
+ [Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]
+ [False]
+ [False]
+
+
+
+
+
+
+
+
+
+ [Microsoft.TeamFoundation.VersionControl.Client.RecursionType.OneLevel]
+ [Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]
+
+
+
+ All
+ Assembly references and imported namespaces serialized as XML namespaces
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dpr b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dpr
new file mode 100644
index 0000000..b3e5cbc
--- /dev/null
+++ b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dpr
@@ -0,0 +1,36 @@
+program Creational.AbstractFactory.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ bag: IBag;
+ shoes: IShoes;
+ factory: IFactory;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ factory := TGucciFactory.Create;
+ bag := factory.CreateBag;
+ shoes := factory.CreateShoes;
+
+ WriteLn('I bought a Bag which is made from ' + bag.Material);
+ WriteLn('I bought some shoes which cost ' + IntToStr(shoes.Price));
+
+ factory := TPoochyFactory.Create;
+ bag := factory.CreateBag;
+ shoes := factory.CreateShoes;
+
+ WriteLn('I bought a Bag which is made from ' + bag.Material);
+ WriteLn('I bought some shoes which cost ' + IntToStr(shoes.Price));
+
+ ReadLn;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dproj b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dproj
new file mode 100644
index 0000000..45b7c5a
--- /dev/null
+++ b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {cd1472b7-3c94-48a8-880f-2779fc5d89e3}
+ Debug
+ DCC32
+ Creational.AbstractFactory.Pattern.exe
+ Creational.AbstractFactory.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Creational_AbstractFactory_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Creational.AbstractFactory.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.res b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.res differ
diff --git a/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.stat b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.stat
new file mode 100644
index 0000000..5da2271
--- /dev/null
+++ b/Creational.AbstractFactory/Creational.AbstractFactory.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=225
+OtherSecs=5
+StartTime=12/31/15 2:41:42 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Creational.AbstractFactory/Pattern.pas b/Creational.AbstractFactory/Pattern.pas
new file mode 100644
index 0000000..fc65cf7
--- /dev/null
+++ b/Creational.AbstractFactory/Pattern.pas
@@ -0,0 +1,152 @@
+unit Pattern;
+
+interface
+
+type
+ // the brands definition
+ IBrand = interface
+ ['{3D8E5363-08E7-4B8F-ABF1-8953E13C7A9A}']
+ function Price: integer;
+ function Material: string;
+ end;
+
+ TGucci = class(TInterfacedObject, IBrand)
+ public
+ function Price: integer;
+ function Material: string;
+ end;
+
+ TPoochy = class(TInterfacedObject, IBrand)
+ public
+ function Price: integer;
+ function Material: string;
+ end;
+ // the products definition
+ IBag = interface
+ ['{7EACC8B1-7963-4677-A8D7-9FA62065B880}']
+ function Material: string;
+ end;
+
+ IShoes = interface
+ ['{1560A332-D2D1-43E1-99BB-3D2882C1501A}']
+ function Price: integer;
+ end;
+
+ TBag = class(TInterfacedObject, IBag)
+ private
+ FMyBrand: IBrand;
+ public
+ constructor Create(brand: IBrand);
+ function Material: string;
+ end;
+
+ TShoes = class(TInterfacedObject, IShoes)
+ private
+ FMyBrand: IBrand;
+ public
+ constructor Create(brand: IBrand);
+ function Price: integer;
+ end;
+ // factories definition
+ IFactory = interface
+ ['{A9948727-DA7C-4843-83CF-92B81DD158F9}']
+ function CreateBag: IBag;
+ function CreateShoes: IShoes;
+ end;
+
+ TGucciFactory = class(TInterfacedObject, IFactory)
+ public
+ function CreateBag: IBag;
+ function CreateShoes: IShoes;
+ end;
+
+ TPoochyFactory = class(TInterfacedObject, IFactory)
+ public
+ function CreateBag: IBag;
+ function CreateShoes: IShoes;
+ end;
+
+implementation
+
+{ TGucci }
+
+function TGucci.Material: string;
+begin
+ Result := 'Crocodile skin';
+end;
+
+function TGucci.Price: integer;
+begin
+ Result := 1000;
+end;
+
+{ TPoochi }
+
+function TPoochy.Material: string;
+begin
+ Result := 'Plastic';
+end;
+
+function TPoochy.Price: integer;
+var
+ gucci: TGucci;
+begin
+ gucci := TGucci.Create;
+ try
+ Result := Round(gucci.Price / 3);
+ finally
+ gucci.Free;
+ end;
+end;
+
+{ TBag }
+
+constructor TBag.Create(brand: IBrand);
+begin
+ inherited Create;
+ FMyBrand := brand;
+end;
+
+function TBag.Material: string;
+begin
+ Result := FMyBrand.Material;
+end;
+
+{ TShoes }
+
+constructor TShoes.Create(brand: IBrand);
+begin
+ inherited Create;
+ FMyBrand := brand;
+end;
+
+function TShoes.Price: integer;
+begin
+ Result := FMyBrand.Price;
+end;
+
+{ TGucciFactory }
+
+function TGucciFactory.CreateBag: IBag;
+begin
+ Result := IBag(TBag.Create(TGucci.Create));
+end;
+
+function TGucciFactory.CreateShoes: IShoes;
+begin
+ Result := IShoes(TShoes.Create(TGucci.Create));
+end;
+
+{ TPoochyFactory }
+
+function TPoochyFactory.CreateBag: IBag;
+begin
+ Result := IBag(TBag.Create(TPoochy.Create));
+end;
+
+function TPoochyFactory.CreateShoes: IShoes;
+begin
+ Result := IShoes(TShoes.Create(TPoochy.Create));
+end;
+
+end.
diff --git a/Creational.Builder/Creational.Builder.Pattern.dpr b/Creational.Builder/Creational.Builder.Pattern.dpr
new file mode 100644
index 0000000..368fd40
--- /dev/null
+++ b/Creational.Builder/Creational.Builder.Pattern.dpr
@@ -0,0 +1,40 @@
+program Creational.Builder.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ b1, b2: IBuilder;
+ director: TDirector;
+ product1, product2: TProduct;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ director := TDirector.Create;
+ try
+ b1 := TBuilder1.Create;
+ b2 := TBuilder2.Create;
+
+ director.Construct(b1);
+ product1 := b1.GetResult;
+ product1.Display;
+
+ director.Construct(b2);
+ product2 := b2.GetResult;
+ product2.Display;
+
+ ReadLn;
+ finally
+ product1.free;
+ product2.free;
+ director.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Creational.Builder/Creational.Builder.Pattern.dproj b/Creational.Builder/Creational.Builder.Pattern.dproj
new file mode 100644
index 0000000..bf9dd6e
--- /dev/null
+++ b/Creational.Builder/Creational.Builder.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {8fb2ae35-26f6-4d07-b3ab-b8e72f7793fb}
+ Debug
+ DCC32
+ Creational.Builder.Pattern.exe
+ Creational.Builder.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Creational_Builder_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Creational.Builder.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Creational.Builder/Creational.Builder.Pattern.res b/Creational.Builder/Creational.Builder.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Creational.Builder/Creational.Builder.Pattern.res differ
diff --git a/Creational.Builder/Creational.Builder.Pattern.stat b/Creational.Builder/Creational.Builder.Pattern.stat
new file mode 100644
index 0000000..ab553ce
--- /dev/null
+++ b/Creational.Builder/Creational.Builder.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=341
+OtherSecs=4
+StartTime=12/31/15 2:41:50 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Creational.Builder/Pattern.pas b/Creational.Builder/Pattern.pas
new file mode 100644
index 0000000..df3d228
--- /dev/null
+++ b/Creational.Builder/Pattern.pas
@@ -0,0 +1,138 @@
+unit Pattern;
+
+interface
+
+uses
+ Classes;
+
+type
+
+ TProduct = class
+ private
+ FParts: TStringList;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ procedure Add(part: string);
+ procedure Display;
+ end;
+
+ IBuilder = interface
+ ['{9769DCD1-A2F5-4105-B28D-8A34DA6B0C12}']
+ procedure BuildPartA;
+ procedure BuildPartB;
+ function GetResult: TProduct;
+ end;
+
+ TBuilder1 = class(TInterfacedObject, IBuilder)
+ private
+ FProduct: TProduct;
+ public
+ constructor Create;
+ procedure BuildPartA;
+ procedure BuildPartB;
+ function GetResult: TProduct;
+ end;
+
+ TBuilder2 = class(TInterfacedObject, IBuilder)
+ private
+ FProduct: TProduct;
+ public
+ constructor Create;
+ procedure BuildPartA;
+ procedure BuildPartB;
+ function GetResult: TProduct;
+ end;
+
+ TDirector = class
+ public
+ procedure Construct(builder: IBuilder);
+ end;
+
+implementation
+
+{ TProduct }
+
+procedure TProduct.Add(part: string);
+begin
+ FParts.Add(part);
+end;
+
+constructor TProduct.Create;
+begin
+ inherited;
+ FParts := TStringList.Create;
+end;
+
+destructor TProduct.Destroy;
+begin
+ FParts.Free;
+ inherited;
+end;
+
+procedure TProduct.Display;
+var
+ I: integer;
+begin
+ WriteLn('Product Patrs -----------');
+ for I := 0 to FParts.Count - 1 do begin
+ WriteLn(FParts[I]);
+ end;
+end;
+
+{ TBuilder1 }
+
+procedure TBuilder1.BuildPartA;
+begin
+ FProduct.Add('Part A ');
+end;
+
+procedure TBuilder1.BuildPartB;
+begin
+ FProduct.Add('Part B ');
+end;
+
+constructor TBuilder1.Create;
+begin
+ inherited;
+ FProduct := TProduct.Create;
+end;
+
+function TBuilder1.GetResult: TProduct;
+begin
+ Result := FProduct;
+end;
+
+{ TBuilder2 }
+
+procedure TBuilder2.BuildPartA;
+begin
+ FProduct.Add('Part X ');
+end;
+
+procedure TBuilder2.BuildPartB;
+begin
+ FProduct.Add('Part Y ');
+end;
+
+constructor TBuilder2.Create;
+begin
+ inherited;
+ FProduct := TProduct.Create;
+end;
+
+function TBuilder2.GetResult: TProduct;
+begin
+ Result := FProduct;
+end;
+
+{ TDirector }
+
+procedure TDirector.Construct(builder: IBuilder);
+begin
+ builder.BuildPartA;
+ builder.BuildPartB;
+ builder.BuildPartB;
+end;
+
+end.
diff --git a/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dpr b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dpr
new file mode 100644
index 0000000..b6f9a0c
--- /dev/null
+++ b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dpr
@@ -0,0 +1,31 @@
+program Creational.FactoryMethod.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ c: TCreator;
+ product: IProduct;
+ i: integer;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ c := TCreator.Create;
+ try
+ for i := 1 to 12 do begin
+ product := c.FactoryMethod(i);
+ WriteLn('Avokados ' + product.ShipFrom);
+ end;
+ ReadLn;
+ finally
+ c.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dproj b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dproj
new file mode 100644
index 0000000..7f0df68
--- /dev/null
+++ b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {d7dacd3e-08e2-4b1f-bcdf-52bcda2242e5}
+ Debug
+ DCC32
+ Creational.FactoryMethod.Pattern.exe
+ Creational.FactoryMethod.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Creational_FactoryMethod_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Creational.FactoryMethod.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.res b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.res differ
diff --git a/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.stat b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.stat
new file mode 100644
index 0000000..639083f
--- /dev/null
+++ b/Creational.FactoryMethod/Creational.FactoryMethod.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=238
+OtherSecs=4
+StartTime=12/31/15 2:41:30 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Creational.FactoryMethod/Pattern.pas b/Creational.FactoryMethod/Pattern.pas
new file mode 100644
index 0000000..71d825a
--- /dev/null
+++ b/Creational.FactoryMethod/Pattern.pas
@@ -0,0 +1,63 @@
+unit Pattern;
+
+interface
+
+type
+
+ IProduct = interface
+ ['{2E0DD8B3-6BA2-4922-93F1-81F521B55AA9}']
+ function ShipFrom: string;
+ End;
+
+ TProductA = class(TInterfacedObject, IProduct)
+ function ShipFrom: string;
+ end;
+
+ TProductB = class(TInterfacedObject, IProduct)
+ function ShipFrom: string;
+ end;
+
+ TDefaultProduct = class(TInterfacedObject, IProduct)
+ function ShipFrom: string;
+ end;
+
+ TCreator = class
+ function FactoryMethod(month: integer): IProduct;
+ end;
+
+implementation
+
+{ TProductA }
+
+function TProductA.ShipFrom: string;
+begin
+ Result := 'from South Africa';
+end;
+
+{ TProductB }
+
+function TProductB.ShipFrom: string;
+begin
+ Result := 'from Spain';
+end;
+
+{ TDefaultProduct }
+
+function TDefaultProduct.ShipFrom: string;
+begin
+ Result := 'not available';
+end;
+
+{ TCreator }
+
+function TCreator.FactoryMethod(month: integer): IProduct;
+begin
+ if (month > 4) and (month <= 11) then begin
+ Result := TProductA.Create;
+ end else if (month in [1,2,12]) then begin
+ Result := TProductB.Create;
+ end else
+ Result := TDefaultProduct.Create;
+end;
+
+end.
diff --git a/Creational.Prototype/Creational.Prototype.Pattern.dpr b/Creational.Prototype/Creational.Prototype.Pattern.dpr
new file mode 100644
index 0000000..d99a57b
--- /dev/null
+++ b/Creational.Prototype/Creational.Prototype.Pattern.dpr
@@ -0,0 +1,17 @@
+program Creational.Prototype.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ { TODO -oUser -cConsole Main : Insert code here }
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Creational.Prototype/Creational.Prototype.Pattern.dproj b/Creational.Prototype/Creational.Prototype.Pattern.dproj
new file mode 100644
index 0000000..ab28ac0
--- /dev/null
+++ b/Creational.Prototype/Creational.Prototype.Pattern.dproj
@@ -0,0 +1,237 @@
+
+
+ {21884fb0-a96e-40f5-8304-360dff1c6a2c}
+ Debug
+ DCC32
+ Creational.Prototype.Pattern.exe
+ Creational.Prototype.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Creational_Prototype_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Creational.Prototype.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
+
+
diff --git a/Creational.Prototype/Creational.Prototype.Pattern.res b/Creational.Prototype/Creational.Prototype.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Creational.Prototype/Creational.Prototype.Pattern.res differ
diff --git a/Creational.Prototype/Creational.Prototype.Pattern.stat b/Creational.Prototype/Creational.Prototype.Pattern.stat
new file mode 100644
index 0000000..e24dfda
--- /dev/null
+++ b/Creational.Prototype/Creational.Prototype.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=296
+OtherSecs=13
+StartTime=12/31/15 2:41:18 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Creational.Prototype/Pattern.pas b/Creational.Prototype/Pattern.pas
new file mode 100644
index 0000000..c3bad37
--- /dev/null
+++ b/Creational.Prototype/Pattern.pas
@@ -0,0 +1,7 @@
+unit Pattern;
+
+interface
+
+implementation
+
+end.
diff --git a/Creational.Singleton/Creational.Singleton.Pattern.dpr b/Creational.Singleton/Creational.Singleton.Pattern.dpr
new file mode 100644
index 0000000..de97925
--- /dev/null
+++ b/Creational.Singleton/Creational.Singleton.Pattern.dpr
@@ -0,0 +1,30 @@
+program Creational.Singleton.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ s1, s2: TSingle;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ s1 := TSingle.Create;
+ s2 := TSingle.Create;
+ try
+ s1.WriteCount;
+ s2.WriteCount;
+
+ ReadLn;
+ finally
+ s1.Free;
+ s2.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Creational.Singleton/Creational.Singleton.Pattern.dproj b/Creational.Singleton/Creational.Singleton.Pattern.dproj
new file mode 100644
index 0000000..b4d67f7
--- /dev/null
+++ b/Creational.Singleton/Creational.Singleton.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {8bf5e379-531a-4a8d-b14e-956bc7ab4cbd}
+ Debug
+ DCC32
+ Creational.Singleton.Pattern.exe
+ Creational.Singleton.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Creational_Singleton_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Creational.Singleton.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Creational.Singleton/Creational.Singleton.Pattern.res b/Creational.Singleton/Creational.Singleton.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Creational.Singleton/Creational.Singleton.Pattern.res differ
diff --git a/Creational.Singleton/Creational.Singleton.Pattern.stat b/Creational.Singleton/Creational.Singleton.Pattern.stat
new file mode 100644
index 0000000..a2c4ee5
--- /dev/null
+++ b/Creational.Singleton/Creational.Singleton.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=221
+OtherSecs=5
+StartTime=12/31/15 2:41:37 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Creational.Singleton/Pattern.pas b/Creational.Singleton/Pattern.pas
new file mode 100644
index 0000000..d4fae1c
--- /dev/null
+++ b/Creational.Singleton/Pattern.pas
@@ -0,0 +1,44 @@
+unit Pattern;
+
+interface
+
+uses SysUtils;
+
+type
+ TSingle = class (Tobject)
+ public
+ procedure WriteCount;
+ class function NewInstance: TObject; override;
+ procedure FreeInstance; override;
+end;
+
+implementation
+
+var
+ Instance: TObject = nil;
+ nCount: Integer = 0;
+
+procedure TSingle.FreeInstance;
+begin
+ Dec (nCount);
+ if nCount = 0 then
+ begin
+ inherited FreeInstance;
+ Instance := nil;
+ end;
+end;
+
+class function TSingle.NewInstance: TObject;
+begin
+ if not Assigned (Instance) then
+ Instance := inherited NewInstance;
+ Result := Instance;
+ Inc (nCount);
+end;
+
+procedure TSingle.WriteCount;
+begin
+ WriteLn('Count = ' + IntToStr(nCount));
+end;
+
+end.
diff --git a/Delphi.Design.Patterns.groupproj b/Delphi.Design.Patterns.groupproj
new file mode 100644
index 0000000..8a9d0dc
--- /dev/null
+++ b/Delphi.Design.Patterns.groupproj
@@ -0,0 +1,254 @@
+
+
+ {14287530-7bfe-4394-a363-447f24eec927}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default.Personality
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Structural.Adapter/Pattern.pas b/Structural.Adapter/Pattern.pas
new file mode 100644
index 0000000..c9bdce7
--- /dev/null
+++ b/Structural.Adapter/Pattern.pas
@@ -0,0 +1,66 @@
+unit Pattern;
+
+interface
+
+uses SysUtils, Windows;
+
+type
+ TAdaptee = class
+ public
+ function SpecificRequest(a, b: Double): Double;
+ end;
+
+ ITarget = interface
+ ['{7422D6B2-5601-4DB6-AF78-63524D1ED7A8}']
+ function Request(i: Integer): string;
+ end;
+
+ TAdapter = class(TAdaptee, ITarget, IInterface)
+ private
+ FRefCount: Integer;
+ public
+ function Request(i: Integer): string;
+ protected
+ function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
+ function _AddRef: Integer; stdcall;
+ function _Release: Integer; stdcall;
+ end;
+
+implementation
+
+{ TAdaptee }
+
+function TAdaptee.SpecificRequest(a, b: Double): Double;
+begin
+ Result := a / b;
+end;
+
+{ TAdapter }
+
+function TAdapter.Request(i: Integer): string;
+begin
+ Result := 'Rough estimate is '
+ + IntToStr(Round(SpecificRequest(i, 3)));
+end;
+
+function TAdapter.QueryInterface(const IID: TGUID; out Obj): HResult;
+begin
+ if GetInterface(IID, Obj) then
+ Result := 0
+ else
+ Result := E_NOINTERFACE;
+end;
+
+function TAdapter._AddRef: Integer;
+begin
+ Result := InterlockedIncrement(FRefCount);
+end;
+
+function TAdapter._Release: Integer;
+begin
+ Result := InterlockedDecrement(FRefCount);
+ if Result = 0 then
+ Destroy;
+end;
+
+end.
diff --git a/Structural.Adapter/Structural.Adapter.Pattern.dpr b/Structural.Adapter/Structural.Adapter.Pattern.dpr
new file mode 100644
index 0000000..3f6d04c
--- /dev/null
+++ b/Structural.Adapter/Structural.Adapter.Pattern.dpr
@@ -0,0 +1,33 @@
+program Structural.Adapter.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ adaptee: TAdaptee;
+ target: ITarget;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ adaptee := TAdaptee.Create;
+ try
+ WriteLn('Before the new standard' + #10 + 'Precise reading:');
+ WriteLn(adaptee.SpecificRequest(5, 3));
+
+ target := TAdapter.Create;
+ WriteLn(#10 + 'Moving to new standard');
+ WriteLn(target.Request(5));
+
+ ReadLn;
+ finally
+ adaptee.Free;
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Adapter/Structural.Adapter.Pattern.dproj b/Structural.Adapter/Structural.Adapter.Pattern.dproj
new file mode 100644
index 0000000..983515a
--- /dev/null
+++ b/Structural.Adapter/Structural.Adapter.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {e2547eae-1b44-4e29-86c4-2f565e45b9b9}
+ Debug
+ DCC32
+ Structural.Adapter.Pattern.exe
+ Structural.Adapter.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Adapter_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Adapter.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Adapter/Structural.Adapter.Pattern.res b/Structural.Adapter/Structural.Adapter.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Adapter/Structural.Adapter.Pattern.res differ
diff --git a/Structural.Adapter/Structural.Adapter.Pattern.stat b/Structural.Adapter/Structural.Adapter.Pattern.stat
new file mode 100644
index 0000000..03d61ae
--- /dev/null
+++ b/Structural.Adapter/Structural.Adapter.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=400
+OtherSecs=12
+StartTime=12/31/15 2:34:40 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=8
diff --git a/Structural.Bridge/Pattern.pas b/Structural.Bridge/Pattern.pas
new file mode 100644
index 0000000..8092f26
--- /dev/null
+++ b/Structural.Bridge/Pattern.pas
@@ -0,0 +1,61 @@
+unit Pattern;
+
+interface
+
+uses
+ SysUtils;
+
+type
+ IBridge = interface
+ ['{FB1F4FB1-8AD8-48FD-AEA5-1E33B4628879}']
+ function OperationImp: String;
+ end;
+
+ TAbstraction = class
+ private
+ FBridge: IBridge;
+ public
+ constructor Create(implement: IBridge);
+ function Operation: string;
+ end;
+
+ TImplementationA = class(TinterfacedObject, IBridge)
+ public
+ function OperationImp: string;
+ end;
+
+ TImplementationB = class(TInterfacedObject, IBridge)
+ public
+ function OperationImp: string;
+ end;
+
+implementation
+
+{ TAbstraction }
+
+constructor TAbstraction.Create(implement: IBridge);
+begin
+ inherited Create();
+ FBridge := implement;
+end;
+
+function TAbstraction.Operation: string;
+begin
+ WriteLn('Abstraction' + ' <<< BRIDGE >>> ' + FBridge.OperationImp);
+end;
+
+{ TImplemetationA }
+
+function TImplementationA.OperationImp: string;
+begin
+ Result := 'Implementation A';
+end;
+
+{ TImplementationB }
+
+function TImplementationB.OperationImp: string;
+begin
+ Result := 'Implementation B';
+end;
+
+end.
diff --git a/Structural.Bridge/Structural.Bridge.Pattern.dpr b/Structural.Bridge/Structural.Bridge.Pattern.dpr
new file mode 100644
index 0000000..afe7690
--- /dev/null
+++ b/Structural.Bridge/Structural.Bridge.Pattern.dpr
@@ -0,0 +1,31 @@
+program Structural.Bridge.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ abstraction: TAbstraction;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ try
+ abstraction := TAbstraction.Create(TImplementationA.Create);
+ WriteLn(abstraction.Operation);
+
+ abstraction.Free;
+ abstraction := TAbstraction.Create(TImplementationB.Create);
+ WriteLn(abstraction.Operation);
+
+ ReadLn;
+ finally
+ FreeAndNil(abstraction);
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Bridge/Structural.Bridge.Pattern.dproj b/Structural.Bridge/Structural.Bridge.Pattern.dproj
new file mode 100644
index 0000000..998ecba
--- /dev/null
+++ b/Structural.Bridge/Structural.Bridge.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {8b6e2577-f71f-4728-8a6a-12c1e2d7ec84}
+ Debug
+ DCC32
+ Structural.Bridge.Pattern.exe
+ Structural.Bridge.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1025
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Bridge_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ Debug
+
+
+ true
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Bridge.Pattern.dpr
+
+
+
+ False
+ False
+ True
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Bridge/Structural.Bridge.Pattern.res b/Structural.Bridge/Structural.Bridge.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Bridge/Structural.Bridge.Pattern.res differ
diff --git a/Structural.Bridge/Structural.Bridge.Pattern.stat b/Structural.Bridge/Structural.Bridge.Pattern.stat
new file mode 100644
index 0000000..4aff581
--- /dev/null
+++ b/Structural.Bridge/Structural.Bridge.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=333
+OtherSecs=28
+StartTime=12/31/15 12:53:27 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Structural.Composite/Pattern.pas b/Structural.Composite/Pattern.pas
new file mode 100644
index 0000000..0f9b387
--- /dev/null
+++ b/Structural.Composite/Pattern.pas
@@ -0,0 +1,185 @@
+unit Pattern;
+
+interface
+
+uses
+ SysUtils, Classes;
+
+type
+ IComponent = interface
+ ['{991C9839-DE75-4687-B194-D820968DBB8E}']
+ procedure Add(c: IComponent);
+ function Remove(c: IComponent): IComponent;
+ function Display(depth: integer): string;
+ function Find(c: IComponent): IComponent;
+ function GetName: string;
+ procedure SetName(Value: string);
+ property Name: string read GetName write SetName;
+ end;
+
+ TSingle = class(TInterfacedObject, IComponent)
+ private
+ FName: string;
+ public
+ constructor Create(n: string);
+ destructor Destroy; override;
+ procedure Add(c: IComponent);
+ function Remove(c: IComponent): IComponent;
+ function Display(depth: integer): string;
+ function Find(c: IComponent): IComponent;
+ function GetName: string;
+ procedure SetName(Value: string);
+ property Name: string read GetName write SetName;
+ end;
+
+ TComposite = class(TInterfacedObject, IComponent)
+ private
+ FList: TInterfaceList;
+ FName: string;
+ FHolder: IComponent;
+ public
+ constructor Create(n: string);
+ destructor Destroy; override;
+ procedure Add(c: IComponent);
+ function Remove(c: IComponent): IComponent;
+ function Display(depth: integer): string;
+ function Find(c: IComponent): IComponent;
+ function GetName: string;
+ procedure SetName(Value: string);
+ property Name: string read GetName write SetName;
+ end;
+
+implementation
+
+{ TComp }
+
+procedure TSingle.Add(c: IComponent);
+begin
+ WriteLn('Cannot add to an Item');
+end;
+
+constructor TSingle.Create(n: string);
+begin
+ inherited Create;
+ SetName(n);
+end;
+
+destructor TSingle.Destroy;
+begin
+ inherited;
+end;
+
+function TSingle.Display(depth: integer): string;
+begin
+ Result := IntToStr(depth) + ' ' + GetName;
+end;
+
+function TSingle.Find(c: IComponent): IComponent;
+begin
+ if c.Name = FName then
+ Result := Self
+ else
+ Result := nil;
+end;
+
+function TSingle.GetName: string;
+begin
+ Result := FName;
+end;
+
+function TSingle.Remove(c: IComponent): IComponent;
+begin
+ WriteLn('Cannot remove directly');
+ Result := Self;
+end;
+
+procedure TSingle.SetName(Value: string);
+begin
+ FName := Value;
+end;
+
+{ TComposite }
+
+procedure TComposite.Add(c: IComponent);
+begin
+ FList.Add(c);
+end;
+
+constructor TComposite.Create(n: string);
+begin
+ inherited Create;
+ FHolder := nil;
+ FName := n;
+ FList := TInterfaceList.Create;
+end;
+
+destructor TComposite.Destroy;
+var
+ i: integer;
+begin
+ FList.Clear;
+ FreeAndNil(FList);
+ inherited;
+end;
+
+function TComposite.Display(depth: integer): string;
+var
+ s: String;
+ i: Integer;
+begin
+ s := 'Set ' + FName + ' length: ' + IntToStr(FList.Count) + #10;
+ for I := 0 to FList.Count - 1 do begin
+ s := s + IComponent(FList.Items[i]).Display(depth + 2) + #10;
+ end;
+ Result := s;
+end;
+
+function TComposite.Find(c: IComponent): IComponent;
+var
+ f: IComponent;
+ i: Integer;
+begin
+ FHolder := Self;
+ if c.Name = FName then begin
+ Result := Self;
+ Exit;
+ end;
+ f := nil;
+ for i := 0 to FList.Count - 1 do begin
+ f := IComponent(FList.Items[i]).Find(c);
+ if (f <> nil) then begin
+ Result := f;
+ exit;
+ end;
+ end;
+ Result := f;
+end;
+
+function TComposite.GetName: string;
+begin
+ Result := FName;
+end;
+
+function TComposite.Remove(c: IComponent): IComponent;
+var
+ i: Integer;
+begin
+ FHolder := Self;
+ if FHolder <> nil then begin
+ for i := 0 to FList.Count - 1 do begin
+ if ((FList.Items[i] as IComponent).Name = c.Name) then begin
+ FList.Remove(c);
+ end;
+ end;
+ Result := FHolder;
+ end else begin
+ Result := Self;
+ end;
+end;
+
+procedure TComposite.SetName(Value: string);
+begin
+ FName := Value;
+end;
+
+end.
diff --git a/Structural.Composite/Structural.Composite.Pattern.dpr b/Structural.Composite/Structural.Composite.Pattern.dpr
new file mode 100644
index 0000000..5e50ed7
--- /dev/null
+++ b/Structural.Composite/Structural.Composite.Pattern.dpr
@@ -0,0 +1,88 @@
+program Structural.Composite.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ album, point, c: IComponent;
+
+begin
+ ReportMemoryLeaksOnShutDown := DebugHook <> 0;
+ try
+ try
+ album := TComposite.Create('Album');
+ point := album;
+
+ // AddSet Home
+ c := TComposite.Create('Home');
+ point.Add(c);
+ point := c;
+ // AddPhoto Dinner.jpg
+ c := TSingle.Create('Dinner.jpg');
+ point.Add(c);
+ // AddSet Pets
+ c := TComposite.Create('Pets');
+ point.Add(c);
+ point := c;
+ // AddPhoto Dog.jpg
+ c := TSingle.Create('Dog.jpg');
+ point.Add(c);
+ // AddPhoto Cat.jpg
+ c := TSingle.Create('Cat.jpg');
+ point.Add(c);
+ // Find Album
+ c := TSingle.Create('Album');
+ point := album.Find(c);
+ // AddSet Garden
+ c := TComposite.Create('Garden');
+ point.Add(c);
+ point := c;
+ // AddPhoto Spring.jpg
+ c := TSingle.Create('Spring.jpg');
+ point.Add(c);
+ // AddPhoto Summer.jpg
+ c := TSingle.Create('Summer.jpg');
+ point.Add(c);
+ // AddPhoto Flowers.jpg
+ c := TSingle.Create('Flowers.jpg');
+ point.Add(c);
+ // AddPhoto Trees.jpg
+ c := TSingle.Create('Trees.jpg');
+ point.Add(c);
+ // Display
+ WriteLn(album.Display(0));
+ // Find Pets
+ c := TSingle.Create('Pets');
+ point := album.Find(c);
+ // Find Garden
+ c := TSingle.Create('Garden');
+ point := album.Find(c);
+ // Remove Flowers.jpg
+ c := TSingle.Create('Flowers.jpg');
+ point.Remove(c);
+ // AddPhoto BetterFlowers.jpg
+ c := TSingle.Create('BetterFlowers.jpg');
+ point.Add(c);
+ // Display
+ WriteLn(album.Display(0));
+ // Find Home
+ c := TSingle.Create('Home');
+ point := album.Find(c);
+ // Remove Pets
+ c := TSingle.Create('Pets');
+ point.Remove(c);
+ // Display
+ WriteLn(album.Display(0));
+
+ ReadLn;
+ finally
+
+ end;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Composite/Structural.Composite.Pattern.dproj b/Structural.Composite/Structural.Composite.Pattern.dproj
new file mode 100644
index 0000000..1e222ea
--- /dev/null
+++ b/Structural.Composite/Structural.Composite.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {3356e4b6-e2a5-4283-99ae-d9aa02e7b785}
+ Debug
+ DCC32
+ Structural.Composite.Pattern.exe
+ Structural.Composite.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Composite_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Composite.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Composite/Structural.Composite.Pattern.res b/Structural.Composite/Structural.Composite.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Composite/Structural.Composite.Pattern.res differ
diff --git a/Structural.Composite/Structural.Composite.Pattern.stat b/Structural.Composite/Structural.Composite.Pattern.stat
new file mode 100644
index 0000000..332dcb4
--- /dev/null
+++ b/Structural.Composite/Structural.Composite.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=349
+OtherSecs=6
+StartTime=12/31/15 2:29:48 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Structural.Decorator/Pattern.pas b/Structural.Decorator/Pattern.pas
new file mode 100644
index 0000000..4b41e91
--- /dev/null
+++ b/Structural.Decorator/Pattern.pas
@@ -0,0 +1,94 @@
+unit Pattern;
+
+interface
+ type
+ IComponent = interface
+ ['{8021ECE2-0D60-4C96-99AA-C5A6C515DF52}']
+ function Operation(): String;
+ End;
+
+ TComponent = class (TInterfacedObject, IComponent)
+ public
+ function Operation(): String;
+ end;
+
+ TDecoratorA = class (TInterfacedObject, IComponent)
+ private
+ FComponent: IComponent;
+ public
+ function Operation(): String;
+ constructor Create(c: IComponent);
+ end;
+
+ TDecoratorB = class (TInterfacedObject, IComponent)
+ private
+ FComponent: IComponent;
+ public
+ addedState: String;
+ function Operation(): String;
+ function AddedBehaviour(): String;
+ constructor Create(c: IComponent);
+ end;
+
+ TClient = class
+ class procedure Display(s: String; c: IComponent);
+ end;
+
+
+implementation
+
+{ TComponent }
+
+function TComponent.Operation: String;
+begin
+ Result := 'I am walking ';
+end;
+
+{ TDecoratorA }
+
+constructor TDecoratorA.Create(c: IComponent);
+begin
+ inherited Create;
+ Self.FComponent := c;
+end;
+
+function TDecoratorA.Operation: String;
+var
+ s: String;
+begin
+ s := Self.FComponent.Operation;
+ s := s + 'and listening to Classic FM ';
+ Result := s;
+end;
+
+{ TDecoratorB }
+
+function TDecoratorB.AddedBehaviour: String;
+begin
+ Result := 'and I bouth a capuccino ';
+end;
+
+constructor TDecoratorB.Create(c: IComponent);
+begin
+ inherited Create;
+ Self.FComponent := c;
+ Self.addedState := 'past the coffe shop ';
+end;
+
+function TDecoratorB.Operation: String;
+var
+ s: String;
+begin
+ s := Self.FComponent.Operation;
+ s := s + 'to school ';
+ Result := s;
+end;
+
+{ TClient }
+
+class procedure TClient.Display(s: String; c: IComponent);
+begin
+ WriteLn(s + c.Operation);
+end;
+
+end.
diff --git a/Structural.Decorator/Structural.Decorator.Pattern b/Structural.Decorator/Structural.Decorator.Pattern
new file mode 100644
index 0000000..13d57bc
Binary files /dev/null and b/Structural.Decorator/Structural.Decorator.Pattern differ
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.dpr b/Structural.Decorator/Structural.Decorator.Pattern.dpr
new file mode 100644
index 0000000..034986b
--- /dev/null
+++ b/Structural.Decorator/Structural.Decorator.Pattern.dpr
@@ -0,0 +1,44 @@
+program Structural.Decorator.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ component, decoratorA, decoratorB: IComponent;
+ decB: TDecoratorB;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+
+ try
+ WriteLn('Decorator Pattern' + #10);
+ try
+ component := TComponent.Create;
+ decoratorA := TDecoratorA.Create(component);
+ decoratorB := TDecoratorB.Create(component);
+
+ TClient.Display('1. Basic component : ', component);
+ TClient.Display('2. A-Decorated : ', decoratorA);
+ TClient.Display('3. B-Decorated : ', decoratorB);
+
+ decoratorB := TDecoratorB.Create(decoratorA);
+ TClient.Display('4. B-A-Decorated : ', decoratorB);
+
+ decB := TDecoratorB.Create(component);
+ decoratorA := TDecoratorA.Create(decB);
+ TClient.Display('5. A-B-Decorated : ', decoratorA);
+ WriteLn(decB.addedState + decB.AddedBehaviour);
+
+ finally
+
+ end;
+
+ ReadLn;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.dproj b/Structural.Decorator/Structural.Decorator.Pattern.dproj
new file mode 100644
index 0000000..17c8e6b
--- /dev/null
+++ b/Structural.Decorator/Structural.Decorator.Pattern.dproj
@@ -0,0 +1,254 @@
+
+
+ {2aff03fe-5f85-4a0c-9ea3-0af022d8400e}
+ Debug
+ DCC32
+ Structural.Decorator.Pattern.exe
+ Structural.Decorator.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Decorator_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Debug
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Decorator.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.entitlements b/Structural.Decorator/Structural.Decorator.Pattern.entitlements
new file mode 100644
index 0000000..cae6150
--- /dev/null
+++ b/Structural.Decorator/Structural.Decorator.Pattern.entitlements
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.info.plist b/Structural.Decorator/Structural.Decorator.Pattern.info.plist
new file mode 100644
index 0000000..e69de29
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.res b/Structural.Decorator/Structural.Decorator.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Decorator/Structural.Decorator.Pattern.res differ
diff --git a/Structural.Decorator/Structural.Decorator.Pattern.stat b/Structural.Decorator/Structural.Decorator.Pattern.stat
new file mode 100644
index 0000000..6622f36
--- /dev/null
+++ b/Structural.Decorator/Structural.Decorator.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=209
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=98854
+OtherSecs=337
+StartTime=12/31/15 11:18:15 AM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Structural.Facade/Pattern.pas b/Structural.Facade/Pattern.pas
new file mode 100644
index 0000000..2681984
--- /dev/null
+++ b/Structural.Facade/Pattern.pas
@@ -0,0 +1,93 @@
+unit Pattern;
+
+interface
+
+type
+
+ TSystemA = class
+ private
+ function A1: string;
+ end;
+
+ TSystemB = class
+ private
+ function B1: string;
+ end;
+
+ TSystemC = class
+ private
+ function C1: string;
+ end;
+
+ TFacade = class
+ public
+ class procedure Operation1;
+ class procedure Operation2;
+ end;
+
+implementation
+
+{ TSystemA }
+
+function TSystemA.A1: string;
+begin
+ Result := 'System A, Method A1' + #10;
+end;
+
+{ TSystemB }
+
+function TSystemB.B1: string;
+begin
+ Result := 'System B, Method B1' + #10;
+end;
+
+{ TSystemC }
+
+function TSystemC.C1: string;
+begin
+ Result := 'System C, Method C1' + #10;
+end;
+
+{ TFacade }
+
+class procedure TFacade.Operation1;
+var
+ sysA: TSystemA;
+ sysB: TSystemB;
+ sysC: TSystemC;
+begin
+ sysA := TSystemA.Create;
+ sysB := TSystemB.Create;
+ sysC := TSystemC.Create;
+ try
+ WriteLn('Operation 1' + #10 +
+ sysA.A1 +
+ sysB.B1 +
+ sysC.C1);
+
+ finally
+ sysA.Free;
+ sysB.Free;
+ sysC.Free;
+ end;
+end;
+
+class procedure TFacade.Operation2;
+var
+ sysB: TSystemB;
+ sysC: TSystemC;
+begin
+ sysB := TSystemB.Create;
+ sysC := TSystemC.Create;
+ try
+ WriteLn('Operation 1' + #10 +
+ sysB.B1 +
+ sysC.C1);
+
+ finally
+ sysB.Free;
+ sysC.Free;
+ end;
+end;
+
+end.
diff --git a/Structural.Facade/Structural.Facade.Pattern.dpr b/Structural.Facade/Structural.Facade.Pattern.dpr
new file mode 100644
index 0000000..05ee36c
--- /dev/null
+++ b/Structural.Facade/Structural.Facade.Pattern.dpr
@@ -0,0 +1,20 @@
+program Structural.Facade.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+ try
+ TFacade.Operation1;
+ TFacade.Operation2;
+
+ ReadLn;
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Facade/Structural.Facade.Pattern.dproj b/Structural.Facade/Structural.Facade.Pattern.dproj
new file mode 100644
index 0000000..baf037c
--- /dev/null
+++ b/Structural.Facade/Structural.Facade.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {7867179d-8ff8-48ad-96ed-c0f5add824b1}
+ Debug
+ DCC32
+ Structural.Facade.Pattern.exe
+ Structural.Facade.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Facade_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Facade.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Facade/Structural.Facade.Pattern.res b/Structural.Facade/Structural.Facade.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Facade/Structural.Facade.Pattern.res differ
diff --git a/Structural.Facade/Structural.Facade.Pattern.stat b/Structural.Facade/Structural.Facade.Pattern.stat
new file mode 100644
index 0000000..f072ae0
--- /dev/null
+++ b/Structural.Facade/Structural.Facade.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=307
+OtherSecs=2
+StartTime=12/31/15 2:34:58 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Structural.Flyweight/Pattern.pas b/Structural.Flyweight/Pattern.pas
new file mode 100644
index 0000000..109f893
--- /dev/null
+++ b/Structural.Flyweight/Pattern.pas
@@ -0,0 +1,12 @@
+unit Pattern;
+
+interface
+
+implementation
+
+type
+ IFlyweight = interface
+
+ end;
+
+end.
diff --git a/Structural.Flyweight/Structural.Flyweight.Pattern.dpr b/Structural.Flyweight/Structural.Flyweight.Pattern.dpr
new file mode 100644
index 0000000..dd23f06
--- /dev/null
+++ b/Structural.Flyweight/Structural.Flyweight.Pattern.dpr
@@ -0,0 +1,16 @@
+program Structural.Flyweight.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+begin
+ try
+ { TODO -oUser -cConsole Main : Insert code here }
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Flyweight/Structural.Flyweight.Pattern.dproj b/Structural.Flyweight/Structural.Flyweight.Pattern.dproj
new file mode 100644
index 0000000..e594672
--- /dev/null
+++ b/Structural.Flyweight/Structural.Flyweight.Pattern.dproj
@@ -0,0 +1,237 @@
+
+
+ {c934c540-64d5-480f-a57a-1c12b1700c2a}
+ Debug
+ DCC32
+ Structural.Flyweight.Pattern.exe
+ Structural.Flyweight.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Flyweight_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Flyweight.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
+
+
diff --git a/Structural.Flyweight/Structural.Flyweight.Pattern.res b/Structural.Flyweight/Structural.Flyweight.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Flyweight/Structural.Flyweight.Pattern.res differ
diff --git a/Structural.Flyweight/Structural.Flyweight.Pattern.stat b/Structural.Flyweight/Structural.Flyweight.Pattern.stat
new file mode 100644
index 0000000..0b561a4
--- /dev/null
+++ b/Structural.Flyweight/Structural.Flyweight.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=115
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=284
+OtherSecs=17
+StartTime=12/31/15 2:30:18 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1
diff --git a/Structural.Proxy/Pattern.pas b/Structural.Proxy/Pattern.pas
new file mode 100644
index 0000000..5772d83
--- /dev/null
+++ b/Structural.Proxy/Pattern.pas
@@ -0,0 +1,94 @@
+unit Pattern;
+
+interface
+
+uses
+ SysUtils;
+
+type
+ ISubject = interface
+ ['{78E26A3C-A657-4327-93CB-F3EB175AF85A}']
+ function Request(): string;
+ end;
+
+ IProtected = interface
+ ['{928BA576-0D8D-47FE-9301-DA3D8F9639AF}']
+ function Authenticate(supplied: string): String;
+ end;
+
+ TSubject = class
+ public
+ function Request(): string;
+ end;
+
+ TProxy = class (TInterfacedObject, ISubject)
+ private
+ FSubject: TSubject;
+ public
+ function Request(): String;
+ destructor Destroy(); override;
+ end;
+
+ TProtectionProxy = class (TInterfacedObject, ISubject, IProtected)
+ private
+ FSubject: TSubject;
+ const FPassword: String = 'Abracadabra';
+ public
+ destructor Destroy(); override;
+ function Authenticate(supplied: String): String;
+ function Request(): String;
+ end;
+
+implementation
+
+destructor TProxy.Destroy;
+begin
+ FreeAndNil(FSubject);
+ inherited;
+end;
+
+function TProxy.Request: String;
+begin
+ if FSubject = nil then begin
+ WriteLn('Subject Inactive');
+ FSubject := TSubject.Create;
+ end;
+ WriteLn('Subject active');
+ Result := 'Proxy: Call to ' + FSubject.Request;
+end;
+
+{ TSubject }
+
+function TSubject.Request: string;
+begin
+ Result := 'Subject Request Choose left door' + #10;
+end;
+
+{ TProtectionProxy }
+
+function TProtectionProxy.Authenticate(supplied: String): String;
+begin
+ if (supplied <> FPassword) then begin
+ Result := 'Protection proxy: No Access!';
+ end else begin
+ FSubject := TSubject.Create;
+ Result := 'Protection Proxy: Authenticated';
+ end;
+end;
+
+destructor TProtectionProxy.Destroy;
+begin
+ FreeAndNil(FSubject);
+ inherited;
+end;
+
+function TProtectionProxy.Request: String;
+begin
+ if FSubject = nil then begin
+ Result := 'Protection Proxy: Authenticate first!';
+ end else begin
+ Result := 'Protection Proxy: Call to ' + FSubject.Request;
+ end;
+end;
+
+end.
diff --git a/Structural.Proxy/Structural.Proxy.Pattern.dpr b/Structural.Proxy/Structural.Proxy.Pattern.dpr
new file mode 100644
index 0000000..a7ed91b
--- /dev/null
+++ b/Structural.Proxy/Structural.Proxy.Pattern.dpr
@@ -0,0 +1,41 @@
+program Structural.Proxy.Pattern;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils,
+ Pattern in 'Pattern.pas';
+
+var
+ subject: ISubject;
+ protect: IProtected;
+
+begin
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
+
+ try
+ WriteLn('Proxy Pattern' + #10);
+
+ try
+ subject := TProxy.Create;
+ WriteLn(subject.Request);
+ WriteLn(subject.Request);
+
+ subject := nil;
+ subject := TProtectionProxy.Create;
+ WriteLn(subject.Request);
+ if Supports(subject, IProtected, protect) then begin
+ WriteLn(protect.Authenticate('Secret'));
+ WriteLn(protect.Authenticate('Abracadabra'));
+ end;
+ WriteLn(subject.Request);
+ ReadLn;
+ finally
+
+ end;
+
+ except
+ on E:Exception do
+ Writeln(E.Classname, ': ', E.Message);
+ end;
+end.
diff --git a/Structural.Proxy/Structural.Proxy.Pattern.dproj b/Structural.Proxy/Structural.Proxy.Pattern.dproj
new file mode 100644
index 0000000..7750251
--- /dev/null
+++ b/Structural.Proxy/Structural.Proxy.Pattern.dproj
@@ -0,0 +1,236 @@
+
+
+ {83b14f8c-eea8-4b6d-9d23-c22f157e0d32}
+ Debug
+ DCC32
+ Structural.Proxy.Pattern.exe
+ Structural.Proxy.Pattern.dpr
+ None
+ 18.1
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Structural_Proxy_Pattern
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ true
+ true
+ true
+ Debug
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(MSBuildProjectName)
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ Debug
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ true
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ 7.0
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ Debug
+
+
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Structural.Proxy.Pattern.dpr
+
+
+
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/Structural.Proxy/Structural.Proxy.Pattern.res b/Structural.Proxy/Structural.Proxy.Pattern.res
new file mode 100644
index 0000000..6876088
Binary files /dev/null and b/Structural.Proxy/Structural.Proxy.Pattern.res differ
diff --git a/Structural.Proxy/Structural.Proxy.Pattern.stat b/Structural.Proxy/Structural.Proxy.Pattern.stat
new file mode 100644
index 0000000..5d91682
--- /dev/null
+++ b/Structural.Proxy/Structural.Proxy.Pattern.stat
@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=1
+CompileSecs=289
+OtherSecs=8
+StartTime=12/31/15 12:53:18 PM
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1