Skip to content
Snippets Groups Projects
Commit e815ee01 authored by AFONY10's avatar AFONY10
Browse files

efe

parent f7eb02ea
No related branches found
No related tags found
No related merge requests found
No preview for this file type
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ATB_ChainPattern.ConcreteHandlers
{
internal class CommodityHandler
{
}
}
......@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace ATB_ChainPattern.ConcreteHandlers
{
// Concrete handler for handling cryptocurrency analysis
class CryptoHandlerBase : CurrencyHandlerBase // Should have inherited from CurrencyHandlerBase (diagram)
class CryptoHandler : CurrencyHandlerBase // Should have inherited from CurrencyHandlerBase (diagram)
{
public override void AnalyzeProduct(string productName)
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ATB_ChainPattern.BaseHandlers;
namespace ATB_ChainPattern.ConcreteHandlers
{
public class DistributeRightHandler : ProductHandlerBase
{
public override void AnalyzeProduct(string productName)
{
if (productName == "Bitcoin")
{
Console.WriteLine("CryptoHandler: Analyzing Bitcoin...");
// Perform cryptocurrency analysis
// Determine if Bitcoin is worth buying
Console.WriteLine("Result: Bitcoin is worth buying.");
}
else if (successor != null)
{
successor.AnalyzeProduct(productName);
}
else
{
Console.WriteLine("Error: Product not supported.");
}
}
public void DistributeHandler(string name, string type)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ATB_ChainPattern.BaseHandlers;
namespace ATB_ChainPattern.ConcreteHandlers
{
class ForexHandler : CurrencyHandlerBase
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// This is the dummy data for the products
namespace ATB_ChainPattern.DummyData
{
public class Product
{
public ProductType ProductType { get; set; }
public ProductName ProductName { get; set; }
}
public enum ProductType
{
Forex,
Commodity,
Stock,
Crypto,
OtherCurrency
}
public enum ProductName
{
// Stocks
TeslaStock,
AppleStock,
MicrosoftStock,
GoogleStock,
// Commodities
Gold,
Silver,
Bronze,
// Forex
EURUSD,
GBPUSD,
USDJPY,
USDCAD, // Not worth buying
// Crypto
Bitcoin, // Worth buying
Ethereum, // Worth buying
Ripple, // Not worth buying
Starknet // Not worth buying
}
}
......@@ -19,7 +19,7 @@ namespace ATB_ChainPattern
// Create handlers
var stockHandler = new StockHandlerBase();
var cryptoHandler = new CryptoHandlerBase();
var cryptoHandler = new CryptoHandler();
var currencyHandler = new CurrencyHandlerBase();
// Set up the chain
stockHandler.SetSuccessor(cryptoHandler);
......
......@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("ATB-ChainPattern")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6b9476b826f97ec3613f9bdc9ae2dcd0627be7b9")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7eb02ea0690b745941439ef1b0f329c82bfcd64")]
[assembly: System.Reflection.AssemblyProductAttribute("ATB-ChainPattern")]
[assembly: System.Reflection.AssemblyTitleAttribute("ATB-ChainPattern")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
f49887bf864d916ce52b353d830f482f0b850bb189cbab79093b388c01af358f
a33a50577ff0071419572e6f0a36f0d66edca70bb42400d9f9c33a1c8c3444a3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment