// Path: src/main/java/weka/core/setupgenerator/Point.java
// public class Point<E>
//   implements Serializable, Cloneable, Comparable<Point<E>> {
// 
//   /** for serialization. */
//   private static final long serialVersionUID = 1061326306122503731L;
//   
//   /** the values in the various dimensions. */
//   protected Object[] m_Values;
//   
//   /**
//    * Initializes the point with the given values.
//    * 
//    * @param values	the position in the various dimensions
//    */
//   public Point(E[] values) {
//     m_Values = (E[]) values.clone();
//   }
//   
//   /**
//    * Returns a clone of itself.
//    * 
//    * @return		a clone of itself
//    */
//   public Object clone() {
//     return new Point(m_Values.clone());
//   }
//   
//   /**
//    * Returns the number of dimensions this points uses.
//    * 
//    * @return		the number of dimensions
//    */
//   public int dimensions() {
//     return m_Values.length;
//   }
//   
//   /**
//    * Returns the value in the specified dimension.
//    * 
//    * @param dimension	the dimension to get the value for
//    * @return		the value
//    */
//   public E getValue(int dimension) {
//     return (E) m_Values[dimension];
//   }
// 
//   /**
//    * Determines whether or not two points are equal.
//    * 
//    * @param obj 	an object to be compared with this PointDouble
//    * @return 		true if the object to be compared has the same values; 
//    * 			false otherwise.
//    */
//   public boolean equals(Object obj) {
//     Point<E> 	pd;
//     int		i;
//     
//     if (obj == null)
//       return false;
//     
//     if (!(obj instanceof Point))
//       return false;
//     
//     pd = (Point<E>) obj;
//     
//     if (dimensions() != pd.dimensions())
//       return false;
//     
//     for (i = 0; i < dimensions(); i++) {
//       if (getValue(i).getClass() != pd.getValue(i).getClass())
//         return false;
// 
//       if (getValue(i) instanceof Double) {
//         if (!Utils.eq((Double) getValue(i), (Double) pd.getValue(i)))
//           return false;
//       }
//       else {
//         if (!getValue(i).toString().equals(pd.getValue(i).toString()))
//           return false;
//       }
//     }
//     
//     return true;
//   }
// 
//   /**
//    * Compares the given point with this point.
//    * 
//    * @param obj 	an object to be compared with this point
//    * @return 		-1, 0, +1, in a manner consistent with equals
//    */
//   public int compareTo(Point<E> obj) {
//     if (obj == null)
//       return -1; 
//     
//     if (dimensions() != obj.dimensions())
//       return -1; 
//     
//     for (int i = 0; i < dimensions(); i++) {
//       if (getValue(i).getClass() != obj.getValue(i).getClass())
//         return -1;
// 
//       if (getValue(i) instanceof Double) {
//         if (Utils.sm((Double) getValue(i), (Double) obj.getValue(i))) {
// 	  return -1;
// 	} else if (Utils.gr((Double) getValue(i), (Double) obj.getValue(i))) {
// 	  return 1;
// 	}
//       } else {
//         int r = getValue(i).toString().compareTo(obj.getValue(i).toString());
// 	if (r != 0) {
// 	  return r;
// 	}
//       }
//     }
//     
//     return 0;
//   }
//   
//   /**
//    * returns a string representation of the Point.
//    * 
//    * @return the point as string
//    */
//   public String toString() {
//     String	result;
//     int	i;
//     double	value;
//     
//     result = "";
// 
//     for (i = 0; i < dimensions(); i++) {
//       if (i > 0)
//         result += ", ";
//       
//       if (getValue(i) instanceof Double) {
//         value = (Double) getValue(i);
//         result += Utils.doubleToString(value, 6);
//       }
//       else {
//         result += getValue(i).toString();
//       }
//     }
//     
//     return result;
//   }
// }


import weka.core.setupgenerator.Point;
import java.io.Serializable;
import java.util.Hashtable;
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * PerformanceCache.java
 * Copyright (C) 2008-2010 University of Waikato, Hamilton, New Zealand
 */

package weka.classifiers.meta.multisearch;



/**
 * Represents a simple cache for performance objects.
 *
 * @author  fracpete (fracpete at waikato dot ac dot nz)
 * @version $Revision: 5156 $
 */
public class PerformanceCache
  implements Serializable {

  /** for serialization. */
  private static final long serialVersionUID = 5838863230451530252L;

  /** the cache for points in the space that got calculated. */
  protected Hashtable<String,Performance> m_Cache = new Hashtable<String,Performance>();

  /**
   * returns the ID string for a cache item.
   *
   * @param cv	the number of folds in the cross-validation
   * @param values	the point in the space
   * @return		the ID string
   */
// Path: src/main/java/weka/core/setupgenerator/Point.java
// public class Point<E>
//   implements Serializable, Cloneable, Comparable<Point<E>> {
// 
//   /** for serialization. */
//   private static final long serialVersionUID = 1061326306122503731L;
//   
//   /** the values in the various dimensions. */
//   protected Object[] m_Values;
//   
//   /**
//    * Initializes the point with the given values.
//    * 
//    * @param values	the position in the various dimensions
//    */
//   public Point(E[] values) {
//     m_Values = (E[]) values.clone();
//   }
//   
//   /**
//    * Returns a clone of itself.
//    * 
//    * @return		a clone of itself
//    */
//   public Object clone() {
//     return new Point(m_Values.clone());
//   }
//   
//   /**
//    * Returns the number of dimensions this points uses.
//    * 
//    * @return		the number of dimensions
//    */
//   public int dimensions() {
//     return m_Values.length;
//   }
//   
//   /**
//    * Returns the value in the specified dimension.
//    * 
//    * @param dimension	the dimension to get the value for
//    * @return		the value
//    */
//   public E getValue(int dimension) {
//     return (E) m_Values[dimension];
//   }
// 
//   /**
//    * Determines whether or not two points are equal.
//    * 
//    * @param obj 	an object to be compared with this PointDouble
//    * @return 		true if the object to be compared has the same values; 
//    * 			false otherwise.
//    */
//   public boolean equals(Object obj) {
//     Point<E> 	pd;
//     int		i;
//     
//     if (obj == null)
//       return false;
//     
//     if (!(obj instanceof Point))
//       return false;
//     
//     pd = (Point<E>) obj;
//     
//     if (dimensions() != pd.dimensions())
//       return false;
//     
//     for (i = 0; i < dimensions(); i++) {
//       if (getValue(i).getClass() != pd.getValue(i).getClass())
//         return false;
// 
//       if (getValue(i) instanceof Double) {
//         if (!Utils.eq((Double) getValue(i), (Double) pd.getValue(i)))
//           return false;
//       }
//       else {
//         if (!getValue(i).toString().equals(pd.getValue(i).toString()))
//           return false;
//       }
//     }
//     
//     return true;
//   }
// 
//   /**
//    * Compares the given point with this point.
//    * 
//    * @param obj 	an object to be compared with this point
//    * @return 		-1, 0, +1, in a manner consistent with equals
//    */
//   public int compareTo(Point<E> obj) {
//     if (obj == null)
//       return -1; 
//     
//     if (dimensions() != obj.dimensions())
//       return -1; 
//     
//     for (int i = 0; i < dimensions(); i++) {
//       if (getValue(i).getClass() != obj.getValue(i).getClass())
//         return -1;
// 
//       if (getValue(i) instanceof Double) {
//         if (Utils.sm((Double) getValue(i), (Double) obj.getValue(i))) {
// 	  return -1;
// 	} else if (Utils.gr((Double) getValue(i), (Double) obj.getValue(i))) {
// 	  return 1;
// 	}
//       } else {
//         int r = getValue(i).toString().compareTo(obj.getValue(i).toString());
// 	if (r != 0) {
// 	  return r;
// 	}
//       }
//     }
//     
//     return 0;
//   }
//   
//   /**
//    * returns a string representation of the Point.
//    * 
//    * @return the point as string
//    */
//   public String toString() {
//     String	result;
//     int	i;
//     double	value;
//     
//     result = "";
// 
//     for (i = 0; i < dimensions(); i++) {
//       if (i > 0)
//         result += ", ";
//       
//       if (getValue(i) instanceof Double) {
//         value = (Double) getValue(i);
//         result += Utils.doubleToString(value, 6);
//       }
//       else {
//         result += getValue(i).toString();
//       }
//     }
//     
//     return result;
//   }
// }


// Path: src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java
import weka.core.setupgenerator.Point;
import java.io.Serializable;
import java.util.Hashtable;

/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * PerformanceCache.java
 * Copyright (C) 2008-2010 University of Waikato, Hamilton, New Zealand
 */

package weka.classifiers.meta.multisearch;



/**
 * Represents a simple cache for performance objects.
 *
 * @author  fracpete (fracpete at waikato dot ac dot nz)
 * @version $Revision: 5156 $
 */
public class PerformanceCache
  implements Serializable {

  /** for serialization. */
  private static final long serialVersionUID = 5838863230451530252L;

  /** the cache for points in the space that got calculated. */
  protected Hashtable<String,Performance> m_Cache = new Hashtable<String,Performance>();

  /**
   * returns the ID string for a cache item.
   *
   * @param cv	the number of folds in the cross-validation
   * @param values	the point in the space
   * @return		the ID string
   */
  protected String getID(int cv, Point<Object> values) {