📄 myparticle.java
字号:
package net.sourceforge.jswarm_pso.example_2;import net.sourceforge.jswarm_pso.Particle;/** * Simple particle example * @author Pablo Cingolani <pcingola@sinectis.com> */public class MyParticle extends Particle { /** Number of dimentions for this particle */ public static int NUMBER_OF_DIMENTIONS = 2; /** Totally useless, just to see how an example with local data works */ double particleData; //------------------------------------------------------------------------- // Constructor/s //------------------------------------------------------------------------- /** * Default constructor */ public MyParticle() { super(NUMBER_OF_DIMENTIONS); // Create a 2-dimentional particle particleData = Math.random(); // Add some custom 'local' data } //------------------------------------------------------------------------- // Methods //------------------------------------------------------------------------- /** Convert to string() */ public String toString() { String str = super.toString(); return str + "\tParticle's data: " + particleData + "\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -