Package de.fraunhofer.aisec.cpg.graph
Class TranslationUnitDeclaration
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.graph.Node
-
- de.fraunhofer.aisec.cpg.graph.Declaration
-
- de.fraunhofer.aisec.cpg.graph.TranslationUnitDeclaration
-
- Direct Known Subclasses:
NamespaceDeclaration
public class TranslationUnitDeclaration extends Declaration
The top most declaration, representing a translation unit, for example a file.
-
-
Constructor Summary
Constructors Constructor Description TranslationUnitDeclaration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Declaration decl)booleanequals(java.lang.Object o)<T> TgetDeclarationAs(int i, java.lang.Class<T> clazz)<T extends Declaration>
java.util.Optional<T>getDeclarationByName(java.lang.String name, java.lang.Class<T> clazz)This returns the first declaration of a specified type and clazz, if it exists.java.util.List<Declaration>getDeclarations()java.util.List<Declaration>getIncludes()java.util.List<Declaration>getNamespaces()inthashCode()voidsetDeclarations(java.util.List<Declaration> declarations)voidsetIncludes(java.util.List<Declaration> includes)java.lang.StringtoString()-
Methods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addNextDFG, addPrevDFG, disconnectFromGraph, getArgumentIndex, getCode, getFile, getId, getLocation, getName, getNextCFG, getNextDFG, getNextEOG, getPrevDFG, getPrevEOG, isDummy, isImplicit, removeNextDFG, removePrevDFG, setArgumentIndex, setCode, setComment, setDummy, setFile, setImplicit, setLocation, setName, setNextDFG, setNextEOG, setPrevDFG, setPrevEOG
-
-
-
-
Method Detail
-
getDeclarationAs
public <T> T getDeclarationAs(int i, java.lang.Class<T> clazz)
-
getDeclarationByName
public <T extends Declaration> java.util.Optional<T> getDeclarationByName(java.lang.String name, java.lang.Class<T> clazz)
This returns the first declaration of a specified type and clazz, if it exists.- Type Parameters:
T- the type of the declaration- Parameters:
name- the name to search forclazz- the declaration class, such asFunctionDeclaration.- Returns:
- an optional containing the declaration if found
-
getDeclarations
public java.util.List<Declaration> getDeclarations()
-
setDeclarations
public void setDeclarations(java.util.List<Declaration> declarations)
-
getIncludes
public java.util.List<Declaration> getIncludes()
-
setIncludes
public void setIncludes(java.util.List<Declaration> includes)
-
getNamespaces
public java.util.List<Declaration> getNamespaces()
-
add
public void add(Declaration decl)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classDeclaration
-
-