⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segment.java

📁 MASON代表多主体邻里或网络仿真(Multi-Agent Simulator of Neighborhoods or Networks)。它是乔治梅森大学用Java开发的离散事件多主体仿真核心库
💻 JAVA
字号:
// Class Segmentpackage sim.app.lsystem;import java.awt.*;import sim.portrayal.*;import sim.util.*;public /*strictfp*/ class Segment extends SimplePortrayal2D    {    public double x,y,x2,y2;        public Segment(double x, double y, double dist, double theta)        {        this.x = x;        this.y = y;        this.x2 = /*Strict*/Math.cos(theta)*dist;        this.y2 = /*Strict*/Math.sin(theta)*dist;        }        public void draw(Object object,  final Graphics2D g, final DrawInfo2D info )        {        g.setColor(new Color(0,127,0));        g.drawLine((int)info.draw.x,                   (int)info.draw.y,                   (int)(info.draw.x) + (int)(info.draw.width*x2),                   (int)(info.draw.y) + (int)(info.draw.height*y2));        }    public void hitObjects(DrawInfo2D range, Bag putInHere)        {        // don't want to have any inspectors        }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -