/** User: dashin Date: 1/18/13 Time: 9:58 PM */
@Service(value = "calculatorService")
public class CalculatorServiceImpl implements CalculatorService {

  private final int TEN = BigDecimal.TEN.intValue();

  @Autowired private final FileAccessSerivce fileAccessSerivce = null;

  @Override
  public float get(long v1) throws ValueNotFoundException {
    float v = fileAccessSerivce.findValue(FILE.F2, v1);
    return v > TEN ? v - TEN : v;
  }

  @Override
  public boolean post(long v2, long v3, long v4) throws ValueNotFoundException {
    boolean isConditionMet = false;
    float f1v3 = fileAccessSerivce.findValue(FILE.F1, v3);
    float value = f1v3 + v2;
    if (f1v3 < TEN) {
      value += TEN;
      isConditionMet = true;
    }
    fileAccessSerivce.putValue(FILE.F2, v4, value);
    return isConditionMet;
  }
}