Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
此 11 页 PDF 描述了从 UML 符号到 Java 约定的映射。例如,将游标实现为 Java 枚举、将多重继承减少为单一继承等。
这是关于同一主题的由 4 部分组成的文章:
第 1 部分
第 2 部分
第 3 部分
第 4 部分
This 11-page PDF describes a mapping from UML notation to Java conventions. For example, implementing cursors as Java Enumerations, reducing multiple inheritance to single, etc.
Here is a 4-part article on the same subject:
Part 1
Part 2
Part 3
Part 4
如果您不想使用自动化工具,唯一的选择是打开文本编辑器或 IDE 并手动创建每个 Java 类的 .java 文件。
为每个 UML 类创建一个 Java 类。在这些类中添加所需的所有方法和数据成员。
如果模型需要继承,请让您的 Java 类扩展这些类或实现这些接口。
我是否误读了这个问题?
If you don't want to use an automated tool, the only alternative is to open a text editor or IDE and create each Java class's .java file by hand.
For every UML class, create a Java class. Add all the methods and data members you want in those classes.
If there's inheritance called for by the model, have your Java classes extend those classes or implement those interfaces.
Did I misread this question?
然后使用 Eclipse 或 vi :)
Then use Eclipse or vi :)
如果您知道类图是如何工作的,那么您应该能够从该图中编写 Java 程序。
类图具有属性、功能和关系。在 Java 类中,属性是变量,方法是函数。 Java 中的关系要么是扩展(用于继承),要么是实现。
如果还有其他不明显的具体事情,您可以询问,但您应该能够很容易地将设计转换为代码。
If you know how class diagrams work, then you should be able to write a Java program from the diagram.
A class diagram has attributes, functions and relationships. In a Java class, the attributes are variables and the methods are functions. The relationships in Java are either extends (for inheritance) or implements.
If there are other specific things that aren't obvious you could ask, but you should be able to translate to code from the design pretty easily.