uml状态图java代码 uml状态图怎么画

根据UML图,写出Java程序的代码public interface ILeanable{
public void stuy();
}
public interface ITeacher{
public void teach();
}
public class Person{
String name;
}
【uml状态图java代码 uml状态图怎么画】public class Student extends Person implements ILeanable{
int age;
String address;
}
public class Teacher extends Person implements ITeacher{
String major;
int age;
}
如何从JAVA代码生成UML类图推荐使用ModelGoon!
*ModelGoon是什么?
它是一个Eclipse插件,用于基于UML图的模型设计,以及逆向工程(即从已有源代码生成类图等,以作为代码分析或者文档使用) 。
*适用条件
ModelGoon目前最新的版本是3.0.0,适用于Eclipse3.4 , 包括最新的Eclipse 3.6版本
*如何安装
推荐在线安装,site地址是
需要注意的是,有时必须使用代理服务器才能连接成功 。
也可以离线安装,下载包的地址是
下载完该jar之后,直接拷贝到Eclipse安装目录下的dropins目录下,重启Eclipse即可
*如何使用
安装成功后,file=new=other菜单里面会多出一项ModelGoon Diagrams , 在自己已有的java工程中新建一个class diagram,用以生成类图 。创建完成后你会发现生成了一个.mgc后缀的文件,现在你可以用这个文件创建自己的类图了 。用法相当直接,你可以把若干个java类拖拽进这个文件视图中,UML类图自然被生成,以及各个类之间的关系 。
*参考资料
需要注意的是,有时必须使用代理服务器才能连接成功 。
*为什么选择ModelGoon而不是其他的插件
其他的UML插件也能完成类似的功能,但是在安装使用的过程中会碰到种种问题 。
常有人推荐EclipseUML这个插件 , 但是目前这个项目的主页无法打开,似乎已停止维护;
还有Slime UML据说也不错,但是找不到下载源;
此外还有AgileJ口碑也不错,可惜是付费的,没有免费版;
至于papyrusuml , 只是单向的,做模型设计、绘制UML图时使用,而并不支持逆向工程;
按照下列UML图,用java实现代码?Point2D.java
/**
* Title: Point2D.javabr
* Description:
*
* @author 王凯芳
* @date 2020年3月5日 下午7:09:35
* @version 1.0
*/
public class Point2D {
protected float x;
protected float y;
public Point2D() {
super();
}
public Point2D(float x, float y) {
super();
this.x = x;
this.y = y;
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float[] getXY() {
return new float[] { x, y };
}
public void setXY(float x, float y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "("x","y")";
}
}
Point3D.java
/**
* Title: Point3D.javabr
* Description:
*
* @author 王凯芳
* @date 2020年3月5日 下午7:09:35
* @version 1.0
*/
public class Point3D extends Point2D {
private float z;
public Point3D() {
super();
}
public Point3D(float x, float y, float z) {
super();
this.x = x;
this.y = y;
this.z = z;
}
public float getZ() {
return z;
}
public void setZ(float z) {
this.z = z;
}
public float[] getXYZ() {
return new float[] { x, y, z };
}
public void setXYZ(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public String toString() {
return "("x","y","z")";
}
}
uml状态图java代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于uml状态图怎么画、uml状态图java代码的信息别忘了在本站进行查找喔 。

    推荐阅读