Example usage for org.apache.commons.text.translate AggregateTranslator AggregateTranslator

List of usage examples for org.apache.commons.text.translate AggregateTranslator AggregateTranslator

Introduction

In this page you can find the example usage for org.apache.commons.text.translate AggregateTranslator AggregateTranslator.

Prototype

public AggregateTranslator(final CharSequenceTranslator... translators) 

Source Link

Document

Specify the translators to be used at creation time.

Usage

From source file:org.jgrapht.io.DOTImporter.java

/**
 * Constructs a new importer.//from w w  w  . jav  a 2 s.co  m
 *
 * @param vertexProvider used to create vertices
 * @param edgeProvider used to create edges
 * @param vertexUpdater used to further update vertices
 * @param graphUpdater used to update graph attributes, like the graph identifier
 */
public DOTImporter(VertexProvider<V> vertexProvider, EdgeProvider<V, E> edgeProvider,
        ComponentUpdater<V> vertexUpdater, ComponentUpdater<Graph<V, E>> graphUpdater) {
    super(vertexProvider, edgeProvider, (vertexUpdater != null) ? vertexUpdater : (c, a) -> {
    }, (graphUpdater != null) ? graphUpdater : (c, a) -> {
    });

    Map<CharSequence, CharSequence> lookupMap = new HashMap<>();
    lookupMap.put("\\\\", "\\");
    lookupMap.put("\\\"", "\"");
    lookupMap.put("\\'", "'");
    lookupMap.put("\\", "");
    UNESCAPE_ID = new AggregateTranslator(new LookupTranslator(lookupMap));

}