上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 118 下一页
摘要: GeovinDuMemento.py # 备忘录模式 Memento Pattern GeovinDuMemento.py # class Memento: def __init__(self, value): self.state = value def SetState(self, value) 阅读全文
posted @ 2022-10-27 22:28 ®Geovin Du Dream Park™ 阅读(68) 评论(0) 推荐(0)
摘要: GeovinDuCommand.py # 命令模式 Command Pattern GeovinDuCommand.py # Web Browser: class WebBrowser(object): def __init__(self): self.bookmarks = [] self.cur 阅读全文
posted @ 2022-10-27 22:13 ®Geovin Du Dream Park™ 阅读(27) 评论(0) 推荐(0)
摘要: GeovinDuState.py #状态模式 State Pattern class ComputerState(object): name = "state" allowed = [] def switch(self, state): """ Switch to new state """ if 阅读全文
posted @ 2022-10-26 23:43 ®Geovin Du Dream Park™ 阅读(27) 评论(0) 推荐(0)
摘要: GeovinDuTemplate.py # 模板方法模式 Template Method Pattern def get_text(): return "text 文件" """ method to get the xml version of file""" def get_xml(): retu 阅读全文
posted @ 2022-10-26 22:49 ®Geovin Du Dream Park™ 阅读(22) 评论(0) 推荐(0)
摘要: GeovinDuVisitor.py # 访问者模式 Visitor Pattern GeovinDuVistitor.py class Courses_At_GFG: def accept(self, visitor): visitor.visit(self) def teaching(self, 阅读全文
posted @ 2022-10-25 23:10 ®Geovin Du Dream Park™ 阅读(28) 评论(0) 推荐(0)
摘要: GeovinDuStrategy.py # 策略模式 Strategy Pattern Types of trading strategies: class RiskyTradingStrategy(object): def MakeTrades(self): print("进行高风险交易!") c 阅读全文
posted @ 2022-10-25 21:54 ®Geovin Du Dream Park™ 阅读(35) 评论(0) 推荐(0)
摘要: GeovinDuObserver.py # 观察者模式 Observer Pattern # The Observer class that recieves updates from the ticker on a specific symbol: class TickerObserver(obj 阅读全文
posted @ 2022-10-24 22:05 ®Geovin Du Dream Park™ 阅读(30) 评论(0) 推荐(0)
摘要: DuMediator.py # 中介者模式 Mediator Pattern import sys # ParticipantReference: class User(object): def __init__(self, med, name): self.mediator = med self. 阅读全文
posted @ 2022-10-24 06:42 ®Geovin Du Dream Park™ 阅读(28) 评论(0) 推荐(0)
摘要: DuIterator.py # 迭代器模式 Iterator Pattern # Doubly Linked List class Node(object): def __init__(self, value, nextNode, prevNode): self.value = value self 阅读全文
posted @ 2022-10-23 23:49 ®Geovin Du Dream Park™ 阅读(31) 评论(0) 推荐(0)
摘要: DuChain.py # 责任链模式 Chain of Responsibility import enum # Item Types: # An enum we'll attach to every game object to specify type: # Requires Python 3. 阅读全文
posted @ 2022-10-23 08:22 ®Geovin Du Dream Park™ 阅读(39) 评论(0) 推荐(0)
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 118 下一页