当前位置: 首页>>代码示例>>Java>>正文


Java DataHandle.getNumColumns方法代码示例

本文整理汇总了Java中org.deidentifier.arx.DataHandle.getNumColumns方法的典型用法代码示例。如果您正苦于以下问题:Java DataHandle.getNumColumns方法的具体用法?Java DataHandle.getNumColumns怎么用?Java DataHandle.getNumColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.deidentifier.arx.DataHandle的用法示例。


在下文中一共展示了DataHandle.getNumColumns方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toArray

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Returns an array representation of the subset, in which all rows that are not part of the
 * subset have been suppressed. This method does *not* preserve the order of tuples from the
 * input handle.
 * 
 * @param handle
 * @param subset
 * @return
 */
public String[][] toArray(DataHandle handle, DataHandle subset) {
    List<String[]> list = new ArrayList<String[]>();
    Iterator<String[]> iter = subset.iterator();
    iter.next(); // Skip header
    for (; iter.hasNext();) {
        list.add(iter.next());
    }
    
    String[] suppressed = new String[handle.getNumColumns()];
    Arrays.fill(suppressed, "*"); // TODO
    for (int i = 0; i < handle.getNumRows() - subset.getNumRows(); i++) {
        list.add(suppressed);
    }
    
    return list.toArray(new String[list.size()][]);
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:26,代码来源:DataConverter.java

示例2: getQualityStatistics

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Returns data quality according to various models. This is a special variant of 
 * the method supporting arbitrary user-defined outputs.
 * 
 * @param output
 * @return
 */
public StatisticsQuality getQualityStatistics(DataHandle output) {

    // Reset stop flag
    interrupt.value = false;
    progress.value = 0;

    // Prepare
    DataHandleInternal input = this.handle.getAssociatedInput();
    ARXConfiguration config = this.handle.getConfiguration();
    
    // Very basic check        
    if (output.getNumRows() != input.getNumRows() ||
        output.getNumColumns() != input.getNumColumns()) {
        throw new IllegalArgumentException("Input and output do not match");
    }

    // Build and return
    return new StatisticsQuality(input.getHandle(), output, config, interrupt, progress);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:StatisticsBuilder.java

示例3: updateEntries

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Updates the view.
 * 
 * @param node
 */
private void updateEntries() {

    // Check
    if (model == null || model.getInputConfig() == null || model.getInputConfig().getInput() == null) { 
        return; 
    }

    table.setRedraw(false);
    table.removeAll();
    DataHandle data = model.getInputConfig().getInput().getHandle();
    for (int i = 0; i < data.getNumColumns(); i++) {
        String attribute = data.getAttributeName(i);
        TableItem item = new TableItem(table, SWT.NONE);
        item.setText(new String[] { "", attribute, getDataType(attribute), getDataTypeFormat(attribute) }); //$NON-NLS-1$
        AttributeType type = model.getInputDefinition().getAttributeType(attribute);
        item.setImage(0, controller.getResources().getImage(type));  
        if (model.getSelectedAttribute() != null && model.getSelectedAttribute().equals(attribute)) {
            table.select(i);
        }
    }
    
    table.setRedraw(true);
    SWTUtil.enable(table);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:30,代码来源:ViewAttributeList.java

示例4: DialogGeneralizationSelection

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param shell
 * @param controller
 * @param model
 */
public DialogGeneralizationSelection(final Shell shell, 
                                     final Controller controller,
                                     final Model model,
                                     final DataGeneralizationScheme scheme) {
    super(shell);
    definition = model.getInputDefinition();
    DataHandle handle = model.getInputConfig().getInput().getHandle();
    for (int i=0; i<handle.getNumColumns(); i++) {
        String attribute = handle.getAttributeName(i);
        if (definition.getQuasiIdentifiersWithGeneralization().contains(attribute)) {
            attributes.add(attribute);
            selection.put(attribute, scheme.getGeneralizationLevel(attribute, definition));
            hierarchies.put(attribute, definition.getHierarchy(attribute));
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:24,代码来源:DialogGeneralizationSelection.java

示例5: DataTableGridLayerStack

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param bodyDataProvider
 * @param table
 * @param context
 * @param parent
 */
public DataTableGridLayerStack(final IDataProvider bodyDataProvider, NatTable table, DataTableContext context, Control parent) {
    super(true, table, context);
    List<String> lcolumns = new ArrayList<String>();
    RowSet rows = context.getRows();
    DataHandle handle = context.getHandle();
    if (bodyDataProvider.getColumnCount() != 0) {
        if (rows != null) {
            lcolumns.add(""); //$NON-NLS-1$
        }
        if (handle != null) {
            for (int i = 0; i < handle.getNumColumns(); i++) {
                lcolumns.add(handle.getAttributeName(i));
            }
        } 
    }
    String[] columns = lcolumns.toArray(new String[] {});
    final IDataProvider columnHeaderDataProvider = new DataTableDataProvider(new DefaultColumnHeaderDataProvider(columns));
    final IDataProvider rowHeaderDataProvider = new DataTableDataProvider(new DefaultRowHeaderDataProvider(bodyDataProvider));
    final IDataProvider cornerDataProvider = new DataTableDataProvider(new DefaultCornerDataProvider(columnHeaderDataProvider,
                                                                           rowHeaderDataProvider));
    init(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, cornerDataProvider, parent);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:31,代码来源:DataTableGridLayerStack.java

示例6: testMicroaggregationAdult

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Test microaggregation arithmetic mean with larger dataset
 * @throws IOException
 */
@Test
public void testMicroaggregationAdult() throws IOException {
    Data data = getDataObject("./data/adult.csv");
    
    data.getDefinition().setAttributeType("age", MicroAggregationFunction.createArithmeticMean());
    data.getDefinition().setDataType("age", DataType.INTEGER);
    
    final ARXAnonymizer anonymizer = new ARXAnonymizer();
    final ARXConfiguration config = ARXConfiguration.create();
    config.addPrivacyModel(new KAnonymity(5));
    config.setMaxOutliers(1d);
    config.setQualityModel(Metric.createLossMetric(AggregateFunction.RANK));
    
    ARXResult result = anonymizer.anonymize(data, config);
    DataHandle exptectedOutput = Data.create("./data/adult_age_microaggregated.csv", StandardCharsets.UTF_8, ';').getHandle();
    
    DataHandle output = result.getOutput();
    for (int i = 0; i < output.getNumRows(); i++) {
        for (int j = 0; j < output.getNumColumns(); j++) {
            assertEquals(exptectedOutput.getValue(i, j), output.getValue(i, j));
        }
    }
    
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:TestMicroaggregation.java

示例7: computeUpperBounds

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Computes the upper bounds
 * @param dataset
 * @throws IOException
 */
private void computeUpperBounds(BenchmarkDataset dataset) throws IOException {
    // Prepare
    Data data = BenchmarkSetup.getData(dataset);
    DataDefinition definition = data.getDefinition();
    DataHandle inputHandle = data.getHandle();

    // Convert to completely suppressed output data
    DataConverter converter = new DataConverter();
    String[][] input = converter.toArray(inputHandle);
    String[][] output = new String[inputHandle.getNumRows()][inputHandle.getNumColumns()];
    for (int i = 0; i < inputHandle.getNumRows(); i++) {
        Arrays.fill(output[i], "*");
    }
    Map<String, String[][]> hierarchies = converter.toMap(definition);
    String[] header = converter.getHeader(inputHandle);
    int[] transformation = new int[definition.getQuasiIdentifyingAttributes().size()];
    for (String attr : definition.getQuasiIdentifyingAttributes()) {
        int maxLevel = definition.getHierarchy(attr)[0].length - 1;
        transformation[inputHandle.getColumnIndexOf(attr)] = maxLevel;
    }

    // Compute metrics
    double outputLoss = new UtilityMeasureLoss<Double>(header, hierarchies, AggregateFunction.GEOMETRIC_MEAN).evaluate(output).getUtility();
    double outputEntropy = new UtilityMeasureNonUniformEntropyWithLowerBoundNormalized<Double>(header, input, hierarchies).evaluate(output, transformation).getUtility();

    // Store results
    if (!upper.containsKey(dataset)) {
        upper.put(dataset, new HashMap<BenchmarkUtilityMeasure, Double>());
    }
    upper.get(dataset).put(BenchmarkUtilityMeasure.LOSS, outputLoss);
    upper.get(dataset).put(BenchmarkUtilityMeasure.ENTROPY, outputEntropy);
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:38,代码来源:BenchmarkMetadataUtility.java

示例8: getHeader

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Returns the header
 * @param handle
 * @return
 */
public String[] getHeader(DataHandle handle) {
    String[] header = new String[handle.getNumColumns()];
    for (int i = 0; i < header.length; i++) {
        header[i] = handle.getAttributeName(i);
    }
    return header;
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:13,代码来源:DataConverter.java

示例9: updateAttributeTypes

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Update
 */
private void updateAttributeTypes() {
    if (model != null && model.getInputConfig() != null && model.getInputConfig().getInput() != null) {
        table.setRedraw(false);
        DataHandle data = model.getInputConfig().getInput().getHandle();
        for (int i = 0; i < data.getNumColumns(); i++) {
            String attribute = data.getAttributeName(i);
            AttributeType type = model.getInputDefinition().getAttributeType(attribute);
            table.getItem(i).setImage(0, controller.getResources().getImage(type));
        }
        table.setRedraw(true);
        SWTUtil.enable(table);
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:ViewAttributeList.java

示例10: updateDataTypes

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Update
 */
private void updateDataTypes() {
    if (model != null && model.getInputConfig() != null && model.getInputConfig().getInput() != null) {
        table.setRedraw(false);
        DataHandle data = model.getInputConfig().getInput().getHandle();
        for (int i = 0; i < data.getNumColumns(); i++) {
            String attribute = data.getAttributeName(i);
            table.getItem(i).setText(2, getDataType(attribute));
            table.getItem(i).setText(3, getDataTypeFormat(attribute));
        }
        table.setRedraw(true);
        SWTUtil.enable(table);
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:ViewAttributeList.java

示例11: updateSelectedAttribute

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Update
 * @param attribute
 */
private void updateSelectedAttribute(String attribute) {
    if (model != null && model.getInputConfig() != null && model.getInputConfig().getInput() != null) {
        DataHandle data = model.getInputConfig().getInput().getHandle();
        for (int i = 0; i < data.getNumColumns(); i++) {
            if (data.getAttributeName(i).equals(attribute)) {
                table.select(i);
                break;
            }
        }   
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:16,代码来源:ViewAttributeList.java

示例12: State

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param model
 * @param handle
 * @param definition
 */
private State(Model model, DataHandle handle, DataDefinition definition) {

    for (int col = 0; col < handle.getNumColumns(); col++) {
        String attribute = handle.getAttributeName(col);
        attributes.add(attribute);
        types.add(definition.getAttributeType(attribute));
    }
    features.addAll(model.getSelectedFeatures());
    classes.addAll(model.getSelectedClasses());
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:18,代码来源:ViewStatisticsClassificationAttributes.java

示例13: actionColumnSelected

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Selects the given column.
 *
 * @param index
 */
private void actionColumnSelected(int index){
	DataHandle handle = getHandle();
    if (handle != null && index < handle.getNumColumns()){
        final String attr = handle.getAttributeName(index);
        model.setSelectedAttribute(attr);
        table.setSelectedAttribute(attr);
        controller.update(new ModelEvent(this, ModelPart.SELECTED_ATTRIBUTE, attr));
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:15,代码来源:ViewData.java

示例14: getBLikenessModel

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Returns the b-Likeness privacy model.
 *
 * @return
 */
public Map<String, ModelBLikenessCriterion> getBLikenessModel() {
    if (this.bLikenessModel == null) {
        this.bLikenessModel = new HashMap<String, ModelBLikenessCriterion>();
        DataHandle handle = inputConfig.getInput().getHandle();
        for (int col = 0; col < handle.getNumColumns(); col++) {
            String attribute = handle.getAttributeName(col);
            bLikenessModel.put(attribute, new ModelBLikenessCriterion(attribute));
        }
    }
    return bLikenessModel;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:Model.java

示例15: getDDisclosurePrivacyModel

import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
 * Returns the d-disclosure privacy model.
 *
 * @return
 */
public Map<String, ModelDDisclosurePrivacyCriterion> getDDisclosurePrivacyModel() {
    if (this.dDisclosurePrivacyModel == null) {
        this.dDisclosurePrivacyModel = new HashMap<String, ModelDDisclosurePrivacyCriterion>();
        DataHandle handle = inputConfig.getInput().getHandle();
        for (int col = 0; col < handle.getNumColumns(); col++) {
            String attribute = handle.getAttributeName(col);
            dDisclosurePrivacyModel.put(attribute, new ModelDDisclosurePrivacyCriterion(attribute));
        }
    }
    return dDisclosurePrivacyModel;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:Model.java


注:本文中的org.deidentifier.arx.DataHandle.getNumColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。