[Demonstration 1]

[Buggy Method]
public void datasetChanged(List<MainModel> dataset) {
    DiffUtil.DiffResult diffResult = calculateDiffResult(dataset);
    this.dataset = dataset;
    diffResult.dispatchUpdatesTo(this);
}

[Buggy Hunk]
this.dataset = dataset;

[Patch]
this.dataset = new ArrayList<>(dataset);

[Demonstration 2]

[Buggy Method]
public static void main(String[] args) {
    try {
        ClusteringMethod method = ClusteringMethod.KMEDOIDS_DTW;
        //ClusteringMethod method = ClusteringMethod.KMEANS_EUCLIDEAN;
        //starkeyElk93Experiment(method);
        boolean plotTrajectories = false;
        boolean simplifyTrajectories = true;
        boolean printDetailedClusters = true;
        boolean printOutputZayFile = false;
        boolean printOutputZayToScreen = false;
        boolean printConfusionMatrix = false;
        boolean printIntraClusterDistanceMatrix = false;
        boolean plotCompleteTrajectoriesEquivalentForSimplifiedClusters = false;
        boolean saveFeatureVectorsToFile = true;
        boolean calculateSilhouetteCoefficient = false;
        boolean normalize = false;
        SegmentationMethod simplificationMethod = SegmentationMethod.douglasPeucker;
        TrajectoryDatasets trajectoryDataset = TrajectoryDatasets.GEOLIFE;
        //normal value = 8 //9 for tests with zay
        int numberOfPartitionsPerTrajectory = 25;
        //For big data Experiment
        boolean veryBigData = false;
        int numTrajectoryBigDataset = 500;
        boolean runMultipleExperiments = true;
        int numberOfExperiments = 5;
        if (runMultipleExperiments) {
            for (int i = 0; i < numberOfExperiments; i++) {
                System.out.println("");
                System.out.println("Start of iteration: " + i);
                CVRRExperiment(method, trajectoryDataset, plotTrajectories, plotCompleteTrajectoriesEquivalentForSimplifiedClusters, simplifyTrajectories, simplificationMethod, numberOfPartitionsPerTrajectory, veryBigData, numTrajectoryBigDataset, printOutputZayFile, printOutputZayToScreen, printConfusionMatrix, printDetailedClusters, printIntraClusterDistanceMatrix, saveFeatureVectorsToFile, calculateSilhouetteCoefficient, normalize);
                System.out.println("End of iteration: " + i);
                System.out.println("");
                System.out.println("");
            }
            System.out.println("NMI Scores: " + testTrajectoryClustering.NMIValues);
            if (calculateSilhouetteCoefficient) {
                System.out.println("Silhouette Scores: " + testTrajectoryClustering.silhouetteValues);
            } else {
                System.out.println("Silhouette calculation deactivativated");
            }
            if (simplifyTrajectories) {
                System.out.println("Douglas Peucker Times: " + testTrajectoryClustering.timesDouglasPeucker);
            } else {
                System.out.println("Trajectory Simplification deactivativated");
            }
            System.out.println("Clustering Times: " + testTrajectoryClustering.timesClustering);
        } else {
            CVRRExperiment(method, trajectoryDataset, plotTrajectories, plotCompleteTrajectoriesEquivalentForSimplifiedClusters, simplifyTrajectories, simplificationMethod, numberOfPartitionsPerTrajectory, veryBigData, numTrajectoryBigDataset, printOutputZayFile, printOutputZayToScreen, printConfusionMatrix, printDetailedClusters, printIntraClusterDistanceMatrix, saveFeatureVectorsToFile, calculateSilhouetteCoefficient, normalize);
        }
        //to evaluate the numbers of buckets produced by different numbers of hashing functions
        /*
			boolean plotHashFuntionsToNumBucketsGraph = true;
			int maxIterations = 20;
			int startingNumHashFunctions = 1;
			
			int totalHashesReached;
			int maxTotalOfHashesToReach = 6;
			do{
			totalHashesReached = evaluateProduceNumOfClusters(method, trajectoryDataset, plotHashFuntionsToNumBucketsGraph, simplifyTrajectories, simplificationMethod, 
					numberOfPartitionsPerTrajectory, maxIterations, startingNumHashFunctions);
			}while(totalHashesReached<maxTotalOfHashesToReach);
			*/
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

[Buggy Hunk]
ClusteringMethod method = ClusteringMethod.KMEDOIDS_DTW;

[Patch]
ClusteringMethod method = ClusteringMethod.DBH_DTW_FEATURE_VECTOR_REAL_NUMBERS;

[Demonstration 3]

[Buggy Method]
@Override
public Dataset apply(final Dataset dataset) {
    // Copy.
    Map<String, Class<? extends Component>> oldDataStructure = dataset.getDataStructure();
    ImmutableMap.Builder<String, Class<? extends Component>> newDataStructure = ImmutableMap.builder();
    checkArgument(oldDataStructure.keySet().containsAll(names.keySet()), "the dataset %s did not contain components with names %s", dataset, Sets.difference(names.keySet(), oldDataStructure.keySet()));
    for (String oldName : dataset.getDataStructure().keySet()) {
        String newName = names.getOrDefault(oldName, oldName);
        Class<? extends Component> newComponent;
        newComponent = roles.getOrDefault(newName, oldDataStructure.get(oldName));
        newDataStructure.put(newName, newComponent);
    }
    return new Dataset() {

        @Override
        public Set<List<Identifier>> cartesian() {
            return null;
        }

        @Override
        public DataStructure getDataStructure() {
            return new DataStructure(newDataStructure.build());
        }

        @Override
        public Stream<Tuple> get() {
            return dataset.get();
        }
    };
}

[Buggy Hunk]
newComponent = roles.getOrDefault(newName, oldDataStructure.get(oldName));

[Patch]
newComponent = roles.getOrDefault(oldName, oldDataStructure.get(oldName));