code: public String rate(RateCondition condition) {
          String description;
          if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION) != null) {
              description = condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION);
          } else {
              description = condition.getDataId();
          }
          switch (condition.getDirection()) {
              case DECREASING:
                  description += " decreasing ";
                  break;
              case INCREASING:
                  description += " increasing ";
                  break;
              case NA:
                  break;
              default:
                  throw new IllegalArgumentException(condition.getDirection().name());
          }
          switch (condition.getOperator()) {
              case GT:
                  description += " greater than ";
                  break;
              case GTE:
                  description += " greater or equal than ";
                  break;
              case LT:
                  description += " less than ";
                  break;
              case LTE:
                  description += " less or equal than ";
                  break;
              default:
                  throw new IllegalArgumentException(condition.getOperator().name());
          }
          description += decimalFormat.format(condition.getThreshold());
          if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_UNIT) != null) {
              description += " " + condition.getContext().get(CONTEXT_PROPERTY_UNIT);
          }
          switch (condition.getPeriod()) {
              case DAY:
                  description = " per day ";
                  break;
              case HOUR:
                  description = " per hour ";
                  break;
              case MINUTE:
                  description = " per minute ";
                  break;
              case SECOND:
                  description = " per second ";
                  break;
              case WEEK:
                  description = " per week ";
                  break;
              default:
                  throw new IllegalArgumentException(condition.getOperator().name());
          }
          return description;
      }
docs: Create a description for a RateCondition object.
  
  @param condition the condition
  @return a description to be used on email templates