This is a custom interner that simultaneously creates and interns
an IntDependency.

@return An interned IntDependency
488199
protected IntDependency intern(IntTaggedWord headTW, IntTaggedWord argTW, boolean leftHeaded, short dist) {
    Map<IntDependency,IntDependency> map = expandDependencyMap;
    IntDependency internTempDependency = new IntDependency(itwInterner.intern(headTW), itwInterner.intern(argTW), leftHeaded, dist);
    IntDependency returnDependency = internTempDependency;
    if (map != null) {
      returnDependency = map.get(internTempDependency);
      if (returnDependency == null) {
        map.put(internTempDependency, internTempDependency);
        returnDependency = internTempDependency;
      }
    }
    return returnDependency;
  }
183310
@Requires({
    "sourceDependencyLoader != null",
    "type != null"
  })
  @Ensures({
    "importNames != null",
    "rootLineNumberIterator != null"
  })
  @SuppressWarnings("unchecked")
  protected void fetchSourceDependency() throws IOException {
    String fileName = type.getName().getBinaryName()
        + JavaUtils.SOURCE_DEPENDENCY_EXTENSION;
    InputStream in =
        sourceDependencyLoader.getResourceAsStream(fileName);
    if (in == null) {
      throw new FileNotFoundException();
    }
    ObjectInputStream oin = new ObjectInputStream(in);
    try {
      importNames = (Set<String>) oin.readObject();
      rootLineNumberIterator = ((List<Long>) oin.readObject()).iterator();
    } catch (ClassNotFoundException e) {
      throw new IOException(e);
    }
    oin.close();
  }
32528
@SuppressWarnings("unchecked") // If a.equals(b) then a and b have the same type.
  public synchronized <T> T intern(T value) {
    Preconditions.checkNotNull(value);

    // Use a pseudo-random number generator to mix up the high and low bits of the hash code.
    Random generator = new java.util.Random(value.hashCode());
    int tries = 0;

    while (true) {
      int index = generator.nextInt(table.length);
      Object candidate = table[index];

      if (candidate == null) {
        // Found a good place to hash it.
        count++;
        collisions += tries;
        table[index] = value;
        rehashIfNeeded();
        return value;
      }

      if (candidate.equals(value)) {
        Preconditions.checkArgument(
            value.getClass() == candidate.getClass(),
            "Interned objects are equals() but different classes: %s and %s",
            value,
            candidate);
        return (T) candidate;
      }

      tries++;
    }
  }
34826
public IIconProvider build()
	{
		switch (type)
		{
			case DEFAULT:
				return (IIconProvider) () -> defaultIcon;
			case SIDES:
				return (ISidesIconProvider) side -> MoreObjects.firstNonNull(sidesIcons.get(side), defaultIcon);
			case STATE:
				return getStateIconProvider();
			case WALL:
				return getWallIconProvider();
			case CONNECTED:
				return new ConnectedIconsProvider(this);
			case MODEL:
				return new ModelIconProvider(this);

			default:
				return null;
		}
	}
758659
public String readIntern ()
        throws IOException
    {
        // create our intern map if necessary
        if (_internmap == null) {
            _internmap = Lists.newArrayList();
            // insert a zeroth element
            _internmap.add(null);
        }

        // read in the intern code for this instance
        short code = readShort();

        // a zero code indicates a null value
        if (code == 0) {
            return null;

        // if the code is negative, that means that we've never seen if before and value follows
        } else if (code < 0) {
            // first swap the code into positive-land
            code *= -1;

            // read in the value
            String value = readUTF().intern();

            // create the mapping and return the value
            mapIntern(code, value);
            return value;

        } else {
            String value = (code < _internmap.size()) ? _internmap.get(code) : null;

            // sanity check
            if (value == null) {
                // this will help with debugging
                log.warning("Internal stream error, no intern value", "code", code,
                            "ois", this, new Exception());
                log.warning("ObjectInputStream mappings", "map", _internmap);
                String errmsg = "Read intern code for which we have no registered value " +
                    "metadata [code=" + code + "]";
                throw new RuntimeException(errmsg);
            }
            return value;
        }
    }
800709
public ForeignKey<JoinTable<T>> getOrCreateForeignKey()
   {
      Node node = childNode.getOrCreate("foreign-key");
      ForeignKey<JoinTable<T>> foreignKey = new ForeignKeyImpl<JoinTable<T>>(this, "foreign-key", childNode, node);
      return foreignKey;
   }
1316256
public static DatasourceDependencyBuilder copyOf(final DatasourceDependency prototype) {
        return new DatasourceDependencyBuilder()
                .withName(prototype.getName())
                .withDescription(prototype.getDescription())
                .withType(prototype.getType())
                .withSubtype(prototype.getSubtype())
                .withDatasources(prototype.getDatasources())
                .withCriticality(prototype.getCriticality())
                .withExpectations(prototype.getExpectations());
    }
1145699
public void addDependency(int id) {
        if (dependencyList == null) {
            dependencyList = new ArrayList(2);
        }

        dependencyList.add(new Integer(id));
    }
250672
public Interator interator ()
    {
        return new AbstractInterator() {
            public boolean hasNext () {
                return (_pos < _size);
            }

            public int nextInt () {
                if (_pos >= _size) {
                    throw new NoSuchElementException();
                }
                _canRemove = true;
                return _values[_pos++];
            }

            @Override public void remove () {
                if (!_canRemove) {
                    throw new IllegalStateException();
                }
                System.arraycopy(_values, _pos, _values, _pos - 1, _size - _pos);
                _pos--;
                _size--; //_values[--_size] = 0;
                _canRemove = false;
            }

            protected int _pos;
            protected boolean _canRemove;
        };
    }
378738
public Transient<EmbeddableAttributes<T>> getOrCreateTransient()
   {
      List<Node> nodeList = childNode.get("transient");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new TransientImpl<EmbeddableAttributes<T>>(this, "transient", childNode, nodeList.get(0));
      }
      return createTransient();
   }
1271134
public static DomUtil getInstance() {

    if (instance == null) {
      synchronized (DomUtilImpl.class) {
        if (instance == null) {
          DomUtilImpl util = new DomUtilImpl();
          util.initialize();
          instance = util;
        }
      }
    }
    return instance;
  }
990784
@ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "INFORMANT")
    public org.openprovenance.prov.model.QualifiedName getInformant() {
        return informant;
    }
385915
public Set<JSModule> getThisAndAllDependencies() {
    Set<JSModule> deps = getAllDependencies();
    deps.add(this);
    return deps;
  }
1170883
protected AbstractCreateMavenProjectsOperation createOperation() {
		return new AbstractCreateMavenProjectsOperation() {
			@SuppressWarnings("synthetic-access")
			@Override
			protected List<IProject> doCreateMavenProjects(IProgressMonitor progressMonitor) throws CoreException {
				final SubMonitor monitor = SubMonitor.convert(progressMonitor, 101);
				try {
					final List<IMavenProjectImportResult> results = MavenImportUtils.runFixedImportJob(
							true,
							getProjects(),
							getImportConfiguration(),
							new MavenProjectWorkspaceAssigner(getWorkingSets()),
							monitor.newChild(100));
					return toProjects(results);
				} finally {
					restorePom();
					monitor.done();
				}
			}
		};
	}
1282301
public String getDependency() {

        String dependency = "";
        CmsRole role = m_role;
        while (role.getParentRole() != null) {
            dependency = dependency + role.getParentRole().getName(getCms().getRequestContext().getLocale());
            role = role.getParentRole();
            if (role.getParentRole() != null) {
                dependency = dependency + ", ";
            }
        }
        return dependency;
    }
246570
public Object createInstanceQuietly() {
      try {
         return clazz.newInstance();
      } catch (InstantiationException e) {
         log.finest(e);
         return null;
      } catch (IllegalAccessException e) {
         log.finest(e);
         return null;
      }
   }
1209753
protected static function initDependencyInjection()
    {
        /*
         * Create instances of required classes
         * Create instance of Doozr_Di_Map_Static and pass required classes as arguments to constructor
         * The Di-Map builder requires two objects Collection + Importer
         */
        $collection = new Doozr_Di_Collection();
        $importer   = new Doozr_Di_Importer_Json();
        $dependency = new Doozr_Di_Dependency();
        $map        = new Doozr_Di_Map_Static($collection, $importer, $dependency);

        // Generate map from static JSON map of Doozr
        $map->generate(self::$registry->getParameter('doozr.directory.root').'Data/Private/Config/.map.json');

        // Create container and set factory and map
        $container = Doozr_Di_Container::getInstance();
        $container
            ->factory(
                new Doozr_Di_Factory(self::$registry)
            )
            ->map($map);

        // Doozr's only Di container. We don't use any other. All Id's + instances shared static!
        self::$registry->setContainer($container);

        // Important for bootstrap result
        return true;
    }