Java Code Examples for java.util.IdentityHashMap

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project riftsaw-ode, under directory /agents/src/main/java/org/apache/ode/agents/memory/.

Source file: SizingAgent.java

  21 
vote

/** 
 * Returns deep size of object, recursively iterating over its fields and superclasses.
 */
public static long deepSizeOf(Object obj){
  if (instrumentation == null) {
    return 0;
  }
  Map visited=new IdentityHashMap();
  Stack stack=new Stack();
  stack.push(obj);
  long result=0;
  do {
    result+=internalSizeOf(stack.pop(),stack,visited);
  }
 while (!stack.isEmpty());
  return result;
}
 

Example 2

From project aether-core, under directory /aether-impl/src/main/java/org/eclipse/aether/internal/impl/.

Source file: DefaultInstaller.java

  19 
vote

private InstallResult install(SyncContext syncContext,RepositorySystemSession session,InstallRequest request) throws InstallationException {
  InstallResult result=new InstallResult(request);
  RequestTrace trace=RequestTrace.newChild(request.getTrace(),request);
  List<MetadataGenerator> generators=getMetadataGenerators(session,request);
  List<Artifact> artifacts=new ArrayList<Artifact>(request.getArtifacts());
  IdentityHashMap<Metadata,Object> processedMetadata=new IdentityHashMap<Metadata,Object>();
  List<Metadata> metadatas=Utils.prepareMetadata(generators,artifacts);
  syncContext.acquire(artifacts,Utils.combine(request.getMetadata(),metadatas));
  for (  Metadata metadata : metadatas) {
    install(session,trace,metadata);
    processedMetadata.put(metadata,null);
    result.addMetadata(metadata);
  }
  for (int i=0; i < artifacts.size(); i++) {
    Artifact artifact=artifacts.get(i);
    for (    MetadataGenerator generator : generators) {
      artifact=generator.transformArtifact(artifact);
    }
    artifacts.set(i,artifact);
    install(session,trace,artifact);
    result.addArtifact(artifact);
  }
  metadatas=Utils.finishMetadata(generators,artifacts);
  syncContext.acquire(null,metadatas);
  for (  Metadata metadata : metadatas) {
    install(session,trace,metadata);
    processedMetadata.put(metadata,null);
    result.addMetadata(metadata);
  }
  for (  Metadata metadata : request.getMetadata()) {
    if (!processedMetadata.containsKey(metadata)) {
      install(session,trace,metadata);
      result.addMetadata(metadata);
    }
  }
  return result;
}
 

Example 3

From project archaius, under directory /archaius-core/src/main/java/com/netflix/config/util/.

Source file: ConfigurationUtils.java

  19 
vote

/** 
 * Convert CombinedConfiguration into  {@link ConcurrentCompositeConfiguration} as the later has better performanceand thread safety. 
 * @param config Configuration to be converted
 */
public static ConcurrentCompositeConfiguration convertToConcurrentCompositeConfiguration(CombinedConfiguration config){
  ConcurrentCompositeConfiguration root=new ConcurrentCompositeConfiguration();
  IdentityHashMap<Configuration,String> reverseMap=new IdentityHashMap<Configuration,String>();
  for (  String name : (Set<String>)config.getConfigurationNames()) {
    Configuration child=config.getConfiguration(name);
    reverseMap.put(child,name);
  }
  for (int i=0; i < config.getNumberOfConfigurations(); i++) {
    Configuration child=config.getConfiguration(i);
    String name=reverseMap.get(child);
    if (child instanceof CombinedConfiguration) {
      CombinedConfiguration combinedConf=(CombinedConfiguration)child;
      ConcurrentCompositeConfiguration newConf=convertToConcurrentCompositeConfiguration(combinedConf);
      root.addConfiguration(newConf,name);
    }
 else {
      Configuration conf=new ConcurrentMapConfiguration(child);
      root.addConfiguration((AbstractConfiguration)conf,name);
    }
  }
  return root;
}
 

Example 4

From project avro, under directory /lang/java/avro/src/main/java/org/apache/avro/.

Source file: Schema.java

  19 
vote

/** 
 * Rewrite a writer's schema using the aliases from a reader's schema.  This permits reading records, enums and fixed schemas whose names have changed, and records whose field names have changed.  The returned schema always contains the same data elements in the same order, but with possibly different names. 
 */
public static Schema applyAliases(Schema writer,Schema reader){
  if (writer == reader)   return writer;
  Map<Schema,Schema> seen=new IdentityHashMap<Schema,Schema>(1);
  Map<Name,Name> aliases=new HashMap<Name,Name>(1);
  Map<Name,Map<String,String>> fieldAliases=new HashMap<Name,Map<String,String>>(1);
  getAliases(reader,seen,aliases,fieldAliases);
  if (aliases.size() == 0 && fieldAliases.size() == 0)   return writer;
  seen.clear();
  return applyAliases(writer,seen,aliases,fieldAliases);
}
 

Example 5

From project core_4, under directory /api/src/main/java/org/ajax4jsf/javascript/.

Source file: ScriptUtils.java

  19 
vote

/** 
 * Convert any Java Object to JavaScript representation ( as possible ).
 * @param obj
 * @return
 */
public static String toScript(Object obj){
  StringBuilder sb=new StringBuilder();
  try {
    appendScript(sb,obj,new IdentityHashMap<Object,Boolean>());
  }
 catch (  IOException e) {
  }
  return sb.toString();
}
 

Example 6

From project droolsjbpm-integration, under directory /drools-camel/src/main/java/org/drools/camel/component/.

Source file: FastCloner.java

  19 
vote

/** 
 * deep clones "o".
 * @param < T > the type of "o"
 * @param o the object to be deep-cloned
 * @return a deep-clone of "o".
 */
public <T>T deepClone(final T o){
  if (o == null) {
    return null;
  }
  if (!this.cloningEnabled) {
    return o;
  }
  if (this.dumpClonedClasses) {
    System.out.println("start>" + o.getClass());
  }
  final Map<Object,Object> clones=new IdentityHashMap<Object,Object>(16);
  try {
    return cloneInternal(o,clones);
  }
 catch (  final IllegalAccessException e) {
    throw new RuntimeException("error during cloning of " + o,e);
  }
}
 

Example 7

From project dynalink, under directory /src/main/java/org/dynalang/dynalink/support/.

Source file: TypeUtilities.java

  19 
vote

private static Map<Class<?>,Class<?>> createWrapperTypes(){
  final Map<Class<?>,Class<?>> wrapperTypes=new IdentityHashMap<Class<?>,Class<?>>(8);
  wrapperTypes.put(Boolean.TYPE,Boolean.class);
  wrapperTypes.put(Byte.TYPE,Byte.class);
  wrapperTypes.put(Character.TYPE,Character.class);
  wrapperTypes.put(Short.TYPE,Short.class);
  wrapperTypes.put(Integer.TYPE,Integer.class);
  wrapperTypes.put(Long.TYPE,Long.class);
  wrapperTypes.put(Float.TYPE,Float.class);
  wrapperTypes.put(Double.TYPE,Double.class);
  return Collections.unmodifiableMap(wrapperTypes);
}
 

Example 8

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.core/src/org/springsource/ide/eclipse/gradle/core/.

Source file: GradleModelProvider.java

  19 
vote

@Override public <T extends HierarchicalEclipseProject>void ensureModels(Class<T> requiredType,IProgressMonitor mon) throws CoreException, OperationCanceledException {
synchronized (this) {
    if (satisfies(requiredType)) {
      return;
    }
  }
  if (alreadyFailed(requiredType)) {
    Assert.isNotNull(error);
    throw new CoreException(ExceptionUtil.status(error));
  }
  T model=null;
  try {
    model=buildModel(rootProject,requiredType,mon);
    Map<GradleProject,HierarchicalEclipseProject> cache=new IdentityHashMap<GradleProject,HierarchicalEclipseProject>();
    walk(model,cache);
synchronized (this) {
      this.models=cache;
      this.type=requiredType;
    }
    for (    GradleProject p : cache.keySet()) {
      p.setModelProvider(this);
    }
    for (    Entry<GradleProject,HierarchicalEclipseProject> e : cache.entrySet()) {
      e.getKey().notifyModelListeners(e.getValue());
    }
  }
 catch (  CoreException e) {
    this.failedType=requiredType;
    this.error=e;
  }
}
 

Example 9

From project fastjson, under directory /src/main/java/com/alibaba/fastjson/serializer/.

Source file: JSONSerializer.java

  19 
vote

public void setContext(SerialContext parent,Object object,Object fieldName){
  if (isEnabled(SerializerFeature.DisableCircularReferenceDetect)) {
    return;
  }
  this.context=new SerialContext(parent,object,fieldName);
  if (references == null) {
    references=new IdentityHashMap<Object,SerialContext>();
  }
  this.references.put(object,context);
}
 

Example 10

From project Flapi, under directory /src/main/java/unquietcode/tools/flapi/.

Source file: DescriptorPostValidator.java

  19 
vote

private void checkForBlocksWithNoEnd(StateClass state,final Set<StateClass> seen,final ObjectWrapper<Boolean> valid){
  if (seen.contains(state)) {
    return;
  }
 else {
    seen.add(state);
  }
  for (  Transition transition : state.getTransitions()) {
    if (transition instanceof RecursiveTransition) {
      continue;
    }
    transition.accept(new TransitionVisitor.$(){
      public @Override void visit(      TerminalTransition transition){
        valid.set(true);
      }
      public @Override void visit(      AscendingTransition transition){
        valid.set(true);
      }
    }
);
    final Set<StateClass> localSeen=Collections.newSetFromMap(new IdentityHashMap<StateClass,Boolean>());
    final ObjectWrapper<Boolean> localValid=new ObjectWrapper<Boolean>(false);
    localSeen.add(state);
    transition.acceptForTraversal(new GenericVisitor<StateClass>(){
      public void visit(      StateClass next){
        checkForBlocksWithNoEnd(next,localSeen,localValid);
      }
    }
);
    if (localValid.get() == true) {
      valid.set(true);
    }
  }
  if (valid.get() != true) {
    throw new DescriptorBuilderException("Encountered a block with no terminal method: " + state.getName());
  }
}
 

Example 11

From project git-plugin, under directory /src/main/java/hudson/plugins/git/util/.

Source file: BuildData.java

  19 
vote

@Override public BuildData clone(){
  BuildData clone;
  try {
    clone=(BuildData)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    throw new RuntimeException("Error cloning BuildData",e);
  }
  IdentityHashMap<Build,Build> clonedBuilds=new IdentityHashMap<Build,Build>();
  clone.buildsByBranchName=new HashMap<String,Build>();
  for (  Map.Entry<String,Build> buildByBranchName : buildsByBranchName.entrySet()) {
    String branchName=buildByBranchName.getKey();
    if (branchName == null) {
      branchName="";
    }
    Build build=buildByBranchName.getValue();
    Build clonedBuild=clonedBuilds.get(build);
    if (clonedBuild == null) {
      clonedBuild=build.clone();
      clonedBuilds.put(build,clonedBuild);
    }
    clone.buildsByBranchName.put(branchName,clonedBuild);
  }
  if (lastBuild != null) {
    clone.lastBuild=clonedBuilds.get(lastBuild);
    if (clone.lastBuild == null) {
      clone.lastBuild=lastBuild.clone();
      clonedBuilds.put(lastBuild,clone.lastBuild);
    }
  }
  return clone;
}
 

Example 12

From project glg2d, under directory /src/main/java/glg2d/.

Source file: GLAwareRepaintManager.java

  19 
vote

private void queue(){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      Map<JComponent,Rectangle> r;
synchronized (rects) {
        r=new IdentityHashMap<JComponent,Rectangle>(rects);
        queued=false;
        rects.clear();
      }
      r=filter(r);
      G2DGLPanel canvas=getGLParent(r.keySet().iterator().next());
      canvas.paintGLImmediately(r);
    }
  }
);
}
 

Example 13

From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.

Source file: Sprite.java

  19 
vote

public int compare(Part a,Part b){
  int c=partcmp.compare(a,b);
  if (c != 0)   return (c);
  c=System.identityHashCode(a) - System.identityHashCode(b);
  if (c != 0)   return (c);
  if (a == b)   return (0);
  if (emergency == null) {
    System.err.println("Could not impose ordering on distinct sprite parts, invoking emergency protocol!");
    emergency=new IdentityHashMap<Part,Integer>();
  }
  int ai, bi;
  if (emergency.containsKey(a))   ai=emergency.get(a);
 else   emergency.put(a,ai=eid++);
  if (emergency.containsKey(a))   bi=emergency.get(a);
 else   emergency.put(b,bi=eid++);
  return (ai - bi);
}
 

Example 14

From project heritrix3, under directory /engine/src/main/java/org/archive/crawler/restlet/.

Source file: JobRelatedResource.java

  19 
vote

/** 
 * Get a map giving object beanNames.
 * @return map from object to beanName
 */
private IdentityHashMap<Object,String> getBeanToNameMap(){
  if (beanToNameMap == null) {
    beanToNameMap=new IdentityHashMap<Object,String>();
    for (    Object entryObj : cj.getJobContext().getBeansOfType(Object.class).entrySet()) {
      Map.Entry<?,?> entry=(Map.Entry<?,?>)entryObj;
      beanToNameMap.put(entry.getValue(),(String)entry.getKey());
    }
  }
  return beanToNameMap;
}
 

Example 15

From project hibernate-validator, under directory /engine/src/main/java/org/hibernate/validator/internal/engine/.

Source file: ValidationContext.java

  19 
vote

protected ValidationContext(BeanMetaDataManager beanMetaDataManager,ConstraintValidatorManager constraintValidatorManager,Class<T> rootBeanClass,T rootBean,MessageInterpolator messageInterpolator,ConstraintValidatorFactory constraintValidatorFactory,TraversableResolver traversableResolver,boolean failFast){
  this.beanMetaDataManager=beanMetaDataManager;
  this.constraintValidatorManager=constraintValidatorManager;
  this.rootBean=rootBean;
  this.rootBeanClass=rootBeanClass;
  this.messageInterpolator=messageInterpolator;
  this.constraintValidatorFactory=constraintValidatorFactory;
  this.traversableResolver=traversableResolver;
  this.failFast=failFast;
  processedObjects=new HashMap<Class<?>,IdentitySet>();
  processedPaths=new IdentityHashMap<Object,Set<PathImpl>>();
  failingConstraintViolations=new HashSet<C>();
}
 

Example 16

From project iudex_1, under directory /iudex-filter/src/main/java/iudex/filter/core/.

Source file: ByFilterReporter.java

  19 
vote

/** 
 * Construct given index of filters, report writer, and report period in seconds.
 */
public ByFilterReporter(FilterIndex index,ReportWriter writer,double period_s){
  Collection<Filter> filters=index.filters();
  _counters=new IdentityHashMap<Filter,Counter>(filters.size());
  for (  Filter f : filters) {
    _counters.put(f,new Counter());
  }
  _writer=writer;
  _notifier=new Notifier(period_s);
}
 

Example 17

From project jboss-marshalling, under directory /serial/src/main/java/org/jboss/marshalling/serial/.

Source file: SerialMarshaller.java

  19 
vote

SerialMarshaller(final AbstractMarshallerFactory marshallerFactory,final SerializableClassRegistry registry,final MarshallingConfiguration configuration) throws IOException {
  super(marshallerFactory,configuration);
  if (configuredVersion != 5) {
    throw new IOException("Only protocol version 5 is supported for writing");
  }
  this.registry=registry;
  instanceCache=new IdentityIntMap<Object>(configuration.getInstanceCount());
  descriptorCache=new IdentityIntMap<Class<?>>(configuration.getClassCount());
  replacementCache=new IdentityHashMap<Object,Object>(configuration.getInstanceCount());
  externalizers=new IdentityHashMap<Class<?>,Externalizer>(configuration.getClassCount());
  bufferSize=configuration.getBufferSize();
}
 

Example 18

From project jboss-msc, under directory /src/main/java/org/jboss/msc/service/.

Source file: ServiceControllerImpl.java

  19 
vote

private void getListenerTasks(final Transition transition,final ArrayList<Runnable> tasks){
  final IdentityHashMap<ServiceListener<? super S>,ServiceListener.Inheritance> listeners=this.listeners;
  for (  ServiceListener<? super S> listener : listeners.keySet()) {
    tasks.add(new ListenerTask(listener,transition));
  }
}
 

Example 19

From project jboss-remoting, under directory /src/main/java/org/jboss/remoting3/spi/.

Source file: AbstractHandleableCloseable.java

  19 
vote

/** 
 * {@inheritDoc}
 */
public Key addCloseHandler(final CloseHandler<? super T> handler){
  if (handler == null) {
    throw new NullPointerException("handler is null");
  }
synchronized (closeLock) {
    if (state == State.OPEN || state == State.CLOSING) {
      final Key key=new KeyImpl<T>(this);
      final Map<Key,CloseHandler<? super T>> closeHandlers=this.closeHandlers;
      if (closeHandlers == null) {
        final IdentityHashMap<Key,CloseHandler<? super T>> newMap=new IdentityHashMap<Key,CloseHandler<? super T>>();
        this.closeHandlers=newMap;
        newMap.put(key,handler);
      }
 else {
        closeHandlers.put(key,handler);
      }
      return key;
    }
  }
  runCloseTask(new CloseHandlerTask(handler,null));
  return new NullKey();
}
 

Example 20

From project JCL, under directory /JCL2/core/src/main/java/org/xeustechnologies/jcl/utils/.

Source file: ObjectCloner.java

  19 
vote

/** 
 * @param original
 * @return T
 */
public <T>T deepClone(final T original){
  if (original == null)   return null;
  final Map<Object,Object> clones=new IdentityHashMap<Object,Object>();
  try {
    return clone(original,clones);
  }
 catch (  IllegalAccessException e) {
    throw new JclException("Error during cloning of " + original,e);
  }
}
 

Example 21

From project jopt-simple, under directory /src/main/java/joptsimple/.

Source file: OptionSet.java

  19 
vote

OptionSet(Map<String,List<?>> defaults){
  detectedSpecs=new ArrayList<OptionSpec<?>>();
  detectedOptions=new HashMap<String,AbstractOptionSpec<?>>();
  optionsToArguments=new IdentityHashMap<AbstractOptionSpec<?>,List<String>>();
  nonOptionArguments=new ArrayList<String>();
  defaultValues=new HashMap<String,List<?>>(defaults);
}
 

Example 22

From project juzu, under directory /core/src/test/java/juzu/test/.

Source file: UserAgent.java

  19 
vote

public UserAgent(URL homeURL){
  WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6);
  client.setAlertHandler(new AlertHandler(){
    public void handleAlert(    Page page,    String message){
      List<String> l=alerts.get(page);
      if (l == null) {
        alerts.put(page,l=new ArrayList<String>());
      }
      l.add(message);
    }
  }
);
  this.alerts=new IdentityHashMap<Page,List<String>>();
  this.client=client;
  this.homeURL=homeURL;
}
 

Example 23

From project kernel_1, under directory /exo.kernel.container/src/main/java/org/exoplatform/container/component/.

Source file: RequestLifeCycle.java

  19 
vote

IdentityHashMap<Object,Throwable> doEnd(){
  IdentityHashMap<Object,Throwable> result=new IdentityHashMap<Object,Throwable>();
  for (  ComponentRequestLifecycle componentRLF : components) {
    Throwable t=null;
    try {
      componentRLF.endRequest(container);
    }
 catch (    Throwable throwable) {
      t=throwable;
    }
 finally {
      result.put(componentRLF,t);
    }
  }
  return result;
}
 

Example 24

From project makegood, under directory /com.piece_framework.makegood.aspect/src/com/piece_framework/makegood/aspect/.

Source file: AspectWeaver.java

  19 
vote

private void weaveAspects(AspectManifest manifest){
  Map<CtClass,CtClass> wovenClasses=new IdentityHashMap<CtClass,CtClass>();
  for (  Aspect aspect : manifest.aspects()) {
    try {
      aspect.weave();
    }
 catch (    NotFoundException e) {
      log(e,manifest);
      continue;
    }
catch (    CannotCompileException e) {
      log(e,manifest);
      continue;
    }
catch (    CannotWeaveException e) {
      log(e,manifest);
      continue;
    }
    for (    CtClass wovenClass : aspect.getWovenClasses()) {
      wovenClasses.put(wovenClass,wovenClass);
    }
  }
  for (  CtClass wovenClass : wovenClasses.values()) {
    try {
      wovenClass.toClass(manifest.getClass().getClassLoader(),null);
    }
 catch (    CannotCompileException e) {
      log(e,manifest);
      continue;
    }
  }
}
 

Example 25

From project maven-shared, under directory /maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/.

Source file: DependencyTreeResolutionListener.java

  19 
vote

/** 
 * Creates a new dependency tree resolution listener that writes to the specified log.
 * @param logger the log to write debug messages to
 */
public DependencyTreeResolutionListener(Logger logger){
  this.logger=logger;
  parentNodes=new Stack<DependencyNode>();
  nodesByArtifact=new IdentityHashMap<Artifact,DependencyNode>();
  rootNode=null;
  currentNode=null;
}
 

Example 26

From project netty, under directory /common/src/main/java/io/netty/util/.

Source file: DefaultAttributeMap.java

  19 
vote

@Override public synchronized <T>Attribute<T> attr(AttributeKey<T> key){
  Map<AttributeKey<?>,Attribute<?>> map=this.map;
  if (map == null) {
    map=this.map=new IdentityHashMap<AttributeKey<?>,Attribute<?>>(2);
  }
  Attribute<T> attr=(Attribute<T>)map.get(key);
  if (attr == null) {
    attr=new DefaultAttribute<T>();
    map.put(key,attr);
  }
  return attr;
}
 

Example 27

From project OpenTripPlanner, under directory /opentripplanner-routing/src/main/java/org/opentripplanner/routing/algorithm/strategies/.

Source file: TableRemainingWeightHeuristic.java

  19 
vote

/** 
 * Use of this method is important to set up the table-driven heuristic instance. It needs to explore around the target vertex and find transit stops in the vicinity. On subsequent calls, if the target is the same, this information will be reused.
 */
@Override public double computeInitialWeight(State s0,Vertex target){
  options=s0.getOptions();
  if (target == this.target) {
    LOG.debug("Reusing target stop list.");
    return 0;
  }
  weightCache=new IdentityHashMap<Vertex,Double>(5000);
  this.target=target;
  targetStops=new ArrayList<NearbyStop>(50);
  Map<Vertex,List<Edge>> extraEdges=new HashMap<Vertex,List<Edge>>();
  ShortestPathTree spt=new BasicShortestPathTree(options);
  BinHeap<State> heap=new BinHeap<State>(100);
  State targetState=new State(target,s0.getTime(),s0.getOptions().reversedClone());
  spt.add(targetState);
  heap.insert(targetState,0);
  while (!heap.empty()) {
    State u=heap.extract_min();
    if (!spt.visit(u))     continue;
    Vertex uVertex=u.getVertex();
    weightCache.put(uVertex,u.getWeight());
    if (uVertex instanceof TransitStop) {
      targetStops.add(new NearbyStop(uVertex,u.getWalkDistance(),u.getWeight()));
      continue;
    }
    if (options.isArriveBy()) {
      for (      Edge e : GraphLibrary.getOutgoingEdges(g,uVertex,extraEdges)) {
        State v=e.traverse(u);
        if (v != null && spt.add(v))         heap.insert(v,v.getWeight());
      }
    }
 else {
      for (      Edge e : GraphLibrary.getIncomingEdges(g,uVertex,extraEdges)) {
        State v=e.traverse(u);
        if (v != null && spt.add(v))         heap.insert(v,v.getWeight());
      }
    }
  }
  LOG.debug("Found " + targetStops.size() + " stops near destination.");
  return defaultHeuristic.computeInitialWeight(s0,target);
}
 

Example 28

From project org.ops4j.pax.web, under directory /pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/.

Source file: ContextModel.java

  19 
vote

public ContextModel(final HttpContext httpContext,final Bundle bundle,final ClassLoader classLoader){
  m_bundle=bundle;
  NullArgumentException.validateNotNull(httpContext,"Http context");
  NullArgumentException.validateNotNull(classLoader,"Class loader");
  m_classLoader=classLoader;
  m_httpContext=httpContext;
  m_contextParams=new HashMap<String,String>();
  m_jspServlets=new IdentityHashMap<Servlet,String[]>();
  m_contextName="";
  m_accessControllerContext=AccessController.getContext();
  virtualHosts=new ArrayList<String>();
  connectors=new ArrayList<String>();
}
 

Example 29

From project sketch, under directory /org.eclipse.sketch.examples.shapes.diagram/src/org/eclipse/sketch/examples/shapes/diagram/providers/.

Source file: ShapesElementTypes.java

  19 
vote

/** 
 * Returns 'type' of the ecore object associated with the hint.
 * @generated
 */
public static ENamedElement getElement(IAdaptable hint){
  Object type=hint.getAdapter(IElementType.class);
  if (elements == null) {
    elements=new IdentityHashMap<IElementType,ENamedElement>();
    elements.put(Diagram_1000,ShapesPackage.eINSTANCE.getDiagram());
    elements.put(Square_2001,ShapesPackage.eINSTANCE.getSquare());
    elements.put(Triangle_2002,ShapesPackage.eINSTANCE.getTriangle());
    elements.put(Unknown_2003,ShapesPackage.eINSTANCE.getUnknown());
    elements.put(Connection_4001,ShapesPackage.eINSTANCE.getConnection());
    elements.put(DashedConnection_4002,ShapesPackage.eINSTANCE.getDashedConnection());
  }
  return (ENamedElement)elements.get(type);
}
 

Example 30

From project sonatype-aether, under directory /aether-impl/src/main/java/org/sonatype/aether/impl/internal/.

Source file: DefaultInstaller.java

  19 
vote

private InstallResult install(SyncContext syncContext,RepositorySystemSession session,InstallRequest request) throws InstallationException {
  InstallResult result=new InstallResult(request);
  RequestTrace trace=DefaultRequestTrace.newChild(request.getTrace(),request);
  List<MetadataGenerator> generators=getMetadataGenerators(session,request);
  List<Artifact> artifacts=new ArrayList<Artifact>(request.getArtifacts());
  IdentityHashMap<Metadata,Object> processedMetadata=new IdentityHashMap<Metadata,Object>();
  List<Metadata> metadatas=Utils.prepareMetadata(generators,artifacts);
  syncContext.acquire(artifacts,Utils.combine(request.getMetadata(),metadatas));
  for (  Metadata metadata : metadatas) {
    install(session,trace,metadata);
    processedMetadata.put(metadata,null);
    result.addMetadata(metadata);
  }
  for (int i=0; i < artifacts.size(); i++) {
    Artifact artifact=artifacts.get(i);
    for (    MetadataGenerator generator : generators) {
      artifact=generator.transformArtifact(artifact);
    }
    artifacts.set(i,artifact);
    install(session,trace,artifact);
    result.addArtifact(artifact);
  }
  metadatas=Utils.finishMetadata(generators,artifacts);
  syncContext.acquire(null,metadatas);
  for (  Metadata metadata : metadatas) {
    install(session,trace,metadata);
    processedMetadata.put(metadata,null);
    result.addMetadata(metadata);
  }
  for (  Metadata metadata : request.getMetadata()) {
    if (!processedMetadata.containsKey(metadata)) {
      install(session,trace,metadata);
      result.addMetadata(metadata);
    }
  }
  return result;
}
 

Example 31

From project spring-data-graph, under directory /spring-data-neo4j/src/main/java/org/springframework/data/neo4j/mapping/.

Source file: Neo4JPersistentPropertyImpl.java

  19 
vote

private Map<Class<? extends Annotation>,? extends Annotation> extractAnnotations(Field field){
  Map<Class<? extends Annotation>,Annotation> result=new IdentityHashMap<Class<? extends Annotation>,Annotation>();
  for (  Annotation annotation : field.getAnnotations()) {
    result.put(annotation.annotationType(),annotation);
  }
  return result;
}
 

Example 32

From project spring-data-neo4j, under directory /spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/mapping/.

Source file: Neo4JPersistentPropertyImpl.java

  19 
vote

private Map<Class<? extends Annotation>,? extends Annotation> extractAnnotations(Field field){
  Map<Class<? extends Annotation>,Annotation> result=new IdentityHashMap<Class<? extends Annotation>,Annotation>();
  for (  Annotation annotation : field.getAnnotations()) {
    result.put(annotation.annotationType(),annotation);
  }
  return result;
}
 

Example 33

From project xnio_1, under directory /api/src/main/java/org/xnio/.

Source file: OptionMap.java

  19 
vote

/** 
 * Create a two-valued option map.  If both options are the same key, then only the second one is added to the map.
 * @param option1 the first option to put in the map
 * @param value1 the first option value
 * @param option2 the second option to put in the map
 * @param value2 the second option value
 * @param < T1 > the first option value type
 * @param < T2 > the second option value type
 * @return the option map
 * @since 3.0
 */
public static <T1,T2>OptionMap create(Option<T1> option1,T1 value1,Option<T2> option2,T2 value2){
  if (option1 == null) {
    throw msg.nullParameter("option1");
  }
  if (value1 == null) {
    throw msg.nullParameter("value1");
  }
  if (option2 == null) {
    throw msg.nullParameter("option2");
  }
  if (value2 == null) {
    throw msg.nullParameter("value2");
  }
  if (option1 == option2) {
    return create(option2,value2);
  }
  final IdentityHashMap<Option<?>,Object> map=new IdentityHashMap<Option<?>,Object>(2);
  map.put(option1,value1);
  map.put(option2,value2);
  return new OptionMap(map);
}