All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpmml.model.visitors.FieldRenamer Maven / Gradle / Ivy

There is a newer version: 1.6.6
Show newest version
/*
 * Copyright (c) 2015 Villu Ruusmann
 */
package org.jpmml.model.visitors;

import java.util.Collections;
import java.util.Map;

import org.dmg.pmml.Field;
import org.dmg.pmml.FieldName;

/**
 * 

* A Visitor that renames a {@link Field} and all references to it. *

*/ public class FieldRenamer extends FieldNameFilterer { private Map mappings = null; public FieldRenamer(FieldName from, FieldName to){ this(Collections.singletonMap(from, to)); } public FieldRenamer(Map mappings){ setMappings(mappings); } @Override public FieldName filter(FieldName name){ Map mappings = getMappings(); if(name != null){ FieldName updatedName = mappings.get(name); if(updatedName != null){ return updatedName; } } return name; } public Map getMappings(){ return this.mappings; } private void setMappings(Map mappings){ this.mappings = mappings; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy