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

📄 colormap.java

📁 MASON代表多主体邻里或网络仿真(Multi-Agent Simulator of Neighborhoods or Networks)。它是乔治梅森大学用Java开发的离散事件多主体仿真核心库
💻 JAVA
字号:
package sim.util.gui;import java.awt.*;/** * ColorMap is a interface for mapping numerical values to colors. * The easiest way to implement getRGB(level) is simply with getColor(level).getRGB(). * validLevel indicates whether the numerical value is within a range that seems "reasonable" * for coding into colors -- however ColorMap should provide *some* feasible color for * *any* given value, including NaN.  defaultValue() provides a default numerical value * within the "reasonable" range -- often the minimum value.  It must be the case that * validLevel(defaultValue()) == true. * * @author Gabriel Catalin Balan *  */public interface ColorMap     {    /** Returns a color for the given level */    public Color getColor(double level);    /** Returns the RGB values, plus alpha, for a color for the given level.  The byte ordering should be in the same fashion that Color.getRGB() is provided. */    public int getRGB(double level);    /** Returns the alpha value for a color for the given level.  This could be simply written as                     <p><code>return getRGB(level) >>> 24 ; </code>                    <p>...or it could be written as:                    <p><code>return getColor(level).getAlpha() </code>                    <p>...however it's likely that it thie method could be written more efficiently than either of these.    */    public int getAlpha(double level);    /** Returns true if a level is "valid" (it provides a meaningful color) */    public boolean validLevel(double level);    /** Returns <i>some</i> level which is valid (that is, validLevel(defaultValue()) should        always return true).  This is commonly provided to give the user a level to replace        an "invalid" level he's typed in. */    public double defaultValue();    }

⌨️ 快捷键说明

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