@Test public void testAppendHighTemperature() { AppendableTemperature temperature = new AppendableTemperature(TemperatureUnit.C); assertEquals(Temperature.UNKNOWN, temperature.getHigh()); SimpleTemperature append1 = new SimpleTemperature(TemperatureUnit.C); append1.setHigh(5, TemperatureUnit.C); temperature.append(append1); assertEquals(5, temperature.getHigh()); SimpleTemperature append2 = new SimpleTemperature(TemperatureUnit.C); append2.setHigh(10, TemperatureUnit.C); temperature.append(append2); assertEquals(10, temperature.getHigh()); SimpleTemperature append3 = new SimpleTemperature(TemperatureUnit.C); append3.setHigh(3, TemperatureUnit.C); temperature.append(append3); assertEquals(10, temperature.getHigh()); }
public void append(Temperature temperature) { if (getLow() == Temperature.UNKNOWN) { setLow(temperature.getLow(), temperature.getTemperatureUnit()); } else { setLow(Math.min( getLow(), convertValue(temperature.getLow(), temperature.getTemperatureUnit())), getTemperatureUnit()); } if (getHigh() == Temperature.UNKNOWN) { setHigh(temperature.getHigh(), temperature.getTemperatureUnit()); } else { setHigh(Math.max( getHigh(), convertValue(temperature.getHigh(), temperature.getTemperatureUnit())), getTemperatureUnit()); } }
AppendableTemperature extends SimpleTemperature { public void append(Temperature temperature) { if (getLow() == Temperature.UNKNOWN) { setLow(temperature.getLow(), temperature.getTemperatureUnit()); } else { setLow(Math.min( getLow(), convertValue(temperature.getLow(), temperature.getTemperatureUnit())), getTemperatureUnit()); } if (getHigh() == Temperature.UNKNOWN) { setHigh(temperature.getHigh(), temperature.getTemperatureUnit()); } else { setHigh(Math.max( getHigh(), convertValue(temperature.getHigh(), temperature.getTemperatureUnit())), getTemperatureUnit()); } } }
AppendableTemperature extends SimpleTemperature { public void append(Temperature temperature) { if (getLow() == Temperature.UNKNOWN) { setLow(temperature.getLow(), temperature.getTemperatureUnit()); } else { setLow(Math.min( getLow(), convertValue(temperature.getLow(), temperature.getTemperatureUnit())), getTemperatureUnit()); } if (getHigh() == Temperature.UNKNOWN) { setHigh(temperature.getHigh(), temperature.getTemperatureUnit()); } else { setHigh(Math.max( getHigh(), convertValue(temperature.getHigh(), temperature.getTemperatureUnit())), getTemperatureUnit()); } } AppendableTemperature(TemperatureUnit unit); }
AppendableTemperature extends SimpleTemperature { public void append(Temperature temperature) { if (getLow() == Temperature.UNKNOWN) { setLow(temperature.getLow(), temperature.getTemperatureUnit()); } else { setLow(Math.min( getLow(), convertValue(temperature.getLow(), temperature.getTemperatureUnit())), getTemperatureUnit()); } if (getHigh() == Temperature.UNKNOWN) { setHigh(temperature.getHigh(), temperature.getTemperatureUnit()); } else { setHigh(Math.max( getHigh(), convertValue(temperature.getHigh(), temperature.getTemperatureUnit())), getTemperatureUnit()); } } AppendableTemperature(TemperatureUnit unit); void append(Temperature temperature); }
AppendableTemperature extends SimpleTemperature { public void append(Temperature temperature) { if (getLow() == Temperature.UNKNOWN) { setLow(temperature.getLow(), temperature.getTemperatureUnit()); } else { setLow(Math.min( getLow(), convertValue(temperature.getLow(), temperature.getTemperatureUnit())), getTemperatureUnit()); } if (getHigh() == Temperature.UNKNOWN) { setHigh(temperature.getHigh(), temperature.getTemperatureUnit()); } else { setHigh(Math.max( getHigh(), convertValue(temperature.getHigh(), temperature.getTemperatureUnit())), getTemperatureUnit()); } } AppendableTemperature(TemperatureUnit unit); void append(Temperature temperature);  }