/** * Creates a deep copy of the given estimator using serialization. * * @param model the estimator to copy * @return a deep copy of the estimator * @exception Exception if an error occurs */ public static Estimator makeCopy(Estimator model) throws Exception { return (Estimator) new SerializedObject(model).getObject(); }
/** * Set the experiment for this sub task * * @param task the experiment */ public void setExperiment(Experiment task) { // m_experiment = task; try { m_serializedExp = new SerializedObject(task); } catch (Exception e) { e.printStackTrace(); } }
/** * Get the experiment for this sub task * * @return this sub task's experiment */ public Experiment getExperiment() { if (m_experiment != null) { return m_experiment; } else { m_experiment = (Experiment) m_serializedExp.getObject(); return m_experiment; } }
/** * Set the experiment for this sub task * * @param task the experiment */ public void setExperiment(Experiment task) { // m_experiment = task; try { m_serializedExp = new SerializedObject(task); } catch (Exception e) { e.printStackTrace(); } }
/** * Get the experiment for this sub task * * @return this sub task's experiment */ public Experiment getExperiment() { if (m_experiment != null) { return m_experiment; } else { m_experiment = (Experiment) m_serializedExp.getObject(); return m_experiment; } }
/** * Creates a deep copy of the given estimator using serialization. * * @param model the estimator to copy * @return a deep copy of the estimator * @exception Exception if an error occurs */ public static Estimator makeCopy(Estimator model) throws Exception { return (Estimator) new SerializedObject(model).getObject(); }
for(int i = 0; i < clientInfo.length; i++) { // Construct new serialized object setData[i] = new SerializedObject(); // Extract client information double locationX = clientInfo[i].getLocation().getX(); double locationY = clientInfo[i].getLocation().getY(); String name = clientInfo[i].getName(); double mood = clientInfo[i].getMood(); double hunger = clientInfo[i].getHunger(); double chargestate = clientInfo[i].getChargestate(); // Store information in serialized object setData[i].setAll(locationX, locationY, name, mood, hunger, chargestate); // Add serialized object to array System.out.println(setData[i].getName()); }
@Override public Object nextElement() { Object oo = ee.nextElement(); if (oo instanceof SerializedObject) { return ((SerializedObject) oo).getObject(); } else { return oo; } } };
/** * Creates a deep copy of the given filter using serialization. * * @param model the filter to copy * @return a deep copy of the filter * @throws Exception if an error occurs */ public static Filter makeCopy(Filter model) throws Exception { return (Filter) new SerializedObject(model).getObject(); }
/** * Adds an attribute value. * * @param value the attribute value */ // @ requires value != null; // @ ensures m_Values.size() == \old(m_Values.size()) + 1; final void forceAddValue(String value) { Object store = value; if (value.length() > STRING_COMPRESS_THRESHOLD) { try { store = new SerializedObject(value, true); } catch (Exception ex) { System.err.println("Couldn't compress string attribute value -" + " storing uncompressed."); } } ((NominalAttributeInfo)m_AttributeInfo).m_Values.add(store); ((NominalAttributeInfo)m_AttributeInfo).m_Hashtable. put(store, new Integer(((NominalAttributeInfo)m_AttributeInfo).m_Values.size() - 1)); }
@Override public Object nextElement() { Object oo = ee.nextElement(); if (oo instanceof SerializedObject) { return ((SerializedObject) oo).getObject(); } else { return oo; } } };
/** * Creates a deep copy of the given classifier using serialization. * * @param model the classifier to copy * @return a deep copy of the classifier * @exception Exception if an error occurs */ public static Classifier makeCopy(Classifier model) throws Exception { return (Classifier) new SerializedObject(model).getObject(); }
/** * Adds an attribute value. * * @param value the attribute value */ // @ requires value != null; // @ ensures m_Values.size() == \old(m_Values.size()) + 1; final void forceAddValue(String value) { Object store = value; if (value.length() > STRING_COMPRESS_THRESHOLD) { try { store = new SerializedObject(value, true); } catch (Exception ex) { System.err.println("Couldn't compress string attribute value -" + " storing uncompressed."); } } ((NominalAttributeInfo)m_AttributeInfo).m_Values.add(store); ((NominalAttributeInfo)m_AttributeInfo).m_Hashtable. put(store, new Integer(((NominalAttributeInfo)m_AttributeInfo).m_Values.size() - 1)); }
/** * Returns a value of a nominal or string attribute. Returns an empty string * if the attribute is neither a string nor a nominal attribute. * * @param valIndex the value's index * @return the attribute's value as a string */ public final/* @ non_null pure @ */String value(int valIndex) { if (!isNominal() && !isString()) { return ""; } else { Object val = ((NominalAttributeInfo)m_AttributeInfo).m_Values.get(valIndex); // If we're storing strings compressed, uncompress it. if (val instanceof SerializedObject) { val = ((SerializedObject) val).getObject(); } return (String) val; } }
/** * Returns a copy of the object. * * @param obj the object to copy * @return the copy * @throws Exception if copying fails */ protected Serializable copy(Serializable obj) throws Exception { return (Serializable) new SerializedObject(obj).getObject(); }
/** * Returns a value of a nominal or string attribute. Returns an empty string * if the attribute is neither a string nor a nominal attribute. * * @param valIndex the value's index * @return the attribute's value as a string */ public final/* @ non_null pure @ */String value(int valIndex) { if (!isNominal() && !isString()) { return ""; } else { Object val = ((NominalAttributeInfo)m_AttributeInfo).m_Values.get(valIndex); // If we're storing strings compressed, uncompress it. if (val instanceof SerializedObject) { val = ((SerializedObject) val).getObject(); } return (String) val; } }
/** * Creates a deep copy of the given filter using serialization. * * @param model the filter to copy * @return a deep copy of the filter * @throws Exception if an error occurs */ public static Filter makeCopy(Filter model) throws Exception { return (Filter) new SerializedObject(model).getObject(); }
/** * Creates a deep copy of the given associator using serialization. * * @param model the associator to copy * @return a deep copy of the associator * @exception Exception if an error occurs */ public static Associator makeCopy(Associator model) throws Exception { return (Associator) new SerializedObject(model).getObject(); }
public Measure makeCopy() throws Exception { return (Measure) new SerializedObject(this).getObject(); } }
/** * Creates a deep copy of the given clusterer using serialization. * * @param model the clusterer to copy * @return a deep copy of the clusterer * @exception Exception if an error occurs */ public static Clusterer makeCopy(Clusterer model) throws Exception { return (Clusterer) new SerializedObject(model).getObject(); }