public void readModel(int n, int k, double[][] points, int[] weight, DistanceMeasure measure) throws OperatorException { if (modelInput.isConnected()) { KNNCollectionModel input; input = modelInput.getData(KNNCollectionModel.class); knnCollection = input.get(); newCollection = false; if (k > knnCollection.getK() || !Arrays.deepEquals(knnCollection.getPoints(), points) || !measure.getClass().toString().equals(input.measure.getClass().toString())) { if (k > knnCollection.getK()) { this.logNote("Model at input port can not be used (k too small)."); } else { this.logNote("Model at input port can not be used (Model andExampleSet not matching)."); } knnCollection = new KNNCollection(n, k, points, weight); newCollection = true; } else { this.logNote(" Model at input port used for speeding up the operator."); } if (k < knnCollection.getK()) { knnCollection = KNNCollection.clone(knnCollection); knnCollection.shrink(knnCollection.getK() - k); } } else { knnCollection = new KNNCollection(n, k, points, weight); newCollection = true; } }