List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap()
From source file:org.pshdl.model.types.builtIn.busses.memorymodel.MemoryModelSideFiles.java
public static byte[] builtHTML(Unit unit, List<Row> rows, boolean withDate) { final Map<String, String> options = Maps.newLinkedHashMap(); options.put("{TITLE}", "Register Overview"); if (withDate) { options.put("{DATE}", new Date().toString()); }/*from w w w .j a va 2 s.c o m*/ options.put("{HEADER}", tableHeader()); options.put("{TABLE}", generateTableBody(rows)); options.put("{HDLINTERFACE}", StringWriteExtension.asString(MemoryModel.buildHDLInterface(unit, rows).setName("Bus"), new SyntaxHighlighter.HTMLHighlighter(true))); try { return Helper.processFile(MemoryModel.class, "memmodelTemplate.html", options); } catch (final IOException e) { e.printStackTrace(); } return null; }
From source file:org.eclipse.emf.compare.ide.utils.StorageURIConverter.java
/** * {@inheritDoc}//from w ww . j av a 2 s .c om * * @see org.eclipse.emf.compare.utils.DelegatingURIConverter#createInputStream(org.eclipse.emf.common.util.URI, * java.util.Map) */ @Override public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException { final URI normalizedURI = normalize(uri); final URIHandler handler = getURIHandler(normalizedURI); // Only keep track of the loaded resource if it's a platform:/resource. // Resources loaded from plugins don't need to be part of our final logical model. if (uri.isPlatformResource()) { getLoadedRevisions().add(createStorage(uri, handler, this)); } final Map<Object, Object> actualOptions = Maps.newLinkedHashMap(); actualOptions.put(URIConverter.OPTION_URI_CONVERTER, this); if (options != null) { actualOptions.putAll(options); } return handler.createInputStream(normalizedURI, actualOptions); }
From source file:org.apache.druid.segment.SimpleQueryableIndex.java
public SimpleQueryableIndex(Interval dataInterval, Indexed<String> dimNames, BitmapFactory bitmapFactory, Map<String, ColumnHolder> columns, SmooshedFileMapper fileMapper, @Nullable Metadata metadata) { Preconditions.checkNotNull(columns.get(ColumnHolder.TIME_COLUMN_NAME)); this.dataInterval = Preconditions.checkNotNull(dataInterval, "dataInterval"); ImmutableList.Builder<String> columnNamesBuilder = ImmutableList.builder(); for (String column : columns.keySet()) { if (!ColumnHolder.TIME_COLUMN_NAME.equals(column)) { columnNamesBuilder.add(column); }// ww w . j a v a2 s . c o m } this.columnNames = columnNamesBuilder.build(); this.availableDimensions = dimNames; this.bitmapFactory = bitmapFactory; this.columns = columns; this.fileMapper = fileMapper; this.metadata = metadata; this.dimensionHandlers = Maps.newLinkedHashMap(); initDimensionHandlers(); }
From source file:org.napile.compiler.lang.resolve.calls.inference.ConstraintsUtil.java
@NotNull public static Collection<TypeSubstitutor> getSubstitutorsForConflictingParameters( @NotNull ConstraintSystem constraintSystem) { TypeParameterDescriptor firstConflictingParameter = getFirstConflictingParameter(constraintSystem); if (firstConflictingParameter == null) return Collections.emptyList(); Collection<NapileType> conflictingTypes = getValues( constraintSystem.getTypeConstraints(firstConflictingParameter)); ArrayList<Map<TypeConstructor, NapileType>> substitutionContexts = Lists.newArrayList(); for (NapileType type : conflictingTypes) { Map<TypeConstructor, NapileType> context = Maps.newLinkedHashMap(); context.put(firstConflictingParameter.getTypeConstructor(), type); substitutionContexts.add(context); }/*w ww . j a v a 2 s.c om*/ for (TypeParameterDescriptor typeParameter : constraintSystem.getTypeVariables()) { if (typeParameter == firstConflictingParameter) continue; NapileType safeType = getSafeValue(constraintSystem, typeParameter); for (Map<TypeConstructor, NapileType> context : substitutionContexts) { context.put(typeParameter.getTypeConstructor(), safeType); } } Collection<TypeSubstitutor> typeSubstitutors = Lists.newArrayList(); for (Map<TypeConstructor, NapileType> context : substitutionContexts) { typeSubstitutors.add(TypeSubstitutor.create(context)); } return typeSubstitutors; }
From source file:io.atomix.core.barrier.impl.DefaultDistributedCyclicBarrierService.java
@Override public void restore(BackupInput input) { parties = input.readObject();//from w w w. jav a2 s . co m barrierId = input.readLong(); broken = input.readBoolean(); this.waiters = Maps.newLinkedHashMap(); Map<SessionId, Long> waiters = input.readObject(); waiters.forEach((sessionId, timeout) -> { this.waiters.put(sessionId, new Waiter(timeout, timeout == 0 ? null : getScheduler().schedule( Duration.ofMillis(timeout - getWallClock().getTime().unixTimestamp()), () -> timeout(barrierId)))); }); }
From source file:org.gradle.api.internal.tasks.AntGroovydoc.java
public void execute(final FileCollection source, File destDir, boolean use, boolean noTimestamp, boolean noVersionStamp, String windowTitle, String docTitle, String header, String footer, String overview, boolean includePrivate, final Set<Groovydoc.Link> links, final Iterable<File> groovyClasspath, Iterable<File> classpath, Project project) { final File tmpDir = new File(project.getBuildDir(), "tmp/groovydoc"); FileOperations fileOperations = (ProjectInternal) project; fileOperations.delete(tmpDir);//from w w w. j a v a 2s . c om fileOperations.copy(new Action<CopySpec>() { public void execute(CopySpec copySpec) { copySpec.from(source).into(tmpDir); } }); List<File> combinedClasspath = ImmutableList.<File>builder().addAll(classpath).addAll(groovyClasspath) .build(); VersionNumber version = VersionNumber.parse(getGroovyVersion(combinedClasspath)); final Map<String, Object> args = Maps.newLinkedHashMap(); args.put("sourcepath", tmpDir.toString()); args.put("destdir", destDir); args.put("use", use); if (isAtLeast(version, "2.4.6")) { args.put("noTimestamp", noTimestamp); args.put("noVersionStamp", noVersionStamp); } args.put("private", includePrivate); putIfNotNull(args, "windowtitle", windowTitle); putIfNotNull(args, "doctitle", docTitle); putIfNotNull(args, "header", header); putIfNotNull(args, "footer", footer); if (overview != null) { args.put("overview", overview); } invokeGroovydoc(links, combinedClasspath, args); }
From source file:org.sonatype.nexus.ldap.internal.persist.DefaultLdapConfigurationManager.java
@Inject public DefaultLdapConfigurationManager(final LdapConfigurationSource configurationSource, final Validator validator, final EventBus eventBus, final RealmManager realmManager) { this.configurationSource = checkNotNull(configurationSource); this.validator = checkNotNull(validator); this.eventBus = checkNotNull(eventBus); this.realmManager = checkNotNull(realmManager); this.cache = Maps.newLinkedHashMap(); this.cachePrimed = false; }
From source file:com.yahoo.sample.Container.java
public Map<String, JsonNode> run(String script, final Module... modules) throws Exception { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); Injector injector = Guice.createInjector(new JavaEngineModule(), new AbstractModule() { @Override//from ww w . ja v a 2 s . com protected void configure() { bind(ViewRegistry.class).toInstance(new ViewRegistry() { @Override public OperatorNode<SequenceOperator> getView(List<String> name) { return null; } }); bind(TaskMetricEmitter.class) .toInstance(new StandardRequestEmitter(new MetricDimension(), new RequestMetricSink() { @Override public void emitRequest(RequestEvent arg0) { } }).start(new MetricDimension())); } }, new AbstractModule() { @Override protected void configure() { for (Module module : modules) { install(module); } } }); YQLPlusCompiler compiler = injector.getInstance(YQLPlusCompiler.class); CompiledProgram program = compiler.compile(script); //program.dump(System.err); ProgramResult result = program.run(Maps.<String, Object>newHashMap(), true); try { result.getEnd().get(10000L, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } Map<String, JsonNode> parsed = Maps.newLinkedHashMap(); for (String key : result.getResultNames()) { YQLResultSet data = result.getResult(key).get(); Object rez = data.getResult(); ByteArrayOutputStream outstream = new ByteArrayOutputStream(); JsonGenerator gen = JSON_FACTORY.createGenerator(outstream); gen.writeObject(rez); gen.flush(); parsed.put(key, (JsonNode) JSON_FACTORY.createParser(outstream.toByteArray()).readValueAsTree()); } return parsed; }
From source file:com.opengamma.financial.analytics.model.curve.forward.FXForwardCurveDefaults.java
public FXForwardCurveDefaults(final ComputationTargetType target, final String... defaultsPerCurrencyPair) { super(target, true); ArgumentChecker.notNull(defaultsPerCurrencyPair, "defaults per currency"); final int n = defaultsPerCurrencyPair.length; ArgumentChecker.isTrue(n % 3 == 0,//w w w. j av a2 s.c om "Need one forward curve name, forward curve calculation method and surface name per currency pair"); _currencyPairToCurveName = Maps.newLinkedHashMap(); _currencyPairToCurveCalculationMethodName = Maps.newLinkedHashMap(); for (int i = 0; i < n; i += 3) { final String currencyPair = defaultsPerCurrencyPair[i]; _currencyPairToCurveName.put(currencyPair, defaultsPerCurrencyPair[i + 1]); _currencyPairToCurveCalculationMethodName.put(currencyPair, defaultsPerCurrencyPair[i + 2]); } }
From source file:org.smartdeveloperhub.harvesters.it.notification.ConnectionManager.java
ConnectionManager(final String name, final String brokerHost, final int brokerPort, final String virtualHost) { this.name = name; this.brokerHost = brokerHost; this.brokerPort = brokerPort; this.virtualHost = virtualHost; this.lock = new ReentrantLock(); this.channels = Maps.newLinkedHashMap(); }