Add a dependence of a statement to a function.  The statement's
dependence string is altered with this function.

@param function The function to add as dependee.
@param catalogStmt The statement to add as depender.
10208
private static void addStatementDependence(Function function, Statement catalogStmt) {
        String fnDeps = catalogStmt.getFunctiondependees();
        Set<String> fnSet = new TreeSet<>();
        for (String fnName : fnDeps.split(",")) {
            if (! fnName.isEmpty()) {
                fnSet.add(fnName);
            }
        }

        String functionName = function.getTypeName();
        if (fnSet.contains(functionName)) {
            return;
        }

        fnSet.add(functionName);
        StringBuilder sb = new StringBuilder();
        sb.append(",");
        for (String fnName : fnSet) {
            sb.append(fnName + ",");
        }

        catalogStmt.setFunctiondependees(sb.toString());
    }
843978
@Override
	public void createFunction(ObjectPath functionPath, CatalogFunction function, boolean ignoreIfExists)
			throws FunctionAlreadyExistException, DatabaseNotExistException {
		checkNotNull(functionPath);
		checkNotNull(function);

		if (!databaseExists(functionPath.getDatabaseName())) {
			throw new DatabaseNotExistException(catalogName, functionPath.getDatabaseName());
		}

		if (functionExists(functionPath)) {
			if (!ignoreIfExists) {
				throw new FunctionAlreadyExistException(catalogName, functionPath);
			}
		} else {
			functions.put(functionPath, function.copy());
		}
	}
1136423
public void assign(final cern.colt.function.DoubleFunction function) {
	copy().forEachPair(
		new cern.colt.function.IntDoubleProcedure() {
			public boolean apply(int key, double value) {
				put(key,function.apply(value));
				return true;
			}
		}
	);
}
551919
public ItemRequest<Task> addDependencies(String task) {
    
        String path = String.format("/tasks/%s/addDependencies", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
1351720
public function addFunction(Compiler $compiler, FunctionDefinition $func, $statement = null)
    {
        $compiler->addFunction($func, $statement);
        $funcName = strtolower($func->getInternalName());
        if (isset($this->functionDefinitions[$funcName])) {
            throw new CompilerException(
                sprintf("Function '%s' was defined more than one time (in the same file)", $func->getName()),
                $statement
            );
        }
        $this->functionDefinitions[$funcName] = $func;
    }
934459
private static void addFileFunction(CtClass clazz, String property)
        throws NotFoundException, CannotCompileException {
        String wrapperName = property + "wrapper";
        String funcName = "set";
        funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
        funcName = funcName + wrapperName.substring(1);
        String setterName = "set";
        setterName = setterName + Character.toUpperCase(property.charAt(0));
        setterName = setterName + property.substring(1);
        CtClass[] params = generateClassField(FileWrapper.class);
        CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
        newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
        clazz.addMethod(newFunc);
    }
401258
public void addDependency(Area main, Area dependent) {
        List<Area> set = areasDependency.get(main);

        if (set == null) {
            set = new ArrayList<Area>();
            areasDependency.put(main, set);
        }
        set.add(dependent);
    }
233915
public void addRule(IntDependency dependency, double count) {
    if ( ! directional) {
      dependency = new IntDependency(dependency.head, dependency.arg, false, dependency.distance);
    }
    if (verbose) System.err.println("Adding dep " + dependency);
    //    coreDependencies.incrementCount(dependency, count);
    /*new IntDependency(dependency.head.word,
                                        dependency.head.tag,
                                        dependency.arg.word,
                                        dependency.arg.tag,
                                        dependency.leftHeaded,
                                        dependency.distance), count);
    */
    expandDependency(dependency, count);
    // System.err.println("stopCounter: " + stopCounter);
    // System.err.println("argCounter: " + argCounter);
  }
918226
public void addFunction(final INodeReadTrx mTransaction, final String mFuncName, final int mNum)
        throws TTXPathException {

        assert getPipeStack().size() >= mNum;

        final List<AbsAxis> args = new ArrayList<AbsAxis>(mNum);
        // arguments are stored on the stack in reverse order -> invert arg
        // order
        for (int i = 0; i < mNum; i++) {
            args.add(getPipeStack().pop().getExpr());
        }

        // get right function type
        final FuncDef func;
        try {
            func = FuncDef.fromString(mFuncName);
        } catch (final NullPointerException e) {
            throw EXPathError.XPST0017.getEncapsulatedException();
        }

        // get function class
        final Class<? extends AbsFunction> function = func.getFunc();
        final Integer min = func.getMin();
        final Integer max = func.getMax();
        final Integer returnType = NamePageHash.generateHashForString(func.getReturnType());

        // parameter types of the function's constructor
        final Class<?>[] paramTypes = {
            INodeReadTrx.class, List.class, Integer.TYPE, Integer.TYPE, Integer.TYPE
        };

        try {
            // instantiate function class with right constructor
            final Constructor<?> cons = function.getConstructor(paramTypes);
            final AbsAxis axis = (AbsAxis)cons.newInstance(mTransaction, args, min, max, returnType);

            if (getPipeStack().empty() || getExpression().getSize() != 0) {
                addExpressionSingle();
            }
            getExpression().add(axis);

        } catch (final NoSuchMethodException e) {
            throw EXPathError.XPST0017.getEncapsulatedException();
        } catch (final IllegalArgumentException e) {
            throw EXPathError.XPST0017.getEncapsulatedException();
        } catch (final InstantiationException e) {
            throw new IllegalStateException("Function not implemented yet.");
        } catch (final IllegalAccessException e) {
            throw EXPathError.XPST0017.getEncapsulatedException();
        } catch (final InvocationTargetException e) {
            throw EXPathError.XPST0017.getEncapsulatedException();
        }

    }
196461
public void addDependency(org.apache.maven.model.Dependency projectDependency) {
        log.debug( "Adding dependency: {}", projectDependency );
        
        DefaultArtifact artifact = null;
        
        if ( Const.TEST.equals( projectDependency.getType() ) || Const.TEST_JAR.equals( projectDependency.getType() ) ) {
            
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion(), artifactType );
        } else {
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion() );
        }
        
        Dependency dependency = new Dependency( artifact , projectDependency.getScope());
        dependency.setOptional( projectDependency.isOptional() );
        
        List<Exclusion> exclusions = new ArrayList<Exclusion>();
        for ( org.apache.maven.model.Exclusion projectExclusion : projectDependency.getExclusions() ) {
            exclusions.add( new Exclusion(projectExclusion.getGroupId(), projectExclusion.getArtifactId(), "*", "*") );            
        }
        log.debug( "Exclusion: {}", exclusions );
        dependency = dependency.setExclusions( exclusions );
        
        dependencies.add( dependency );
    }
928599
public void addToCatalog(PdfDictionary catalog) {
		if(catalog_version != null) {
			catalog.put(PdfName.VERSION, catalog_version);
		}
		if (extensions != null) {
			catalog.put(PdfName.EXTENSIONS, extensions);
		}
	}
304815
def depends(func):
    
    from jcvi.apps.base import need_update, listify

    infile = "infile"
    outfile = "outfile"

    def wrapper(*args, **kwargs):
        assert outfile in kwargs, \
            "You need to specify `outfile=` on function call"
        if infile in kwargs:
            infilename = listify(kwargs[infile])
            for x in infilename:
                assert op.exists(x), \
                    "The specified infile `{0}` does not exist".format(x)

        outfilename = kwargs[outfile]
        if need_update(infilename, outfilename):
            return func(*args, **kwargs)
        else:
            msg = "File `{0}` exists. Computation skipped." \
                .format(outfilename)
            logging.debug(msg)

        outfilename = listify(outfilename)

        for x in outfilename:
            assert op.exists(x), \
                "Something went wrong, `{0}` not found".format(x)

        return outfilename

    return wrapper
818785
protected void updateDependencyManagement(DependencyManagement value, String xmlTag, Counter counter,
            Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         iterateDependency(innerCount, root, value.getDependencies(), "dependencies", "dependency");
      }
   }
582197
@SuppressWarnings("unchecked")
    protected String addPostRunDependent(Creatable<? extends Indexable> creatable) {
        TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatable;
        return this.addPostRunDependent(dependency);
    }
540396
protected void addCacheDependency(String dependantCacheName) {
      protobufSchemaCache = (Cache<String, String>) SecurityActions.getUnwrappedCache(cacheManager, PROTOBUF_METADATA_CACHE_NAME).getAdvancedCache().withEncoding(IdentityEncoder.class);
      // add stop dependency
      cacheManager.addCacheDependency(dependantCacheName, ProtobufMetadataManagerImpl.PROTOBUF_METADATA_CACHE_NAME);
   }
630174
private void compileFallbackQueriesAndUpdateCatalog(Database db,
                                                        String query,
                                                        List<VoltXMLElement> fallbackQueryXMLs,
                                                        MaterializedViewInfo matviewinfo) throws VoltCompilerException {
        DatabaseEstimates estimates = new DatabaseEstimates();
        for (int i=0; i<fallbackQueryXMLs.size(); ++i) {
            String key = String.valueOf(i);
            Statement fallbackQueryStmt = matviewinfo.getFallbackquerystmts().add(key);
            VoltXMLElement fallbackQueryXML = fallbackQueryXMLs.get(i);
            fallbackQueryStmt.setSqltext(query);
            StatementCompiler.compileStatementAndUpdateCatalog(m_compiler,
                              m_hsql,
                              db,
                              estimates,
                              fallbackQueryStmt,
                              fallbackQueryXML,
                              fallbackQueryStmt.getSqltext(),
                              null, // no user-supplied join order
                              DeterminismMode.FASTER,
                              StatementPartitioning.forceSP());
        }
    }
200126
protected function resolveSubTemplateDependencies($function)
    {
        if ($this->debug) {
            echo 'Compiler::' . __FUNCTION__ . "\n";
        }

        $body = $this->templatePlugins[$function]['body'];
        foreach ($this->templatePlugins as $func => $attr) {
            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
            'Plugin' . Core::toCamelCase($func)) !== false) {
                $this->templatePlugins[$func]['called'] = true;
                $this->resolveSubTemplateDependencies($func);
            }
        }
        $this->templatePlugins[$function]['checked'] = true;
    }