/*
 * Copyright Myrrix Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.myrrix.client.translating;

public final class GenericTranslatedRecommendedItem implements TranslatedRecommendedItem {

  private final String itemID;
  private final float value;

  public GenericTranslatedRecommendedItem(String itemID, float value) {
    this.itemID = itemID;
    this.value = value;
  }
  
  @Override
  public String getItemID() {
    return itemID;
  }
  
  @Override
  public float getValue() {
    return value;
  }
  
}

@@ -624,16 +624,241 @@
 ating;%0A%0A
+import java.io.Serializable;%0A%0Aimport com.google.common.base.Preconditions;%0Aimport org.apache.mahout.common.RandomUtils;%0A%0A/**%0A * %3Cp%3EA simple implementation of %7B@link TranslatedRecommendedItem%7D.%3C/p%3E%0A *%0A * @author Sean Owen%0A */%0A
 public f
@@ -937,16 +937,30 @@
 ndedItem
+, Serializable
  %7B%0A%0A  pr
@@ -1022,259 +1022,1010 @@
 %0A%0A  
-public GenericTranslatedRecommendedItem(String itemID, float value) %7B%0A    this.itemID = itemID;%0A    this.value = value;%0A  %7D%0A  %0A  @Override%0A  public String getItemID() %7B%0A    return itemID;%0A  %7D%0A  %0A  @Override%0A  public float getValue() %7B%0A    return value
+/**%0A   * @throws IllegalArgumentException if item is null or value is NaN or infinite%0A   */%0A  public GenericTranslatedRecommendedItem(String itemID, float value) %7B%0A    Preconditions.checkNotNull(itemID);%0A    Preconditions.checkArgument(!Float.isNaN(value) && !Float.isInfinite(value));%0A    this.itemID = itemID;%0A    this.value = value;%0A  %7D%0A  %0A  @Override%0A  public String getItemID() %7B%0A    return itemID;%0A  %7D%0A  %0A  @Override%0A  public float getValue() %7B%0A    return value;%0A  %7D%0A%0A  @Override%0A  public String toString() %7B%0A    return %22GenericTranslatedRecommendedItem%5Bitem:%22 + itemID + %22, value:%22 + value + '%5D';%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    return itemID.hashCode() %5E RandomUtils.hashFloat(value);%0A  %7D%0A%0A  @Override%0A  public boolean equals(Object o) %7B%0A    if (!(o instanceof GenericTranslatedRecommendedItem)) %7B%0A      return false;%0A    %7D%0A    GenericTranslatedRecommendedItem other = (GenericTranslatedRecommendedItem) o;%0A    return itemID.equals(other.getItemID()) && value == other.getValue()
 ;%0A  

Add a few more changes to be consistent with GenericRecommendedItem, like toString()