コード例 #1
0
 static void Main(string[] args)
 {
     var builder = new SandwichBuilder()
                   .WithMeat()
                   .WithCheeseChedar()
                   .WithMayoMustard();
 }
コード例 #2
0
 public void Assemble(SandwichBuilder sandwichBuilder)
 {
     sandwichBuilder.AddBread();
     sandwichBuilder.AddMeats();
     sandwichBuilder.AddCheese();
     sandwichBuilder.AddVeggies();
     sandwichBuilder.AddCondiments();
 }
コード例 #3
0
        public Sandwich ConstructSandwich(SandwichBuilder sandwichBuilder)
        {
            sandwichBuilder.CreateNewSandwich();
            sandwichBuilder.SetSandwichType();
            sandwichBuilder.AddCondiments();
            sandwichBuilder.AddMeat();
            sandwichBuilder.AddVeggies();
            sandwichBuilder.PrepareSandwich();

            return(sandwichBuilder.GetSandwich());
        }
コード例 #4
0
        private SandwichMaker(SandwichType sandwichTyp, bool hasMayo, bool hasMustard)
        {
            switch (sandwichTyp)
            {
            case SandwichType.Bauru:
                _builder = new BauruSandwichBuilder();
                break;

            case SandwichType.Chacarero:
                _builder = new ChacareroSandwichBuilder();
                break;

            case SandwichType.Jambon:
                _builder = new JambonBeurreSandwichBuilder();
                break;

            default:
                _builder = null;
                break;
            }
            _hasMayo = hasMayo; _hasMustard = hasMustard;
        }
コード例 #5
0
 public SandwichMaker(SandwichBuilder builder)
 {
     _builder = builder;
 }
コード例 #6
0
 public SandwichDirector(SandwichBuilder builder)
 {
     this.builder = builder;
 }
コード例 #7
0
 public void ChangeBuilder(SandwichBuilder newBuilder)
 {
     _builder = newBuilder;
 }
コード例 #8
0
 public SandwichMaker(SandwichBuilder builder)
 {
     this.builder = builder;
 }
コード例 #9
0
 public SandwichDirector(SandwichBuilder builder) => _builder = builder;
コード例 #10
0
ファイル: SandwichAssembly.cs プロジェクト: carlostoalz/Udemy
 public SandwichAssembly(SandwichBuilder sadwichBuilder)
 {
     _sadwichBuilder = sadwichBuilder;
 }
コード例 #11
0
 public void Make(SandwichBuilder sandwichBuilder)
 {
     sandwichBuilder.AddBread();
     sandwichBuilder.AddFilling();
     sandwichBuilder.AddSauce();
 }