/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ @Override public void addValue(double data, double given, double weight) { int insertIndex = findNearestPair(given, data); if ((m_Values.size() <= insertIndex) || (m_CondValues.elementAt(insertIndex).doubleValue() != given) || (m_Values.elementAt(insertIndex).doubleValue() != data)) { m_CondValues.insertElementAt(new Double(given), insertIndex); m_Values.insertElementAt(new Double(data), insertIndex); m_Weights.insertElementAt(new Double(weight), insertIndex); if (weight != 1) { } } else { double newWeight = m_Weights.elementAt(insertIndex).doubleValue(); newWeight += weight; m_Weights.setElementAt(new Double(newWeight), insertIndex); } m_SumOfWeights += weight; // Invalidate any previously calculated covariance matrix m_Covariance = null; }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ @Override public void addValue(double data, double given, double weight) { int insertIndex = findNearestPair(given, data); if ((m_Values.size() <= insertIndex) || (m_CondValues.elementAt(insertIndex).doubleValue() != given) || (m_Values.elementAt(insertIndex).doubleValue() != data)) { m_CondValues.insertElementAt(new Double(given), insertIndex); m_Values.insertElementAt(new Double(data), insertIndex); m_Weights.insertElementAt(new Double(weight), insertIndex); if (weight != 1) { } } else { double newWeight = m_Weights.elementAt(insertIndex).doubleValue(); newWeight += weight; m_Weights.setElementAt(new Double(newWeight), insertIndex); } m_SumOfWeights += weight; // Invalidate any previously calculated covariance matrix m_Covariance = null; }