Example usage for com.google.common.collect Maps newEnumMap

List of usage examples for com.google.common.collect Maps newEnumMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newEnumMap.

Prototype

public static <K extends Enum<K>, V> EnumMap<K, V> newEnumMap(Map<K, ? extends V> map) 

Source Link

Document

Creates an EnumMap with the same mappings as the specified map.

Usage

From source file:com.basistech.rosette.dm.util.WholeDocumentLanguageDispatchAnnotatorBuilder.java

/**
 * Create a builder.
 */
public WholeDocumentLanguageDispatchAnnotatorBuilder() {
    delegates = Maps.newEnumMap(LanguageCode.class);
}

From source file:io.knotx.server.KnotxServerConfiguration.java

public KnotxServerConfiguration(JsonObject config) {
    httpPort = config.getInteger("httpPort");
    splitterAddress = config.getJsonObject("splitter").getString("address");
    assemblerAddress = config.getJsonObject("assembler").getString("address");

    displayExceptionDetails = config.getBoolean("displayExceptionDetails", false);

    engineRouting = Maps.newEnumMap(HttpMethod.class);
    config.getJsonObject("routing").stream().forEach(this::parseMethodRouting);

    repositoryAddressMapping = Maps.newHashMap();
    config.getJsonArray("repositories").stream().map(item -> (JsonObject) item)
            .forEach(object -> repositoryAddressMapping.put(object.getString("path"),
                    new RepositoryEntry(object.getString("address"), object.getBoolean("doProcessing", true))));

    allowedResponseHeaders = config.getJsonArray("allowedResponseHeaders").stream()
            .map(item -> ((String) item).toLowerCase()).collect(Collectors.toSet());
}

From source file:com.android.build.gradle.internal.variant.LibraryVariantData.java

public LibraryVariantData(@NonNull AndroidConfig androidConfig, @NonNull TaskManager taskManager,
        @NonNull GradleVariantConfiguration config) {
    super(androidConfig, taskManager, config);
    testVariants = Maps.newEnumMap(VariantType.class);

    // create default output
    createOutput(OutputFile.OutputType.MAIN, Collections.<FilterData>emptyList());
}

From source file:com.torodb.core.transaction.metainf.ImmutableMetaDocPart.java

public ImmutableMetaDocPart(TableRef tableRef, String dbName) {
    this(tableRef, dbName, Collections.emptyMap(), Maps.newEnumMap(FieldType.class), Collections.emptyMap());
}

From source file:org.spongepowered.mod.event.HandlerCache.java

@SuppressWarnings("unchecked")
HandlerCache(List<RegisteredHandler> registrations) {
    this.handlers = Lists.newArrayList();
    for (RegisteredHandler reg : registrations) {
        this.handlers.add(reg.getHandler());
    }/*from   ww w  . j av a2s.  co m*/

    this.orderGrouped = Maps.newEnumMap(Order.class);
    for (Order order : Order.values()) {
        this.orderGrouped.put(order, new ArrayList<Handler>());
    }
    for (RegisteredHandler reg : registrations) {
        this.orderGrouped.get(reg.getOrder()).add(reg.getHandler());
    }
}

From source file:org.des.tao.ide.components.Event.java

public Event(String name, int instanceId, Point2D center) {
    this.instanceId = instanceId;
    this.eventState = new EventState(name, center);
    this.eventImageMap = Maps.newEnumMap(State.class);
    this.eventEditor = new EventEditor(eventState) {
        @Override//from   www . ja v  a2  s.c  o m
        public void commitCallback() {
            redrawImage();
        }
    };

    redrawImage();
}

From source file:datamine.storage.recordbuffers.example.data.StructTableTestData.java

public static List<EnumMap<StructTableMetadata, Object>> createInputData(int num) {
    List<EnumMap<StructTableMetadata, Object>> dataList = Lists.newArrayList();
    for (int i = 0; i < num; ++i) {
        EnumMap<StructTableMetadata, Object> dataMap = Maps.newEnumMap(StructTableMetadata.class);

        {/*from w  w  w. j  a  va  2s.c o  m*/
            Object val = SecondLevelNestedTableTestData.createInputData(3);
            if (val != null && !((List) val).isEmpty()) {
                dataMap.put(StructTableMetadata.NESTED_TABLE_COLUMN, val);
            }
        }

        if (!dataMap.isEmpty()) {
            dataList.add(dataMap);
        }
    }
    return dataList;
}

From source file:org.des.tao.ide.editors.EdeEditor.java

public EdeEditor() {
    super();/* ww  w  . j  a  v a2s .  co m*/

    editorMap = Maps.newEnumMap(EdgeType.class);
    editorMap.put(EdgeType.SCHEDULING, new SchedulingEdgeEditor());
    editorMap.put(EdgeType.PENDING, new PendingEdgeEditor());
    editorMap.put(EdgeType.CANCELLING, new CancellingEdgeEditor());

    revertChanges();
}

From source file:org.terasology.tutorial.assetsystem.block.family.RotateableBlockFamilyFactory.java

private static Map<Side, Map<Side, Rotation>> blockRotations() {
    Map<Side, Map<Side, Rotation>> rotations = Maps.newEnumMap(Side.class);
    //rotations where the TOP is on top and we rotate the front (add yaw)
    Map<Side, Rotation> topOnTopRotations = Maps.newEnumMap(Side.class);
    topOnTopRotations.put(Side.FRONT, Rotation.rotate(Yaw.NONE, Pitch.NONE, Roll.NONE));
    topOnTopRotations.put(Side.RIGHT, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.NONE, Roll.NONE));
    topOnTopRotations.put(Side.BACK, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.NONE, Roll.NONE));
    topOnTopRotations.put(Side.LEFT, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.NONE, Roll.NONE));
    rotations.put(Side.TOP, topOnTopRotations);
    //rotations where FRONT is on top (pitch 90) and we rotate the front (add yaw)
    Map<Side, Rotation> frontOnTopRotations = Maps.newEnumMap(Side.class);
    frontOnTopRotations.put(Side.BOTTOM, Rotation.rotate(Yaw.NONE, Pitch.CLOCKWISE_90, Roll.NONE));
    frontOnTopRotations.put(Side.BACK, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.CLOCKWISE_90, Roll.NONE));
    frontOnTopRotations.put(Side.TOP, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.CLOCKWISE_90, Roll.NONE));
    frontOnTopRotations.put(Side.FRONT, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.CLOCKWISE_90, Roll.NONE));
    rotations.put(Side.FRONT, frontOnTopRotations);
    //rotations where RIGHT is on top (roll 270) and we rotate the front (add yaw)
    Map<Side, Rotation> rightOnTopRotations = Maps.newEnumMap(Side.class);
    rightOnTopRotations.put(Side.FRONT, Rotation.rotate(Yaw.NONE, Pitch.NONE, Roll.CLOCKWISE_270));
    rightOnTopRotations.put(Side.BOTTOM, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.NONE, Roll.CLOCKWISE_270));
    rightOnTopRotations.put(Side.BACK, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.NONE, Roll.CLOCKWISE_270));
    rightOnTopRotations.put(Side.TOP, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.NONE, Roll.CLOCKWISE_270));
    rotations.put(Side.RIGHT, rightOnTopRotations);
    //rotations where LEFT is on top (roll 90) and we rotate the front (add yaw)
    Map<Side, Rotation> leftOnTopRotations = Maps.newEnumMap(Side.class);
    leftOnTopRotations.put(Side.FRONT, Rotation.rotate(Yaw.NONE, Pitch.NONE, Roll.CLOCKWISE_90));
    leftOnTopRotations.put(Side.TOP, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.NONE, Roll.CLOCKWISE_90));
    leftOnTopRotations.put(Side.BACK, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.NONE, Roll.CLOCKWISE_90));
    leftOnTopRotations.put(Side.BOTTOM, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.NONE, Roll.CLOCKWISE_90));
    rotations.put(Side.LEFT, leftOnTopRotations);
    //rotations where BACK is on top (pitch 270) and we rotate the front (add yaw)
    Map<Side, Rotation> backOnTopRotations = Maps.newEnumMap(Side.class);
    backOnTopRotations.put(Side.TOP, Rotation.rotate(Yaw.NONE, Pitch.CLOCKWISE_270, Roll.NONE));
    backOnTopRotations.put(Side.RIGHT, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.CLOCKWISE_270, Roll.NONE));
    backOnTopRotations.put(Side.BOTTOM, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.CLOCKWISE_270, Roll.NONE));
    backOnTopRotations.put(Side.LEFT, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.CLOCKWISE_270, Roll.NONE));
    rotations.put(Side.BACK, backOnTopRotations);
    //rotations where BOTTOM is on top (pitch 180) and we rotate the front (add yaw)
    Map<Side, Rotation> bottomOnTopRotations = Maps.newEnumMap(Side.class);
    bottomOnTopRotations.put(Side.FRONT, Rotation.rotate(Yaw.NONE, Pitch.CLOCKWISE_180, Roll.NONE));
    bottomOnTopRotations.put(Side.LEFT, Rotation.rotate(Yaw.CLOCKWISE_90, Pitch.CLOCKWISE_180, Roll.NONE));
    bottomOnTopRotations.put(Side.BACK, Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.CLOCKWISE_180, Roll.NONE));
    bottomOnTopRotations.put(Side.RIGHT, Rotation.rotate(Yaw.CLOCKWISE_270, Pitch.CLOCKWISE_180, Roll.NONE));
    rotations.put(Side.BOTTOM, bottomOnTopRotations);
    return rotations;
}

From source file:co.cask.cdap.metrics.store.upgrade.MetricsEntityCodec.java

MetricsEntityCodec(EntityTable entityTable, int contextDepth, int metricDepth, int tagDepth) {
    this.entityTable = entityTable;
    this.contextDepth = contextDepth;
    this.metricDepth = metricDepth;
    this.tagDepth = tagDepth;

    this.entityCaches = Maps.newEnumMap(MetricsEntityType.class);
    for (MetricsEntityType type : MetricsEntityType.values()) {
        LoadingCache<String, byte[]> cache = CacheBuilder.newBuilder()
                .expireAfterAccess(CACHE_EXPIRE_MINUTE, TimeUnit.MINUTES).build(createCacheLoader(type));
        this.entityCaches.put(type, cache);
    }//from   w ww.java 2s.com
}