摘要: 术语 节点深度:对任意节点x,x节点的深度表示为根节点到x节点的路径长度。所以根节点深度为0,第二层节点深度为1,以此类推 节点高度:对任意节点x,叶子节点到x节点的路径长度就是节点x的高度 树的深度:一棵树中节点的最大深度就是树的深度,也称为高度 父节点:若一个节点含有子节点,则这个节点称为其子节 阅读全文
posted @ 2022-01-19 17:19 icxl 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 侠盗飞车存档 钱 人物坐标 目前任务关卡 犯罪星级 public class GameData { public double Money { get; set; } public int TaskLevel { get; set; } public int X { get; set; } publ 阅读全文
posted @ 2022-01-17 10:44 icxl 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 例子 访问者模式 Element → AbsPlatform -》 User,Guild,GuildMember Visitor → AbsVisitor -》 教会管理员,教会创建者,平台管理员 ObjectStructure → BusinessReport public abstract cl 阅读全文
posted @ 2022-01-14 20:52 icxl 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 例子 责任链 教会(同工,管理员,创建者) 修改教会成员名称(同工) 去教会祷告请假(管理员) 教会关门,隐退(创建者) public abstract class AbsGuildManager { private string _name; protected AbsGuildManager S 阅读全文
posted @ 2022-01-14 20:49 icxl 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 例子 对一个价钱做不同策略;原价,打折,返利 public abstract class CashSuper { public abstract double AcceptCash(double money); } public class NormalCash : CashSuper { publ 阅读全文
posted @ 2022-01-14 20:47 icxl 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 例子 我们经常坐电梯都知道,电梯有多种状态,就按最简单的来说,包括运行状态、停止状态、开门状态、闭门状态。下面就以电梯运行为例,举一个具体的实例,UML图如下: public abstract class LiftState { protected LiftContext LiftContext; 阅读全文
posted @ 2022-01-14 20:45 icxl 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 例子 打牌(斗地主规则) 初始钱50 赢牌对面扣钱 地主赢扣20(地主40块) 农民赢扣20(农民一人10块) public abstract class AbsMediator { public abstract void Register(Person obj); /// <summary> / 阅读全文
posted @ 2022-01-14 20:43 icxl 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 例子 教会(Subject) 教会成员(Observer) public class GuildSubject { private List<AbsSubscriber<GuildSubject>> _subscribers; public GuildSubject(string guildName 阅读全文
posted @ 2022-01-14 20:41 icxl 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 例子 public interface ITerator<TSource> { TSource Current { get; } bool HasNext(); void MoveNext(); } public class ArrayIterator<TSource> : ITerator<TSo 阅读全文
posted @ 2022-01-14 20:40 icxl 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 例子 public class CommandLineArgs { public CommandLineArgs(string command, params string[] args) { Command = command; Args = args; } public string Comma 阅读全文
posted @ 2022-01-14 20:38 icxl 阅读(58) 评论(0) 推荐(0) 编辑