本文整理汇总了Java中org.deidentifier.arx.DataHandle.getAttributeName方法的典型用法代码示例。如果您正苦于以下问题:Java DataHandle.getAttributeName方法的具体用法?Java DataHandle.getAttributeName怎么用?Java DataHandle.getAttributeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.deidentifier.arx.DataHandle
的用法示例。
在下文中一共展示了DataHandle.getAttributeName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: QualityMeasureColumnOriented
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Creates a new instance for input data
* @param handle
* @param indices
*/
public QualityMeasureColumnOriented(DataHandle handle,
int[] indices) {
// Prepare
this.result = new HashMap<>();
this.minimum = new HashMap<>();
this.maximum = new HashMap<>();
// Convert
for (int i = 0; i < indices.length; i++) {
int column = indices[i];
String attribute = handle.getAttributeName(column);
this.minimum.put(attribute, 0d);
this.result.put(attribute, 0d);
this.maximum.put(attribute, 1d);
}
}
示例2: 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);
}
示例3: 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));
}
}
}
示例4: 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;
}
示例5: getNumbersFromNumericColumn
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Parses numbers from a numeric column
* @param handle
* @param column
* @return
*/
private double[] getNumbersFromNumericColumn(DataHandle handle, int column) {
try {
// Prepare
String attribute = handle.getAttributeName(column);
double[] result = new double[handle.getNumRows()];
// Parse numbers
if (handle.getDataType(attribute) instanceof DataTypeWithRatioScale) {
QualityConfigurationValueParser<?> parser = QualityConfigurationValueParser.create(handle.getDataType(attribute));
for (int row = 0; row < handle.getNumRows(); row++) {
String value = handle.getValue(row, column);
if (handle.isOutlier(row) || super.isSuppressed(column, value)) {
result[row] = Double.NaN;
} else {
result[row] = parser.getDouble(value);
}
// Check
checkInterrupt();
}
// Return
return result;
} else {
// Return
return null;
}
} catch (Exception e) {
// Fail silently
return null;
}
}
示例6: getNumbersFromNumericColumn
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Parses numbers from a numeric input column
* @param input
* @param column
* @return
*/
private double[] getNumbersFromNumericColumn(DataHandle input, int column) {
try {
// Prepare
String attribute = input.getAttributeName(column);
double[] result = new double[input.getNumRows() * 2];
// Parse numbers
if (input.getDataType(attribute) instanceof DataTypeWithRatioScale) {
QualityConfigurationValueParser<?> parser = QualityConfigurationValueParser.create(input.getDataType(attribute));
for (int row = 0; row < input.getNumRows(); row++) {
double number = parser.getDouble(input.getValue(row, column));
result[row * 2] = number;
result[row * 2 + 1] = number;
// Check
checkInterrupt();
}
// Return
return result;
} else {
// Return
return null;
}
} catch (Exception e) {
// Fail silently
return null;
}
}
示例7: getDomainShares
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Returns domain shares for the handle
* @param handle
* @param indices
* @param hierarchies
* @param config
* @return
*/
private QualityDomainShare[] getDomainShares(DataHandle handle,
int[] indices,
String[][][] hierarchies,
QualityConfiguration config) {
// Prepare
QualityDomainShare[] shares = new QualityDomainShare[indices.length];
// Compute domain shares
for (int i=0; i<shares.length; i++) {
try {
// Extract info
String[][] hierarchy = hierarchies[i];
String attribute = handle.getAttributeName(indices[i]);
HierarchyBuilder<?> builder = handle.getDefinition().getHierarchyBuilder(attribute);
// Create shares for redaction-based hierarchies
if (builder != null && (builder instanceof HierarchyBuilderRedactionBased) &&
((HierarchyBuilderRedactionBased<?>)builder).isDomainPropertiesAvailable()){
shares[i] = new QualityDomainShareRedaction((HierarchyBuilderRedactionBased<?>)builder);
// Create fallback-shares for materialized hierarchies
// TODO: Interval-based hierarchies are currently not compatible
} else {
shares[i] = new QualityDomainShareRaw(hierarchy, config.getSuppressedValue());
}
} catch (Exception e) {
// Ignore silently
shares[i] = null;
}
}
// Return
return shares;
}
示例8: 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);
}
}
示例9: 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);
}
}
示例10: 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());
}
示例11: DialogFindReplace
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Creates a new instance
*
* @param parentShell
* @param handle
* @param column
*/
public DialogFindReplace(Shell parentShell,
Model model,
DataHandle handle,
int column) {
super(parentShell);
this.title = Resources.getMessage("DialogFindReplace.0"); //$NON-NLS-1$
this.model = model;
this.attribute = handle.getAttributeName(column);
this.message = Resources.getMessage("DialogFindReplace.1") + //$NON-NLS-1$
handle.getAttributeName(column) + Resources.getMessage("DialogFindReplace.2"); //$NON-NLS-1$
this.elements.addAll(Arrays.asList(handle.getDistinctValues(column)));
}
示例12: 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));
}
}
示例13: 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;
}
示例14: 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;
}
示例15: resetCriteria
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Resets the configuration of the privacy criteria.
*/
public void resetCriteria() {
if (inputConfig==null || inputConfig.getInput()==null) return;
differentialPrivacyModel = new ModelDifferentialPrivacyCriterion();
kAnonymityModel = new ModelKAnonymityCriterion();
stackelbergPrivacyModel = new ModelProfitabilityCriterion();
dPresenceModel = new ModelDPresenceCriterion();
kMapModel = new ModelKMapCriterion();
lDiversityModel.clear();
tClosenessModel.clear();
riskBasedModel.clear();
dDisclosurePrivacyModel.clear();
bLikenessModel.clear();
DataHandle handle = inputConfig.getInput().getHandle();
for (int col = 0; col < handle.getNumColumns(); col++) {
String attribute = handle.getAttributeName(col);
lDiversityModel.put(attribute, new ModelLDiversityCriterion(attribute));
tClosenessModel.put(attribute, new ModelTClosenessCriterion(attribute));
dDisclosurePrivacyModel.put(attribute, new ModelDDisclosurePrivacyCriterion(attribute));
bLikenessModel.put(attribute, new ModelBLikenessCriterion(attribute));
}
riskBasedModel.add(new ModelRiskBasedCriterion(ModelRiskBasedCriterion.VARIANT_AVERAGE_RISK));
riskBasedModel.add(new ModelRiskBasedCriterion(ModelRiskBasedCriterion.VARIANT_SAMPLE_UNIQUES));
riskBasedModel.add(new ModelRiskBasedCriterion(ModelRiskBasedCriterion.VARIANT_POPULATION_UNIQUES_DANKAR));
}