/*
 * ARX: Powerful Data Anonymization
 * Copyright 2012 - 2016 Fabian Prasser, Florian Kohlmayer and contributors
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.deidentifier.arx.framework.data;

import java.util.Map;

import org.deidentifier.arx.DataType;
import org.deidentifier.arx.framework.check.distribution.DistributionAggregateFunction;

/**
 * A data manager that is projected onto a given subset. Used for post-optimization.
 * 
 * @author Fabian Prasser
 */
public class DataManagerSubset extends DataManager {

    private final DataManager source;
    
    /**
     * Constructor
     * @param source
     * @param dataAnalyzed
     * @param dataGeneralized
     * @param dataStatic
     * @param header
     * @param hierarchiesGeneralized
     * @param hierarchiesHeights
     * @param hierarchiesSensitive
     * @param indexesSensitive
     * @param maxLevels
     * @param microaggregationFunctions
     * @param microaggregationHeader
     * @param microaggregationMap
     * @param microaggregationNumAttributes
     * @param microaggregationStartIndex
     * @param minLevels
     * @param dataTypesSensitive 
     */
    protected DataManagerSubset(DataManager source,
                                Data dataAnalyzed,
                                Data dataGeneralized,
                                Data dataStatic,
                                String[] header,
                                GeneralizationHierarchy[] hierarchiesGeneralized,
                                int[] hierarchiesHeights,
                                Map<String, GeneralizationHierarchy> hierarchiesSensitive,
                                Map<String, Integer> indexesSensitive,
                                int[] maxLevels,
                                DistributionAggregateFunction[] microaggregationFunctions,
                                String[] microaggregationHeader,
                                int[] microaggregationMap,
                                int microaggregationNumAttributes,
                                int microaggregationStartIndex,
                                int[] minLevels,
                                Map<String, DataType<?>> dataTypesSensitive) {
        super(dataAnalyzed,
              dataGeneralized,
              dataStatic,
              header,
              hierarchiesGeneralized,
              hierarchiesHeights,
              hierarchiesSensitive,
              indexesSensitive,
              maxLevels,
              microaggregationFunctions,
              microaggregationHeader,
              microaggregationMap,
              microaggregationNumAttributes,
              microaggregationStartIndex,
              minLevels,
              dataTypesSensitive);
        
        this.source = source;
    }

    @Override
    public double[] getDistribution(int[][] data, int index, int distinctValues) {
        // Delegate to source
        return source.getDistribution(data, index, distinctValues);
    }

    @Override
    public double[] getDistribution(String attribute) {
        // Delegate to source
        return source.getDistribution(attribute);
    }

    @Override
    public int[] getTree(int[][] data, int index, int[][] hierarchy) {
        // Delegate to source
        return source.getTree(data, index, hierarchy);
    }

    @Override
    public int[] getTree(String attribute) {
        // Delegate to source
        return source.getTree(attribute);
    }
}

@@ -3400,32 +3400,178 @@
 urce;%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A    public int%5B%5D getOrder(String attribute) %7B%0D%0A        // Delegate to source%0D%0A        return source.getOrder(attribute);%0D%0A    %7D%0D%0A%0D%0A
     @Override%0D%0A 

Add delegate