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

📄 hilodataimp.java

📁 著名的uncle Bob的Agile software development的代码
💻 JAVA
字号:
package wmsdataimp;

public class HiLoDataImp implements java.io.Serializable,
                                    wmsdata.HiLoData
{
  private double itsHighValue;
  private double itsLowValue;
  private long itsHighTime;
  private long itsLowTime;

  public HiLoDataImp(double initial, long time)
  {
    itsHighValue = itsLowValue = initial;
    itsHighTime = itsLowTime = time;
  }

  public double getHighValue()
  { return itsHighValue; }
  public double getLowValue()
  { return itsLowValue; }
  public long getHighTime()
  { return itsHighTime; }
  public long getLowTime()
  { return itsLowTime; }

  public boolean currentReading(double current, long time)
  {
    boolean rtnVal = false;

    if(current > itsHighValue)
    {
      itsHighTime = time;
      itsHighValue = current;
      rtnVal = true;
    }
    else if(current < itsLowValue)
    {
      itsLowTime = time;
      itsLowValue = current;
      rtnVal = true;
    }

    return rtnVal;
  }

  public void newDay(double initial, long time)
  {
    itsLowValue = itsHighValue = initial;
    itsHighTime = itsLowTime = time;
  }
}

⌨️ 快捷键说明

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