简体   繁体   English

霍夫曼编码UML图

[英]Huffman coding UML diagram

I wrote a huffman code and it has 5 classes: huffcode, leaf, node, tree and main. 我写了一个霍夫曼代码,它有5个类:huffcode,叶子,节点,树和main。 I have to create a uml diagram for this program. 我必须为此程序创建一个uml图。 I already created the diagram for leaf, node and tree. 我已经为叶,节点和树创建了图表。 But I dont know what relationship huffcode has with other class. 但是我不知道huffcode与其他类有什么关系。 My huffcode class has all the instruction to make the huffman code. 我的huffcode类具有制作霍夫曼代码的所有指令。 Inputs String is parsed from the main to this class. 输入String从主类解析到此类。 There are methods in huffcode to take inputs create leaves, then nodes. huffcode中有一些方法可以让输入创建叶子,然后创建节点。 Well, in short, all the instruction for the huffman coding is in huffcode. 好吧,简而言之,霍夫曼编码的所有指令都在霍夫编码中。 What kind of relationship does this class have with the other class? 这个班级与另一个班级有什么样的关系? Also, my priority queue is created in huffcode. 另外,我的优先级队列是在huffcode中创建的。

Sounds like your huffcode has compositions to the tree/leaf/node - assuming these will be deleted when an instance of huffcode is deleted. 听起来您的huffcode具有树/叶/节点的组成-假设在删除huffcode实例时这些组成将被删除。 Similarly, main probably has a composition to huffcode. 同样,main可能具有要进行huffcode的组成。

Uses Composite pattern from Gof. 使用来自Gof的Composite模式。 It will help you to write the diagram of huffmans algorithm. 这将帮助您编写霍夫曼算法的图表。 Good luck!!! 祝好运!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM