PatternFlyweight.Chessman
2016-05-27 10:23:38 0 举报
PatternFlyweight.Chessman 是一个设计模式,它属于享元模式的一种变体。享元模式旨在减少应用程序中创建的对象数量,以降低内存占用和提高性能。在 Chessman 场景中,这个模式主要用于处理棋子对象。通过将棋子的外观和行为抽象为一个 Flyweight 对象,我们可以在需要时重复使用这些对象,而不是为每个棋子实例化一个新的对象。这样可以减少内存占用,并提高程序运行速度。 总之,PatternFlyweight.Chessman 是一种优化内存和性能的设计模式,适用于处理大量相似对象的场景。
作者其他创作
大纲/内容
ChessmanWhite
+ getColor() : String
ChessmanBlack
Chessman {abstract}
+ getColor() : String+ loaction(Coordinate coordinate) : void
ChessmanFactory
- instance : ChessmanFactory- ht : Hashtable
- ChessmanFactory()+ getInstance() : ChessmanFactory+ getChessman(String Color) : Chessman
Client
+ main() : void
Coordinate
- x : int- y : int
0 条评论
下一页
为你推荐
查看更多