StarUML

StarUML


软件介绍

  • 操作系统:MAC
  • 软件版本:3.0
  • 软件功能:UML(Unified Modeling Language,统一建模语言) 类图、时序图、状态图绘制

软件安装

  • 打开终端
  • 安装 brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装 npm
brew install node
  • 验证 npm
npm -v 
  • 下载 starUML:http://staruml.io/
  • 软件破解
    • 应用程序  -> StarUML -> 显示包内容 -> Contents/Resources/app.asar
    • 解压文件 -> asar extract app.asar app
    • 修改文件  -> app/src/engine/license-manager.js,将 app/src/engine/license-manager.js 改为 true ,删除下方验证语句
    • 重新打包  -> asar pack app app.asar
    • 替换文件

绘制类图


类图示例

/**
 * 运算接口
 */
public interface ICalculateOperation {

    double calculate(double numberA,double numberB);
}
/**
 * 加法运算
 */
public class AddCalculateOperation implements ICalculateOperation {

    @Override
    public double calculate(double numberA, double numberB) {
        return numberA+numberB;
    }
}
/**
 * 减法运算
 */
public class SubCalculateOperation implements ICalculateOperation {
    @Override
    public double calculate(double numberA, double numberB) {
        return numberA - numberB;
    }
}

/**
 * 运算对象
 */
public class Calculator {

    private double numberA ;

    private double numberB ;

    private ICalculateOperation calculateOperation ;

    public Calculator(double numberA,double numberB,ICalculateOperation calculateOperation){
        this.numberA = numberA;
        this.numberB = numberB;
        this.calculateOperation = calculateOperation;
    }

    public double getCalculateResult(){
        return calculateOperation.calculate(numberA, numberB);
    }

    public double getNumberA() {
        return numberA;
    }

    public void setNumberA(double numberA) {
        this.numberA = numberA;
    }

    public double getNumberB() {
        return numberB;
    }

    public void setNumberB(double numberB) {
        this.numberB = numberB;
    }
}
/**
 * 运算测试类
 */
public class CalculateTest {

    public static void main(String[] args) {
        Calculator addCalculator = new Calculator(1,2,new AddCalculateOperation());
        System.out.println(addCalculator.getCalculateResult());

        Calculator subCalculator = new Calculator(2,2,new SubCalculateOperation());
        System.out.println(subCalculator.getCalculateResult());
    }
}

StarUML_第1张图片


使用总结

  • 接口类图:
    • ToolBox : 选中 Interface ,在绘图区域点击,接口绘制完成
    • Format :绘图区域选中接口,Format --> steretotype display --> label ,类图中显示 interface 而非圆形(默认圆形)
  • 实现关系:
    • 创建接口类后,点击生成实现类
  • 关联关系:
    • 选中关联箭头,拖动鼠标由子类指向父类,实现类指向接口类
    • 选择关联接头,Directed Association ,在属性配置列表中选择聚合、合成
  • 添加参数
    • 类中添加方法后,在右侧 ModelExplorer 中选中方法,右键(键盘区两个手指同时点击)添加 add --> parameter

参考资料

  • mac 下安装和使用 brew
  • MAC上安装npm
  • MAC StarUML 3.0 破解
  • 使用StarUML创建类图

你可能感兴趣的:(职场办公)