コード例 #1
0
 public virtual int?TrySolve(CPUProblem p)
 {
     if (threads >= p.RequiredThreads)
     {
         Console.WriteLine("Problem {0} - solved with CPU {1}", p.Name, model);
         return(p.Computation());
     }
     Console.WriteLine("Problem {0} - failed to solve with CPU {1}", p.Name, model);
     return(null);
 }
コード例 #2
0
ファイル: CPU.cs プロジェクト: chlebnymaciej/Design_Patterns
 public int?CanSolve(CPUProblem p)
 {
     if (p.RequiredThreads <= this.threads)
     {
         SolvingInfo.Solved(this.model, p.Name);
         return(p.Computation());
     }
     SolvingInfo.NotSolved(this.model, p.Name);
     return(null);
 }
コード例 #3
0
ファイル: CPU.cs プロジェクト: WojciechKrawczyk/Visitor
 public int?Visit(CPUProblem cPUProblem)
 {
     if (this.threads >= cPUProblem.RequiredThreads)
     {
         System.Console.WriteLine($"{this.model} resolved the problem");
         return(cPUProblem.Computation());
     }
     System.Console.WriteLine($"{this.model} failed to resolve the problem");
     return(null);
 }
コード例 #4
0
ファイル: GPU.cs プロジェクト: chlebnymaciej/Design_Patterns
 public int?CanSolve(CPUProblem p)
 {
     if (DidThermalThrottle())
     {
         SolvingInfo.NotSolved(this.model, p.Name);
         return(null);
     }
     SolvingInfo.Solved(this.model, p.Name);
     this.temperature += CPUProblemTemperatureMultiplier * p.RequiredThreads;
     return(p.Computation());
 }
コード例 #5
0
ファイル: GPU.cs プロジェクト: WojciechKrawczyk/Visitor
 public int?Visit(CPUProblem cPUProblem)
 {
     if (!DidThermalThrottle())
     {
         this.temperature += CPUProblemTemperatureMultiplier * cPUProblem.RequiredThreads;
         System.Console.WriteLine($"{this.model} resolved the problem");
         return(cPUProblem.Computation());
     }
     System.Console.WriteLine($"{this.model} failed to resolve the problem");
     return(null);
 }
コード例 #6
0
 public virtual int?TrySolve(CPUProblem p)
 {
     if (temperature <= MaxTemperature)
     {
         temperature += p.RequiredThreads * CPUProblemTemperatureMultiplier;
         DidThermalThrottle();
         Console.WriteLine("Problem {0} - solved with GPU {1}", p.Name, model);
         return(p.Computation());
     }
     Console.WriteLine("Problem {0} - failed to solve with GPU {1}", p.Name, model);
     return(null);
 }