From e0c33c637bcfe2e0b74c23f77c387a937ae594fc Mon Sep 17 00:00:00 2001 From: David Baker Effendi Date: Sun, 11 Jun 2023 12:27:23 +0200 Subject: [PATCH] Standalone EXT template --- .gitignore | 6 + .scalafmt.conf | 5 + README.md | 10 + build.sbt | 49 + domain-classes/build.sbt | 11 + .../generated/ControlStructureTypes.java | 69 + .../codepropertygraph/generated/Cpg.scala | 376 ++ .../generated/DispatchTypes.java | 27 + .../generated/EdgeTypes.java | 142 + .../generated/EvaluationStrategies.java | 27 + .../generated/Languages.java | 83 + .../generated/ModifierTypes.java | 59 + .../generated/NodeTypes.java | 371 ++ .../generated/Operators.java | 307 ++ .../generated/Properties.java | 318 ++ .../generated/PropertyNames.java | 318 ++ .../generated/edges/AliasOf.scala | 38 + .../generated/edges/Argument.scala | 38 + .../generated/edges/Ast.scala | 38 + .../generated/edges/Binds.scala | 38 + .../generated/edges/BindsTo.scala | 38 + .../generated/edges/Call.scala | 38 + .../generated/edges/Capture.scala | 38 + .../generated/edges/CapturedBy.scala | 38 + .../generated/edges/Cdg.scala | 38 + .../generated/edges/Cfg.scala | 38 + .../generated/edges/Condition.scala | 38 + .../generated/edges/Contains.scala | 38 + .../generated/edges/Dominate.scala | 38 + .../generated/edges/EvalType.scala | 38 + .../generated/edges/Imports.scala | 38 + .../generated/edges/InheritsFrom.scala | 38 + .../generated/edges/IsCallForImport.scala | 38 + .../generated/edges/ParameterLink.scala | 38 + .../generated/edges/PointsTo.scala | 38 + .../generated/edges/PostDominate.scala | 38 + .../generated/edges/ReachingDef.scala | 44 + .../generated/edges/Receiver.scala | 38 + .../generated/edges/Ref.scala | 38 + .../generated/edges/SourceFile.scala | 38 + .../generated/edges/TaggedBy.scala | 38 + .../generated/edges/package.scala | 47 + .../generated/nodes/Annotation.scala | 375 ++ .../generated/nodes/AnnotationLiteral.scala | 325 ++ .../generated/nodes/AnnotationParameter.scala | 238 + .../nodes/AnnotationParameterAssign.scala | 265 + .../generated/nodes/ArrayInitializer.scala | 334 ++ .../generated/nodes/AstNode.scala | 52 + .../generated/nodes/Binding.scala | 243 + .../generated/nodes/Block.scala | 1050 ++++ .../generated/nodes/Call.scala | 1293 +++++ .../generated/nodes/CallRepr.scala | 64 + .../generated/nodes/CfgNode.scala | 368 ++ .../generated/nodes/ClosureBinding.scala | 257 + .../generated/nodes/Comment.scala | 274 + .../generated/nodes/ConfigFile.scala | 186 + .../generated/nodes/ControlStructure.scala | 1056 ++++ .../generated/nodes/Declaration.scala | 36 + .../generated/nodes/Dependency.scala | 216 + .../generated/nodes/Expression.scala | 128 + .../generated/nodes/FieldIdentifier.scala | 806 +++ .../generated/nodes/File.scala | 331 ++ .../generated/nodes/Finding.scala | 260 + .../generated/nodes/Identifier.scala | 1056 ++++ .../generated/nodes/Import.scala | 343 ++ .../generated/nodes/JumpLabel.scala | 266 + .../generated/nodes/JumpTarget.scala | 791 +++ .../generated/nodes/KeyValuePair.scala | 186 + .../generated/nodes/Literal.scala | 1019 ++++ .../generated/nodes/Local.scala | 401 ++ .../generated/nodes/Location.scala | 331 ++ .../generated/nodes/Member.scala | 378 ++ .../generated/nodes/MetaData.scala | 252 + .../generated/nodes/Method.scala | 869 +++ .../generated/nodes/MethodParameterIn.scala | 547 ++ .../generated/nodes/MethodParameterOut.scala | 498 ++ .../generated/nodes/MethodRef.scala | 1081 ++++ .../generated/nodes/MethodReturn.scala | 572 ++ .../generated/nodes/Modifier.scala | 283 + .../generated/nodes/Mynodetype.scala | 169 + .../generated/nodes/Namespace.scala | 249 + .../generated/nodes/NamespaceBlock.scala | 326 ++ .../generated/nodes/NewNodes.scala | 4711 +++++++++++++++++ .../generated/nodes/Return.scala | 952 ++++ .../generated/nodes/RootTypes.scala | 148 + .../generated/nodes/Tag.scala | 299 ++ .../generated/nodes/TagNodePair.scala | 196 + .../generated/nodes/TemplateDom.scala | 379 ++ .../generated/nodes/Type.scala | 359 ++ .../generated/nodes/TypeArgument.scala | 257 + .../generated/nodes/TypeDecl.scala | 541 ++ .../generated/nodes/TypeParameter.scala | 275 + .../generated/nodes/TypeRef.scala | 1026 ++++ .../generated/nodes/Unknown.scala | 1059 ++++ .../generated/traversal/Annotation.scala | 424 ++ .../traversal/AnnotationLiteral.scala | 369 ++ .../traversal/AnnotationParameter.scala | 210 + .../traversal/AnnotationParameterAssign.scala | 210 + .../traversal/ArrayInitializer.scala | 312 ++ .../generated/traversal/AstNode.scala | 209 + .../generated/traversal/Binding.scala | 188 + .../generated/traversal/Block.scala | 380 ++ .../generated/traversal/Call.scala | 606 +++ .../generated/traversal/CallRepr.scala | 321 ++ .../generated/traversal/CfgNode.scala | 209 + .../generated/traversal/ClosureBinding.scala | 180 + .../generated/traversal/Comment.scala | 270 + .../generated/traversal/ConfigFile.scala | 121 + .../traversal/ControlStructure.scala | 430 ++ .../generated/traversal/Declaration.scala | 65 + .../generated/traversal/Dependency.scala | 176 + .../generated/traversal/Expression.scala | 312 ++ .../generated/traversal/FieldIdentifier.scala | 369 ++ .../generated/traversal/File.scala | 339 ++ .../generated/traversal/Finding.scala | 7 + .../generated/traversal/Identifier.scala | 429 ++ .../generated/traversal/Import.scala | 361 ++ .../generated/traversal/JumpLabel.scala | 322 ++ .../generated/traversal/JumpTarget.scala | 370 ++ .../generated/traversal/KeyValuePair.scala | 121 + .../generated/traversal/Literal.scala | 373 ++ .../generated/traversal/Local.scala | 402 ++ .../generated/traversal/Location.scala | 509 ++ .../generated/traversal/Member.scala | 340 ++ .../generated/traversal/MetaData.scala | 235 + .../generated/traversal/Method.scala | 750 +++ .../traversal/MethodParameterIn.scala | 478 ++ .../traversal/MethodParameterOut.scala | 463 ++ .../generated/traversal/MethodRef.scala | 437 ++ .../generated/traversal/MethodReturn.scala | 336 ++ .../generated/traversal/Modifier.scala | 266 + .../generated/traversal/Mynodetype.scala | 65 + .../generated/traversal/Namespace.scala | 265 + .../generated/traversal/NamespaceBlock.scala | 377 ++ .../traversal/NodeTraversalImplicits.scala | 211 + .../generated/traversal/Return.scala | 312 ++ .../generated/traversal/Tag.scala | 121 + .../generated/traversal/TagNodePair.scala | 7 + .../generated/traversal/TemplateDom.scala | 368 ++ .../generated/traversal/Type.scala | 192 + .../generated/traversal/TypeArgument.scala | 209 + .../generated/traversal/TypeDecl.scala | 578 ++ .../generated/traversal/TypeParameter.scala | 265 + .../generated/traversal/TypeRef.scala | 373 ++ .../generated/traversal/Unknown.scala | 487 ++ .../generated/traversal/package.scala | 2 + install-local-joern.sh | 76 + joern | 1 + log4j2.xml | 14 + project/Projects.scala | 7 + project/Versions.scala | 20 + project/build.properties | 1 + project/meta-build.sbt | 4 + project/plugins.sbt | 5 + schema-extender/build.sbt | 18 + schema/build.sbt | 10 + schema/src/main/scala/CpgExtSchema.scala | 24 + .../org/codeminers/standalone/Main.scala | 50 + .../org/codeminers/standalone/package.scala | 30 + .../org/codeminers/standalone/MyTest.scala | 37 + standalone | 1 + testprogram/Foo.java | 4 + updateDependencies.sh | 81 + 163 files changed, 47271 insertions(+) create mode 100644 .gitignore create mode 100644 .scalafmt.conf create mode 100644 README.md create mode 100644 build.sbt create mode 100644 domain-classes/build.sbt create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ControlStructureTypes.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Cpg.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/DispatchTypes.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EdgeTypes.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EvaluationStrategies.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Languages.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ModifierTypes.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/NodeTypes.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Operators.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyNames.java create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/AliasOf.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Argument.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ast.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Binds.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/BindsTo.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Call.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Capture.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/CapturedBy.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cdg.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cfg.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Condition.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Contains.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Dominate.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/EvalType.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Imports.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/InheritsFrom.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/IsCallForImport.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ParameterLink.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PointsTo.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PostDominate.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ReachingDef.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Receiver.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ref.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/SourceFile.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/TaggedBy.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/package.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AstNode.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CallRepr.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CfgNode.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Declaration.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Expression.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Mynodetype.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewNodes.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/RootTypes.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Annotation.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationLiteral.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameter.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameterAssign.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ArrayInitializer.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AstNode.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Binding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Block.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Call.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CallRepr.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CfgNode.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ClosureBinding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Comment.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ConfigFile.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ControlStructure.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Declaration.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Dependency.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Expression.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/FieldIdentifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/File.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Finding.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Identifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Import.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpLabel.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpTarget.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/KeyValuePair.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Literal.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Local.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Location.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Member.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MetaData.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Method.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterIn.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterOut.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodRef.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodReturn.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Modifier.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Mynodetype.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Namespace.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NamespaceBlock.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NodeTraversalImplicits.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Return.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Tag.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TagNodePair.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TemplateDom.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Type.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeArgument.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeDecl.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeParameter.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeRef.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Unknown.scala create mode 100644 domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/package.scala create mode 100755 install-local-joern.sh create mode 120000 joern create mode 100644 log4j2.xml create mode 100644 project/Projects.scala create mode 100644 project/Versions.scala create mode 100644 project/build.properties create mode 100644 project/meta-build.sbt create mode 100644 project/plugins.sbt create mode 100644 schema-extender/build.sbt create mode 100644 schema/build.sbt create mode 100644 schema/src/main/scala/CpgExtSchema.scala create mode 100644 src/main/scala/org/codeminers/standalone/Main.scala create mode 100644 src/main/scala/org/codeminers/standalone/package.scala create mode 100644 src/test/scala/org/codeminers/standalone/MyTest.scala create mode 120000 standalone create mode 100644 testprogram/Foo.java create mode 100755 updateDependencies.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5cf37d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +cpg.bin +target/ +.idea/ +/.bsp +/joern-inst +/workspace diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..ba1b77c --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,5 @@ +version = 3.5.1 +runner.dialect = scala213 +preset = IntelliJ +maxColumn = 120 +align.preset = true diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d51235 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Sample standalone application on top of joern +============================================= + +A program that makes use of Joern to create a CPG and list all method +names: + +``` +sbt stage +./standalone -Dlog4j.configurationFile=log4j2.xml +``` diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..35eb864 --- /dev/null +++ b/build.sbt @@ -0,0 +1,49 @@ +name := "standalone" +ThisBuild/organization := "org.codeminers" +ThisBuild/scalaVersion := "2.13.8" + +// parsed by project/Versions.scala, updated by updateDependencies.sh +val cpgVersion = "1.3.612" +val joernVersion = "1.2.3" +val overflowdbVersion = "1.179" + +lazy val schema = Projects.schema +lazy val domainClasses = Projects.domainClasses +lazy val schemaExtender = Projects.schemaExtender + +dependsOn(domainClasses) + +libraryDependencies ++= Seq( + "com.github.pathikrit" %% "better-files" % "3.9.2", + "com.github.scopt" %% "scopt" % "4.1.0", + "org.apache.logging.log4j" % "log4j-slf4j2-impl" % "2.20.0" % Optional, + "io.joern" %% "x2cpg" % Versions.joern, + "io.joern" %% "javasrc2cpg" % Versions.joern, + "io.joern" %% "joern-cli" % Versions.joern, + "io.joern" %% "semanticcpg" % Versions.joern, + "io.joern" %% "semanticcpg" % Versions.joern % Test classifier "tests", + "org.scalatest" %% "scalatest" % "3.2.15" % Test +) + + +ThisBuild/Compile/scalacOptions ++= Seq( + "-feature", + "-deprecation", + "-language:implicitConversions", +) + +enablePlugins(JavaAppPackaging) + +ThisBuild/licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) + +Global/onChangedBuildSource := ReloadOnSourceChanges + +ThisBuild / resolvers ++= Seq( + Resolver.mavenLocal, + "Sonatype OSS" at "https://oss.sonatype.org/content/repositories/public", + "Atlassian" at "https://packages.atlassian.com/mvn/maven-atlassian-external", + "Gradle Releases" at "https://repo.gradle.org/gradle/libs-releases/" +) + +Compile/doc/sources := Seq.empty +Compile/packageDoc/publishArtifact := false diff --git a/domain-classes/build.sbt b/domain-classes/build.sbt new file mode 100644 index 0000000..09fcf3f --- /dev/null +++ b/domain-classes/build.sbt @@ -0,0 +1,11 @@ +name := "joern-standalone-domain-classes" + +libraryDependencies += "io.shiftleft" %% "overflowdb-traversal" % Versions.overflowdb + +lazy val generatedSrcDir = settingKey[File]("root for generated sources - we want to check those in") +generatedSrcDir := (Compile/sourceDirectory).value / "generated" + +Compile/unmanagedSourceDirectories += generatedSrcDir.value +Compile/compile := (Compile/compile).dependsOn(Projects.schema/Compile/generateDomainClasses).value + +Compile / scalacOptions --= Seq("-Xfatal-warnings", "-Wunused", "-Ywarn-unused") diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ControlStructureTypes.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ControlStructureTypes.java new file mode 100644 index 0000000..61565a2 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ControlStructureTypes.java @@ -0,0 +1,69 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class ControlStructureTypes { + +/** Represents a break statement. Labeled breaks are expected to have a JUMP_LABEL +node AST child with ORDER 1 */ +public static final String BREAK = "BREAK"; + +/** Represents a continue statement. Labeled continues are expected to have a JUMP_LABEL +node AST child with ORDER 1 */ +public static final String CONTINUE = "CONTINUE"; + +/** Represents a while statement */ +public static final String WHILE = "WHILE"; + +/** Represents a do statement */ +public static final String DO = "DO"; + +/** Represents a for statement */ +public static final String FOR = "FOR"; + +/** Represents a goto statement */ +public static final String GOTO = "GOTO"; + +/** Represents an if statement */ +public static final String IF = "IF"; + +/** Represents an else statement */ +public static final String ELSE = "ELSE"; + +/** Represents a switch statement */ +public static final String SWITCH = "SWITCH"; + +/** Represents a try statement */ +public static final String TRY = "TRY"; + +/** Represents a throw statement */ +public static final String THROW = "THROW"; + +/** Represents a match expression */ +public static final String MATCH = "MATCH"; + +/** Represents a yield expression */ +public static final String YIELD = "YIELD"; + + +public static Set ALL = new HashSet() {{ +add(BREAK); +add(CONTINUE); +add(WHILE); +add(DO); +add(FOR); +add(GOTO); +add(IF); +add(ELSE); +add(SWITCH); +add(TRY); +add(THROW); +add(MATCH); +add(YIELD); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Cpg.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Cpg.scala new file mode 100644 index 0000000..8bdf089 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Cpg.scala @@ -0,0 +1,376 @@ +package io.shiftleft.codepropertygraph.generated + +import java.nio.file.{Path, Paths} +import overflowdb.traversal.help.{DocSearchPackages, TraversalHelp} +import overflowdb.{Config, Graph} +import scala.jdk.javaapi.CollectionConverters.asJava + +object Cpg { + implicit val defaultDocSearchPackage: DocSearchPackages = DocSearchPackages(getClass.getPackage.getName) + + /** Syntactic sugar for `new Cpg(graph)`. Usage: `Cpg(graph)` or simply `Cpg` if you have an `implicit Graph` in scope + */ + def apply(implicit graph: Graph) = new Cpg(graph) + + def empty: Cpg = + new Cpg(emptyGraph) + + /** Instantiate Cpg with storage. If the storage file already exists, it will load (a subset of) the data into memory. + * Otherwise it will create an empty Cpg. In either case, configuring storage means that OverflowDb will be stored to + * disk on shutdown (`close`). + * I.e. if you want to preserve state between sessions, just use this method to instantiate the Cpg and ensure to + * properly `close` it at the end. + * @param path + * to the storage file, e.g. /home/user1/overflowdb.bin + */ + def withStorage(path: Path): Cpg = + withConfig(Config.withoutOverflow.withStorageLocation(path)) + + def withStorage(path: String): Cpg = + withStorage(Paths.get(path)) + + def withConfig(config: overflowdb.Config): Cpg = + new Cpg(Graph.open(config, nodes.Factories.allAsJava, edges.Factories.allAsJava, convertPropertyForPersistence)) + + def emptyGraph: Graph = + Graph.open( + Config.withoutOverflow, + nodes.Factories.allAsJava, + edges.Factories.allAsJava, + convertPropertyForPersistence + ) + + def convertPropertyForPersistence(property: Any): Any = + property match { + case arraySeq: scala.collection.immutable.ArraySeq[_] => arraySeq.unsafeArray + case coll: IterableOnce[Any] => asJava(coll.iterator.toArray) + case other => other + } + +} + +/** Domain-specific wrapper for graph, starting point for traversals. + * @param graph + * the underlying graph. An empty graph is created if this parameter is omitted. + */ +class Cpg(private val _graph: Graph = Cpg.emptyGraph) extends AutoCloseable { + def graph: Graph = _graph + + def help(implicit searchPackageNames: DocSearchPackages): String = + new TraversalHelp(searchPackageNames).forTraversalSources + + override def close(): Unit = + graph.close + + override def toString(): String = + String.format("Cpg (%s)", graph) +} + +class GeneratedNodeStarterExt(val wrapper: Cpg) extends AnyVal { + import scala.jdk.CollectionConverters.IteratorHasAsScala + @overflowdb.traversal.help.Doc(info = "All nodes of type Annotation, i.e. with label ANNOTATION") + def annotation: Iterator[nodes.Annotation] = + overflowdb.traversal.InitialTraversal.from[nodes.Annotation](wrapper.graph, "ANNOTATION") + + @overflowdb.traversal.help.Doc(info = "All nodes of type AnnotationLiteral, i.e. with label ANNOTATION_LITERAL") + def annotationLiteral: Iterator[nodes.AnnotationLiteral] = + overflowdb.traversal.InitialTraversal.from[nodes.AnnotationLiteral](wrapper.graph, "ANNOTATION_LITERAL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type AnnotationParameter, i.e. with label ANNOTATION_PARAMETER") + def annotationParameter: Iterator[nodes.AnnotationParameter] = + overflowdb.traversal.InitialTraversal.from[nodes.AnnotationParameter](wrapper.graph, "ANNOTATION_PARAMETER") + + @overflowdb.traversal.help.Doc( + info = "All nodes of type AnnotationParameterAssign, i.e. with label ANNOTATION_PARAMETER_ASSIGN" + ) + def annotationParameterAssign: Iterator[nodes.AnnotationParameterAssign] = overflowdb.traversal.InitialTraversal + .from[nodes.AnnotationParameterAssign](wrapper.graph, "ANNOTATION_PARAMETER_ASSIGN") + + @overflowdb.traversal.help.Doc(info = "All nodes of type ArrayInitializer, i.e. with label ARRAY_INITIALIZER") + def arrayInitializer: Iterator[nodes.ArrayInitializer] = + overflowdb.traversal.InitialTraversal.from[nodes.ArrayInitializer](wrapper.graph, "ARRAY_INITIALIZER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Binding, i.e. with label BINDING") + def binding: Iterator[nodes.Binding] = + overflowdb.traversal.InitialTraversal.from[nodes.Binding](wrapper.graph, "BINDING") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Block, i.e. with label BLOCK") + def block: Iterator[nodes.Block] = overflowdb.traversal.InitialTraversal.from[nodes.Block](wrapper.graph, "BLOCK") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Call, i.e. with label CALL") + def call: Iterator[nodes.Call] = overflowdb.traversal.InitialTraversal.from[nodes.Call](wrapper.graph, "CALL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type ClosureBinding, i.e. with label CLOSURE_BINDING") + def closureBinding: Iterator[nodes.ClosureBinding] = + overflowdb.traversal.InitialTraversal.from[nodes.ClosureBinding](wrapper.graph, "CLOSURE_BINDING") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Comment, i.e. with label COMMENT") + def comment: Iterator[nodes.Comment] = + overflowdb.traversal.InitialTraversal.from[nodes.Comment](wrapper.graph, "COMMENT") + + @overflowdb.traversal.help.Doc(info = "All nodes of type ConfigFile, i.e. with label CONFIG_FILE") + def configFile: Iterator[nodes.ConfigFile] = + overflowdb.traversal.InitialTraversal.from[nodes.ConfigFile](wrapper.graph, "CONFIG_FILE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type ControlStructure, i.e. with label CONTROL_STRUCTURE") + def controlStructure: Iterator[nodes.ControlStructure] = + overflowdb.traversal.InitialTraversal.from[nodes.ControlStructure](wrapper.graph, "CONTROL_STRUCTURE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Dependency, i.e. with label DEPENDENCY") + def dependency: Iterator[nodes.Dependency] = + overflowdb.traversal.InitialTraversal.from[nodes.Dependency](wrapper.graph, "DEPENDENCY") + + @overflowdb.traversal.help.Doc(info = "All nodes of type FieldIdentifier, i.e. with label FIELD_IDENTIFIER") + def fieldIdentifier: Iterator[nodes.FieldIdentifier] = + overflowdb.traversal.InitialTraversal.from[nodes.FieldIdentifier](wrapper.graph, "FIELD_IDENTIFIER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type File, i.e. with label FILE") + def file: Iterator[nodes.File] = overflowdb.traversal.InitialTraversal.from[nodes.File](wrapper.graph, "FILE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Finding, i.e. with label FINDING") + def finding: Iterator[nodes.Finding] = + overflowdb.traversal.InitialTraversal.from[nodes.Finding](wrapper.graph, "FINDING") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Identifier, i.e. with label IDENTIFIER") + def identifier: Iterator[nodes.Identifier] = + overflowdb.traversal.InitialTraversal.from[nodes.Identifier](wrapper.graph, "IDENTIFIER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Import, i.e. with label IMPORT") + def imports: Iterator[nodes.Import] = + overflowdb.traversal.InitialTraversal.from[nodes.Import](wrapper.graph, "IMPORT") + + @overflowdb.traversal.help.Doc(info = "All nodes of type JumpLabel, i.e. with label JUMP_LABEL") + def jumpLabel: Iterator[nodes.JumpLabel] = + overflowdb.traversal.InitialTraversal.from[nodes.JumpLabel](wrapper.graph, "JUMP_LABEL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type JumpTarget, i.e. with label JUMP_TARGET") + def jumpTarget: Iterator[nodes.JumpTarget] = + overflowdb.traversal.InitialTraversal.from[nodes.JumpTarget](wrapper.graph, "JUMP_TARGET") + + @overflowdb.traversal.help.Doc(info = "All nodes of type KeyValuePair, i.e. with label KEY_VALUE_PAIR") + def keyValuePair: Iterator[nodes.KeyValuePair] = + overflowdb.traversal.InitialTraversal.from[nodes.KeyValuePair](wrapper.graph, "KEY_VALUE_PAIR") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Literal, i.e. with label LITERAL") + def literal: Iterator[nodes.Literal] = + overflowdb.traversal.InitialTraversal.from[nodes.Literal](wrapper.graph, "LITERAL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Local, i.e. with label LOCAL") + def local: Iterator[nodes.Local] = overflowdb.traversal.InitialTraversal.from[nodes.Local](wrapper.graph, "LOCAL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Location, i.e. with label LOCATION") + def location: Iterator[nodes.Location] = + overflowdb.traversal.InitialTraversal.from[nodes.Location](wrapper.graph, "LOCATION") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Member, i.e. with label MEMBER") + def member: Iterator[nodes.Member] = overflowdb.traversal.InitialTraversal.from[nodes.Member](wrapper.graph, "MEMBER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type MetaData, i.e. with label META_DATA") + def metaData: Iterator[nodes.MetaData] = + overflowdb.traversal.InitialTraversal.from[nodes.MetaData](wrapper.graph, "META_DATA") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Method, i.e. with label METHOD") + def method: Iterator[nodes.Method] = overflowdb.traversal.InitialTraversal.from[nodes.Method](wrapper.graph, "METHOD") + + @overflowdb.traversal.help.Doc(info = "All nodes of type MethodParameterIn, i.e. with label METHOD_PARAMETER_IN") + def methodParameterIn: Iterator[nodes.MethodParameterIn] = + overflowdb.traversal.InitialTraversal.from[nodes.MethodParameterIn](wrapper.graph, "METHOD_PARAMETER_IN") + + @overflowdb.traversal.help.Doc(info = "All nodes of type MethodParameterOut, i.e. with label METHOD_PARAMETER_OUT") + def methodParameterOut: Iterator[nodes.MethodParameterOut] = + overflowdb.traversal.InitialTraversal.from[nodes.MethodParameterOut](wrapper.graph, "METHOD_PARAMETER_OUT") + + @overflowdb.traversal.help.Doc(info = "All nodes of type MethodRef, i.e. with label METHOD_REF") + def methodRef: Iterator[nodes.MethodRef] = + overflowdb.traversal.InitialTraversal.from[nodes.MethodRef](wrapper.graph, "METHOD_REF") + + @overflowdb.traversal.help.Doc(info = "All nodes of type MethodReturn, i.e. with label METHOD_RETURN") + def methodReturn: Iterator[nodes.MethodReturn] = + overflowdb.traversal.InitialTraversal.from[nodes.MethodReturn](wrapper.graph, "METHOD_RETURN") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Modifier, i.e. with label MODIFIER") + def modifier: Iterator[nodes.Modifier] = + overflowdb.traversal.InitialTraversal.from[nodes.Modifier](wrapper.graph, "MODIFIER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Mynodetype, i.e. with label MYNODETYPE") + def mynodetype: Iterator[nodes.Mynodetype] = + overflowdb.traversal.InitialTraversal.from[nodes.Mynodetype](wrapper.graph, "MYNODETYPE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Namespace, i.e. with label NAMESPACE") + def namespace: Iterator[nodes.Namespace] = + overflowdb.traversal.InitialTraversal.from[nodes.Namespace](wrapper.graph, "NAMESPACE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type NamespaceBlock, i.e. with label NAMESPACE_BLOCK") + def namespaceBlock: Iterator[nodes.NamespaceBlock] = + overflowdb.traversal.InitialTraversal.from[nodes.NamespaceBlock](wrapper.graph, "NAMESPACE_BLOCK") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Return, i.e. with label RETURN") + def ret: Iterator[nodes.Return] = overflowdb.traversal.InitialTraversal.from[nodes.Return](wrapper.graph, "RETURN") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Tag, i.e. with label TAG") + def tag: Iterator[nodes.Tag] = overflowdb.traversal.InitialTraversal.from[nodes.Tag](wrapper.graph, "TAG") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TagNodePair, i.e. with label TAG_NODE_PAIR") + def tagNodePair: Iterator[nodes.TagNodePair] = + overflowdb.traversal.InitialTraversal.from[nodes.TagNodePair](wrapper.graph, "TAG_NODE_PAIR") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TemplateDom, i.e. with label TEMPLATE_DOM") + def templateDom: Iterator[nodes.TemplateDom] = + overflowdb.traversal.InitialTraversal.from[nodes.TemplateDom](wrapper.graph, "TEMPLATE_DOM") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Type, i.e. with label TYPE") + def typ: Iterator[nodes.Type] = overflowdb.traversal.InitialTraversal.from[nodes.Type](wrapper.graph, "TYPE") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TypeArgument, i.e. with label TYPE_ARGUMENT") + def typeArgument: Iterator[nodes.TypeArgument] = + overflowdb.traversal.InitialTraversal.from[nodes.TypeArgument](wrapper.graph, "TYPE_ARGUMENT") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TypeDecl, i.e. with label TYPE_DECL") + def typeDecl: Iterator[nodes.TypeDecl] = + overflowdb.traversal.InitialTraversal.from[nodes.TypeDecl](wrapper.graph, "TYPE_DECL") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TypeParameter, i.e. with label TYPE_PARAMETER") + def typeParameter: Iterator[nodes.TypeParameter] = + overflowdb.traversal.InitialTraversal.from[nodes.TypeParameter](wrapper.graph, "TYPE_PARAMETER") + + @overflowdb.traversal.help.Doc(info = "All nodes of type TypeRef, i.e. with label TYPE_REF") + def typeRef: Iterator[nodes.TypeRef] = + overflowdb.traversal.InitialTraversal.from[nodes.TypeRef](wrapper.graph, "TYPE_REF") + + @overflowdb.traversal.help.Doc(info = "All nodes of type Unknown, i.e. with label UNKNOWN") + def unknown: Iterator[nodes.Unknown] = + overflowdb.traversal.InitialTraversal.from[nodes.Unknown](wrapper.graph, "UNKNOWN") + + @overflowdb.traversal.help.Doc( + info = + "All nodes of type AstNode, i.e. with label in ANNOTATION, ANNOTATION_LITERAL, ANNOTATION_PARAMETER, ANNOTATION_PARAMETER_ASSIGN, ARRAY_INITIALIZER, BLOCK, CALL, COMMENT, CONTROL_STRUCTURE, FIELD_IDENTIFIER, FILE, IDENTIFIER, IMPORT, JUMP_LABEL, JUMP_TARGET, LITERAL, LOCAL, MEMBER, METHOD, METHOD_PARAMETER_IN, METHOD_PARAMETER_OUT, METHOD_REF, METHOD_RETURN, MODIFIER, NAMESPACE, NAMESPACE_BLOCK, RETURN, TEMPLATE_DOM, TYPE_ARGUMENT, TYPE_DECL, TYPE_PARAMETER, TYPE_REF, UNKNOWN" + ) + def astNode: Iterator[nodes.AstNode] = wrapper.graph + .nodes( + "ANNOTATION", + "ANNOTATION_LITERAL", + "ANNOTATION_PARAMETER", + "ANNOTATION_PARAMETER_ASSIGN", + "ARRAY_INITIALIZER", + "BLOCK", + "CALL", + "COMMENT", + "CONTROL_STRUCTURE", + "FIELD_IDENTIFIER", + "FILE", + "IDENTIFIER", + "IMPORT", + "JUMP_LABEL", + "JUMP_TARGET", + "LITERAL", + "LOCAL", + "MEMBER", + "METHOD", + "METHOD_PARAMETER_IN", + "METHOD_PARAMETER_OUT", + "METHOD_REF", + "METHOD_RETURN", + "MODIFIER", + "NAMESPACE", + "NAMESPACE_BLOCK", + "RETURN", + "TEMPLATE_DOM", + "TYPE_ARGUMENT", + "TYPE_DECL", + "TYPE_PARAMETER", + "TYPE_REF", + "UNKNOWN" + ) + .asScala + .asInstanceOf[Iterator[nodes.AstNode]] + + @overflowdb.traversal.help.Doc(info = "All nodes of type CallRepr, i.e. with label in CALL") + def callRepr: Iterator[nodes.CallRepr] = wrapper.graph.nodes("CALL").asScala.asInstanceOf[Iterator[nodes.CallRepr]] + + @overflowdb.traversal.help.Doc( + info = + "All nodes of type CfgNode, i.e. with label in ANNOTATION, ANNOTATION_LITERAL, ARRAY_INITIALIZER, BLOCK, CALL, CONTROL_STRUCTURE, FIELD_IDENTIFIER, IDENTIFIER, JUMP_TARGET, LITERAL, METHOD, METHOD_PARAMETER_IN, METHOD_PARAMETER_OUT, METHOD_REF, METHOD_RETURN, RETURN, TEMPLATE_DOM, TYPE_REF, UNKNOWN" + ) + def cfgNode: Iterator[nodes.CfgNode] = wrapper.graph + .nodes( + "ANNOTATION", + "ANNOTATION_LITERAL", + "ARRAY_INITIALIZER", + "BLOCK", + "CALL", + "CONTROL_STRUCTURE", + "FIELD_IDENTIFIER", + "IDENTIFIER", + "JUMP_TARGET", + "LITERAL", + "METHOD", + "METHOD_PARAMETER_IN", + "METHOD_PARAMETER_OUT", + "METHOD_REF", + "METHOD_RETURN", + "RETURN", + "TEMPLATE_DOM", + "TYPE_REF", + "UNKNOWN" + ) + .asScala + .asInstanceOf[Iterator[nodes.CfgNode]] + + @overflowdb.traversal.help.Doc( + info = + "All nodes of type Declaration, i.e. with label in LOCAL, MEMBER, METHOD, METHOD_PARAMETER_IN, METHOD_PARAMETER_OUT" + ) + def declaration: Iterator[nodes.Declaration] = wrapper.graph + .nodes("LOCAL", "MEMBER", "METHOD", "METHOD_PARAMETER_IN", "METHOD_PARAMETER_OUT") + .asScala + .asInstanceOf[Iterator[nodes.Declaration]] + + @overflowdb.traversal.help.Doc( + info = + "All nodes of type Expression, i.e. with label in ANNOTATION, ANNOTATION_LITERAL, ARRAY_INITIALIZER, BLOCK, CALL, CONTROL_STRUCTURE, FIELD_IDENTIFIER, IDENTIFIER, LITERAL, METHOD_REF, RETURN, TEMPLATE_DOM, TYPE_REF, UNKNOWN" + ) + def expression: Iterator[nodes.Expression] = wrapper.graph + .nodes( + "ANNOTATION", + "ANNOTATION_LITERAL", + "ARRAY_INITIALIZER", + "BLOCK", + "CALL", + "CONTROL_STRUCTURE", + "FIELD_IDENTIFIER", + "IDENTIFIER", + "LITERAL", + "METHOD_REF", + "RETURN", + "TEMPLATE_DOM", + "TYPE_REF", + "UNKNOWN" + ) + .asScala + .asInstanceOf[Iterator[nodes.Expression]] +} + +/** Domain-specific version of diffgraph builder. This is to allow schema checking before diffgraph application in the + * future, as well as a schema-aware point for providing backwards compatibility in odbv2. + */ +class DiffGraphBuilder extends overflowdb.BatchedUpdate.DiffGraphBuilder { + override def absorb(other: overflowdb.BatchedUpdate.DiffGraphBuilder): this.type = { super.absorb(other); this } + override def addNode(node: overflowdb.DetachedNodeData): this.type = { super.addNode(node); this } + override def addNode(label: String, keyvalues: Any*): this.type = { super.addNode(label, keyvalues: _*); this } + override def addEdge( + src: overflowdb.NodeOrDetachedNode, + dst: overflowdb.NodeOrDetachedNode, + label: String + ): this.type = { super.addEdge(src, dst, label); this } + override def addEdge( + src: overflowdb.NodeOrDetachedNode, + dst: overflowdb.NodeOrDetachedNode, + label: String, + properties: Any* + ): this.type = { super.addEdge(src, dst, label, properties: _*); this } + override def setNodeProperty(node: overflowdb.Node, label: String, property: Any): this.type = { + super.setNodeProperty(node, label, property); this + } + override def removeNode(node: overflowdb.Node): this.type = { super.removeNode(node); this } + override def removeEdge(edge: overflowdb.Edge): this.type = { super.removeEdge(edge); this } +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/DispatchTypes.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/DispatchTypes.java new file mode 100644 index 0000000..981aa43 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/DispatchTypes.java @@ -0,0 +1,27 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class DispatchTypes { + +/** For statically dispatched calls the call target is known before program execution */ +public static final String STATIC_DISPATCH = "STATIC_DISPATCH"; + +/** For dynamically dispatched calls the target is determined during runtime */ +public static final String DYNAMIC_DISPATCH = "DYNAMIC_DISPATCH"; + +/** For macro expansions, code is inlined. */ +public static final String INLINED = "INLINED"; + + +public static Set ALL = new HashSet() {{ +add(STATIC_DISPATCH); +add(DYNAMIC_DISPATCH); +add(INLINED); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EdgeTypes.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EdgeTypes.java new file mode 100644 index 0000000..9729a6b --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EdgeTypes.java @@ -0,0 +1,142 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class EdgeTypes { + +/** This edge represents an alias relation between a type declaration and a type. +The language frontend MUST NOT create `ALIAS_OF` edges as they are created +automatically based on `ALIAS_TYPE_FULL_NAME` fields when the CPG is first loaded. */ +public static final String ALIAS_OF = "ALIAS_OF"; + +/** Argument edges connect call sites (node type `CALL`) to their arguments +(node type `EXPRESSION`) as well as `RETURN` nodes to the expressions +that return. */ +public static final String ARGUMENT = "ARGUMENT"; + +/** This edge connects a parent node to its child in the syntax tree. */ +public static final String AST = "AST"; + +/** This edge connects a type declaration (`TYPE_DECL`) with a binding node (`BINDING`) and +indicates that the type declaration has the binding represented by the binding node, in +other words, there is a (name, signature) pair that can be resolved for the type +declaration as stored in the binding node. */ +public static final String BINDS = "BINDS"; + +/** This edge connects type arguments to type parameters to indicate +that the type argument is used to instantiate the type parameter. */ +public static final String BINDS_TO = "BINDS_TO"; + +/** This edge connects call sites, i.e., nodes with the type `CALL`, to the +method node that represent the method they invoke. The frontend MAY create +`CALL` edges but is not required to do so. Instead, of the `METHOD_FULL_NAME` +field of the `CALL` node is set correctly, `CALL` edges are created +automatically as the CPG is first loaded. */ +public static final String CALL = "CALL"; + +/** Represents the capturing of a variable into a closure */ +public static final String CAPTURE = "CAPTURE"; + +/** Connection between a captured LOCAL and the corresponding CLOSURE_BINDING */ +public static final String CAPTURED_BY = "CAPTURED_BY"; + +/** A CDG edge expresses that the destination node is control dependent on the source node. */ +public static final String CDG = "CDG"; + +/** This edge indicates control flow from the source to the destination node. */ +public static final String CFG = "CFG"; + +/** The edge connects control structure nodes to the expressions that holds their conditions. */ +public static final String CONDITION = "CONDITION"; + +/** This edge connects a node to the method that contains it. */ +public static final String CONTAINS = "CONTAINS"; + +/** This edge indicates that the source node immediately dominates the destination node. */ +public static final String DOMINATE = "DOMINATE"; + +/** This edge connects a node to its evaluation type. */ +public static final String EVAL_TYPE = "EVAL_TYPE"; + +/** Edge from imports to dependencies */ +public static final String IMPORTS = "IMPORTS"; + +/** Inheritance relation between a type declaration and a type. This edge MUST NOT + be created by the language frontend as it is automatically created from + `INHERITS_FROM_TYPE_FULL_NAME` fields then the CPG is first loaded. */ +public static final String INHERITS_FROM = "INHERITS_FROM"; + +/** Edge from CALL statement in the AST to the IMPORT. + |We use this edge to traverse from the logical representation of the IMPORT + |to the corresponding import statement in the AST. + | */ +public static final String IS_CALL_FOR_IMPORT = "IS_CALL_FOR_IMPORT"; + +/** This edge connects a method input parameter to the corresponding +method output parameter. */ +public static final String PARAMETER_LINK = "PARAMETER_LINK"; + +/** Used for calculating points-to sets for resolving object aliasing. */ +public static final String POINTS_TO = "POINTS_TO"; + +/** This edge indicates that the source node immediately post dominates the destination node. */ +public static final String POST_DOMINATE = "POST_DOMINATE"; + +/** A reaching definition edge indicates that a variable produced at the source node reaches +the destination node without being reassigned on the way. The `VARIABLE` property indicates +which variable is propagated. */ +public static final String REACHING_DEF = "REACHING_DEF"; + +/** Similar to `ARGUMENT` edges, `RECEIVER` edges connect call sites +to their receiver arguments. A receiver argument is the object on +which a method operates, that is, it is the expression that is +assigned to the `this` pointer as control is transferred to the method. */ +public static final String RECEIVER = "RECEIVER"; + +/** This edge indicates that the source node is an identifier that denotes +access to the destination node. For example, an identifier may reference +a local variable. */ +public static final String REF = "REF"; + +/** This edge connects a node to the node that represents its source file. These +edges MUST not be created by the language frontend but are automatically +created based on `FILENAME` fields. */ +public static final String SOURCE_FILE = "SOURCE_FILE"; + +/** Edges from nodes to the tags they are tagged by. */ +public static final String TAGGED_BY = "TAGGED_BY"; + + +public static Set ALL = new HashSet() {{ +add(ALIAS_OF); +add(ARGUMENT); +add(AST); +add(BINDS); +add(BINDS_TO); +add(CALL); +add(CAPTURE); +add(CAPTURED_BY); +add(CDG); +add(CFG); +add(CONDITION); +add(CONTAINS); +add(DOMINATE); +add(EVAL_TYPE); +add(IMPORTS); +add(INHERITS_FROM); +add(IS_CALL_FOR_IMPORT); +add(PARAMETER_LINK); +add(POINTS_TO); +add(POST_DOMINATE); +add(REACHING_DEF); +add(RECEIVER); +add(REF); +add(SOURCE_FILE); +add(TAGGED_BY); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EvaluationStrategies.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EvaluationStrategies.java new file mode 100644 index 0000000..bad4818 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/EvaluationStrategies.java @@ -0,0 +1,27 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class EvaluationStrategies { + +/** A parameter or return of a function is passed by reference which means an address is used behind the scenes */ +public static final String BY_REFERENCE = "BY_REFERENCE"; + +/** Only applicable to object parameter or return values. The pointer to the object is passed by value but the object itself is not copied and changes to it are thus propagated out of the method context */ +public static final String BY_SHARING = "BY_SHARING"; + +/** A parameter or return of a function passed by value which means a flat copy is used */ +public static final String BY_VALUE = "BY_VALUE"; + + +public static Set ALL = new HashSet() {{ +add(BY_REFERENCE); +add(BY_SHARING); +add(BY_VALUE); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Languages.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Languages.java new file mode 100644 index 0000000..1ee7ae2 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Languages.java @@ -0,0 +1,83 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class Languages { + + +public static final String JAVA = "JAVA"; + + +public static final String JAVASCRIPT = "JAVASCRIPT"; + + +public static final String GOLANG = "GOLANG"; + + +public static final String CSHARP = "CSHARP"; + + +public static final String C = "C"; + + +public static final String PYTHON = "PYTHON"; + + +public static final String LLVM = "LLVM"; + + +public static final String PHP = "PHP"; + + +public static final String FUZZY_TEST_LANG = "FUZZY_TEST_LANG"; + +/** generic reverse engineering framework */ +public static final String GHIDRA = "GHIDRA"; + + +public static final String KOTLIN = "KOTLIN"; + +/** Eclipse CDT based parser for C/C++ */ +public static final String NEWC = "NEWC"; + +/** Source-based front-end for Java */ +public static final String JAVASRC = "JAVASRC"; + +/** Source-based front-end for Python */ +public static final String PYTHONSRC = "PYTHONSRC"; + +/** Source-based JS frontend based on Babel */ +public static final String JSSRC = "JSSRC"; + +/** Solidity language frontend */ +public static final String SOLIDITY = "SOLIDITY"; + +/** Source-based frontend for Ruby */ +public static final String RUBYSRC = "RUBYSRC"; + + +public static Set ALL = new HashSet() {{ +add(JAVA); +add(JAVASCRIPT); +add(GOLANG); +add(CSHARP); +add(C); +add(PYTHON); +add(LLVM); +add(PHP); +add(FUZZY_TEST_LANG); +add(GHIDRA); +add(KOTLIN); +add(NEWC); +add(JAVASRC); +add(PYTHONSRC); +add(JSSRC); +add(SOLIDITY); +add(RUBYSRC); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ModifierTypes.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ModifierTypes.java new file mode 100644 index 0000000..3560ee7 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/ModifierTypes.java @@ -0,0 +1,59 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class ModifierTypes { + +/** The static modifier */ +public static final String STATIC = "STATIC"; + +/** The public modifier */ +public static final String PUBLIC = "PUBLIC"; + +/** The protected modifier */ +public static final String PROTECTED = "PROTECTED"; + +/** The private modifier */ +public static final String PRIVATE = "PRIVATE"; + +/** The abstract modifier */ +public static final String ABSTRACT = "ABSTRACT"; + +/** The native modifier */ +public static final String NATIVE = "NATIVE"; + +/** The constructor modifier */ +public static final String CONSTRUCTOR = "CONSTRUCTOR"; + +/** The virtual modifier */ +public static final String VIRTUAL = "VIRTUAL"; + +/** The internal modifier */ +public static final String INTERNAL = "INTERNAL"; + +/** The final modifier */ +public static final String FINAL = "FINAL"; + +/** The readonly modifier */ +public static final String READONLY = "READONLY"; + + +public static Set ALL = new HashSet() {{ +add(STATIC); +add(PUBLIC); +add(PROTECTED); +add(PRIVATE); +add(ABSTRACT); +add(NATIVE); +add(CONSTRUCTOR); +add(VIRTUAL); +add(INTERNAL); +add(FINAL); +add(READONLY); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/NodeTypes.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/NodeTypes.java new file mode 100644 index 0000000..b0c4c16 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/NodeTypes.java @@ -0,0 +1,371 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class NodeTypes { + +/** A method annotation. +The semantics of the FULL_NAME property on this node differ from the usual FULL_NAME +semantics in the sense that FULL_NAME describes the represented annotation class/interface +itself and not the ANNOTATION node. */ +public static final String ANNOTATION = "ANNOTATION"; + +/** A literal value assigned to an ANNOTATION_PARAMETER */ +public static final String ANNOTATION_LITERAL = "ANNOTATION_LITERAL"; + +/** Formal annotation parameter */ +public static final String ANNOTATION_PARAMETER = "ANNOTATION_PARAMETER"; + +/** Assignment of annotation argument to annotation parameter */ +public static final String ANNOTATION_PARAMETER_ASSIGN = "ANNOTATION_PARAMETER_ASSIGN"; + +/** Initialization construct for arrays */ +public static final String ARRAY_INITIALIZER = "ARRAY_INITIALIZER"; + +/** `BINDING` nodes represent name-signature pairs that can be resolved at a +type declaration (`TYPE_DECL`). They are connected to `TYPE_DECL` nodes via +incoming `BINDS` edges. The bound method is either associated with an outgoing +`REF` edge to a `METHOD` or with the `METHOD_FULL_NAME` property. The `REF` edge +if present has priority. */ +public static final String BINDING = "BINDING"; + +/** This node represents a compound statement. Compound statements are used in many languages to allow +grouping a sequence of statements. For example, in C and Java, compound statements +are statements enclosed by curly braces. Function/Method bodies are compound +statements. We do not use the term "compound statement" because "statement" would +imply that the block does not yield a value upon evaluation, that is, that it is +not an expression. This is true in languages such as C and Java, but not for languages +such as Scala where the value of the block is given by that of the last expression it +contains. In fact, the Scala grammar uses the term "BlockExpr" (short for +"block expression") to describe what in the CPG we call "Block". */ +public static final String BLOCK = "BLOCK"; + +/** A (function/method/procedure) call. The `METHOD_FULL_NAME` property is the name of the +invoked method (the callee) while the `TYPE_FULL_NAME` is its return type, and +therefore, the return type of the call when viewing it as an expression. For +languages like Javascript, it is common that we may know the (short-) name +of the invoked method, but we do not know at compile time which method +will actually be invoked, e.g., because it depends on a dynamic import. +In this case, we leave `METHOD_FULL_NAME` blank but at least fill out `NAME`, +which contains the method's (short-) name and `SIGNATURE`, which contains +any information we may have about the types of arguments and return value. */ +public static final String CALL = "CALL"; + +/** Represents the binding of a LOCAL or METHOD_PARAMETER_IN into the closure of a method */ +public static final String CLOSURE_BINDING = "CLOSURE_BINDING"; + +/** A source code comment */ +public static final String COMMENT = "COMMENT"; + +/** This node type represent a configuration file, where `NAME` is the name +of the file and `content` is its content. The exact representation of the +name is left undefined and can be chosen as required by consumers of +the corresponding configuration files. */ +public static final String CONFIG_FILE = "CONFIG_FILE"; + +/** This node represents a control structure as introduced by control structure +statements as well as conditional and unconditional jumps. Its type is stored in the +`CONTROL_STRUCTURE_TYPE` field to be one of several pre-defined types. These types + are used in the construction of the control flow layer, making it possible to + generate the control flow layer from the abstract syntax tree layer automatically. + +In addition to the `CONTROL_STRUCTURE_TYPE` field, the `PARSER_TYPE_NAME` field +MAY be used by frontends to store the name of the control structure as emitted by +the parser or disassembler, however, the value of this field is not relevant +for construction of the control flow layer. */ +public static final String CONTROL_STRUCTURE = "CONTROL_STRUCTURE"; + +/** This node represents a dependency */ +public static final String DEPENDENCY = "DEPENDENCY"; + +/** This node represents the field accessed in a field access, e.g., in +`a.b`, it represents `b`. The field name as it occurs in the code is +stored in the `CODE` field. This may mean that the `CODE` field holds +an expression. The `CANONICAL_NAME` field MAY contain the same value is +the `CODE` field but SHOULD contain the normalized name that results +from evaluating `CODE` as an expression if such an evaluation is +possible for the language frontend. The objective is to store an identifier +in `CANONICAL_NAME` that is the same for two nodes iff they refer to the +same field, regardless of whether they use the same expression to reference +it. */ +public static final String FIELD_IDENTIFIER = "FIELD_IDENTIFIER"; + +/** File nodes represent source files or a shared objects from which the CPG +was generated. File nodes serve as indices, that is, they allow looking up all +elements of the code by file. + +For each file, the graph MUST contain exactly one File node. +As file nodes are root nodes of abstract syntax tress, they are AstNodes and +their order field is set to 0. This is because they have no sibling nodes, +not because they are the first node of the AST. + +Each CPG MUST contain a special file node with name set to +``. This node is a placeholder used in cases where a file cannot be +determined at compile time. As an example, consider external library functions. +As their code is not available on CPG construction, the file name is unknown. + +File nodes MUST NOT be created by the language frontend. Instead, the language +frontend is assumed to fill out the `FILENAME` field wherever possible, +allowing File nodes to be created automatically upon first loading the CPG. */ +public static final String FILE = "FILE"; + +/** Finding nodes may be used to store analysis results in the graph +that are to be exposed to an end-user, e.g., information about +potential vulnerabilities or dangerous programming practices. +A Finding node may contain an abitrary list of key value pairs +that characterize the finding, as well as a list of nodes that +serve as evidence for the finding. */ +public static final String FINDING = "FINDING"; + +/** This node represents an identifier as used when referring to a variable by name. +It holds the identifier's name in the `NAME` field and its fully-qualified type +name in `TYPE_FULL_NAME`. */ +public static final String IDENTIFIER = "IDENTIFIER"; + +/** Declarative import as it is found in statically typed languages like Java. +This kind of node is not supposed to be used for imports in dynamically typed +languages like Javascript. */ +public static final String IMPORT = "IMPORT"; + +/** A jump label specifies the label and thus the JUMP_TARGET of control structures +BREAK and CONTINUE. The `NAME` field holds the name of the label while the +`PARSER_TYPE_NAME` field holds the name of language construct that this jump +label is created from, e.g., "Label". */ +public static final String JUMP_LABEL = "JUMP_LABEL"; + +/** A jump target is any location in the code that has been specifically marked +as the target of a jump, e.g., via a label. The `NAME` field holds the name of +the label while the `PARSER_TYPE_NAME` field holds the name of language construct +that this jump target is created from, e.g., "Label". */ +public static final String JUMP_TARGET = "JUMP_TARGET"; + +/** This node represents a key value pair, where both the key and the value are strings. */ +public static final String KEY_VALUE_PAIR = "KEY_VALUE_PAIR"; + +/** This node represents a literal such as an integer or string constant. Literals +are symbols included in the code in verbatim form and which are immutable. +The `TYPE_FULL_NAME` field stores the literal's fully-qualified type name, +e.g., `java.lang.Integer`. */ +public static final String LITERAL = "LITERAL"; + +/** This node represents a local variable. Its fully qualified type name is stored +in the `TYPE_FULL_NAME` field and its name in the `NAME` field. The `CODE` field +contains the entire local variable declaration without initialization, e.g., for +`int x = 10;`, it contains `int x`. */ +public static final String LOCAL = "LOCAL"; + +/** A location node summarizes a source code location. */ +public static final String LOCATION = "LOCATION"; + +/** This node represents a type member of a class, struct or union, e.g., for the + type declaration `class Foo{ int i ; }`, it represents the declaration of the + variable `i`. */ +public static final String MEMBER = "MEMBER"; + +/** This node contains the CPG meta data. Exactly one node of this type +MUST exist per CPG. The `HASH` property MAY contain a hash value calculated +over the source files this CPG was generated from. The `VERSION` MUST be +set to the version of the specification ("1.1"). The language field indicates +which language frontend was used to generate the CPG and the list property +`OVERLAYS` specifies which overlays have been applied to the CPG. */ +public static final String META_DATA = "META_DATA"; + +/** Programming languages offer many closely-related concepts for describing blocks +of code that can be executed with input parameters and return output parameters, +possibly causing side effects. In the CPG specification, we refer to all of these +concepts (procedures, functions, methods, etc.) as methods. A single METHOD node +must exist for each method found in the source program. + +The `FULL_NAME` field specifies the method's fully-qualified name, including +information about the namespace it is contained in if applicable, the name field +is the function's short name. The field `IS_EXTERNAL` indicates whether it was +possible to identify a method body for the method. This is true for methods that +are defined in the source program, and false for methods that are dynamically +linked to the program, that is, methods that exist in an external dependency. + +Line and column number information is specified in the optional fields +`LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and +the name of the source file is specified in `FILENAME`. An optional hash value +MAY be calculated over the function contents and included in the `HASH` field. + +Finally, the fully qualified name of the program constructs that the method +is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field +and its type is indicated in the `AST_PARENT_TYPE` field to be one of +`METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`. */ +public static final String METHOD = "METHOD"; + +/** This node represents a formal input parameter. The field `NAME` contains its +name, while the field `TYPE_FULL_NAME` contains the fully qualified type name. */ +public static final String METHOD_PARAMETER_IN = "METHOD_PARAMETER_IN"; + +/** This node represents a formal output parameter. Corresponding output parameters +for input parameters MUST NOT be created by the frontend as they are automatically +created upon first loading the CPG. */ +public static final String METHOD_PARAMETER_OUT = "METHOD_PARAMETER_OUT"; + +/** This node represents a reference to a method/function/procedure as it +appears when a method is passed as an argument in a call. The `METHOD_FULL_NAME` +field holds the fully-qualified name of the referenced method and the +`TYPE_FULL_NAME` holds its fully-qualified type name. */ +public static final String METHOD_REF = "METHOD_REF"; + +/** This node represents an (unnamed) formal method return parameter. It carries its +fully qualified type name in `TYPE_FULL_NAME`. The `CODE` field MAY be set freely, +e.g., to the constant `RET`, however, subsequent layer creators MUST NOT depend +on this value. */ +public static final String METHOD_RETURN = "METHOD_RETURN"; + +/** This field represents a (language-dependent) modifier such as `static`, `private` +or `public`. Unlike most other AST nodes, it is NOT an expression, that is, it +cannot be evaluated and cannot be passed as an argument in function calls. */ +public static final String MODIFIER = "MODIFIER"; + + +public static final String MYNODETYPE = "MYNODETYPE"; + +/** This node represents a namespace. Similar to FILE nodes, NAMESPACE nodes +serve as indices that allow all definitions inside a namespace to be +obtained by following outgoing edges from a NAMESPACE node. + +NAMESPACE nodes MUST NOT be created by language frontends. Instead, +they are generated from NAMESPACE_BLOCK nodes automatically upon +first loading of the CPG. */ +public static final String NAMESPACE = "NAMESPACE"; + +/** A reference to a namespace. +We borrow the concept of a "namespace block" from C++, that is, a namespace block +is a block of code that has been placed in the same namespace by a programmer. +This block may be introduced via a `package` statement in Java or +a `namespace{ }` statement in C++. + +The `FULL_NAME` field contains a unique identifier to represent the namespace block +itself not just the namespace it references. So in addition to the namespace name +it can be useful to use the containing file name to derive a unique identifier. + +The `NAME` field contains the namespace name in a human-readable format. +The name should be given in dot-separated form where a dot indicates +that the right hand side is a sub namespace of the left hand side, e.g., +`foo.bar` denotes the namespace `bar` contained in the namespace `foo`. */ +public static final String NAMESPACE_BLOCK = "NAMESPACE_BLOCK"; + +/** This node represents a return instruction, e.g., `return x`. Note that it does +NOT represent a formal return parameter as formal return parameters are +represented via `METHOD_RETURN` nodes. */ +public static final String RETURN = "RETURN"; + +/** This node represents a tag. */ +public static final String TAG = "TAG"; + +/** This node contains an arbitrary node and an associated tag node. */ +public static final String TAG_NODE_PAIR = "TAG_NODE_PAIR"; + +/** This node represents a DOM node used in template languages, e.g., JSX/TSX */ +public static final String TEMPLATE_DOM = "TEMPLATE_DOM"; + +/** This node represents a type instance, that is, a concrete instantiation +of a type declaration. */ +public static final String TYPE = "TYPE"; + +/** An (actual) type argument as used to instantiate a parametrized type, in the +same way an (actual) arguments provides concrete values for a parameter +at method call sites. As it true for arguments, the method is not expected +to interpret the type argument. It MUST however store its code in the +`CODE` field. */ +public static final String TYPE_ARGUMENT = "TYPE_ARGUMENT"; + +/** This node represents a type declaration as for example given by a class-, struct-, +or union declaration. In contrast to a `TYPE` node, this node does not represent a +concrete instantiation of a type, e.g., for the parametrized type `List[T]`, it represents +`List[T]`, but not `List[Integer]` where `Integer` is a concrete type. + +The language frontend MUST create type declarations for all types declared in the +source program and MAY provide type declarations for types that are not declared +but referenced by the source program. If a declaration is present in the source +program, the field `IS_EXTERNAL` is set to `false`. Otherwise, it is set to `true`. + +The `FULL_NAME` field specifies the type's fully-qualified name, including +information about the namespace it is contained in if applicable, the name field +is the type's short name. Line and column number information is specified in the +optional fields `LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and +`COLUMN_NUMBER_END` and the name of the source file is specified in `FILENAME`. + +Base types can be specified via the `INHERITS_FROM_TYPE_FULL_NAME` list, where +each entry contains the fully-qualified name of a base type. If the type is +known to be an alias of another type (as for example introduced via the C +`typedef` statement), the name of the alias is stored in `ALIAS_TYPE_FULL_NAME`. + +Finally, the fully qualified name of the program constructs that the type declaration +is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field +and its type is indicated in the `AST_PARENT_TYPE` field to be one of +`METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`. */ +public static final String TYPE_DECL = "TYPE_DECL"; + +/** This node represents a formal type parameter, that is, the type parameter +as given in a type-parametrized method or type declaration. Examples for +languages that support type parameters are Java (via Generics) and C++ +(via templates). Apart from the standard fields of AST nodes, the type +parameter carries only a `NAME` field that holds the parameters name. */ +public static final String TYPE_PARAMETER = "TYPE_PARAMETER"; + +/** Reference to a type/class */ +public static final String TYPE_REF = "TYPE_REF"; + +/** Any AST node that the frontend would like to include in the AST but for +which no suitable AST node is specified in the CPG specification may be +included using a node of type `UNKNOWN`. */ +public static final String UNKNOWN = "UNKNOWN"; + + +public static Set ALL = new HashSet() {{ +add(ANNOTATION); +add(ANNOTATION_LITERAL); +add(ANNOTATION_PARAMETER); +add(ANNOTATION_PARAMETER_ASSIGN); +add(ARRAY_INITIALIZER); +add(BINDING); +add(BLOCK); +add(CALL); +add(CLOSURE_BINDING); +add(COMMENT); +add(CONFIG_FILE); +add(CONTROL_STRUCTURE); +add(DEPENDENCY); +add(FIELD_IDENTIFIER); +add(FILE); +add(FINDING); +add(IDENTIFIER); +add(IMPORT); +add(JUMP_LABEL); +add(JUMP_TARGET); +add(KEY_VALUE_PAIR); +add(LITERAL); +add(LOCAL); +add(LOCATION); +add(MEMBER); +add(META_DATA); +add(METHOD); +add(METHOD_PARAMETER_IN); +add(METHOD_PARAMETER_OUT); +add(METHOD_REF); +add(METHOD_RETURN); +add(MODIFIER); +add(MYNODETYPE); +add(NAMESPACE); +add(NAMESPACE_BLOCK); +add(RETURN); +add(TAG); +add(TAG_NODE_PAIR); +add(TEMPLATE_DOM); +add(TYPE); +add(TYPE_ARGUMENT); +add(TYPE_DECL); +add(TYPE_PARAMETER); +add(TYPE_REF); +add(UNKNOWN); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Operators.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Operators.java new file mode 100644 index 0000000..da3fa66 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Operators.java @@ -0,0 +1,307 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class Operators { + + +public static final String addition = ".addition"; + + +public static final String subtraction = ".subtraction"; + + +public static final String multiplication = ".multiplication"; + + +public static final String division = ".division"; + + +public static final String exponentiation = ".exponentiation"; + + +public static final String modulo = ".modulo"; + + +public static final String shiftLeft = ".shiftLeft"; + +/** Shift right padding with zeros */ +public static final String logicalShiftRight = ".logicalShiftRight"; + +/** Shift right preserving the sign */ +public static final String arithmeticShiftRight = ".arithmeticShiftRight"; + + +public static final String not = ".not"; + + +public static final String and = ".and"; + + +public static final String or = ".or"; + + +public static final String xor = ".xor"; + + +public static final String assignmentPlus = ".assignmentPlus"; + + +public static final String assignmentMinus = ".assignmentMinus"; + + +public static final String assignmentMultiplication = ".assignmentMultiplication"; + + +public static final String assignmentDivision = ".assignmentDivision"; + + +public static final String assignmentExponentiation = ".assignmentExponentiation"; + + +public static final String assignmentModulo = ".assignmentModulo"; + + +public static final String assignmentShiftLeft = ".assignmentShiftLeft"; + + +public static final String assignmentLogicalShiftRight = ".assignmentLogicalShiftRight"; + + +public static final String assignmentArithmeticShiftRight = ".assignmentArithmeticShiftRight"; + + +public static final String assignmentAnd = ".assignmentAnd"; + + +public static final String assignmentOr = ".assignmentOr"; + + +public static final String assignmentXor = ".assignmentXor"; + + +public static final String arrayInitializer = ".arrayInitializer"; + + +public static final String assignment = ".assignment"; + +/** E.g. `a = -b` */ +public static final String minus = ".minus"; + +/** E.g. `a = +b` */ +public static final String plus = ".plus"; + + +public static final String preIncrement = ".preIncrement"; + + +public static final String preDecrement = ".preDecrement"; + + +public static final String postIncrement = ".postIncrement"; + + +public static final String postDecrement = ".postDecrement"; + + +public static final String logicalNot = ".logicalNot"; + + +public static final String logicalOr = ".logicalOr"; + + +public static final String logicalAnd = ".logicalAnd"; + + +public static final String equals = ".equals"; + + +public static final String notEquals = ".notEquals"; + + +public static final String greaterThan = ".greaterThan"; + + +public static final String lessThan = ".lessThan"; + + +public static final String greaterEqualsThan = ".greaterEqualsThan"; + + +public static final String lessEqualsThan = ".lessEqualsThan"; + + +public static final String instanceOf = ".instanceOf"; + +/** Deprecated. Formerly in C: `a.b` but not! in Java */ +public static final String memberAccess = ".memberAccess"; + +/** Deprecated. Formerly in C: `a->b` and `a.b` in Java */ +public static final String indirectMemberAccess = ".indirectMemberAccess"; + +/** Deprecated. Formerly in C: `a[b]` but not! in Java */ +public static final String computedMemberAccess = ".computedMemberAccess"; + +/** Deprecated. Formerly in C++: `a->*b` and a[b] in Java */ +public static final String indirectComputedMemberAccess = ".indirectComputedMemberAccess"; + +/** Accesses through a pointer (load/store), i.e. dereferences it. Typically the star-operator in C/C++. Pairs of addressOf and indirection operators cancel each other. Handling of this operator is special-cased in the back-end */ +public static final String indirection = ".indirection"; + +/** Deletes a property from a namespace. E.g. `a=3; delete a; a == undefined; */ +public static final String delete = ".delete"; + +/** E.g. `a ? consequent : alternate`. In future probably also used for if statements */ +public static final String conditional = ".conditional"; + +/** E.g. `x = f() ?: g()`. A binary operator that returns its first operand if that operand evaluates to a true value, and otherwise evaluates and returns its second operand. */ +public static final String elvis = ".elvis"; + +/** Type casts of any sort */ +public static final String cast = ".cast"; + +/** Comparison between two arguments with the results: 0 == equal, negative == left < right, positive == left > right */ +public static final String compare = ".compare"; + +/** Returns the address of a given object. Pairs of addressOf and indirection operators cancel each other. Handling of this operator is special-cased in the back-end */ +public static final String addressOf = ".addressOf"; + +/** Returns the size of a given object */ +public static final String sizeOf = ".sizeOf"; + +/** Returns or sets a field/member of a struct/class. Typically, the dot-operator. In terms of CPG, the first argument is the struct/class and the second argument is either a FIELD_IDENTIFIER node, a LITERAL node or an arbitrary expression. If it is a FIELD_IDENTIFIER, then the string contained in the CANONICAL_NAME field of this FIELD_IDENTIFIER node selects which field/member is accessed. If it is a LITERAL node, then its CODE selects which field/member is selected. In any other case the access is considered unpredictable by the backend, and we overtaint. indexAccess and fieldAccess live in the same space, such that e.g. obj.field and obj["field"] refer to the same target (as is correct in e.g. javascript). Handling of this operator is special-cased in the back-end */ +public static final String fieldAccess = ".fieldAccess"; + +/** Accesses (loads/stores) to a field/member through a pointer to a struct/class. Typically, C/C++ arrow-operator. The field selection works the same way as for fieldAccess. For the sake of data-flow tracking, this is the same as first dereferencing the pointer and then accessing the field. Handling of this operator is special-cased in the back-end */ +public static final String indirectFieldAccess = ".indirectFieldAccess"; + +/** Accesses a container (e.g. array or associative array / dict / map) at an index. The index selection works the same way as for fieldAccess. Handling of this operator is special-cased in the back-end */ +public static final String indexAccess = ".indexAccess"; + +/** Accesses an element of an Array through a pointer. The index selection works similar as for fieldAccess: However, the index must be an integer. If the second argument is a FIELD_ACCESS resp. LITERAL then its CANONICAL_NAME resp. CODE field is parsed as an integer; on parsing failure, the access is considered unpredictable and we overtaint. This is equivalent to a pointerShift followed by an indirection. This operator is currently only used by C-style languages. This behavior allows the backend to infer that ptr[0] and *ptr refer to the same object. Handling of this operator is special-cased in the back-end */ +public static final String indirectIndexAccess = ".indirectIndexAccess"; + +/** Shifts a pointer. In terms of CPG, the first argument is the pointer and the second argument is the index. The index selection works the same way as for indirectIndexAccess. This operator is currently only used directly by the LLVM language, but it is also used internally for C. For example, pointerShift(ptr, 7) is equivalent to &(ptr[7]). Handling of this operator is special-cased in the back-end */ +public static final String pointerShift = ".pointerShift"; + +/** Derives a pointer to a field of a struct from a pointer to the entire struct. This corresponds to the C idiom &(ptr->field), which does not access memory. The field selection works the same way as for fieldAccess. This operator is currently only used directly by the LLVM language. Handling of this operator is special-cased in the back-end */ +public static final String getElementPtr = ".getElementPtr"; + +/** Defines a string literal which can replace containing expressions with their values. */ +public static final String formatString = ".formatString"; + +/** Replaces an expression with its string value. */ +public static final String formattedValue = ".formattedValue"; + +/** Defines a range of values, e.g. `for (i in 1..10) print(i)`. */ +public static final String range = ".range"; + +/** Checks the existence of a variable in a range or collection, e.g. `for (i in 1..10) print(i)`. */ +public static final String in = ".in"; + +/** Checks the non-existence of a variable in a range or collection, e.g. `print(5 not in [1, 2, 3, 4])` */ +public static final String notIn = ".notIn"; + +/** Checks whether a variable is of a given type */ +public static final String is = ".is"; + +/** Checks whether a variable is not of a given type */ +public static final String isNot = ".isNot"; + +/** Converts any value to a not-null type */ +public static final String notNullAssert = ".notNullAssert"; + +/** Returns the length of the given collection e.g. (new int[]{ 1, 2, 3 }).length in Java or len([1, 2, 3]) in Python */ +public static final String lengthOf = ".lengthOf"; + +/** Returns null if the first operator is null, otherwise performs a dereferencing operation */ +public static final String safeNavigation = ".safeNavigation"; + +/** Returns either the last expression in the `try`-block, or the last expression in one of the `catch`/`except`-blocks. The contents of the `finally`-block are ignored. */ +public static final String tryCatch = ".tryCatch"; + +/** Allocates memory for an object of a specific type */ +public static final String alloc = ".alloc"; + + +public static Set ALL = new HashSet() {{ +add(addition); +add(subtraction); +add(multiplication); +add(division); +add(exponentiation); +add(modulo); +add(shiftLeft); +add(logicalShiftRight); +add(arithmeticShiftRight); +add(not); +add(and); +add(or); +add(xor); +add(assignmentPlus); +add(assignmentMinus); +add(assignmentMultiplication); +add(assignmentDivision); +add(assignmentExponentiation); +add(assignmentModulo); +add(assignmentShiftLeft); +add(assignmentLogicalShiftRight); +add(assignmentArithmeticShiftRight); +add(assignmentAnd); +add(assignmentOr); +add(assignmentXor); +add(arrayInitializer); +add(assignment); +add(minus); +add(plus); +add(preIncrement); +add(preDecrement); +add(postIncrement); +add(postDecrement); +add(logicalNot); +add(logicalOr); +add(logicalAnd); +add(equals); +add(notEquals); +add(greaterThan); +add(lessThan); +add(greaterEqualsThan); +add(lessEqualsThan); +add(instanceOf); +add(memberAccess); +add(indirectMemberAccess); +add(computedMemberAccess); +add(indirectComputedMemberAccess); +add(indirection); +add(delete); +add(conditional); +add(elvis); +add(cast); +add(compare); +add(addressOf); +add(sizeOf); +add(fieldAccess); +add(indirectFieldAccess); +add(indexAccess); +add(indirectIndexAccess); +add(pointerShift); +add(getElementPtr); +add(formatString); +add(formattedValue); +add(range); +add(in); +add(notIn); +add(is); +add(isNot); +add(notNullAssert); +add(lengthOf); +add(safeNavigation); +add(tryCatch); +add(alloc); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.java new file mode 100644 index 0000000..63c6888 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.java @@ -0,0 +1,318 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class Properties { + +/** This property holds the fully qualified name of the type that the node is +a type alias of. */ +public static final overflowdb.PropertyKey ALIAS_TYPE_FULL_NAME = new overflowdb.PropertyKey<>("ALIAS_TYPE_FULL_NAME"); + +/** AST-children of CALL nodes have an argument index, that is used to match +call-site arguments with callee parameters. Explicit parameters are numbered +from 1 to N, while index 0 is reserved for implicit self / this parameter. +CALLs without implicit parameter therefore have arguments starting with index 1. +AST-children of BLOCK nodes may have an argument index as well; in this case, +the last argument index determines the return expression of a BLOCK expression. +If the `PARAMETER_NAME` field is set, then the `ARGUMENT_INDEX` field is +ignored. It is suggested to set it to -1. */ +public static final overflowdb.PropertyKey ARGUMENT_INDEX = new overflowdb.PropertyKey<>("ARGUMENT_INDEX"); + +/** For calls involving named parameters, the `ARGUMENT_NAME` field holds the +name of the parameter initialized by the expression. For all other calls, +this field is unset. */ +public static final overflowdb.PropertyKey ARGUMENT_NAME = new overflowdb.PropertyKey<>("ARGUMENT_NAME"); + +/** This field holds the FULL_NAME of the AST parent of an entity. */ +public static final overflowdb.PropertyKey AST_PARENT_FULL_NAME = new overflowdb.PropertyKey<>("AST_PARENT_FULL_NAME"); + +/** The type of the AST parent. Since this is only used in some parts of the graph, +the list does not include all possible parents by intention. +Possible parents: METHOD, TYPE_DECL, NAMESPACE_BLOCK. */ +public static final overflowdb.PropertyKey AST_PARENT_TYPE = new overflowdb.PropertyKey<>("AST_PARENT_TYPE"); + +/** This field holds the canonical name of a `FIELD_IDENTIFIER`. It is typically +identical to the CODE field, but canonicalized according to source language +semantics. Human readable names are preferable. `FIELD_IDENTIFIER` nodes must +share identical `CANONICAL_NAME` if and +only if they alias, e.g., in C-style unions (if the aliasing relationship is +unknown or there are partial overlaps, then one must make a reasonable guess, +and trade off between false negatives and false positives). */ +public static final overflowdb.PropertyKey CANONICAL_NAME = new overflowdb.PropertyKey<>("CANONICAL_NAME"); + + +public static final overflowdb.PropertyKey CLASS_NAME = new overflowdb.PropertyKey<>("CLASS_NAME"); + + +public static final overflowdb.PropertyKey CLASS_SHORT_NAME = new overflowdb.PropertyKey<>("CLASS_SHORT_NAME"); + +/** Identifier which uniquely describes a CLOSURE_BINDING. This property is used to match captured LOCAL nodes with the corresponding CLOSURE_BINDING nodes */ +public static final overflowdb.PropertyKey CLOSURE_BINDING_ID = new overflowdb.PropertyKey<>("CLOSURE_BINDING_ID"); + +/** The original name of the (potentially mangled) captured variable */ +public static final overflowdb.PropertyKey CLOSURE_ORIGINAL_NAME = new overflowdb.PropertyKey<>("CLOSURE_ORIGINAL_NAME"); + +/** This field holds the code snippet that the node represents. */ +public static final overflowdb.PropertyKey CODE = new overflowdb.PropertyKey<>("CODE"); + +/** This optional fields provides the column number of the program construct +represented by the node. */ +public static final overflowdb.PropertyKey COLUMN_NUMBER = new overflowdb.PropertyKey<>("COLUMN_NUMBER"); + +/** This optional fields provides the column number at which the program construct +represented by the node ends. */ +public static final overflowdb.PropertyKey COLUMN_NUMBER_END = new overflowdb.PropertyKey<>("COLUMN_NUMBER_END"); + +/** References to other nodes. This is not a real property; it exists here for the sake of proto serialization only. valueType and cardinality are meaningless. */ +public static final overflowdb.PropertyKey CONTAINED_REF = new overflowdb.PropertyKey<>("CONTAINED_REF"); + +/** Certain files, e.g., configuration files, may be included in the CPG as-is. +For such files, the `CONTENT` field contains the files content. */ +public static final overflowdb.PropertyKey CONTENT = new overflowdb.PropertyKey<>("CONTENT"); + +/** The `CONTROL_STRUCTURE_TYPE` field indicates which kind of control structure +a `CONTROL_STRUCTURE` node represents. The available types are the following: + BREAK, CONTINUE, DO, WHILE, FOR, GOTO, IF, ELSE, TRY, THROW and SWITCH. */ +public static final overflowdb.PropertyKey CONTROL_STRUCTURE_TYPE = new overflowdb.PropertyKey<>("CONTROL_STRUCTURE_TYPE"); + +/** The group ID for a dependency */ +public static final overflowdb.PropertyKey DEPENDENCY_GROUP_ID = new overflowdb.PropertyKey<>("DEPENDENCY_GROUP_ID"); + +/** This field holds the dispatch type of a call, which is either `STATIC_DISPATCH` or +`DYNAMIC_DISPATCH`. For statically dispatched method calls, the call target is known +at compile time while for dynamically dispatched calls, it can only be determined at +runtime as it may depend on the type of an object (as is the case for virtual method +calls) or calculation of an offset. */ +public static final overflowdb.PropertyKey DISPATCH_TYPE = new overflowdb.PropertyKey<>("DISPATCH_TYPE"); + +/** Type hint for the dynamic type */ +public static final overflowdb.PropertyKey> DYNAMIC_TYPE_HINT_FULL_NAME = new overflowdb.PropertyKey<>("DYNAMIC_TYPE_HINT_FULL_NAME"); + +/** For formal method input parameters, output parameters, and return parameters, +this field holds the evaluation strategy, which is one of the following: +1) `BY_REFERENCE` indicates that the parameter is passed by reference, 2) +`BY_VALUE` indicates that it is passed by value, that is, a copy is made, +3) `BY_SHARING` the parameter is a pointer/reference and it is shared with +the caller/callee. While a copy of the pointer is made, a copy of the object +that it points to is not made. */ +public static final overflowdb.PropertyKey EVALUATION_STRATEGY = new overflowdb.PropertyKey<>("EVALUATION_STRATEGY"); + +/** Specifies whether the IMPORTED_AS property was explicitly present in the code. +For languages like Java which do not allow a renaming during import this is +always false. For e.g. Kotlin it depends on the existence of the "as" keyword. */ +public static final overflowdb.PropertyKey EXPLICIT_AS = new overflowdb.PropertyKey<>("EXPLICIT_AS"); + +/** The path of the source file this node was generated from, relative to the root +path in the meta data node. This field must be set but may be set to the value `` to +indicate that no source file can be associated with the node, e.g., because the node represents +an entity known to exist because it is referenced, but for which the file that is is declared in +is unknown. */ +public static final overflowdb.PropertyKey FILENAME = new overflowdb.PropertyKey<>("FILENAME"); + +/** This is the fully-qualified name of an entity, e.g., the fully-qualified +name of a method or type. The details of what constitutes a fully-qualified +name are language specific. This field SHOULD be human readable. */ +public static final overflowdb.PropertyKey FULL_NAME = new overflowdb.PropertyKey<>("FULL_NAME"); + +/** This property contains a hash value in the form of a string. +Hashes can be used to summarize data, e.g., to summarize the +contents of source files or sub graphs. Such summaries are useful +to determine whether code has already been analyzed in incremental +analysis pipelines. This property is optional to allow its calculation +to be deferred or skipped if the hash is not needed. */ +public static final overflowdb.PropertyKey HASH = new overflowdb.PropertyKey<>("HASH"); + +/** The identifier under which the import can be accessed in the importing context. +For a Java import this is always identical to the class name. But e.g. for a +Kotlin import like "import java.nio.ByteBuffer as BBuffer" this would be "BBuffer". +This property is ignored if IS_WILDCARD is true. */ +public static final overflowdb.PropertyKey IMPORTED_AS = new overflowdb.PropertyKey<>("IMPORTED_AS"); + +/** The identifying string of the imported entity. +For a Java import like "import java.nio.ByteBuffer;" this would be "java.nio.ByteBuffer". */ +public static final overflowdb.PropertyKey IMPORTED_ENTITY = new overflowdb.PropertyKey<>("IMPORTED_ENTITY"); + +/** Specifies an index, e.g., for a parameter or argument. + Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit + self / this parameter. */ +public static final overflowdb.PropertyKey INDEX = new overflowdb.PropertyKey<>("INDEX"); + +/** The static types a TYPE_DECL inherits from. This property is matched against the +FULL_NAME of TYPE nodes and thus it is required to have at least one TYPE node +for each TYPE_FULL_NAME */ +public static final overflowdb.PropertyKey> INHERITS_FROM_TYPE_FULL_NAME = new overflowdb.PropertyKey<>("INHERITS_FROM_TYPE_FULL_NAME"); + +/** Specifies whether this is an explicit import. +Most languages have implicit default imports of some standard library elements +and this flag is used to distinguish those from explicit imports found in the +code base. */ +public static final overflowdb.PropertyKey IS_EXPLICIT = new overflowdb.PropertyKey<>("IS_EXPLICIT"); + +/** Indicates that the construct (METHOD or TYPE_DECL) is external, that is, +it is referenced but not defined in the code (applies both to insular +parsing and to library functions where we have header files only) */ +public static final overflowdb.PropertyKey IS_EXTERNAL = new overflowdb.PropertyKey<>("IS_EXTERNAL"); + +/** Specifies whether a parameter is the variadic argument handling parameter of +a variadic method. Only one parameter of a method is allowed to have this +property set to true. */ +public static final overflowdb.PropertyKey IS_VARIADIC = new overflowdb.PropertyKey<>("IS_VARIADIC"); + +/** Specifies whether this is a wildcard import. +For a Java import like "import java.nio.*;" IS_WILDCARD would be "true" and +IMPORTED_ENTITY would be "java.nio". +For wildcard imports the IMPORTED_AS property is ignored. */ +public static final overflowdb.PropertyKey IS_WILDCARD = new overflowdb.PropertyKey<>("IS_WILDCARD"); + +/** This property denotes a key of a key-value pair. */ +public static final overflowdb.PropertyKey KEY = new overflowdb.PropertyKey<>("KEY"); + +/** This field indicates which CPG language frontend generated the CPG. +Frontend developers may freely choose a value that describes their frontend +so long as it is not used by an existing frontend. Reserved values are to date: +C, LLVM, GHIDRA, PHP. */ +public static final overflowdb.PropertyKey LANGUAGE = new overflowdb.PropertyKey<>("LANGUAGE"); + +/** This optional field provides the line number of the program construct +represented by the node. */ +public static final overflowdb.PropertyKey LINE_NUMBER = new overflowdb.PropertyKey<>("LINE_NUMBER"); + +/** This optional fields provides the line number at which the program construct +represented by the node ends. */ +public static final overflowdb.PropertyKey LINE_NUMBER_END = new overflowdb.PropertyKey<>("LINE_NUMBER_END"); + +/** The FULL_NAME of a method. Used to link CALL and METHOD nodes. It is required +to have exactly one METHOD node for each METHOD_FULL_NAME */ +public static final overflowdb.PropertyKey METHOD_FULL_NAME = new overflowdb.PropertyKey<>("METHOD_FULL_NAME"); + + +public static final overflowdb.PropertyKey METHOD_SHORT_NAME = new overflowdb.PropertyKey<>("METHOD_SHORT_NAME"); + +/** The modifier type is a free-form string. The following are known modifier types: +`STATIC`, `PUBLIC`, `PROTECTED`, `PRIVATE`, `ABSTRACT`, `NATIVE`, `CONSTRUCTOR`, `VIRTUAL`. */ +public static final overflowdb.PropertyKey MODIFIER_TYPE = new overflowdb.PropertyKey<>("MODIFIER_TYPE"); + + +public static final overflowdb.PropertyKey MYPROPERTY = new overflowdb.PropertyKey<>("MYPROPERTY"); + +/** Name of represented object, e.g., method name (e.g. "run") */ +public static final overflowdb.PropertyKey NAME = new overflowdb.PropertyKey<>("NAME"); + + +public static final overflowdb.PropertyKey NODE_LABEL = new overflowdb.PropertyKey<>("NODE_LABEL"); + +/** This integer indicates the position of the node among +its siblings in the AST. The left-most child has an +order of 0. */ +public static final overflowdb.PropertyKey ORDER = new overflowdb.PropertyKey<>("ORDER"); + +/** The field contains the names of the overlays applied to this CPG, in order of their +application. Names are free-form strings, that is, this specification does not +dictate them but rather requires tool producers and consumers to communicate them +between each other. */ +public static final overflowdb.PropertyKey> OVERLAYS = new overflowdb.PropertyKey<>("OVERLAYS"); + + +public static final overflowdb.PropertyKey PACKAGE_NAME = new overflowdb.PropertyKey<>("PACKAGE_NAME"); + +/** AST node type name emitted by parser. */ +public static final overflowdb.PropertyKey PARSER_TYPE_NAME = new overflowdb.PropertyKey<>("PARSER_TYPE_NAME"); + +/** The path to the root directory of the source/binary this CPG is generated from. */ +public static final overflowdb.PropertyKey ROOT = new overflowdb.PropertyKey<>("ROOT"); + +/** The method signature encodes the types of parameters in a string. +The string SHOULD be human readable and suitable for differentiating methods +with different parameter types sufficiently to allow for resolving of +function overloading. The present specification does not enforce a strict +format for the signature, that is, it can be chosen by the frontend +implementor to fit the source language. */ +public static final overflowdb.PropertyKey SIGNATURE = new overflowdb.PropertyKey<>("SIGNATURE"); + + +public static final overflowdb.PropertyKey SYMBOL = new overflowdb.PropertyKey<>("SYMBOL"); + +/** The static type decl of a TYPE. This property is matched against the FULL_NAME +of TYPE_DECL nodes. It is required to have exactly one TYPE_DECL for each +different TYPE_DECL_FULL_NAME */ +public static final overflowdb.PropertyKey TYPE_DECL_FULL_NAME = new overflowdb.PropertyKey<>("TYPE_DECL_FULL_NAME"); + +/** This field contains the fully-qualified static type name of the program +construct represented by a node. It is the name of an instantiated type, e.g., +`java.util.List`, rather than `java.util.List[T]`. If the type +cannot be determined, this field should be set to the empty string. */ +public static final overflowdb.PropertyKey TYPE_FULL_NAME = new overflowdb.PropertyKey<>("TYPE_FULL_NAME"); + +/** This property denotes a string value as used in a key-value pair. */ +public static final overflowdb.PropertyKey VALUE = new overflowdb.PropertyKey<>("VALUE"); + +/** This edge property represents the variable propagated by a reaching definition edge. */ +public static final overflowdb.PropertyKey VARIABLE = new overflowdb.PropertyKey<>("VARIABLE"); + +/** A version, given as a string. Used, for example, in the META_DATA node to +indicate which version of the CPG spec this CPG conforms to */ +public static final overflowdb.PropertyKey VERSION = new overflowdb.PropertyKey<>("VERSION"); + + +public static Set> ALL = new HashSet>() {{ +add(ALIAS_TYPE_FULL_NAME); +add(ARGUMENT_INDEX); +add(ARGUMENT_NAME); +add(AST_PARENT_FULL_NAME); +add(AST_PARENT_TYPE); +add(CANONICAL_NAME); +add(CLASS_NAME); +add(CLASS_SHORT_NAME); +add(CLOSURE_BINDING_ID); +add(CLOSURE_ORIGINAL_NAME); +add(CODE); +add(COLUMN_NUMBER); +add(COLUMN_NUMBER_END); +add(CONTAINED_REF); +add(CONTENT); +add(CONTROL_STRUCTURE_TYPE); +add(DEPENDENCY_GROUP_ID); +add(DISPATCH_TYPE); +add(DYNAMIC_TYPE_HINT_FULL_NAME); +add(EVALUATION_STRATEGY); +add(EXPLICIT_AS); +add(FILENAME); +add(FULL_NAME); +add(HASH); +add(IMPORTED_AS); +add(IMPORTED_ENTITY); +add(INDEX); +add(INHERITS_FROM_TYPE_FULL_NAME); +add(IS_EXPLICIT); +add(IS_EXTERNAL); +add(IS_VARIADIC); +add(IS_WILDCARD); +add(KEY); +add(LANGUAGE); +add(LINE_NUMBER); +add(LINE_NUMBER_END); +add(METHOD_FULL_NAME); +add(METHOD_SHORT_NAME); +add(MODIFIER_TYPE); +add(MYPROPERTY); +add(NAME); +add(NODE_LABEL); +add(ORDER); +add(OVERLAYS); +add(PACKAGE_NAME); +add(PARSER_TYPE_NAME); +add(ROOT); +add(SIGNATURE); +add(SYMBOL); +add(TYPE_DECL_FULL_NAME); +add(TYPE_FULL_NAME); +add(VALUE); +add(VARIABLE); +add(VERSION); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyNames.java b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyNames.java new file mode 100644 index 0000000..94bc208 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyNames.java @@ -0,0 +1,318 @@ +package io.shiftleft.codepropertygraph.generated; + +import overflowdb.*; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class PropertyNames { + +/** This property holds the fully qualified name of the type that the node is +a type alias of. */ +public static final String ALIAS_TYPE_FULL_NAME = "ALIAS_TYPE_FULL_NAME"; + +/** AST-children of CALL nodes have an argument index, that is used to match +call-site arguments with callee parameters. Explicit parameters are numbered +from 1 to N, while index 0 is reserved for implicit self / this parameter. +CALLs without implicit parameter therefore have arguments starting with index 1. +AST-children of BLOCK nodes may have an argument index as well; in this case, +the last argument index determines the return expression of a BLOCK expression. +If the `PARAMETER_NAME` field is set, then the `ARGUMENT_INDEX` field is +ignored. It is suggested to set it to -1. */ +public static final String ARGUMENT_INDEX = "ARGUMENT_INDEX"; + +/** For calls involving named parameters, the `ARGUMENT_NAME` field holds the +name of the parameter initialized by the expression. For all other calls, +this field is unset. */ +public static final String ARGUMENT_NAME = "ARGUMENT_NAME"; + +/** This field holds the FULL_NAME of the AST parent of an entity. */ +public static final String AST_PARENT_FULL_NAME = "AST_PARENT_FULL_NAME"; + +/** The type of the AST parent. Since this is only used in some parts of the graph, +the list does not include all possible parents by intention. +Possible parents: METHOD, TYPE_DECL, NAMESPACE_BLOCK. */ +public static final String AST_PARENT_TYPE = "AST_PARENT_TYPE"; + +/** This field holds the canonical name of a `FIELD_IDENTIFIER`. It is typically +identical to the CODE field, but canonicalized according to source language +semantics. Human readable names are preferable. `FIELD_IDENTIFIER` nodes must +share identical `CANONICAL_NAME` if and +only if they alias, e.g., in C-style unions (if the aliasing relationship is +unknown or there are partial overlaps, then one must make a reasonable guess, +and trade off between false negatives and false positives). */ +public static final String CANONICAL_NAME = "CANONICAL_NAME"; + + +public static final String CLASS_NAME = "CLASS_NAME"; + + +public static final String CLASS_SHORT_NAME = "CLASS_SHORT_NAME"; + +/** Identifier which uniquely describes a CLOSURE_BINDING. This property is used to match captured LOCAL nodes with the corresponding CLOSURE_BINDING nodes */ +public static final String CLOSURE_BINDING_ID = "CLOSURE_BINDING_ID"; + +/** The original name of the (potentially mangled) captured variable */ +public static final String CLOSURE_ORIGINAL_NAME = "CLOSURE_ORIGINAL_NAME"; + +/** This field holds the code snippet that the node represents. */ +public static final String CODE = "CODE"; + +/** This optional fields provides the column number of the program construct +represented by the node. */ +public static final String COLUMN_NUMBER = "COLUMN_NUMBER"; + +/** This optional fields provides the column number at which the program construct +represented by the node ends. */ +public static final String COLUMN_NUMBER_END = "COLUMN_NUMBER_END"; + +/** References to other nodes. This is not a real property; it exists here for the sake of proto serialization only. valueType and cardinality are meaningless. */ +public static final String CONTAINED_REF = "CONTAINED_REF"; + +/** Certain files, e.g., configuration files, may be included in the CPG as-is. +For such files, the `CONTENT` field contains the files content. */ +public static final String CONTENT = "CONTENT"; + +/** The `CONTROL_STRUCTURE_TYPE` field indicates which kind of control structure +a `CONTROL_STRUCTURE` node represents. The available types are the following: + BREAK, CONTINUE, DO, WHILE, FOR, GOTO, IF, ELSE, TRY, THROW and SWITCH. */ +public static final String CONTROL_STRUCTURE_TYPE = "CONTROL_STRUCTURE_TYPE"; + +/** The group ID for a dependency */ +public static final String DEPENDENCY_GROUP_ID = "DEPENDENCY_GROUP_ID"; + +/** This field holds the dispatch type of a call, which is either `STATIC_DISPATCH` or +`DYNAMIC_DISPATCH`. For statically dispatched method calls, the call target is known +at compile time while for dynamically dispatched calls, it can only be determined at +runtime as it may depend on the type of an object (as is the case for virtual method +calls) or calculation of an offset. */ +public static final String DISPATCH_TYPE = "DISPATCH_TYPE"; + +/** Type hint for the dynamic type */ +public static final String DYNAMIC_TYPE_HINT_FULL_NAME = "DYNAMIC_TYPE_HINT_FULL_NAME"; + +/** For formal method input parameters, output parameters, and return parameters, +this field holds the evaluation strategy, which is one of the following: +1) `BY_REFERENCE` indicates that the parameter is passed by reference, 2) +`BY_VALUE` indicates that it is passed by value, that is, a copy is made, +3) `BY_SHARING` the parameter is a pointer/reference and it is shared with +the caller/callee. While a copy of the pointer is made, a copy of the object +that it points to is not made. */ +public static final String EVALUATION_STRATEGY = "EVALUATION_STRATEGY"; + +/** Specifies whether the IMPORTED_AS property was explicitly present in the code. +For languages like Java which do not allow a renaming during import this is +always false. For e.g. Kotlin it depends on the existence of the "as" keyword. */ +public static final String EXPLICIT_AS = "EXPLICIT_AS"; + +/** The path of the source file this node was generated from, relative to the root +path in the meta data node. This field must be set but may be set to the value `` to +indicate that no source file can be associated with the node, e.g., because the node represents +an entity known to exist because it is referenced, but for which the file that is is declared in +is unknown. */ +public static final String FILENAME = "FILENAME"; + +/** This is the fully-qualified name of an entity, e.g., the fully-qualified +name of a method or type. The details of what constitutes a fully-qualified +name are language specific. This field SHOULD be human readable. */ +public static final String FULL_NAME = "FULL_NAME"; + +/** This property contains a hash value in the form of a string. +Hashes can be used to summarize data, e.g., to summarize the +contents of source files or sub graphs. Such summaries are useful +to determine whether code has already been analyzed in incremental +analysis pipelines. This property is optional to allow its calculation +to be deferred or skipped if the hash is not needed. */ +public static final String HASH = "HASH"; + +/** The identifier under which the import can be accessed in the importing context. +For a Java import this is always identical to the class name. But e.g. for a +Kotlin import like "import java.nio.ByteBuffer as BBuffer" this would be "BBuffer". +This property is ignored if IS_WILDCARD is true. */ +public static final String IMPORTED_AS = "IMPORTED_AS"; + +/** The identifying string of the imported entity. +For a Java import like "import java.nio.ByteBuffer;" this would be "java.nio.ByteBuffer". */ +public static final String IMPORTED_ENTITY = "IMPORTED_ENTITY"; + +/** Specifies an index, e.g., for a parameter or argument. + Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit + self / this parameter. */ +public static final String INDEX = "INDEX"; + +/** The static types a TYPE_DECL inherits from. This property is matched against the +FULL_NAME of TYPE nodes and thus it is required to have at least one TYPE node +for each TYPE_FULL_NAME */ +public static final String INHERITS_FROM_TYPE_FULL_NAME = "INHERITS_FROM_TYPE_FULL_NAME"; + +/** Specifies whether this is an explicit import. +Most languages have implicit default imports of some standard library elements +and this flag is used to distinguish those from explicit imports found in the +code base. */ +public static final String IS_EXPLICIT = "IS_EXPLICIT"; + +/** Indicates that the construct (METHOD or TYPE_DECL) is external, that is, +it is referenced but not defined in the code (applies both to insular +parsing and to library functions where we have header files only) */ +public static final String IS_EXTERNAL = "IS_EXTERNAL"; + +/** Specifies whether a parameter is the variadic argument handling parameter of +a variadic method. Only one parameter of a method is allowed to have this +property set to true. */ +public static final String IS_VARIADIC = "IS_VARIADIC"; + +/** Specifies whether this is a wildcard import. +For a Java import like "import java.nio.*;" IS_WILDCARD would be "true" and +IMPORTED_ENTITY would be "java.nio". +For wildcard imports the IMPORTED_AS property is ignored. */ +public static final String IS_WILDCARD = "IS_WILDCARD"; + +/** This property denotes a key of a key-value pair. */ +public static final String KEY = "KEY"; + +/** This field indicates which CPG language frontend generated the CPG. +Frontend developers may freely choose a value that describes their frontend +so long as it is not used by an existing frontend. Reserved values are to date: +C, LLVM, GHIDRA, PHP. */ +public static final String LANGUAGE = "LANGUAGE"; + +/** This optional field provides the line number of the program construct +represented by the node. */ +public static final String LINE_NUMBER = "LINE_NUMBER"; + +/** This optional fields provides the line number at which the program construct +represented by the node ends. */ +public static final String LINE_NUMBER_END = "LINE_NUMBER_END"; + +/** The FULL_NAME of a method. Used to link CALL and METHOD nodes. It is required +to have exactly one METHOD node for each METHOD_FULL_NAME */ +public static final String METHOD_FULL_NAME = "METHOD_FULL_NAME"; + + +public static final String METHOD_SHORT_NAME = "METHOD_SHORT_NAME"; + +/** The modifier type is a free-form string. The following are known modifier types: +`STATIC`, `PUBLIC`, `PROTECTED`, `PRIVATE`, `ABSTRACT`, `NATIVE`, `CONSTRUCTOR`, `VIRTUAL`. */ +public static final String MODIFIER_TYPE = "MODIFIER_TYPE"; + + +public static final String MYPROPERTY = "MYPROPERTY"; + +/** Name of represented object, e.g., method name (e.g. "run") */ +public static final String NAME = "NAME"; + + +public static final String NODE_LABEL = "NODE_LABEL"; + +/** This integer indicates the position of the node among +its siblings in the AST. The left-most child has an +order of 0. */ +public static final String ORDER = "ORDER"; + +/** The field contains the names of the overlays applied to this CPG, in order of their +application. Names are free-form strings, that is, this specification does not +dictate them but rather requires tool producers and consumers to communicate them +between each other. */ +public static final String OVERLAYS = "OVERLAYS"; + + +public static final String PACKAGE_NAME = "PACKAGE_NAME"; + +/** AST node type name emitted by parser. */ +public static final String PARSER_TYPE_NAME = "PARSER_TYPE_NAME"; + +/** The path to the root directory of the source/binary this CPG is generated from. */ +public static final String ROOT = "ROOT"; + +/** The method signature encodes the types of parameters in a string. +The string SHOULD be human readable and suitable for differentiating methods +with different parameter types sufficiently to allow for resolving of +function overloading. The present specification does not enforce a strict +format for the signature, that is, it can be chosen by the frontend +implementor to fit the source language. */ +public static final String SIGNATURE = "SIGNATURE"; + + +public static final String SYMBOL = "SYMBOL"; + +/** The static type decl of a TYPE. This property is matched against the FULL_NAME +of TYPE_DECL nodes. It is required to have exactly one TYPE_DECL for each +different TYPE_DECL_FULL_NAME */ +public static final String TYPE_DECL_FULL_NAME = "TYPE_DECL_FULL_NAME"; + +/** This field contains the fully-qualified static type name of the program +construct represented by a node. It is the name of an instantiated type, e.g., +`java.util.List`, rather than `java.util.List[T]`. If the type +cannot be determined, this field should be set to the empty string. */ +public static final String TYPE_FULL_NAME = "TYPE_FULL_NAME"; + +/** This property denotes a string value as used in a key-value pair. */ +public static final String VALUE = "VALUE"; + +/** This edge property represents the variable propagated by a reaching definition edge. */ +public static final String VARIABLE = "VARIABLE"; + +/** A version, given as a string. Used, for example, in the META_DATA node to +indicate which version of the CPG spec this CPG conforms to */ +public static final String VERSION = "VERSION"; + + +public static Set ALL = new HashSet() {{ +add(ALIAS_TYPE_FULL_NAME); +add(ARGUMENT_INDEX); +add(ARGUMENT_NAME); +add(AST_PARENT_FULL_NAME); +add(AST_PARENT_TYPE); +add(CANONICAL_NAME); +add(CLASS_NAME); +add(CLASS_SHORT_NAME); +add(CLOSURE_BINDING_ID); +add(CLOSURE_ORIGINAL_NAME); +add(CODE); +add(COLUMN_NUMBER); +add(COLUMN_NUMBER_END); +add(CONTAINED_REF); +add(CONTENT); +add(CONTROL_STRUCTURE_TYPE); +add(DEPENDENCY_GROUP_ID); +add(DISPATCH_TYPE); +add(DYNAMIC_TYPE_HINT_FULL_NAME); +add(EVALUATION_STRATEGY); +add(EXPLICIT_AS); +add(FILENAME); +add(FULL_NAME); +add(HASH); +add(IMPORTED_AS); +add(IMPORTED_ENTITY); +add(INDEX); +add(INHERITS_FROM_TYPE_FULL_NAME); +add(IS_EXPLICIT); +add(IS_EXTERNAL); +add(IS_VARIADIC); +add(IS_WILDCARD); +add(KEY); +add(LANGUAGE); +add(LINE_NUMBER); +add(LINE_NUMBER_END); +add(METHOD_FULL_NAME); +add(METHOD_SHORT_NAME); +add(MODIFIER_TYPE); +add(MYPROPERTY); +add(NAME); +add(NODE_LABEL); +add(ORDER); +add(OVERLAYS); +add(PACKAGE_NAME); +add(PARSER_TYPE_NAME); +add(ROOT); +add(SIGNATURE); +add(SYMBOL); +add(TYPE_DECL_FULL_NAME); +add(TYPE_FULL_NAME); +add(VALUE); +add(VARIABLE); +add(VERSION); +}}; + +} \ No newline at end of file diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/AliasOf.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/AliasOf.scala new file mode 100644 index 0000000..5aaa667 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/AliasOf.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object AliasOf { + val Label = "ALIAS_OF" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[AliasOf] { + override val forLabel = AliasOf.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new AliasOf(graph, outNode, inNode) + } +} + +class AliasOf(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, AliasOf.Label, _outNode, _inNode, AliasOf.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Argument.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Argument.scala new file mode 100644 index 0000000..3edab42 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Argument.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Argument { + val Label = "ARGUMENT" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Argument] { + override val forLabel = Argument.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Argument(graph, outNode, inNode) + } +} + +class Argument(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Argument.Label, _outNode, _inNode, Argument.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ast.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ast.scala new file mode 100644 index 0000000..df48ef3 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ast.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Ast { + val Label = "AST" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Ast] { + override val forLabel = Ast.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Ast(graph, outNode, inNode) + } +} + +class Ast(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Ast.Label, _outNode, _inNode, Ast.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Binds.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Binds.scala new file mode 100644 index 0000000..ffa5f48 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Binds.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Binds { + val Label = "BINDS" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Binds] { + override val forLabel = Binds.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Binds(graph, outNode, inNode) + } +} + +class Binds(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Binds.Label, _outNode, _inNode, Binds.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/BindsTo.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/BindsTo.scala new file mode 100644 index 0000000..14fd66d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/BindsTo.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object BindsTo { + val Label = "BINDS_TO" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[BindsTo] { + override val forLabel = BindsTo.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new BindsTo(graph, outNode, inNode) + } +} + +class BindsTo(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, BindsTo.Label, _outNode, _inNode, BindsTo.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Call.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Call.scala new file mode 100644 index 0000000..a67a44b --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Call.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Call { + val Label = "CALL" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Call] { + override val forLabel = Call.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Call(graph, outNode, inNode) + } +} + +class Call(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Call.Label, _outNode, _inNode, Call.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Capture.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Capture.scala new file mode 100644 index 0000000..884b116 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Capture.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Capture { + val Label = "CAPTURE" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Capture] { + override val forLabel = Capture.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Capture(graph, outNode, inNode) + } +} + +class Capture(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Capture.Label, _outNode, _inNode, Capture.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/CapturedBy.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/CapturedBy.scala new file mode 100644 index 0000000..7032966 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/CapturedBy.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object CapturedBy { + val Label = "CAPTURED_BY" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[CapturedBy] { + override val forLabel = CapturedBy.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new CapturedBy(graph, outNode, inNode) + } +} + +class CapturedBy(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, CapturedBy.Label, _outNode, _inNode, CapturedBy.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cdg.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cdg.scala new file mode 100644 index 0000000..80f483c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cdg.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Cdg { + val Label = "CDG" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Cdg] { + override val forLabel = Cdg.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Cdg(graph, outNode, inNode) + } +} + +class Cdg(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Cdg.Label, _outNode, _inNode, Cdg.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cfg.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cfg.scala new file mode 100644 index 0000000..fda3455 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Cfg.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Cfg { + val Label = "CFG" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Cfg] { + override val forLabel = Cfg.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Cfg(graph, outNode, inNode) + } +} + +class Cfg(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Cfg.Label, _outNode, _inNode, Cfg.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Condition.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Condition.scala new file mode 100644 index 0000000..4032455 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Condition.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Condition { + val Label = "CONDITION" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Condition] { + override val forLabel = Condition.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Condition(graph, outNode, inNode) + } +} + +class Condition(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Condition.Label, _outNode, _inNode, Condition.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Contains.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Contains.scala new file mode 100644 index 0000000..3021609 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Contains.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Contains { + val Label = "CONTAINS" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Contains] { + override val forLabel = Contains.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Contains(graph, outNode, inNode) + } +} + +class Contains(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Contains.Label, _outNode, _inNode, Contains.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Dominate.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Dominate.scala new file mode 100644 index 0000000..7faa686 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Dominate.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Dominate { + val Label = "DOMINATE" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Dominate] { + override val forLabel = Dominate.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Dominate(graph, outNode, inNode) + } +} + +class Dominate(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Dominate.Label, _outNode, _inNode, Dominate.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/EvalType.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/EvalType.scala new file mode 100644 index 0000000..814aabf --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/EvalType.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object EvalType { + val Label = "EVAL_TYPE" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[EvalType] { + override val forLabel = EvalType.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new EvalType(graph, outNode, inNode) + } +} + +class EvalType(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, EvalType.Label, _outNode, _inNode, EvalType.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Imports.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Imports.scala new file mode 100644 index 0000000..08bef1d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Imports.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Imports { + val Label = "IMPORTS" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Imports] { + override val forLabel = Imports.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Imports(graph, outNode, inNode) + } +} + +class Imports(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Imports.Label, _outNode, _inNode, Imports.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/InheritsFrom.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/InheritsFrom.scala new file mode 100644 index 0000000..79dbe1d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/InheritsFrom.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object InheritsFrom { + val Label = "INHERITS_FROM" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[InheritsFrom] { + override val forLabel = InheritsFrom.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new InheritsFrom(graph, outNode, inNode) + } +} + +class InheritsFrom(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, InheritsFrom.Label, _outNode, _inNode, InheritsFrom.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/IsCallForImport.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/IsCallForImport.scala new file mode 100644 index 0000000..5792580 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/IsCallForImport.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object IsCallForImport { + val Label = "IS_CALL_FOR_IMPORT" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[IsCallForImport] { + override val forLabel = IsCallForImport.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new IsCallForImport(graph, outNode, inNode) + } +} + +class IsCallForImport(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, IsCallForImport.Label, _outNode, _inNode, IsCallForImport.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ParameterLink.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ParameterLink.scala new file mode 100644 index 0000000..ad5e452 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ParameterLink.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ParameterLink { + val Label = "PARAMETER_LINK" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[ParameterLink] { + override val forLabel = ParameterLink.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new ParameterLink(graph, outNode, inNode) + } +} + +class ParameterLink(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, ParameterLink.Label, _outNode, _inNode, ParameterLink.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PointsTo.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PointsTo.scala new file mode 100644 index 0000000..f7ca3be --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PointsTo.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object PointsTo { + val Label = "POINTS_TO" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[PointsTo] { + override val forLabel = PointsTo.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new PointsTo(graph, outNode, inNode) + } +} + +class PointsTo(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, PointsTo.Label, _outNode, _inNode, PointsTo.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PostDominate.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PostDominate.scala new file mode 100644 index 0000000..0e81d92 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/PostDominate.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object PostDominate { + val Label = "POST_DOMINATE" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[PostDominate] { + override val forLabel = PostDominate.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new PostDominate(graph, outNode, inNode) + } +} + +class PostDominate(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, PostDominate.Label, _outNode, _inNode, PostDominate.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ReachingDef.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ReachingDef.scala new file mode 100644 index 0000000..3956764 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/ReachingDef.scala @@ -0,0 +1,44 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ReachingDef { + val Label = "REACHING_DEF" + + object PropertyNames { + val Variable = "VARIABLE" + val all: Set[String] = Set(Variable) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Variable = new overflowdb.PropertyKey[String]("VARIABLE") + } + + object PropertyDefaults { + val Variable = "" + } + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[ReachingDef] { + override val forLabel = ReachingDef.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new ReachingDef(graph, outNode, inNode) + } +} + +class ReachingDef(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, ReachingDef.Label, _outNode, _inNode, ReachingDef.PropertyNames.allAsJava) { + + def variable: String = property("VARIABLE").asInstanceOf[String] + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "VARIABLE" => ReachingDef.PropertyDefaults.Variable + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Receiver.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Receiver.scala new file mode 100644 index 0000000..98e80fd --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Receiver.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Receiver { + val Label = "RECEIVER" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Receiver] { + override val forLabel = Receiver.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Receiver(graph, outNode, inNode) + } +} + +class Receiver(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Receiver.Label, _outNode, _inNode, Receiver.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ref.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ref.scala new file mode 100644 index 0000000..9ca3991 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/Ref.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Ref { + val Label = "REF" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[Ref] { + override val forLabel = Ref.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new Ref(graph, outNode, inNode) + } +} + +class Ref(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, Ref.Label, _outNode, _inNode, Ref.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/SourceFile.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/SourceFile.scala new file mode 100644 index 0000000..b76b0f5 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/SourceFile.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object SourceFile { + val Label = "SOURCE_FILE" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[SourceFile] { + override val forLabel = SourceFile.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new SourceFile(graph, outNode, inNode) + } +} + +class SourceFile(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, SourceFile.Label, _outNode, _inNode, SourceFile.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/TaggedBy.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/TaggedBy.scala new file mode 100644 index 0000000..abde0b9 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/TaggedBy.scala @@ -0,0 +1,38 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TaggedBy { + val Label = "TAGGED_BY" + + object PropertyNames { + + val all: Set[String] = Set() + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties {} + + object PropertyDefaults {} + + val layoutInformation = new EdgeLayoutInformation(Label, PropertyNames.allAsJava) + + val factory = new EdgeFactory[TaggedBy] { + override val forLabel = TaggedBy.Label + + override def createEdge(graph: Graph, outNode: NodeRef[NodeDb], inNode: NodeRef[NodeDb]) = + new TaggedBy(graph, outNode, inNode) + } +} + +class TaggedBy(_graph: Graph, _outNode: NodeRef[NodeDb], _inNode: NodeRef[NodeDb]) + extends Edge(_graph, TaggedBy.Label, _outNode, _inNode, TaggedBy.PropertyNames.allAsJava) { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/package.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/package.scala new file mode 100644 index 0000000..fce5b83 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/edges/package.scala @@ -0,0 +1,47 @@ +package io.shiftleft.codepropertygraph.generated.edges + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object PropertyErrorRegister { + private var errorMap = Set[(Class[_], String)]() + private val logger = org.slf4j.LoggerFactory.getLogger(getClass) + + def logPropertyErrorIfFirst(clazz: Class[_], propertyName: String): Unit = { + if (!errorMap.contains((clazz, propertyName))) { + logger.warn("Property " + propertyName + " is deprecated for " + clazz.getName + ".") + errorMap += ((clazz, propertyName)) + } + } +} + +object Factories { + lazy val all: Seq[EdgeFactory[_]] = Seq( + AliasOf.factory, + Argument.factory, + Ast.factory, + Binds.factory, + BindsTo.factory, + Call.factory, + Capture.factory, + CapturedBy.factory, + Cdg.factory, + Cfg.factory, + Condition.factory, + Contains.factory, + Dominate.factory, + EvalType.factory, + Imports.factory, + InheritsFrom.factory, + IsCallForImport.factory, + ParameterLink.factory, + PointsTo.factory, + PostDominate.factory, + ReachingDef.factory, + Receiver.factory, + Ref.factory, + SourceFile.factory, + TaggedBy.factory + ) + lazy val allAsJava: java.util.List[EdgeFactory[_]] = all.asJava +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala new file mode 100644 index 0000000..276f1e0 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala @@ -0,0 +1,375 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Annotation { + def apply(graph: Graph, id: Long) = new Annotation(graph, id) + + val Label = "ANNOTATION" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val FullName = "FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, FullName, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val FullName = new overflowdb.PropertyKey[String]("FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val FullName = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ARGUMENT", "AST", "POINTS_TO") + val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[AnnotationDb] { + override val forLabel = Annotation.Label + + override def createNode(ref: NodeRef[AnnotationDb]) = + new AnnotationDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Annotation(graph, id) + } +} + +trait AnnotationBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def fullName: String + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class Annotation(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[AnnotationDb](graph_4762, id_4762) + with AnnotationBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def fullName: String = get().fullName + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Annotation.PropertyDefaults.ArgumentIndex + case "CODE" => Annotation.PropertyDefaults.Code + case "FULL_NAME" => Annotation.PropertyDefaults.FullName + case "NAME" => Annotation.PropertyDefaults.Name + case "ORDER" => Annotation.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[AnnotationParameterAssign] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST OUT edge. + */ + def _annotationParameterAssignViaAstOut: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + get()._annotationParameterAssignViaAstOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST IN edge. + */ + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + get()._annotationParameterAssignViaAstIn + + /** Traverse to MEMBER via AST IN edge. + */ + def _memberViaAstIn: overflowdb.traversal.Traversal[Member] = get()._memberViaAstIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: overflowdb.traversal.Traversal[Method] = get()._methodViaAstIn + + /** Traverse to METHOD_PARAMETER_IN via AST IN edge. + */ + def _methodParameterInViaAstIn: overflowdb.traversal.Traversal[MethodParameterIn] = get()._methodParameterInViaAstIn + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Annotation.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "fullName" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => fullName + case 6 => lineNumber + case 7 => name + case 8 => order + } + + override def productPrefix = "Annotation" + override def productArity = 9 +} + +class AnnotationDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with AnnotationBase { + + override def layoutInformation: NodeLayoutInformation = Annotation.layoutInformation + + private var _argumentIndex: scala.Int = Annotation.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Annotation.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _fullName: String = Annotation.PropertyDefaults.FullName + def fullName: String = _fullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = Annotation.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Annotation.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("FULL_NAME", fullName) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == fullName)) { properties.put("FULL_NAME", fullName) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[AnnotationParameterAssign] = + createAdjacentNodeScalaIteratorByOffSet[AnnotationParameterAssign](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _annotationParameterAssignViaAstOut: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + astOut.collectAll[AnnotationParameterAssign] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + astIn.collectAll[AnnotationParameterAssign] + def _memberViaAstIn: overflowdb.traversal.Traversal[Member] = astIn.collectAll[Member] + def _methodViaAstIn: overflowdb.traversal.Traversal[Method] = astIn.collectAll[Method] + def _methodParameterInViaAstIn: overflowdb.traversal.Traversal[MethodParameterIn] = + astIn.collectAll[MethodParameterIn] + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = astIn.collectAll[TypeDecl] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](6) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + override def label: String = { + Annotation.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "fullName" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => fullName + case 6 => lineNumber + case 7 => name + case 8 => order + } + + override def productPrefix = "Annotation" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[AnnotationDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "FULL_NAME" => this._fullName + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "FULL_NAME" => this._fullName = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewAnnotation].argumentIndex + this._argumentName = newNode.asInstanceOf[NewAnnotation].argumentName.orNull + this._code = newNode.asInstanceOf[NewAnnotation].code + this._columnNumber = newNode.asInstanceOf[NewAnnotation].columnNumber.orNull + this._fullName = newNode.asInstanceOf[NewAnnotation].fullName + this._lineNumber = newNode.asInstanceOf[NewAnnotation].lineNumber.orNull + this._name = newNode.asInstanceOf[NewAnnotation].name + this._order = newNode.asInstanceOf[NewAnnotation].order + + graph.indexManager.putIfIndexed("FULL_NAME", newNode.asInstanceOf[NewAnnotation].fullName, this.ref) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala new file mode 100644 index 0000000..a7c9e09 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala @@ -0,0 +1,325 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object AnnotationLiteral { + def apply(graph: Graph, id: Long) = new AnnotationLiteral(graph, id) + + val Label = "ANNOTATION_LITERAL" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ARGUMENT", "POINTS_TO") + val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[AnnotationLiteralDb] { + override val forLabel = AnnotationLiteral.Label + + override def createNode(ref: NodeRef[AnnotationLiteralDb]) = + new AnnotationLiteralDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = AnnotationLiteral(graph, id) + } +} + +trait AnnotationLiteralBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class AnnotationLiteral(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[AnnotationLiteralDb](graph_4762, id_4762) + with AnnotationLiteralBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => AnnotationLiteral.PropertyDefaults.ArgumentIndex + case "CODE" => AnnotationLiteral.PropertyDefaults.Code + case "NAME" => AnnotationLiteral.PropertyDefaults.Name + case "ORDER" => AnnotationLiteral.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST IN edge. + */ + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + get()._annotationParameterAssignViaAstIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + AnnotationLiteral.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "AnnotationLiteral" + override def productArity = 8 +} + +class AnnotationLiteralDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with Expression + with AnnotationLiteralBase { + + override def layoutInformation: NodeLayoutInformation = AnnotationLiteral.layoutInformation + + private var _argumentIndex: scala.Int = AnnotationLiteral.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = AnnotationLiteral.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = AnnotationLiteral.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = AnnotationLiteral.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](2) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + astIn.collectAll[AnnotationParameterAssign] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](5) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + override def label: String = { + AnnotationLiteral.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "AnnotationLiteral" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[AnnotationLiteralDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewAnnotationLiteral].argumentIndex + this._argumentName = newNode.asInstanceOf[NewAnnotationLiteral].argumentName.orNull + this._code = newNode.asInstanceOf[NewAnnotationLiteral].code + this._columnNumber = newNode.asInstanceOf[NewAnnotationLiteral].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewAnnotationLiteral].lineNumber.orNull + this._name = newNode.asInstanceOf[NewAnnotationLiteral].name + this._order = newNode.asInstanceOf[NewAnnotationLiteral].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala new file mode 100644 index 0000000..f8cc439 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala @@ -0,0 +1,238 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object AnnotationParameter { + def apply(graph: Graph, id: Long) = new AnnotationParameter(graph, id) + + val Label = "ANNOTATION_PARAMETER" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[AnnotationParameterDb] { + override val forLabel = AnnotationParameter.Label + + override def createNode(ref: NodeRef[AnnotationParameterDb]) = + new AnnotationParameterDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = AnnotationParameter(graph, id) + } +} + +trait AnnotationParameterBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class AnnotationParameter(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[AnnotationParameterDb](graph_4762, id_4762) + with AnnotationParameterBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => AnnotationParameter.PropertyDefaults.Code + case "ORDER" => AnnotationParameter.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astIn: Iterator[AnnotationParameterAssign] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST IN edge. + */ + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + get()._annotationParameterAssignViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + AnnotationParameter.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "AnnotationParameter" + override def productArity = 5 +} + +class AnnotationParameterDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with AnnotationParameterBase { + + override def layoutInformation: NodeLayoutInformation = AnnotationParameter.layoutInformation + + private var _code: String = AnnotationParameter.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = AnnotationParameter.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astIn: Iterator[AnnotationParameterAssign] = createAdjacentNodeScalaIteratorByOffSet[AnnotationParameterAssign](0) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + astIn.collectAll[AnnotationParameterAssign] + + override def label: String = { + AnnotationParameter.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "AnnotationParameter" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[AnnotationParameterDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewAnnotationParameter].code + this._columnNumber = newNode.asInstanceOf[NewAnnotationParameter].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewAnnotationParameter].lineNumber.orNull + this._order = newNode.asInstanceOf[NewAnnotationParameter].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala new file mode 100644 index 0000000..63d0b3d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala @@ -0,0 +1,265 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object AnnotationParameterAssign { + def apply(graph: Graph, id: Long) = new AnnotationParameterAssign(graph, id) + + val Label = "ANNOTATION_PARAMETER_ASSIGN" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST") + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[AnnotationParameterAssignDb] { + override val forLabel = AnnotationParameterAssign.Label + + override def createNode(ref: NodeRef[AnnotationParameterAssignDb]) = + new AnnotationParameterAssignDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = AnnotationParameterAssign(graph, id) + } +} + +trait AnnotationParameterAssignBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class AnnotationParameterAssign(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[AnnotationParameterAssignDb](graph_4762, id_4762) + with AnnotationParameterAssignBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => AnnotationParameterAssign.PropertyDefaults.Code + case "ORDER" => AnnotationParameterAssign.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION via AST OUT edge. + */ + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstOut + + /** Traverse to ANNOTATION_LITERAL via AST OUT edge. + */ + def _annotationLiteralViaAstOut: overflowdb.traversal.Traversal[AnnotationLiteral] = get()._annotationLiteralViaAstOut + + /** Traverse to ANNOTATION_PARAMETER via AST OUT edge. + */ + def _annotationParameterViaAstOut: overflowdb.traversal.Traversal[AnnotationParameter] = + get()._annotationParameterViaAstOut + + /** Traverse to ARRAY_INITIALIZER via AST OUT edge. + */ + def _arrayInitializerViaAstOut: overflowdb.traversal.Traversal[ArrayInitializer] = get()._arrayInitializerViaAstOut + + def astIn: Iterator[Annotation] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ANNOTATION via AST IN edge. + */ + def _annotationViaAstIn: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + AnnotationParameterAssign.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "AnnotationParameterAssign" + override def productArity = 5 +} + +class AnnotationParameterAssignDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with AnnotationParameterAssignBase { + + override def layoutInformation: NodeLayoutInformation = AnnotationParameterAssign.layoutInformation + + private var _code: String = AnnotationParameterAssign.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = AnnotationParameterAssign.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = astOut.collectAll[Annotation] + def _annotationLiteralViaAstOut: overflowdb.traversal.Traversal[AnnotationLiteral] = + astOut.collectAll[AnnotationLiteral] + def _annotationParameterViaAstOut: overflowdb.traversal.Traversal[AnnotationParameter] = + astOut.collectAll[AnnotationParameter] + def _arrayInitializerViaAstOut: overflowdb.traversal.Traversal[ArrayInitializer] = astOut.collectAll[ArrayInitializer] + + def astIn: Iterator[Annotation] = createAdjacentNodeScalaIteratorByOffSet[Annotation](1) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _annotationViaAstIn: overflowdb.traversal.Traversal[Annotation] = astIn.collectAll[Annotation] + + override def label: String = { + AnnotationParameterAssign.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "AnnotationParameterAssign" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[AnnotationParameterAssignDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewAnnotationParameterAssign].code + this._columnNumber = newNode.asInstanceOf[NewAnnotationParameterAssign].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewAnnotationParameterAssign].lineNumber.orNull + this._order = newNode.asInstanceOf[NewAnnotationParameterAssign].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala new file mode 100644 index 0000000..24a060c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala @@ -0,0 +1,334 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ArrayInitializer { + def apply(graph: Graph, id: Long) = new ArrayInitializer(graph, id) + + val Label = "ARRAY_INITIALIZER" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ARGUMENT", "AST", "EVAL_TYPE", "POINTS_TO") + val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[ArrayInitializerDb] { + override val forLabel = ArrayInitializer.Label + + override def createNode(ref: NodeRef[ArrayInitializerDb]) = + new ArrayInitializerDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = ArrayInitializer(graph, id) + } +} + +trait ArrayInitializerBase extends AbstractNode with AstNodeBase with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class ArrayInitializer(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ArrayInitializerDb](graph_4762, id_4762) + with ArrayInitializerBase + with StoredNode + with AstNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => ArrayInitializer.PropertyDefaults.ArgumentIndex + case "CODE" => ArrayInitializer.PropertyDefaults.Code + case "ORDER" => ArrayInitializer.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[Literal] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST IN edge. + */ + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + get()._annotationParameterAssignViaAstIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + ArrayInitializer.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => order + } + + override def productPrefix = "ArrayInitializer" + override def productArity = 7 +} + +class ArrayInitializerDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with Expression + with ArrayInitializerBase { + + override def layoutInformation: NodeLayoutInformation = ArrayInitializer.layoutInformation + + private var _argumentIndex: scala.Int = ArrayInitializer.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = ArrayInitializer.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = ArrayInitializer.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[Literal] = createAdjacentNodeScalaIteratorByOffSet[Literal](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](2) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](4) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] = + astIn.collectAll[AnnotationParameterAssign] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](7) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + + override def label: String = { + ArrayInitializer.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => order + } + + override def productPrefix = "ArrayInitializer" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ArrayInitializerDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewArrayInitializer].argumentIndex + this._argumentName = newNode.asInstanceOf[NewArrayInitializer].argumentName.orNull + this._code = newNode.asInstanceOf[NewArrayInitializer].code + this._columnNumber = newNode.asInstanceOf[NewArrayInitializer].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewArrayInitializer].lineNumber.orNull + this._order = newNode.asInstanceOf[NewArrayInitializer].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AstNode.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AstNode.scala new file mode 100644 index 0000000..a6e4fc5 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AstNode.scala @@ -0,0 +1,52 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +object AstNode { + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order) + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + +} + +trait AstNodeBase extends AbstractNode { + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait AstNodeNew extends NewNode { + def code_=(value: String): Unit + def columnNumber_=(value: Option[Integer]): Unit + def lineNumber_=(value: Option[Integer]): Unit + def order_=(value: scala.Int): Unit + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait AstNode extends StoredNode with AstNodeBase { + import overflowdb.traversal._ + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala new file mode 100644 index 0000000..dc4eeb6 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala @@ -0,0 +1,243 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Binding { + def apply(graph: Graph, id: Long) = new Binding(graph, id) + + val Label = "BINDING" + + object PropertyNames { + val MethodFullName = "METHOD_FULL_NAME" + val Name = "NAME" + val Signature = "SIGNATURE" + val all: Set[String] = Set(MethodFullName, Name, Signature) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val MethodFullName = new overflowdb.PropertyKey[String]("METHOD_FULL_NAME") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Signature = new overflowdb.PropertyKey[String]("SIGNATURE") + + } + + object PropertyDefaults { + val MethodFullName = "" + val Name = "" + val Signature = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation).asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Binds.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array("REF") + val In: Array[String] = Array("BINDS") + } + + val factory = new NodeFactory[BindingDb] { + override val forLabel = Binding.Label + + override def createNode(ref: NodeRef[BindingDb]) = + new BindingDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Binding(graph, id) + } +} + +trait BindingBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def methodFullName: String + def name: String + def signature: String + +} + +class Binding(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[BindingDb](graph_4762, id_4762) + with BindingBase + with StoredNode { + override def methodFullName: String = get().methodFullName + override def name: String = get().name + override def signature: String = get().signature + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "METHOD_FULL_NAME" => Binding.PropertyDefaults.MethodFullName + case "NAME" => Binding.PropertyDefaults.Name + case "SIGNATURE" => Binding.PropertyDefaults.Signature + case _ => super.propertyDefaultValue(propertyKey) + } + + def refOut: Iterator[Method] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to METHOD via REF OUT edge. + */ + def boundMethod: Method = get().boundMethod + + def bindsIn: Iterator[TypeDecl] = get().bindsIn + override def _bindsIn = get()._bindsIn + + /** Traverse to TYPE_DECL via BINDS IN edge. + */ + def bindingTypeDecl: TypeDecl = get().bindingTypeDecl + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Binding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "methodFullName" + case 2 => "name" + case 3 => "signature" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => methodFullName + case 2 => name + case 3 => signature + } + + override def productPrefix = "Binding" + override def productArity = 4 +} + +class BindingDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with BindingBase { + + override def layoutInformation: NodeLayoutInformation = Binding.layoutInformation + + private var _methodFullName: String = Binding.PropertyDefaults.MethodFullName + def methodFullName: String = _methodFullName + private var _name: String = Binding.PropertyDefaults.Name + def name: String = _name + private var _signature: String = Binding.PropertyDefaults.Signature + def signature: String = _signature + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("METHOD_FULL_NAME", methodFullName) + properties.put("NAME", name) + properties.put("SIGNATURE", signature) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == methodFullName)) { properties.put("METHOD_FULL_NAME", methodFullName) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!(("") == signature)) { properties.put("SIGNATURE", signature) } + + properties + } + + import overflowdb.traversal._ + def refOut: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](0) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def boundMethod: Method = try { refOut.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label REF to an adjacent METHOD is mandatory, but not defined for this BINDING node with id=" + id, + e + ) + } + + def bindsIn: Iterator[TypeDecl] = createAdjacentNodeScalaIteratorByOffSet[TypeDecl](1) + override def _bindsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def bindingTypeDecl: TypeDecl = try { bindsIn.collectAll[TypeDecl].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label BINDS to an adjacent TYPE_DECL is mandatory, but not defined for this BINDING node with id=" + id, + e + ) + } + + override def label: String = { + Binding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "methodFullName" + case 2 => "name" + case 3 => "signature" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => methodFullName + case 2 => name + case 3 => signature + } + + override def productPrefix = "Binding" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[BindingDb] + + override def property(key: String): Any = { + key match { + case "METHOD_FULL_NAME" => this._methodFullName + case "NAME" => this._name + case "SIGNATURE" => this._signature + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "METHOD_FULL_NAME" => this._methodFullName = value.asInstanceOf[String] + case "NAME" => this._name = value.asInstanceOf[String] + case "SIGNATURE" => this._signature = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._methodFullName = newNode.asInstanceOf[NewBinding].methodFullName + this._name = newNode.asInstanceOf[NewBinding].name + this._signature = newNode.asInstanceOf[NewBinding].signature + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala new file mode 100644 index 0000000..0959cc7 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala @@ -0,0 +1,1050 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Block { + def apply(graph: Graph, id: Long) = new Block(graph, id) + + val Label = "BLOCK" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[BlockDb] { + override val forLabel = Block.Label + + override def createNode(ref: NodeRef[BlockDb]) = + new BlockDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Block(graph, id) + } +} + +trait BlockBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def order: scala.Int + def typeFullName: String + +} + +class Block(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[BlockDb](graph_4762, id_4762) + with BlockBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Block.PropertyDefaults.ArgumentIndex + case "CODE" => Block.PropertyDefaults.Code + case "ORDER" => Block.PropertyDefaults.Order + case "TYPE_FULL_NAME" => Block.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to BLOCK via AST OUT edge. + */ + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = get()._blockViaAstOut + + /** Traverse to CALL via AST OUT edge. + */ + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = get()._callViaAstOut + + /** Traverse to CONTROL_STRUCTURE via AST OUT edge. + */ + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstOut + + /** Traverse to IDENTIFIER via AST OUT edge. + */ + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaAstOut + + /** Traverse to IMPORT via AST OUT edge. + */ + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = get()._importViaAstOut + + /** Traverse to JUMP_TARGET via AST OUT edge. + */ + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaAstOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + /** Traverse to LOCAL via AST OUT edge. + */ + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = get()._localViaAstOut + + /** Traverse to locals of this block. Traverse to LOCAL via AST OUT edge. + */ + /** Traverse to locals of this block. */ + @overflowdb.traversal.help.Doc(info = """Traverse to locals of this block.""") + def local: overflowdb.traversal.Traversal[Local] = get().local + + /** Traverse to METHOD_REF via AST OUT edge. + */ + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaAstOut + + /** Traverse to RETURN via AST OUT edge. + */ + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = get()._returnViaAstOut + + /** Traverse to TYPE_REF via AST OUT edge. + */ + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaAstOut + + /** Traverse to UNKNOWN via AST OUT edge. + */ + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to BLOCK via REACHING_DEF OUT edge. + */ + def _blockViaReachingDefOut: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Option[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[CfgNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: Block = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: Option[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Method = get()._methodViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[Expression] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: Option[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Block.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Block" + override def productArity = 9 +} + +class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with BlockBase { + + override def layoutInformation: NodeLayoutInformation = Block.layoutInformation + + private var _argumentIndex: scala.Int = Block.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Block.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Block.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = Block.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = astOut.collectAll[Block] + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = astOut.collectAll[Call] + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = astOut.collectAll[ControlStructure] + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = astOut.collectAll[Identifier] + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = astOut.collectAll[Import] + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = astOut.collectAll[JumpTarget] + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = astOut.collectAll[Local] + def local: overflowdb.traversal.Traversal[Local] = astOut.collectAll[Local] + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = astOut.collectAll[MethodRef] + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = astOut.collectAll[Return] + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = astOut.collectAll[TypeRef] + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = astOut.collectAll[Unknown] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](5) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _blockViaReachingDefOut: overflowdb.traversal.Traversal[Block] = reachingDefOut.collectAll[Block] + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](9) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](10) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _callViaArgumentIn: Option[Call] = argumentIn.collectAll[Call].nextOption() + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](11) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaAstIn: Block = try { astIn.collectAll[Block].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent BLOCK is mandatory, but not defined for this BLOCK node with id=" + id, + e + ) + } + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: Option[ControlStructure] = astIn.collectAll[ControlStructure].nextOption() + def _methodViaAstIn: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this BLOCK node with id=" + id, + e + ) + } + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](14) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](15) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](19) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](20) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _callViaReceiverIn: Option[Call] = receiverIn.collectAll[Call].nextOption() + + override def label: String = { + Block.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Block" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[BlockDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewBlock].argumentIndex + this._argumentName = newNode.asInstanceOf[NewBlock].argumentName.orNull + this._code = newNode.asInstanceOf[NewBlock].code + this._columnNumber = newNode.asInstanceOf[NewBlock].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewBlock].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewBlock].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewBlock].lineNumber.orNull + this._order = newNode.asInstanceOf[NewBlock].order + this._typeFullName = newNode.asInstanceOf[NewBlock].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala new file mode 100644 index 0000000..8dcfa1e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala @@ -0,0 +1,1293 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Call { + def apply(graph: Graph, id: Long) = new Call(graph, id) + + val Label = "CALL" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DispatchType = "DISPATCH_TYPE" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val MethodFullName = "METHOD_FULL_NAME" + val Name = "NAME" + val Order = "ORDER" + val Signature = "SIGNATURE" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set( + ArgumentIndex, + ArgumentName, + Code, + ColumnNumber, + DispatchType, + DynamicTypeHintFullName, + LineNumber, + MethodFullName, + Name, + Order, + Signature, + TypeFullName + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DispatchType = new overflowdb.PropertyKey[String]("DISPATCH_TYPE") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val MethodFullName = new overflowdb.PropertyKey[String]("METHOD_FULL_NAME") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val Signature = new overflowdb.PropertyKey[String]("SIGNATURE") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val DispatchType = "" + val MethodFullName = "" + val Name = "" + val Order = -1: Int + val Signature = "" + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Call.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.IsCallForImport.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "AST", + "CALL", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "IS_CALL_FOR_IMPORT", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER", + "REF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[CallDb] { + override val forLabel = Call.Label + + override def createNode(ref: NodeRef[CallDb]) = + new CallDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Call(graph, id) + } +} + +trait CallBase extends AbstractNode with CallReprBase with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dispatchType: String + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def methodFullName: String + def name: String + def order: scala.Int + def signature: String + def typeFullName: String + +} + +class Call(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[CallDb](graph_4762, id_4762) + with CallBase + with StoredNode + with CallRepr + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dispatchType: String = get().dispatchType + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def methodFullName: String = get().methodFullName + override def name: String = get().name + override def order: scala.Int = get().order + override def signature: String = get().signature + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Call.PropertyDefaults.ArgumentIndex + case "CODE" => Call.PropertyDefaults.Code + case "DISPATCH_TYPE" => Call.PropertyDefaults.DispatchType + case "METHOD_FULL_NAME" => Call.PropertyDefaults.MethodFullName + case "NAME" => Call.PropertyDefaults.Name + case "ORDER" => Call.PropertyDefaults.Order + case "SIGNATURE" => Call.PropertyDefaults.Signature + case "TYPE_FULL_NAME" => Call.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[CfgNode] = get().argumentOut + override def _argumentOut = get()._argumentOut + + /** Traverse to BLOCK via ARGUMENT OUT edge. + */ + def _blockViaArgumentOut: overflowdb.traversal.Traversal[Block] = get()._blockViaArgumentOut + + /** Traverse to CALL via ARGUMENT OUT edge. + */ + def _callViaArgumentOut: overflowdb.traversal.Traversal[Call] = get()._callViaArgumentOut + + /** Traverse to CONTROL_STRUCTURE via ARGUMENT OUT edge. + */ + def _controlStructureViaArgumentOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaArgumentOut + + /** Traverse to FIELD_IDENTIFIER via ARGUMENT OUT edge. + */ + def _fieldIdentifierViaArgumentOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaArgumentOut + + /** Traverse to IDENTIFIER via ARGUMENT OUT edge. + */ + def _identifierViaArgumentOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaArgumentOut + + /** Traverse to JUMP_TARGET via ARGUMENT OUT edge. + */ + def _jumpTargetViaArgumentOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaArgumentOut + + /** Traverse to LITERAL via ARGUMENT OUT edge. + */ + def _literalViaArgumentOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaArgumentOut + + /** Traverse to METHOD_REF via ARGUMENT OUT edge. + */ + def _methodRefViaArgumentOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaArgumentOut + + /** Traverse to TYPE_REF via ARGUMENT OUT edge. + */ + def _typeRefViaArgumentOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaArgumentOut + + /** Traverse to UNKNOWN via ARGUMENT OUT edge. + */ + def _unknownViaArgumentOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaArgumentOut + + def astOut: Iterator[Expression] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to BLOCK via AST OUT edge. + */ + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = get()._blockViaAstOut + + /** Traverse to CALL via AST OUT edge. + */ + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = get()._callViaAstOut + + /** Traverse to CONTROL_STRUCTURE via AST OUT edge. + */ + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstOut + + /** Traverse to FIELD_IDENTIFIER via AST OUT edge. + */ + def _fieldIdentifierViaAstOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaAstOut + + /** Traverse to IDENTIFIER via AST OUT edge. + */ + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaAstOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + /** Traverse to METHOD_REF via AST OUT edge. + */ + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaAstOut + + /** Traverse to RETURN via AST OUT edge. + */ + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = get()._returnViaAstOut + + /** Traverse to TYPE_REF via AST OUT edge. + */ + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaAstOut + + def callOut: Iterator[Method] = get().callOut + override def _callOut = get()._callOut + + /** Traverse to METHOD via CALL OUT edge. + */ + def _methodViaCallOut: overflowdb.traversal.Traversal[Method] = get()._methodViaCallOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def isCallForImportOut: Iterator[Import] = get().isCallForImportOut + override def _isCallForImportOut = get()._isCallForImportOut + + /** Traverse to IMPORT via IS_CALL_FOR_IMPORT OUT edge. + */ + def _importViaIsCallForImportOut: overflowdb.traversal.Traversal[Import] = get()._importViaIsCallForImportOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def receiverOut: Iterator[Expression] = get().receiverOut + override def _receiverOut = get()._receiverOut + + /** Traverse to BLOCK via RECEIVER OUT edge. + */ + def _blockViaReceiverOut: Option[Block] = get()._blockViaReceiverOut + + /** Traverse to CALL via RECEIVER OUT edge. + */ + def _callViaReceiverOut: Option[Call] = get()._callViaReceiverOut + + /** Traverse to CONTROL_STRUCTURE via RECEIVER OUT edge. + */ + def _controlStructureViaReceiverOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReceiverOut + + /** Traverse to IDENTIFIER via RECEIVER OUT edge. + */ + def _identifierViaReceiverOut: Option[Identifier] = get()._identifierViaReceiverOut + + /** Traverse to LITERAL via RECEIVER OUT edge. + */ + def _literalViaReceiverOut: Option[Literal] = get()._literalViaReceiverOut + + /** Traverse to METHOD_REF via RECEIVER OUT edge. + */ + def _methodRefViaReceiverOut: Option[MethodRef] = get()._methodRefViaReceiverOut + + /** Traverse to TYPE_REF via RECEIVER OUT edge. + */ + def _typeRefViaReceiverOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReceiverOut + + /** Traverse to UNKNOWN via RECEIVER OUT edge. + */ + def _unknownViaReceiverOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReceiverOut + + def refOut: Iterator[Member] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to referenced members Traverse to MEMBER via REF OUT edge. + */ + /** Traverse to referenced members */ + @overflowdb.traversal.help.Doc(info = """Traverse to referenced members""") + def referencedMember: overflowdb.traversal.Traversal[Member] = get().referencedMember + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Option[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: ControlStructure = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: Option[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Call.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dispatchType" + case 6 => "dynamicTypeHintFullName" + case 7 => "lineNumber" + case 8 => "methodFullName" + case 9 => "name" + case 10 => "order" + case 11 => "signature" + case 12 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dispatchType + case 6 => dynamicTypeHintFullName + case 7 => lineNumber + case 8 => methodFullName + case 9 => name + case 10 => order + case 11 => signature + case 12 => typeFullName + } + + override def productPrefix = "Call" + override def productArity = 13 +} + +class CallDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with CallRepr with Expression with CallBase { + + override def layoutInformation: NodeLayoutInformation = Call.layoutInformation + + private var _argumentIndex: scala.Int = Call.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Call.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dispatchType: String = Call.PropertyDefaults.DispatchType + def dispatchType: String = _dispatchType + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _methodFullName: String = Call.PropertyDefaults.MethodFullName + def methodFullName: String = _methodFullName + private var _name: String = Call.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Call.PropertyDefaults.Order + def order: scala.Int = _order + private var _signature: String = Call.PropertyDefaults.Signature + def signature: String = _signature + private var _typeFullName: String = Call.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("DISPATCH_TYPE", dispatchType) + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("METHOD_FULL_NAME", methodFullName) + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("SIGNATURE", signature) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == dispatchType)) { properties.put("DISPATCH_TYPE", dispatchType) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == methodFullName)) { properties.put("METHOD_FULL_NAME", methodFullName) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == signature)) { properties.put("SIGNATURE", signature) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _blockViaArgumentOut: overflowdb.traversal.Traversal[Block] = argumentOut.collectAll[Block] + def _callViaArgumentOut: overflowdb.traversal.Traversal[Call] = argumentOut.collectAll[Call] + def _controlStructureViaArgumentOut: overflowdb.traversal.Traversal[ControlStructure] = + argumentOut.collectAll[ControlStructure] + def _fieldIdentifierViaArgumentOut: overflowdb.traversal.Traversal[FieldIdentifier] = + argumentOut.collectAll[FieldIdentifier] + def _identifierViaArgumentOut: overflowdb.traversal.Traversal[Identifier] = argumentOut.collectAll[Identifier] + def _jumpTargetViaArgumentOut: overflowdb.traversal.Traversal[JumpTarget] = argumentOut.collectAll[JumpTarget] + def _literalViaArgumentOut: overflowdb.traversal.Traversal[Literal] = argumentOut.collectAll[Literal] + def _methodRefViaArgumentOut: overflowdb.traversal.Traversal[MethodRef] = argumentOut.collectAll[MethodRef] + def _typeRefViaArgumentOut: overflowdb.traversal.Traversal[TypeRef] = argumentOut.collectAll[TypeRef] + def _unknownViaArgumentOut: overflowdb.traversal.Traversal[Unknown] = argumentOut.collectAll[Unknown] + + def astOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = astOut.collectAll[Block] + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = astOut.collectAll[Call] + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = astOut.collectAll[ControlStructure] + def _fieldIdentifierViaAstOut: overflowdb.traversal.Traversal[FieldIdentifier] = astOut.collectAll[FieldIdentifier] + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = astOut.collectAll[Identifier] + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = astOut.collectAll[MethodRef] + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = astOut.collectAll[Return] + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = astOut.collectAll[TypeRef] + + def callOut: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](2) + override def _callOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _methodViaCallOut: overflowdb.traversal.Traversal[Method] = callOut.collectAll[Method] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](6) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def isCallForImportOut: Iterator[Import] = createAdjacentNodeScalaIteratorByOffSet[Import](7) + override def _isCallForImportOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _importViaIsCallForImportOut: overflowdb.traversal.Traversal[Import] = isCallForImportOut.collectAll[Import] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](9) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](10) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def receiverOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](11) + override def _receiverOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaReceiverOut: Option[Block] = receiverOut.collectAll[Block].nextOption() + def _callViaReceiverOut: Option[Call] = receiverOut.collectAll[Call].nextOption() + def _controlStructureViaReceiverOut: overflowdb.traversal.Traversal[ControlStructure] = + receiverOut.collectAll[ControlStructure] + def _identifierViaReceiverOut: Option[Identifier] = receiverOut.collectAll[Identifier].nextOption() + def _literalViaReceiverOut: Option[Literal] = receiverOut.collectAll[Literal].nextOption() + def _methodRefViaReceiverOut: Option[MethodRef] = receiverOut.collectAll[MethodRef].nextOption() + def _typeRefViaReceiverOut: overflowdb.traversal.Traversal[TypeRef] = receiverOut.collectAll[TypeRef] + def _unknownViaReceiverOut: overflowdb.traversal.Traversal[Unknown] = receiverOut.collectAll[Unknown] + + def refOut: Iterator[Member] = createAdjacentNodeScalaIteratorByOffSet[Member](12) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def referencedMember: overflowdb.traversal.Traversal[Member] = refOut.collectAll[Member] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](13) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](14) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _callViaArgumentIn: Option[Call] = argumentIn.collectAll[Call].nextOption() + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](15) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: ControlStructure = try { astIn.collectAll[ControlStructure].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent CONTROL_STRUCTURE is mandatory, but not defined for this CALL node with id=" + id, + e + ) + } + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](18) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](19) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](20) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](21) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](21) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](22) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](22) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](23) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](23) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](24) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](24) + def _callViaReceiverIn: Option[Call] = receiverIn.collectAll[Call].nextOption() + + override def label: String = { + Call.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dispatchType" + case 6 => "dynamicTypeHintFullName" + case 7 => "lineNumber" + case 8 => "methodFullName" + case 9 => "name" + case 10 => "order" + case 11 => "signature" + case 12 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dispatchType + case 6 => dynamicTypeHintFullName + case 7 => lineNumber + case 8 => methodFullName + case 9 => name + case 10 => order + case 11 => signature + case 12 => typeFullName + } + + override def productPrefix = "Call" + override def productArity = 13 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[CallDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DISPATCH_TYPE" => this._dispatchType + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "METHOD_FULL_NAME" => this._methodFullName + case "NAME" => this._name + case "ORDER" => this._order + case "SIGNATURE" => this._signature + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DISPATCH_TYPE" => this._dispatchType = value.asInstanceOf[String] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "METHOD_FULL_NAME" => this._methodFullName = value.asInstanceOf[String] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "SIGNATURE" => this._signature = value.asInstanceOf[String] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewCall].argumentIndex + this._argumentName = newNode.asInstanceOf[NewCall].argumentName.orNull + this._code = newNode.asInstanceOf[NewCall].code + this._columnNumber = newNode.asInstanceOf[NewCall].columnNumber.orNull + this._dispatchType = newNode.asInstanceOf[NewCall].dispatchType + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewCall].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewCall].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewCall].lineNumber.orNull + this._methodFullName = newNode.asInstanceOf[NewCall].methodFullName + this._name = newNode.asInstanceOf[NewCall].name + this._order = newNode.asInstanceOf[NewCall].order + this._signature = newNode.asInstanceOf[NewCall].signature + this._typeFullName = newNode.asInstanceOf[NewCall].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CallRepr.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CallRepr.scala new file mode 100644 index 0000000..f48d96c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CallRepr.scala @@ -0,0 +1,64 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +object CallRepr { + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val Signature = "SIGNATURE" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Name, Order, Signature) + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val Signature = new overflowdb.PropertyKey[String]("SIGNATURE") + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + val Signature = "" + } + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + +} + +trait CallReprBase extends AbstractNode with CfgNodeBase { + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def signature: String +} + +trait CallReprNew extends NewNode with CfgNodeNew { + def code_=(value: String): Unit + def columnNumber_=(value: Option[Integer]): Unit + def lineNumber_=(value: Option[Integer]): Unit + def name_=(value: String): Unit + def order_=(value: scala.Int): Unit + def signature_=(value: String): Unit + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def signature: String +} + +trait CallRepr extends StoredNode with CallReprBase with CfgNode { + import overflowdb.traversal._ + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CfgNode.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CfgNode.scala new file mode 100644 index 0000000..d37aa42 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/CfgNode.scala @@ -0,0 +1,368 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +object CfgNode { + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order) + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + object Edges { + val Out: Array[String] = Array("POINTS_TO") + val In: Array[String] = + Array("CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "CFG", "POINTS_TO") + } + +} + +trait CfgNodeBase extends AbstractNode with AstNodeBase { + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait CfgNodeNew extends NewNode with AstNodeNew { + def code_=(value: String): Unit + def columnNumber_=(value: Option[Integer]): Unit + def lineNumber_=(value: Option[Integer]): Unit + def order_=(value: scala.Int): Unit + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait CfgNode extends StoredNode with CfgNodeBase with AstNode { + import overflowdb.traversal._ + def pointsToOut: Iterator[_ <: StoredNode] + + /** Traverse to CALL_REPR via POINTS_TO OUT edge. + */ + def _callReprViaPointsToOut: overflowdb.traversal.Traversal[CallRepr] = + pointsToOut.collectAll[CallRepr] + + /** Traverse to TYPE_REF via POINTS_TO OUT edge. + */ + def _typeRefViaPointsToOut: overflowdb.traversal.Traversal[TypeRef] = + pointsToOut.collectAll[TypeRef] + + /** Traverse to FIELD_IDENTIFIER via POINTS_TO OUT edge. + */ + def _fieldIdentifierViaPointsToOut: overflowdb.traversal.Traversal[FieldIdentifier] = + pointsToOut.collectAll[FieldIdentifier] + + /** Traverse to METHOD_PARAMETER_OUT via POINTS_TO OUT edge. + */ + def _methodParameterOutViaPointsToOut: overflowdb.traversal.Traversal[MethodParameterOut] = + pointsToOut.collectAll[MethodParameterOut] + + /** Traverse to ANNOTATION via POINTS_TO OUT edge. + */ + def _annotationViaPointsToOut: overflowdb.traversal.Traversal[Annotation] = + pointsToOut.collectAll[Annotation] + + /** Traverse to CONTROL_STRUCTURE via POINTS_TO OUT edge. + */ + def _controlStructureViaPointsToOut: overflowdb.traversal.Traversal[ControlStructure] = + pointsToOut.collectAll[ControlStructure] + + /** Traverse to RETURN via POINTS_TO OUT edge. + */ + def _returnViaPointsToOut: overflowdb.traversal.Traversal[Return] = + pointsToOut.collectAll[Return] + + /** Traverse to TEMPLATE_DOM via POINTS_TO OUT edge. + */ + def _templateDomViaPointsToOut: overflowdb.traversal.Traversal[TemplateDom] = + pointsToOut.collectAll[TemplateDom] + + /** Traverse to METHOD_RETURN via POINTS_TO OUT edge. + */ + def _methodReturnViaPointsToOut: overflowdb.traversal.Traversal[MethodReturn] = + pointsToOut.collectAll[MethodReturn] + + /** Traverse to METHOD_REF via POINTS_TO OUT edge. + */ + def _methodRefViaPointsToOut: overflowdb.traversal.Traversal[MethodRef] = + pointsToOut.collectAll[MethodRef] + + /** Traverse to JUMP_TARGET via POINTS_TO OUT edge. + */ + def _jumpTargetViaPointsToOut: overflowdb.traversal.Traversal[JumpTarget] = + pointsToOut.collectAll[JumpTarget] + + /** Traverse to IDENTIFIER via POINTS_TO OUT edge. + */ + def _identifierViaPointsToOut: overflowdb.traversal.Traversal[Identifier] = + pointsToOut.collectAll[Identifier] + + /** Traverse to EXPRESSION via POINTS_TO OUT edge. + */ + def _expressionViaPointsToOut: overflowdb.traversal.Traversal[Expression] = + pointsToOut.collectAll[Expression] + + /** Traverse to METHOD_PARAMETER_IN via POINTS_TO OUT edge. + */ + def _methodParameterInViaPointsToOut: overflowdb.traversal.Traversal[MethodParameterIn] = + pointsToOut.collectAll[MethodParameterIn] + + /** Traverse to ANNOTATION_LITERAL via POINTS_TO OUT edge. + */ + def _annotationLiteralViaPointsToOut: overflowdb.traversal.Traversal[AnnotationLiteral] = + pointsToOut.collectAll[AnnotationLiteral] + + /** Traverse to LITERAL via POINTS_TO OUT edge. + */ + def _literalViaPointsToOut: overflowdb.traversal.Traversal[Literal] = + pointsToOut.collectAll[Literal] + + /** Traverse to BLOCK via POINTS_TO OUT edge. + */ + def _blockViaPointsToOut: overflowdb.traversal.Traversal[Block] = + pointsToOut.collectAll[Block] + + /** Traverse to CALL via POINTS_TO OUT edge. + */ + def _callViaPointsToOut: overflowdb.traversal.Traversal[Call] = + pointsToOut.collectAll[Call] + + /** Traverse to METHOD via POINTS_TO OUT edge. + */ + def _methodViaPointsToOut: overflowdb.traversal.Traversal[Method] = + pointsToOut.collectAll[Method] + + /** Traverse to AST_NODE via POINTS_TO OUT edge. + */ + def _astNodeViaPointsToOut: overflowdb.traversal.Traversal[AstNode] = + pointsToOut.collectAll[AstNode] + + /** Traverse to UNKNOWN via POINTS_TO OUT edge. + */ + def _unknownViaPointsToOut: overflowdb.traversal.Traversal[Unknown] = + pointsToOut.collectAll[Unknown] + + /** Traverse to CFG_NODE via POINTS_TO OUT edge. + */ + def _cfgNodeViaPointsToOut: overflowdb.traversal.Traversal[CfgNode] = + pointsToOut.collectAll[CfgNode] + + /** Traverse to ARRAY_INITIALIZER via POINTS_TO OUT edge. + */ + def _arrayInitializerViaPointsToOut: overflowdb.traversal.Traversal[ArrayInitializer] = + pointsToOut.collectAll[ArrayInitializer] + + def cfgIn: Iterator[_ <: StoredNode] + + /** Traverse to EXPRESSION via CFG IN edge. + */ + def _expressionViaCfgIn: overflowdb.traversal.Traversal[Expression] = + cfgIn.collectAll[Expression] + + /** Traverse to AST_NODE via CFG IN edge. + */ + def _astNodeViaCfgIn: overflowdb.traversal.Traversal[AstNode] = + cfgIn.collectAll[AstNode] + + /** Traverse to CFG_NODE via CFG IN edge. + */ + def _cfgNodeViaCfgIn: overflowdb.traversal.Traversal[CfgNode] = + cfgIn.collectAll[CfgNode] + + /** Traverse to BLOCK via CFG IN edge. + */ + def _blockViaCfgIn: overflowdb.traversal.Traversal[Block] = + cfgIn.collectAll[Block] + + /** Traverse to CALL via CFG IN edge. + */ + def _callViaCfgIn: overflowdb.traversal.Traversal[Call] = + cfgIn.collectAll[Call] + + /** Traverse to CALL_REPR via CFG IN edge. + */ + def _callReprViaCfgIn: overflowdb.traversal.Traversal[CallRepr] = + cfgIn.collectAll[CallRepr] + + /** Traverse to CONTROL_STRUCTURE via CFG IN edge. + */ + def _controlStructureViaCfgIn: overflowdb.traversal.Traversal[ControlStructure] = + cfgIn.collectAll[ControlStructure] + + /** Traverse to FIELD_IDENTIFIER via CFG IN edge. + */ + def _fieldIdentifierViaCfgIn: overflowdb.traversal.Traversal[FieldIdentifier] = + cfgIn.collectAll[FieldIdentifier] + + /** Traverse to IDENTIFIER via CFG IN edge. + */ + def _identifierViaCfgIn: overflowdb.traversal.Traversal[Identifier] = + cfgIn.collectAll[Identifier] + + /** Traverse to JUMP_TARGET via CFG IN edge. + */ + def _jumpTargetViaCfgIn: overflowdb.traversal.Traversal[JumpTarget] = + cfgIn.collectAll[JumpTarget] + + /** Traverse to LITERAL via CFG IN edge. + */ + def _literalViaCfgIn: overflowdb.traversal.Traversal[Literal] = + cfgIn.collectAll[Literal] + + /** Traverse to DECLARATION via CFG IN edge. + */ + def _declarationViaCfgIn: overflowdb.traversal.Traversal[Declaration] = + cfgIn.collectAll[Declaration] + + /** Traverse to METHOD via CFG IN edge. + */ + def _methodViaCfgIn: overflowdb.traversal.Traversal[Method] = + cfgIn.collectAll[Method] + + /** Traverse to METHOD_REF via CFG IN edge. + */ + def _methodRefViaCfgIn: overflowdb.traversal.Traversal[MethodRef] = + cfgIn.collectAll[MethodRef] + + /** Traverse to TYPE_REF via CFG IN edge. + */ + def _typeRefViaCfgIn: overflowdb.traversal.Traversal[TypeRef] = + cfgIn.collectAll[TypeRef] + + /** Traverse to UNKNOWN via CFG IN edge. + */ + def _unknownViaCfgIn: overflowdb.traversal.Traversal[Unknown] = + cfgIn.collectAll[Unknown] + + def pointsToIn: Iterator[_ <: StoredNode] + + /** Traverse to METHOD_PARAMETER_IN via POINTS_TO IN edge. + */ + def _methodParameterInViaPointsToIn: overflowdb.traversal.Traversal[MethodParameterIn] = + pointsToIn.collectAll[MethodParameterIn] + + /** Traverse to EXPRESSION via POINTS_TO IN edge. + */ + def _expressionViaPointsToIn: overflowdb.traversal.Traversal[Expression] = + pointsToIn.collectAll[Expression] + + /** Traverse to CFG_NODE via POINTS_TO IN edge. + */ + def _cfgNodeViaPointsToIn: overflowdb.traversal.Traversal[CfgNode] = + pointsToIn.collectAll[CfgNode] + + /** Traverse to FIELD_IDENTIFIER via POINTS_TO IN edge. + */ + def _fieldIdentifierViaPointsToIn: overflowdb.traversal.Traversal[FieldIdentifier] = + pointsToIn.collectAll[FieldIdentifier] + + /** Traverse to METHOD_PARAMETER_OUT via POINTS_TO IN edge. + */ + def _methodParameterOutViaPointsToIn: overflowdb.traversal.Traversal[MethodParameterOut] = + pointsToIn.collectAll[MethodParameterOut] + + /** Traverse to JUMP_TARGET via POINTS_TO IN edge. + */ + def _jumpTargetViaPointsToIn: overflowdb.traversal.Traversal[JumpTarget] = + pointsToIn.collectAll[JumpTarget] + + /** Traverse to UNKNOWN via POINTS_TO IN edge. + */ + def _unknownViaPointsToIn: overflowdb.traversal.Traversal[Unknown] = + pointsToIn.collectAll[Unknown] + + /** Traverse to IDENTIFIER via POINTS_TO IN edge. + */ + def _identifierViaPointsToIn: overflowdb.traversal.Traversal[Identifier] = + pointsToIn.collectAll[Identifier] + + /** Traverse to TYPE_REF via POINTS_TO IN edge. + */ + def _typeRefViaPointsToIn: overflowdb.traversal.Traversal[TypeRef] = + pointsToIn.collectAll[TypeRef] + + /** Traverse to METHOD via POINTS_TO IN edge. + */ + def _methodViaPointsToIn: overflowdb.traversal.Traversal[Method] = + pointsToIn.collectAll[Method] + + /** Traverse to ANNOTATION_LITERAL via POINTS_TO IN edge. + */ + def _annotationLiteralViaPointsToIn: overflowdb.traversal.Traversal[AnnotationLiteral] = + pointsToIn.collectAll[AnnotationLiteral] + + /** Traverse to METHOD_RETURN via POINTS_TO IN edge. + */ + def _methodReturnViaPointsToIn: overflowdb.traversal.Traversal[MethodReturn] = + pointsToIn.collectAll[MethodReturn] + + /** Traverse to TEMPLATE_DOM via POINTS_TO IN edge. + */ + def _templateDomViaPointsToIn: overflowdb.traversal.Traversal[TemplateDom] = + pointsToIn.collectAll[TemplateDom] + + /** Traverse to ARRAY_INITIALIZER via POINTS_TO IN edge. + */ + def _arrayInitializerViaPointsToIn: overflowdb.traversal.Traversal[ArrayInitializer] = + pointsToIn.collectAll[ArrayInitializer] + + /** Traverse to AST_NODE via POINTS_TO IN edge. + */ + def _astNodeViaPointsToIn: overflowdb.traversal.Traversal[AstNode] = + pointsToIn.collectAll[AstNode] + + /** Traverse to CALL via POINTS_TO IN edge. + */ + def _callViaPointsToIn: overflowdb.traversal.Traversal[Call] = + pointsToIn.collectAll[Call] + + /** Traverse to ANNOTATION via POINTS_TO IN edge. + */ + def _annotationViaPointsToIn: overflowdb.traversal.Traversal[Annotation] = + pointsToIn.collectAll[Annotation] + + /** Traverse to LITERAL via POINTS_TO IN edge. + */ + def _literalViaPointsToIn: overflowdb.traversal.Traversal[Literal] = + pointsToIn.collectAll[Literal] + + /** Traverse to METHOD_REF via POINTS_TO IN edge. + */ + def _methodRefViaPointsToIn: overflowdb.traversal.Traversal[MethodRef] = + pointsToIn.collectAll[MethodRef] + + /** Traverse to CALL_REPR via POINTS_TO IN edge. + */ + def _callReprViaPointsToIn: overflowdb.traversal.Traversal[CallRepr] = + pointsToIn.collectAll[CallRepr] + + /** Traverse to RETURN via POINTS_TO IN edge. + */ + def _returnViaPointsToIn: overflowdb.traversal.Traversal[Return] = + pointsToIn.collectAll[Return] + + /** Traverse to CONTROL_STRUCTURE via POINTS_TO IN edge. + */ + def _controlStructureViaPointsToIn: overflowdb.traversal.Traversal[ControlStructure] = + pointsToIn.collectAll[ControlStructure] + + /** Traverse to BLOCK via POINTS_TO IN edge. + */ + def _blockViaPointsToIn: overflowdb.traversal.Traversal[Block] = + pointsToIn.collectAll[Block] + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala new file mode 100644 index 0000000..e89a0b4 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala @@ -0,0 +1,257 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ClosureBinding { + def apply(graph: Graph, id: Long) = new ClosureBinding(graph, id) + + val Label = "CLOSURE_BINDING" + + object PropertyNames { + val ClosureBindingId = "CLOSURE_BINDING_ID" + val ClosureOriginalName = "CLOSURE_ORIGINAL_NAME" + val EvaluationStrategy = "EVALUATION_STRATEGY" + val all: Set[String] = Set(ClosureBindingId, ClosureOriginalName, EvaluationStrategy) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ClosureBindingId = new overflowdb.PropertyKey[String]("CLOSURE_BINDING_ID") + val ClosureOriginalName = new overflowdb.PropertyKey[String]("CLOSURE_ORIGINAL_NAME") + val EvaluationStrategy = new overflowdb.PropertyKey[String]("EVALUATION_STRATEGY") + + } + + object PropertyDefaults { + val EvaluationStrategy = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Capture.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.CapturedBy.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("REF") + val In: Array[String] = Array("CAPTURE", "CAPTURED_BY") + } + + val factory = new NodeFactory[ClosureBindingDb] { + override val forLabel = ClosureBinding.Label + + override def createNode(ref: NodeRef[ClosureBindingDb]) = + new ClosureBindingDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = ClosureBinding(graph, id) + } +} + +trait ClosureBindingBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def closureBindingId: Option[String] + def closureOriginalName: Option[String] + def evaluationStrategy: String + +} + +class ClosureBinding(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ClosureBindingDb](graph_4762, id_4762) + with ClosureBindingBase + with StoredNode { + override def closureBindingId: Option[String] = get().closureBindingId + override def closureOriginalName: Option[String] = get().closureOriginalName + override def evaluationStrategy: String = get().evaluationStrategy + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "EVALUATION_STRATEGY" => ClosureBinding.PropertyDefaults.EvaluationStrategy + case _ => super.propertyDefaultValue(propertyKey) + } + + def refOut: Iterator[AstNode] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to LOCAL via REF OUT edge. + */ + def _localViaRefOut: Local = get()._localViaRefOut + + /** Traverse to METHOD_PARAMETER_IN via REF OUT edge. + */ + def _methodParameterInViaRefOut: overflowdb.traversal.Traversal[MethodParameterIn] = get()._methodParameterInViaRefOut + + def captureIn: Iterator[Expression] = get().captureIn + override def _captureIn = get()._captureIn + + /** Traverse to METHOD_REF via CAPTURE IN edge. + */ + def _methodRefViaCaptureIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCaptureIn + + /** Traverse to TYPE_REF via CAPTURE IN edge. + */ + def _typeRefViaCaptureIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCaptureIn + + def capturedByIn: Iterator[Local] = get().capturedByIn + override def _capturedByIn = get()._capturedByIn + + /** Traverse to LOCAL via CAPTURED_BY IN edge. + */ + def _localViaCapturedByIn: overflowdb.traversal.Traversal[Local] = get()._localViaCapturedByIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + ClosureBinding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "closureBindingId" + case 2 => "closureOriginalName" + case 3 => "evaluationStrategy" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => closureBindingId + case 2 => closureOriginalName + case 3 => evaluationStrategy + } + + override def productPrefix = "ClosureBinding" + override def productArity = 4 +} + +class ClosureBindingDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with ClosureBindingBase { + + override def layoutInformation: NodeLayoutInformation = ClosureBinding.layoutInformation + + private var _closureBindingId: String = null + def closureBindingId: Option[String] = Option(_closureBindingId) + private var _closureOriginalName: String = null + def closureOriginalName: Option[String] = Option(_closureOriginalName) + private var _evaluationStrategy: String = ClosureBinding.PropertyDefaults.EvaluationStrategy + def evaluationStrategy: String = _evaluationStrategy + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + closureBindingId.map { value => properties.put("CLOSURE_BINDING_ID", value) } + closureOriginalName.map { value => properties.put("CLOSURE_ORIGINAL_NAME", value) } + properties.put("EVALUATION_STRATEGY", evaluationStrategy) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + closureBindingId.map { value => properties.put("CLOSURE_BINDING_ID", value) } + closureOriginalName.map { value => properties.put("CLOSURE_ORIGINAL_NAME", value) } + if (!(("") == evaluationStrategy)) { properties.put("EVALUATION_STRATEGY", evaluationStrategy) } + + properties + } + + import overflowdb.traversal._ + def refOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _localViaRefOut: Local = try { refOut.collectAll[Local].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label REF to an adjacent LOCAL is mandatory, but not defined for this CLOSURE_BINDING node with id=" + id, + e + ) + } + def _methodParameterInViaRefOut: overflowdb.traversal.Traversal[MethodParameterIn] = + refOut.collectAll[MethodParameterIn] + + def captureIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](1) + override def _captureIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _methodRefViaCaptureIn: overflowdb.traversal.Traversal[MethodRef] = captureIn.collectAll[MethodRef] + def _typeRefViaCaptureIn: overflowdb.traversal.Traversal[TypeRef] = captureIn.collectAll[TypeRef] + + def capturedByIn: Iterator[Local] = createAdjacentNodeScalaIteratorByOffSet[Local](2) + override def _capturedByIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _localViaCapturedByIn: overflowdb.traversal.Traversal[Local] = capturedByIn.collectAll[Local] + + override def label: String = { + ClosureBinding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "closureBindingId" + case 2 => "closureOriginalName" + case 3 => "evaluationStrategy" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => closureBindingId + case 2 => closureOriginalName + case 3 => evaluationStrategy + } + + override def productPrefix = "ClosureBinding" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ClosureBindingDb] + + override def property(key: String): Any = { + key match { + case "CLOSURE_BINDING_ID" => this._closureBindingId + case "CLOSURE_ORIGINAL_NAME" => this._closureOriginalName + case "EVALUATION_STRATEGY" => this._evaluationStrategy + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CLOSURE_BINDING_ID" => this._closureBindingId = value.asInstanceOf[String] + case "CLOSURE_ORIGINAL_NAME" => this._closureOriginalName = value.asInstanceOf[String] + case "EVALUATION_STRATEGY" => this._evaluationStrategy = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._closureBindingId = newNode.asInstanceOf[NewClosureBinding].closureBindingId.orNull + this._closureOriginalName = newNode.asInstanceOf[NewClosureBinding].closureOriginalName.orNull + this._evaluationStrategy = newNode.asInstanceOf[NewClosureBinding].evaluationStrategy + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala new file mode 100644 index 0000000..397a518 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala @@ -0,0 +1,274 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Comment { + def apply(graph: Graph, id: Long) = new Comment(graph, id) + + val Label = "COMMENT" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val Filename = "FILENAME" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, Filename, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val Filename = new overflowdb.PropertyKey[String]("FILENAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Filename = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List(io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("SOURCE_FILE") + val In: Array[String] = Array("AST", "SOURCE_FILE") + } + + val factory = new NodeFactory[CommentDb] { + override val forLabel = Comment.Label + + override def createNode(ref: NodeRef[CommentDb]) = + new CommentDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Comment(graph, id) + } +} + +trait CommentBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def filename: String + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class Comment(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[CommentDb](graph_4762, id_4762) + with CommentBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def filename: String = get().filename + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Comment.PropertyDefaults.Code + case "FILENAME" => Comment.PropertyDefaults.Filename + case "ORDER" => Comment.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def sourceFileOut: Iterator[Comment] = get().sourceFileOut + override def _sourceFileOut = get()._sourceFileOut + + /** Traverse to COMMENT via SOURCE_FILE OUT edge. + */ + def file: overflowdb.traversal.Traversal[Comment] = get().file + + def astIn: Iterator[File] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to FILE via AST IN edge. + */ + def _fileViaAstIn: overflowdb.traversal.Traversal[File] = get()._fileViaAstIn + + def sourceFileIn: Iterator[Comment] = get().sourceFileIn + override def _sourceFileIn = get()._sourceFileIn + + /** Traverse to COMMENT via SOURCE_FILE IN edge. + */ + def _commentViaSourceFileIn: overflowdb.traversal.Traversal[Comment] = get()._commentViaSourceFileIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Comment.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "filename" + case 4 => "lineNumber" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => filename + case 4 => lineNumber + case 5 => order + } + + override def productPrefix = "Comment" + override def productArity = 6 +} + +class CommentDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with CommentBase { + + override def layoutInformation: NodeLayoutInformation = Comment.layoutInformation + + private var _code: String = Comment.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _filename: String = Comment.PropertyDefaults.Filename + def filename: String = _filename + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Comment.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("FILENAME", filename) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == filename)) { properties.put("FILENAME", filename) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def sourceFileOut: Iterator[Comment] = createAdjacentNodeScalaIteratorByOffSet[Comment](0) + override def _sourceFileOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def file: overflowdb.traversal.Traversal[Comment] = sourceFileOut.collectAll[Comment] + + def astIn: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](1) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _fileViaAstIn: overflowdb.traversal.Traversal[File] = astIn.collectAll[File] + + def sourceFileIn: Iterator[Comment] = createAdjacentNodeScalaIteratorByOffSet[Comment](2) + override def _sourceFileIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _commentViaSourceFileIn: overflowdb.traversal.Traversal[Comment] = sourceFileIn.collectAll[Comment] + + override def label: String = { + Comment.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "filename" + case 4 => "lineNumber" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => filename + case 4 => lineNumber + case 5 => order + } + + override def productPrefix = "Comment" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[CommentDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "FILENAME" => this._filename + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "FILENAME" => this._filename = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewComment].code + this._columnNumber = newNode.asInstanceOf[NewComment].columnNumber.orNull + this._filename = newNode.asInstanceOf[NewComment].filename + this._lineNumber = newNode.asInstanceOf[NewComment].lineNumber.orNull + this._order = newNode.asInstanceOf[NewComment].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala new file mode 100644 index 0000000..0a411ef --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala @@ -0,0 +1,186 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ConfigFile { + def apply(graph: Graph, id: Long) = new ConfigFile(graph, id) + + val Label = "CONFIG_FILE" + + object PropertyNames { + val Content = "CONTENT" + val Name = "NAME" + val all: Set[String] = Set(Content, Name) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Content = new overflowdb.PropertyKey[String]("CONTENT") + val Name = new overflowdb.PropertyKey[String]("NAME") + + } + + object PropertyDefaults { + val Content = "" + val Name = "" + } + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[ConfigFileDb] { + override val forLabel = ConfigFile.Label + + override def createNode(ref: NodeRef[ConfigFileDb]) = + new ConfigFileDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = ConfigFile(graph, id) + } +} + +trait ConfigFileBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def content: String + def name: String + +} + +class ConfigFile(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ConfigFileDb](graph_4762, id_4762) + with ConfigFileBase + with StoredNode { + override def content: String = get().content + override def name: String = get().name + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CONTENT" => ConfigFile.PropertyDefaults.Content + case "NAME" => ConfigFile.PropertyDefaults.Name + case _ => super.propertyDefaultValue(propertyKey) + } + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + ConfigFile.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "content" + case 2 => "name" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => content + case 2 => name + } + + override def productPrefix = "ConfigFile" + override def productArity = 3 +} + +class ConfigFileDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with ConfigFileBase { + + override def layoutInformation: NodeLayoutInformation = ConfigFile.layoutInformation + + private var _content: String = ConfigFile.PropertyDefaults.Content + def content: String = _content + private var _name: String = ConfigFile.PropertyDefaults.Name + def name: String = _name + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CONTENT", content) + properties.put("NAME", name) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == content)) { properties.put("CONTENT", content) } + if (!(("") == name)) { properties.put("NAME", name) } + + properties + } + + import overflowdb.traversal._ + + override def label: String = { + ConfigFile.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "content" + case 2 => "name" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => content + case 2 => name + } + + override def productPrefix = "ConfigFile" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ConfigFileDb] + + override def property(key: String): Any = { + key match { + case "CONTENT" => this._content + case "NAME" => this._name + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CONTENT" => this._content = value.asInstanceOf[String] + case "NAME" => this._name = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._content = newNode.asInstanceOf[NewConfigFile].content + this._name = newNode.asInstanceOf[NewConfigFile].name + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala new file mode 100644 index 0000000..c6dda56 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala @@ -0,0 +1,1056 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object ControlStructure { + def apply(graph: Graph, id: Long) = new ControlStructure(graph, id) + + val Label = "CONTROL_STRUCTURE" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val ControlStructureType = "CONTROL_STRUCTURE_TYPE" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val ParserTypeName = "PARSER_TYPE_NAME" + val all: Set[String] = + Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, ControlStructureType, LineNumber, Order, ParserTypeName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val ControlStructureType = new overflowdb.PropertyKey[String]("CONTROL_STRUCTURE_TYPE") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val ParserTypeName = new overflowdb.PropertyKey[String]("PARSER_TYPE_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val ControlStructureType = "" + val Order = -1: Int + val ParserTypeName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[ControlStructureDb] { + override val forLabel = ControlStructure.Label + + override def createNode(ref: NodeRef[ControlStructureDb]) = + new ControlStructureDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = ControlStructure(graph, id) + } +} + +trait ControlStructureBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def controlStructureType: String + def lineNumber: Option[Integer] + def order: scala.Int + def parserTypeName: String + +} + +class ControlStructure(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ControlStructureDb](graph_4762, id_4762) + with ControlStructureBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def controlStructureType: String = get().controlStructureType + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def parserTypeName: String = get().parserTypeName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => ControlStructure.PropertyDefaults.ArgumentIndex + case "CODE" => ControlStructure.PropertyDefaults.Code + case "CONTROL_STRUCTURE_TYPE" => ControlStructure.PropertyDefaults.ControlStructureType + case "ORDER" => ControlStructure.PropertyDefaults.Order + case "PARSER_TYPE_NAME" => ControlStructure.PropertyDefaults.ParserTypeName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to BLOCK via AST OUT edge. + */ + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = get()._blockViaAstOut + + /** Traverse to CALL via AST OUT edge. + */ + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = get()._callViaAstOut + + /** Traverse to CONTROL_STRUCTURE via AST OUT edge. + */ + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstOut + + /** Traverse to IDENTIFIER via AST OUT edge. + */ + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaAstOut + + /** Traverse to JUMP_LABEL via AST OUT edge. + */ + def _jumpLabelViaAstOut: overflowdb.traversal.Traversal[JumpLabel] = get()._jumpLabelViaAstOut + + /** Traverse to JUMP_TARGET via AST OUT edge. + */ + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaAstOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + /** Traverse to LOCAL via AST OUT edge. + */ + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = get()._localViaAstOut + + /** Traverse to METHOD_REF via AST OUT edge. + */ + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaAstOut + + /** Traverse to MODIFIER via AST OUT edge. + */ + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = get()._modifierViaAstOut + + /** Traverse to RETURN via AST OUT edge. + */ + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = get()._returnViaAstOut + + /** Traverse to TYPE_REF via AST OUT edge. + */ + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaAstOut + + /** Traverse to UNKNOWN via AST OUT edge. + */ + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def conditionOut: Iterator[CfgNode] = get().conditionOut + override def _conditionOut = get()._conditionOut + + /** Traverse to BLOCK via CONDITION OUT edge. + */ + def _blockViaConditionOut: overflowdb.traversal.Traversal[Block] = get()._blockViaConditionOut + + /** Traverse to CALL via CONDITION OUT edge. + */ + def _callViaConditionOut: overflowdb.traversal.Traversal[Call] = get()._callViaConditionOut + + /** Traverse to CONTROL_STRUCTURE via CONDITION OUT edge. + */ + def _controlStructureViaConditionOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionOut + + /** Traverse to IDENTIFIER via CONDITION OUT edge. + */ + def _identifierViaConditionOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaConditionOut + + /** Traverse to JUMP_TARGET via CONDITION OUT edge. + */ + def _jumpTargetViaConditionOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaConditionOut + + /** Traverse to LITERAL via CONDITION OUT edge. + */ + def _literalViaConditionOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaConditionOut + + /** Traverse to METHOD_REF via CONDITION OUT edge. + */ + def _methodRefViaConditionOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaConditionOut + + /** Traverse to RETURN via CONDITION OUT edge. + */ + def _returnViaConditionOut: overflowdb.traversal.Traversal[Return] = get()._returnViaConditionOut + + /** Traverse to TYPE_REF via CONDITION OUT edge. + */ + def _typeRefViaConditionOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaConditionOut + + /** Traverse to UNKNOWN via CONDITION OUT edge. + */ + def _unknownViaConditionOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaConditionOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + ControlStructure.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "controlStructureType" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => controlStructureType + case 6 => lineNumber + case 7 => order + case 8 => parserTypeName + } + + override def productPrefix = "ControlStructure" + override def productArity = 9 +} + +class ControlStructureDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with Expression + with ControlStructureBase { + + override def layoutInformation: NodeLayoutInformation = ControlStructure.layoutInformation + + private var _argumentIndex: scala.Int = ControlStructure.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = ControlStructure.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _controlStructureType: String = ControlStructure.PropertyDefaults.ControlStructureType + def controlStructureType: String = _controlStructureType + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = ControlStructure.PropertyDefaults.Order + def order: scala.Int = _order + private var _parserTypeName: String = ControlStructure.PropertyDefaults.ParserTypeName + def parserTypeName: String = _parserTypeName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("CONTROL_STRUCTURE_TYPE", controlStructureType) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("PARSER_TYPE_NAME", parserTypeName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == controlStructureType)) { properties.put("CONTROL_STRUCTURE_TYPE", controlStructureType) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == parserTypeName)) { properties.put("PARSER_TYPE_NAME", parserTypeName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = astOut.collectAll[Block] + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = astOut.collectAll[Call] + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = astOut.collectAll[ControlStructure] + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = astOut.collectAll[Identifier] + def _jumpLabelViaAstOut: overflowdb.traversal.Traversal[JumpLabel] = astOut.collectAll[JumpLabel] + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = astOut.collectAll[JumpTarget] + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = astOut.collectAll[Local] + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = astOut.collectAll[MethodRef] + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = astOut.collectAll[Modifier] + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = astOut.collectAll[Return] + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = astOut.collectAll[TypeRef] + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = astOut.collectAll[Unknown] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def conditionOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _conditionOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaConditionOut: overflowdb.traversal.Traversal[Block] = conditionOut.collectAll[Block] + def _callViaConditionOut: overflowdb.traversal.Traversal[Call] = conditionOut.collectAll[Call] + def _controlStructureViaConditionOut: overflowdb.traversal.Traversal[ControlStructure] = + conditionOut.collectAll[ControlStructure] + def _identifierViaConditionOut: overflowdb.traversal.Traversal[Identifier] = conditionOut.collectAll[Identifier] + def _jumpTargetViaConditionOut: overflowdb.traversal.Traversal[JumpTarget] = conditionOut.collectAll[JumpTarget] + def _literalViaConditionOut: overflowdb.traversal.Traversal[Literal] = conditionOut.collectAll[Literal] + def _methodRefViaConditionOut: overflowdb.traversal.Traversal[MethodRef] = conditionOut.collectAll[MethodRef] + def _returnViaConditionOut: overflowdb.traversal.Traversal[Return] = conditionOut.collectAll[Return] + def _typeRefViaConditionOut: overflowdb.traversal.Traversal[TypeRef] = conditionOut.collectAll[TypeRef] + def _unknownViaConditionOut: overflowdb.traversal.Traversal[Unknown] = conditionOut.collectAll[Unknown] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](6) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](9) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](10) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](11) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = argumentIn.collectAll[Call] + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = argumentIn.collectAll[Return] + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](12) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](14) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](15) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](16) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](19) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](20) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](21) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](21) + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = receiverIn.collectAll[Call] + + override def label: String = { + ControlStructure.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "controlStructureType" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => controlStructureType + case 6 => lineNumber + case 7 => order + case 8 => parserTypeName + } + + override def productPrefix = "ControlStructure" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ControlStructureDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "CONTROL_STRUCTURE_TYPE" => this._controlStructureType + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "PARSER_TYPE_NAME" => this._parserTypeName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "CONTROL_STRUCTURE_TYPE" => this._controlStructureType = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "PARSER_TYPE_NAME" => this._parserTypeName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewControlStructure].argumentIndex + this._argumentName = newNode.asInstanceOf[NewControlStructure].argumentName.orNull + this._code = newNode.asInstanceOf[NewControlStructure].code + this._columnNumber = newNode.asInstanceOf[NewControlStructure].columnNumber.orNull + this._controlStructureType = newNode.asInstanceOf[NewControlStructure].controlStructureType + this._lineNumber = newNode.asInstanceOf[NewControlStructure].lineNumber.orNull + this._order = newNode.asInstanceOf[NewControlStructure].order + this._parserTypeName = newNode.asInstanceOf[NewControlStructure].parserTypeName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Declaration.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Declaration.scala new file mode 100644 index 0000000..0a6a34c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Declaration.scala @@ -0,0 +1,36 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +object Declaration { + object PropertyNames { + val Name = "NAME" + val all: Set[String] = Set(Name) + } + + object Properties { + val Name = new overflowdb.PropertyKey[String]("NAME") + } + + object PropertyDefaults { + val Name = "" + } + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + +} + +trait DeclarationBase extends AbstractNode { + def name: String +} + +trait DeclarationNew extends NewNode { + def name_=(value: String): Unit + def name: String +} + +trait Declaration extends StoredNode with DeclarationBase { + import overflowdb.traversal._ + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala new file mode 100644 index 0000000..71c945e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala @@ -0,0 +1,216 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Dependency { + def apply(graph: Graph, id: Long) = new Dependency(graph, id) + + val Label = "DEPENDENCY" + + object PropertyNames { + val DependencyGroupId = "DEPENDENCY_GROUP_ID" + val Name = "NAME" + val Version = "VERSION" + val all: Set[String] = Set(DependencyGroupId, Name, Version) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val DependencyGroupId = new overflowdb.PropertyKey[String]("DEPENDENCY_GROUP_ID") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Version = new overflowdb.PropertyKey[String]("VERSION") + + } + + object PropertyDefaults { + val Name = "" + val Version = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Imports.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("IMPORTS") + } + + val factory = new NodeFactory[DependencyDb] { + override val forLabel = Dependency.Label + + override def createNode(ref: NodeRef[DependencyDb]) = + new DependencyDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Dependency(graph, id) + } +} + +trait DependencyBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def dependencyGroupId: Option[String] + def name: String + def version: String + +} + +class Dependency(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[DependencyDb](graph_4762, id_4762) + with DependencyBase + with StoredNode { + override def dependencyGroupId: Option[String] = get().dependencyGroupId + override def name: String = get().name + override def version: String = get().version + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "NAME" => Dependency.PropertyDefaults.Name + case "VERSION" => Dependency.PropertyDefaults.Version + case _ => super.propertyDefaultValue(propertyKey) + } + + def importsIn: Iterator[Import] = get().importsIn + override def _importsIn = get()._importsIn + + /** Traverse to IMPORT via IMPORTS IN edge. + */ + def _importViaImportsIn: overflowdb.traversal.Traversal[Import] = get()._importViaImportsIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Dependency.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "dependencyGroupId" + case 2 => "name" + case 3 => "version" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => dependencyGroupId + case 2 => name + case 3 => version + } + + override def productPrefix = "Dependency" + override def productArity = 4 +} + +class DependencyDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with DependencyBase { + + override def layoutInformation: NodeLayoutInformation = Dependency.layoutInformation + + private var _dependencyGroupId: String = null + def dependencyGroupId: Option[String] = Option(_dependencyGroupId) + private var _name: String = Dependency.PropertyDefaults.Name + def name: String = _name + private var _version: String = Dependency.PropertyDefaults.Version + def version: String = _version + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + dependencyGroupId.map { value => properties.put("DEPENDENCY_GROUP_ID", value) } + properties.put("NAME", name) + properties.put("VERSION", version) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + dependencyGroupId.map { value => properties.put("DEPENDENCY_GROUP_ID", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!(("") == version)) { properties.put("VERSION", version) } + + properties + } + + import overflowdb.traversal._ + def importsIn: Iterator[Import] = createAdjacentNodeScalaIteratorByOffSet[Import](0) + override def _importsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _importViaImportsIn: overflowdb.traversal.Traversal[Import] = importsIn.collectAll[Import] + + override def label: String = { + Dependency.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "dependencyGroupId" + case 2 => "name" + case 3 => "version" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => dependencyGroupId + case 2 => name + case 3 => version + } + + override def productPrefix = "Dependency" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[DependencyDb] + + override def property(key: String): Any = { + key match { + case "DEPENDENCY_GROUP_ID" => this._dependencyGroupId + case "NAME" => this._name + case "VERSION" => this._version + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "DEPENDENCY_GROUP_ID" => this._dependencyGroupId = value.asInstanceOf[String] + case "NAME" => this._name = value.asInstanceOf[String] + case "VERSION" => this._version = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._dependencyGroupId = newNode.asInstanceOf[NewDependency].dependencyGroupId.orNull + this._name = newNode.asInstanceOf[NewDependency].name + this._version = newNode.asInstanceOf[NewDependency].version + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Expression.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Expression.scala new file mode 100644 index 0000000..c7c9729 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Expression.scala @@ -0,0 +1,128 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +object Expression { + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, LineNumber, Order) + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + } + + object Edges { + val Out: Array[String] = Array("ARGUMENT") + val In: Array[String] = Array("AST", "REACHING_DEF") + } + +} + +trait ExpressionBase extends AbstractNode with AstNodeBase with CfgNodeBase { + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait ExpressionNew extends NewNode with AstNodeNew with CfgNodeNew { + def argumentIndex_=(value: scala.Int): Unit + def argumentName_=(value: Option[String]): Unit + def code_=(value: String): Unit + def columnNumber_=(value: Option[Integer]): Unit + def lineNumber_=(value: Option[Integer]): Unit + def order_=(value: scala.Int): Unit + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int +} + +trait Expression extends StoredNode with ExpressionBase with AstNode with CfgNode { + import overflowdb.traversal._ + def argumentOut: Iterator[_ <: StoredNode] + + /** Traverse to EXPRESSION via ARGUMENT OUT edge. + */ + def _expressionViaArgumentOut: overflowdb.traversal.Traversal[Expression] = + argumentOut.collectAll[Expression] + + /** Traverse to AST_NODE via ARGUMENT OUT edge. + */ + def _astNodeViaArgumentOut: overflowdb.traversal.Traversal[AstNode] = + argumentOut.collectAll[AstNode] + + /** Traverse to CFG_NODE via ARGUMENT OUT edge. + */ + def _cfgNodeViaArgumentOut: overflowdb.traversal.Traversal[CfgNode] = + argumentOut.collectAll[CfgNode] + + /** Traverse to TEMPLATE_DOM via ARGUMENT OUT edge. + */ + def _templateDomViaArgumentOut: overflowdb.traversal.Traversal[TemplateDom] = + argumentOut.collectAll[TemplateDom] + + def astIn: Iterator[_ <: StoredNode] + + /** Traverse to EXPRESSION via AST IN edge. + */ + def _expressionViaAstIn: overflowdb.traversal.Traversal[Expression] = + astIn.collectAll[Expression] + + /** Traverse to AST_NODE via AST IN edge. + */ + def _astNodeViaAstIn: overflowdb.traversal.Traversal[AstNode] = + astIn.collectAll[AstNode] + + /** Traverse to CFG_NODE via AST IN edge. + */ + def _cfgNodeViaAstIn: overflowdb.traversal.Traversal[CfgNode] = + astIn.collectAll[CfgNode] + + /** Traverse to TEMPLATE_DOM via AST IN edge. + */ + def _templateDomViaAstIn: overflowdb.traversal.Traversal[TemplateDom] = + astIn.collectAll[TemplateDom] + + def reachingDefIn: Iterator[_ <: StoredNode] + + /** Traverse to EXPRESSION via REACHING_DEF IN edge. + */ + def _expressionViaReachingDefIn: overflowdb.traversal.Traversal[Expression] = + reachingDefIn.collectAll[Expression] + + /** Traverse to AST_NODE via REACHING_DEF IN edge. + */ + def _astNodeViaReachingDefIn: overflowdb.traversal.Traversal[AstNode] = + reachingDefIn.collectAll[AstNode] + + /** Traverse to CFG_NODE via REACHING_DEF IN edge. + */ + def _cfgNodeViaReachingDefIn: overflowdb.traversal.Traversal[CfgNode] = + reachingDefIn.collectAll[CfgNode] + + /** Traverse to TEMPLATE_DOM via REACHING_DEF IN edge. + */ + def _templateDomViaReachingDefIn: overflowdb.traversal.Traversal[TemplateDom] = + reachingDefIn.collectAll[TemplateDom] + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala new file mode 100644 index 0000000..0d04b07 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala @@ -0,0 +1,806 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object FieldIdentifier { + def apply(graph: Graph, id: Long) = new FieldIdentifier(graph, id) + + val Label = "FIELD_IDENTIFIER" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val CanonicalName = "CANONICAL_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, CanonicalName, Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val CanonicalName = new overflowdb.PropertyKey[String]("CANONICAL_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val CanonicalName = "" + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ARGUMENT", "CDG", "CFG", "DOMINATE", "POINTS_TO", "POST_DOMINATE", "TAGGED_BY") + val In: Array[String] = + Array("ARGUMENT", "AST", "CDG", "CFG", "CONTAINS", "DOMINATE", "POINTS_TO", "POST_DOMINATE", "REACHING_DEF") + } + + val factory = new NodeFactory[FieldIdentifierDb] { + override val forLabel = FieldIdentifier.Label + + override def createNode(ref: NodeRef[FieldIdentifierDb]) = + new FieldIdentifierDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = FieldIdentifier(graph, id) + } +} + +trait FieldIdentifierBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def canonicalName: String + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class FieldIdentifier(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[FieldIdentifierDb](graph_4762, id_4762) + with FieldIdentifierBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def canonicalName: String = get().canonicalName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => FieldIdentifier.PropertyDefaults.ArgumentIndex + case "CANONICAL_NAME" => FieldIdentifier.PropertyDefaults.CanonicalName + case "CODE" => FieldIdentifier.PropertyDefaults.Code + case "ORDER" => FieldIdentifier.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[AstNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CALL via CFG OUT edge. + */ + def _callViaCfgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Call] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Call = get()._callViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: Call = get()._callViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + FieldIdentifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "canonicalName" + case 4 => "code" + case 5 => "columnNumber" + case 6 => "lineNumber" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => canonicalName + case 4 => code + case 5 => columnNumber + case 6 => lineNumber + case 7 => order + } + + override def productPrefix = "FieldIdentifier" + override def productArity = 8 +} + +class FieldIdentifierDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with Expression + with FieldIdentifierBase { + + override def layoutInformation: NodeLayoutInformation = FieldIdentifier.layoutInformation + + private var _argumentIndex: scala.Int = FieldIdentifier.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _canonicalName: String = FieldIdentifier.PropertyDefaults.CanonicalName + def canonicalName: String = _canonicalName + private var _code: String = FieldIdentifier.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = FieldIdentifier.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CANONICAL_NAME", canonicalName) + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == canonicalName)) { properties.put("CANONICAL_NAME", canonicalName) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](2) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _callViaCfgOut: overflowdb.traversal.Traversal[Call] = cfgOut.collectAll[Call] + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](6) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](7) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _callViaArgumentIn: Call = try { argumentIn.collectAll[Call].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label ARGUMENT to an adjacent CALL is mandatory, but not defined for this FIELD_IDENTIFIER node with id=" + id, + e + ) + } + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](8) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _callViaAstIn: Call = try { astIn.collectAll[Call].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent CALL is mandatory, but not defined for this FIELD_IDENTIFIER node with id=" + id, + e + ) + } + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](9) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](10) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](11) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](14) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](15) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + + override def label: String = { + FieldIdentifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "canonicalName" + case 4 => "code" + case 5 => "columnNumber" + case 6 => "lineNumber" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => canonicalName + case 4 => code + case 5 => columnNumber + case 6 => lineNumber + case 7 => order + } + + override def productPrefix = "FieldIdentifier" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[FieldIdentifierDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CANONICAL_NAME" => this._canonicalName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CANONICAL_NAME" => this._canonicalName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewFieldIdentifier].argumentIndex + this._argumentName = newNode.asInstanceOf[NewFieldIdentifier].argumentName.orNull + this._canonicalName = newNode.asInstanceOf[NewFieldIdentifier].canonicalName + this._code = newNode.asInstanceOf[NewFieldIdentifier].code + this._columnNumber = newNode.asInstanceOf[NewFieldIdentifier].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewFieldIdentifier].lineNumber.orNull + this._order = newNode.asInstanceOf[NewFieldIdentifier].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala new file mode 100644 index 0000000..a17e538 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala @@ -0,0 +1,331 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object File { + def apply(graph: Graph, id: Long) = new File(graph, id) + + val Label = "FILE" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val Hash = "HASH" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, Hash, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val Hash = new overflowdb.PropertyKey[String]("HASH") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List(io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST", "CONTAINS", "TAGGED_BY") + val In: Array[String] = Array("SOURCE_FILE") + } + + val factory = new NodeFactory[FileDb] { + override val forLabel = File.Label + + override def createNode(ref: NodeRef[FileDb]) = + new FileDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = File(graph, id) + } +} + +trait FileBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def hash: Option[String] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class File(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[FileDb](graph_4762, id_4762) + with FileBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def hash: Option[String] = get().hash + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => File.PropertyDefaults.Code + case "NAME" => File.PropertyDefaults.Name + case "ORDER" => File.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to COMMENT via AST OUT edge. + */ + def comment: overflowdb.traversal.Traversal[Comment] = get().comment + + /** Traverse to IMPORT via AST OUT edge. + */ + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = get()._importViaAstOut + + /** Traverse to NAMESPACE_BLOCK via AST OUT edge. + */ + def _namespaceBlockViaAstOut: overflowdb.traversal.Traversal[NamespaceBlock] = get()._namespaceBlockViaAstOut + + def containsOut: Iterator[AstNode] = get().containsOut + override def _containsOut = get()._containsOut + + /** Traverse to METHOD via CONTAINS OUT edge. + */ + def _methodViaContainsOut: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsOut + + /** Traverse to TEMPLATE_DOM via CONTAINS OUT edge. + */ + def _templateDomViaContainsOut: overflowdb.traversal.Traversal[TemplateDom] = get()._templateDomViaContainsOut + + /** Traverse to TYPE_DECL via CONTAINS OUT edge. + */ + def _typeDeclViaContainsOut: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaContainsOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def sourceFileIn: Iterator[AstNode] = get().sourceFileIn + override def _sourceFileIn = get()._sourceFileIn + + /** Traverse to METHOD via SOURCE_FILE IN edge. + */ + def method: overflowdb.traversal.Traversal[Method] = get().method + + /** Traverse to NAMESPACE_BLOCK via SOURCE_FILE IN edge. + */ + def namespaceBlock: overflowdb.traversal.Traversal[NamespaceBlock] = get().namespaceBlock + + /** Traverse to TYPE_DECL via SOURCE_FILE IN edge. + */ + def typeDecl: overflowdb.traversal.Traversal[TypeDecl] = get().typeDecl + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + File.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "hash" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => hash + case 4 => lineNumber + case 5 => name + case 6 => order + } + + override def productPrefix = "File" + override def productArity = 7 +} + +class FileDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with FileBase { + + override def layoutInformation: NodeLayoutInformation = File.layoutInformation + + private var _code: String = File.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _hash: String = null + def hash: Option[String] = Option(_hash) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = File.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = File.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + hash.map { value => properties.put("HASH", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + hash.map { value => properties.put("HASH", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def comment: overflowdb.traversal.Traversal[Comment] = astOut.collectAll[Comment] + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = astOut.collectAll[Import] + def _namespaceBlockViaAstOut: overflowdb.traversal.Traversal[NamespaceBlock] = astOut.collectAll[NamespaceBlock] + + def containsOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _containsOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _methodViaContainsOut: overflowdb.traversal.Traversal[Method] = containsOut.collectAll[Method] + def _templateDomViaContainsOut: overflowdb.traversal.Traversal[TemplateDom] = containsOut.collectAll[TemplateDom] + def _typeDeclViaContainsOut: overflowdb.traversal.Traversal[TypeDecl] = containsOut.collectAll[TypeDecl] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](2) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def sourceFileIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _sourceFileIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def method: overflowdb.traversal.Traversal[Method] = sourceFileIn.collectAll[Method] + def namespaceBlock: overflowdb.traversal.Traversal[NamespaceBlock] = sourceFileIn.collectAll[NamespaceBlock] + def typeDecl: overflowdb.traversal.Traversal[TypeDecl] = sourceFileIn.collectAll[TypeDecl] + + override def label: String = { + File.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "hash" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => hash + case 4 => lineNumber + case 5 => name + case 6 => order + } + + override def productPrefix = "File" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[FileDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "HASH" => this._hash + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "HASH" => this._hash = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewFile].code + this._columnNumber = newNode.asInstanceOf[NewFile].columnNumber.orNull + this._hash = newNode.asInstanceOf[NewFile].hash.orNull + this._lineNumber = newNode.asInstanceOf[NewFile].lineNumber.orNull + this._name = newNode.asInstanceOf[NewFile].name + this._order = newNode.asInstanceOf[NewFile].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala new file mode 100644 index 0000000..a27c741 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala @@ -0,0 +1,260 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Finding { + def apply(graph: Graph, id: Long) = new Finding(graph, id) + + val Label = "FINDING" + + object PropertyNames { + val Evidence = "evidence" + val Keyvaluepairs = "keyValuePairs" + val all: Set[String] = Set(Evidence, Keyvaluepairs) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + + val Evidence = new overflowdb.PropertyKey[IndexedSeq[StoredNode]]("evidence") + val Keyvaluepairs = new overflowdb.PropertyKey[IndexedSeq[KeyValuePair]]("keyValuePairs") + } + + object PropertyDefaults {} + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[FindingDb] { + override val forLabel = Finding.Label + + override def createNode(ref: NodeRef[FindingDb]) = + new FindingDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Finding(graph, id) + } +} + +trait FindingBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def evidence: IndexedSeq[AbstractNode] + def keyValuePairs: IndexedSeq[KeyValuePairBase] +} + +class Finding(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[FindingDb](graph_4762, id_4762) + with FindingBase + with StoredNode { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + + def evidence: collection.immutable.IndexedSeq[StoredNode] = get().evidence + + def keyValuePairs: collection.immutable.IndexedSeq[KeyValuePair] = get().keyValuePairs + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Finding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "evidence" + case 2 => "keyValuePairs" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => evidence + case 2 => keyValuePairs + } + + override def productPrefix = "Finding" + override def productArity = 3 +} + +class FindingDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with FindingBase { + + override def layoutInformation: NodeLayoutInformation = Finding.layoutInformation + + private var _evidence: IndexedSeq[StoredNode] = collection.immutable.ArraySeq.empty + def evidence: IndexedSeq[StoredNode] = this._evidence + + private var _keyValuePairs: IndexedSeq[KeyValuePair] = collection.immutable.ArraySeq.empty + def keyValuePairs: IndexedSeq[KeyValuePair] = this._keyValuePairs + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + + if (this._evidence != null && this._evidence.nonEmpty) { properties.put("evidence", this.evidence) } + if (this._keyValuePairs != null && this._keyValuePairs.nonEmpty) { + properties.put("keyValuePairs", this.keyValuePairs) + } + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + + if (this._evidence != null && this._evidence.nonEmpty) { properties.put("evidence", this.evidence) } + if (this._keyValuePairs != null && this._keyValuePairs.nonEmpty) { + properties.put("keyValuePairs", this.keyValuePairs) + } + properties + } + + import overflowdb.traversal._ + + override def label: String = { + Finding.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "evidence" + case 2 => "keyValuePairs" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => evidence + case 2 => keyValuePairs + } + + override def productPrefix = "Finding" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[FindingDb] + + override def property(key: String): Any = { + key match { + + case "evidence" => this._evidence + case "keyValuePairs" => this._keyValuePairs + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + + case "evidence" => + this._evidence = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: StoredNode => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[StoredNode]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[StoredNode]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[StoredNode]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "keyValuePairs" => + this._keyValuePairs = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: KeyValuePair => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => + collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[KeyValuePair]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[KeyValuePair]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[KeyValuePair]].toArray) + } else collection.immutable.ArraySeq.empty + } + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + + this._evidence = + if (newNode.asInstanceOf[NewFinding].evidence == null || newNode.asInstanceOf[NewFinding].evidence.isEmpty) { + collection.immutable.ArraySeq.empty + } else { + collection.immutable.ArraySeq.unsafeWrapArray( + newNode + .asInstanceOf[NewFinding] + .evidence + .map { + case null => throw new NullPointerException("NullPointers forbidden in contained nodes") + case newNode: NewNode => mapping(newNode).asInstanceOf[StoredNode] + case oldNode: StoredNode => oldNode.asInstanceOf[StoredNode] + case _ => throw new MatchError("unreachable") + } + .toArray + ) + } + + this._keyValuePairs = + if ( + newNode.asInstanceOf[NewFinding].keyValuePairs == null || newNode.asInstanceOf[NewFinding].keyValuePairs.isEmpty + ) { + collection.immutable.ArraySeq.empty + } else { + collection.immutable.ArraySeq.unsafeWrapArray( + newNode + .asInstanceOf[NewFinding] + .keyValuePairs + .map { + case null => throw new NullPointerException("NullPointers forbidden in contained nodes") + case newNode: NewNode => mapping(newNode).asInstanceOf[KeyValuePair] + case oldNode: StoredNode => oldNode.asInstanceOf[KeyValuePair] + case _ => throw new MatchError("unreachable") + } + .toArray + ) + } + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala new file mode 100644 index 0000000..8b487f1 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala @@ -0,0 +1,1056 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Identifier { + def apply(graph: Graph, id: Long) = new Identifier(graph, id) + + val Label = "IDENTIFIER" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set( + ArgumentIndex, + ArgumentName, + Code, + ColumnNumber, + DynamicTypeHintFullName, + LineNumber, + Name, + Order, + TypeFullName + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Name = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "REF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[IdentifierDb] { + override val forLabel = Identifier.Label + + override def createNode(ref: NodeRef[IdentifierDb]) = + new IdentifierDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Identifier(graph, id) + } +} + +trait IdentifierBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def typeFullName: String + +} + +class Identifier(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[IdentifierDb](graph_4762, id_4762) + with IdentifierBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Identifier.PropertyDefaults.ArgumentIndex + case "CODE" => Identifier.PropertyDefaults.Code + case "NAME" => Identifier.PropertyDefaults.Name + case "ORDER" => Identifier.PropertyDefaults.Order + case "TYPE_FULL_NAME" => Identifier.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def refOut: Iterator[AstNode] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to LOCAL via REF OUT edge. + */ + def _localViaRefOut: Option[Local] = get()._localViaRefOut + + /** Traverse to METHOD_PARAMETER_IN via REF OUT edge. + */ + def _methodParameterInViaRefOut: Option[MethodParameterIn] = get()._methodParameterInViaRefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Option[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: Option[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to RETURN via REACHING_DEF IN edge. + */ + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: Option[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Identifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => name + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "Identifier" + override def productArity = 10 +} + +class IdentifierDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with IdentifierBase { + + override def layoutInformation: NodeLayoutInformation = Identifier.layoutInformation + + private var _argumentIndex: scala.Int = Identifier.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Identifier.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = Identifier.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Identifier.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = Identifier.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](4) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def refOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](8) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _localViaRefOut: Option[Local] = refOut.collectAll[Local].nextOption() + def _methodParameterInViaRefOut: Option[MethodParameterIn] = refOut.collectAll[MethodParameterIn].nextOption() + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](9) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](10) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _callViaArgumentIn: Option[Call] = argumentIn.collectAll[Call].nextOption() + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](11) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: Option[ControlStructure] = astIn.collectAll[ControlStructure].nextOption() + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](14) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](15) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](19) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = reachingDefIn.collectAll[Return] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](20) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _callViaReceiverIn: Option[Call] = receiverIn.collectAll[Call].nextOption() + + override def label: String = { + Identifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => name + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "Identifier" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[IdentifierDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewIdentifier].argumentIndex + this._argumentName = newNode.asInstanceOf[NewIdentifier].argumentName.orNull + this._code = newNode.asInstanceOf[NewIdentifier].code + this._columnNumber = newNode.asInstanceOf[NewIdentifier].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewIdentifier].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewIdentifier].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewIdentifier].lineNumber.orNull + this._name = newNode.asInstanceOf[NewIdentifier].name + this._order = newNode.asInstanceOf[NewIdentifier].order + this._typeFullName = newNode.asInstanceOf[NewIdentifier].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala new file mode 100644 index 0000000..34accfc --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala @@ -0,0 +1,343 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Import { + def apply(graph: Graph, id: Long) = new Import(graph, id) + + val Label = "IMPORT" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val ExplicitAs = "EXPLICIT_AS" + val ImportedAs = "IMPORTED_AS" + val ImportedEntity = "IMPORTED_ENTITY" + val IsExplicit = "IS_EXPLICIT" + val IsWildcard = "IS_WILDCARD" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = + Set(Code, ColumnNumber, ExplicitAs, ImportedAs, ImportedEntity, IsExplicit, IsWildcard, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val ExplicitAs = new overflowdb.PropertyKey[java.lang.Boolean]("EXPLICIT_AS") + val ImportedAs = new overflowdb.PropertyKey[String]("IMPORTED_AS") + val ImportedEntity = new overflowdb.PropertyKey[String]("IMPORTED_ENTITY") + val IsExplicit = new overflowdb.PropertyKey[java.lang.Boolean]("IS_EXPLICIT") + val IsWildcard = new overflowdb.PropertyKey[java.lang.Boolean]("IS_WILDCARD") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List(io.shiftleft.codepropertygraph.generated.edges.Imports.layoutInformation).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.IsCallForImport.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("IMPORTS") + val In: Array[String] = Array("AST", "IS_CALL_FOR_IMPORT") + } + + val factory = new NodeFactory[ImportDb] { + override val forLabel = Import.Label + + override def createNode(ref: NodeRef[ImportDb]) = + new ImportDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Import(graph, id) + } +} + +trait ImportBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def explicitAs: Option[java.lang.Boolean] + def importedAs: Option[String] + def importedEntity: Option[String] + def isExplicit: Option[java.lang.Boolean] + def isWildcard: Option[java.lang.Boolean] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class Import(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ImportDb](graph_4762, id_4762) + with ImportBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def explicitAs: Option[java.lang.Boolean] = get().explicitAs + override def importedAs: Option[String] = get().importedAs + override def importedEntity: Option[String] = get().importedEntity + override def isExplicit: Option[java.lang.Boolean] = get().isExplicit + override def isWildcard: Option[java.lang.Boolean] = get().isWildcard + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Import.PropertyDefaults.Code + case "ORDER" => Import.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def importsOut: Iterator[Dependency] = get().importsOut + override def _importsOut = get()._importsOut + + /** Traverse to DEPENDENCY via IMPORTS OUT edge. + */ + def _dependencyViaImportsOut: overflowdb.traversal.Traversal[Dependency] = get()._dependencyViaImportsOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to FILE via AST IN edge. + */ + def _fileViaAstIn: overflowdb.traversal.Traversal[File] = get()._fileViaAstIn + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstIn + + def isCallForImportIn: Iterator[Call] = get().isCallForImportIn + override def _isCallForImportIn = get()._isCallForImportIn + + /** Traverse to CALL via IS_CALL_FOR_IMPORT IN edge. + */ + def _callViaIsCallForImportIn: overflowdb.traversal.Traversal[Call] = get()._callViaIsCallForImportIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Import.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "explicitAs" + case 4 => "importedAs" + case 5 => "importedEntity" + case 6 => "isExplicit" + case 7 => "isWildcard" + case 8 => "lineNumber" + case 9 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => explicitAs + case 4 => importedAs + case 5 => importedEntity + case 6 => isExplicit + case 7 => isWildcard + case 8 => lineNumber + case 9 => order + } + + override def productPrefix = "Import" + override def productArity = 10 +} + +class ImportDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with ImportBase { + + override def layoutInformation: NodeLayoutInformation = Import.layoutInformation + + private var _code: String = Import.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _explicitAs: java.lang.Boolean = null + def explicitAs: Option[java.lang.Boolean] = Option(_explicitAs) + private var _importedAs: String = null + def importedAs: Option[String] = Option(_importedAs) + private var _importedEntity: String = null + def importedEntity: Option[String] = Option(_importedEntity) + private var _isExplicit: java.lang.Boolean = null + def isExplicit: Option[java.lang.Boolean] = Option(_isExplicit) + private var _isWildcard: java.lang.Boolean = null + def isWildcard: Option[java.lang.Boolean] = Option(_isWildcard) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Import.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + explicitAs.map { value => properties.put("EXPLICIT_AS", value) } + importedAs.map { value => properties.put("IMPORTED_AS", value) } + importedEntity.map { value => properties.put("IMPORTED_ENTITY", value) } + isExplicit.map { value => properties.put("IS_EXPLICIT", value) } + isWildcard.map { value => properties.put("IS_WILDCARD", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + explicitAs.map { value => properties.put("EXPLICIT_AS", value) } + importedAs.map { value => properties.put("IMPORTED_AS", value) } + importedEntity.map { value => properties.put("IMPORTED_ENTITY", value) } + isExplicit.map { value => properties.put("IS_EXPLICIT", value) } + isWildcard.map { value => properties.put("IS_WILDCARD", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def importsOut: Iterator[Dependency] = createAdjacentNodeScalaIteratorByOffSet[Dependency](0) + override def _importsOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _dependencyViaImportsOut: overflowdb.traversal.Traversal[Dependency] = importsOut.collectAll[Dependency] + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _fileViaAstIn: overflowdb.traversal.Traversal[File] = astIn.collectAll[File] + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = astIn.collectAll[TypeDecl] + + def isCallForImportIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](2) + override def _isCallForImportIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _callViaIsCallForImportIn: overflowdb.traversal.Traversal[Call] = isCallForImportIn.collectAll[Call] + + override def label: String = { + Import.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "explicitAs" + case 4 => "importedAs" + case 5 => "importedEntity" + case 6 => "isExplicit" + case 7 => "isWildcard" + case 8 => "lineNumber" + case 9 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => explicitAs + case 4 => importedAs + case 5 => importedEntity + case 6 => isExplicit + case 7 => isWildcard + case 8 => lineNumber + case 9 => order + } + + override def productPrefix = "Import" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ImportDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "EXPLICIT_AS" => this._explicitAs + case "IMPORTED_AS" => this._importedAs + case "IMPORTED_ENTITY" => this._importedEntity + case "IS_EXPLICIT" => this._isExplicit + case "IS_WILDCARD" => this._isWildcard + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "EXPLICIT_AS" => this._explicitAs = value.asInstanceOf[java.lang.Boolean] + case "IMPORTED_AS" => this._importedAs = value.asInstanceOf[String] + case "IMPORTED_ENTITY" => this._importedEntity = value.asInstanceOf[String] + case "IS_EXPLICIT" => this._isExplicit = value.asInstanceOf[java.lang.Boolean] + case "IS_WILDCARD" => this._isWildcard = value.asInstanceOf[java.lang.Boolean] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewImport].code + this._columnNumber = newNode.asInstanceOf[NewImport].columnNumber.orNull + this._explicitAs = newNode.asInstanceOf[NewImport].explicitAs.orNull + this._importedAs = newNode.asInstanceOf[NewImport].importedAs.orNull + this._importedEntity = newNode.asInstanceOf[NewImport].importedEntity.orNull + this._isExplicit = newNode.asInstanceOf[NewImport].isExplicit.orNull + this._isWildcard = newNode.asInstanceOf[NewImport].isWildcard.orNull + this._lineNumber = newNode.asInstanceOf[NewImport].lineNumber.orNull + this._order = newNode.asInstanceOf[NewImport].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala new file mode 100644 index 0000000..bc9550a --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala @@ -0,0 +1,266 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object JumpLabel { + def apply(graph: Graph, id: Long) = new JumpLabel(graph, id) + + val Label = "JUMP_LABEL" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val ParserTypeName = "PARSER_TYPE_NAME" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Name, Order, ParserTypeName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val ParserTypeName = new overflowdb.PropertyKey[String]("PARSER_TYPE_NAME") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + val ParserTypeName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[JumpLabelDb] { + override val forLabel = JumpLabel.Label + + override def createNode(ref: NodeRef[JumpLabelDb]) = + new JumpLabelDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = JumpLabel(graph, id) + } +} + +trait JumpLabelBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def parserTypeName: String + +} + +class JumpLabel(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[JumpLabelDb](graph_4762, id_4762) + with JumpLabelBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def parserTypeName: String = get().parserTypeName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => JumpLabel.PropertyDefaults.Code + case "NAME" => JumpLabel.PropertyDefaults.Name + case "ORDER" => JumpLabel.PropertyDefaults.Order + case "PARSER_TYPE_NAME" => JumpLabel.PropertyDefaults.ParserTypeName + case _ => super.propertyDefaultValue(propertyKey) + } + + def astIn: Iterator[ControlStructure] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + JumpLabel.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + case 6 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + case 6 => parserTypeName + } + + override def productPrefix = "JumpLabel" + override def productArity = 7 +} + +class JumpLabelDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with JumpLabelBase { + + override def layoutInformation: NodeLayoutInformation = JumpLabel.layoutInformation + + private var _code: String = JumpLabel.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = JumpLabel.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = JumpLabel.PropertyDefaults.Order + def order: scala.Int = _order + private var _parserTypeName: String = JumpLabel.PropertyDefaults.ParserTypeName + def parserTypeName: String = _parserTypeName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("PARSER_TYPE_NAME", parserTypeName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == parserTypeName)) { properties.put("PARSER_TYPE_NAME", parserTypeName) } + + properties + } + + import overflowdb.traversal._ + def astIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](0) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + + override def label: String = { + JumpLabel.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + case 6 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + case 6 => parserTypeName + } + + override def productPrefix = "JumpLabel" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[JumpLabelDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "PARSER_TYPE_NAME" => this._parserTypeName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "PARSER_TYPE_NAME" => this._parserTypeName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewJumpLabel].code + this._columnNumber = newNode.asInstanceOf[NewJumpLabel].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewJumpLabel].lineNumber.orNull + this._name = newNode.asInstanceOf[NewJumpLabel].name + this._order = newNode.asInstanceOf[NewJumpLabel].order + this._parserTypeName = newNode.asInstanceOf[NewJumpLabel].parserTypeName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala new file mode 100644 index 0000000..3a5414d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala @@ -0,0 +1,791 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object JumpTarget { + def apply(graph: Graph, id: Long) = new JumpTarget(graph, id) + + val Label = "JUMP_TARGET" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val ParserTypeName = "PARSER_TYPE_NAME" + val all: Set[String] = Set(ArgumentIndex, Code, ColumnNumber, LineNumber, Name, Order, ParserTypeName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val ParserTypeName = new overflowdb.PropertyKey[String]("PARSER_TYPE_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Name = "" + val Order = -1: Int + val ParserTypeName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("CDG", "CFG", "DOMINATE", "POINTS_TO", "POST_DOMINATE", "TAGGED_BY") + val In: Array[String] = + Array("ARGUMENT", "AST", "CDG", "CFG", "CONDITION", "CONTAINS", "DOMINATE", "POINTS_TO", "POST_DOMINATE") + } + + val factory = new NodeFactory[JumpTargetDb] { + override val forLabel = JumpTarget.Label + + override def createNode(ref: NodeRef[JumpTargetDb]) = + new JumpTargetDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = JumpTarget(graph, id) + } +} + +trait JumpTargetBase extends AbstractNode with AstNodeBase with CfgNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def parserTypeName: String + +} + +class JumpTarget(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[JumpTargetDb](graph_4762, id_4762) + with JumpTargetBase + with StoredNode + with AstNode + with CfgNode { + override def argumentIndex: scala.Int = get().argumentIndex + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def parserTypeName: String = get().parserTypeName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => JumpTarget.PropertyDefaults.ArgumentIndex + case "CODE" => JumpTarget.PropertyDefaults.Code + case "NAME" => JumpTarget.PropertyDefaults.Name + case "ORDER" => JumpTarget.PropertyDefaults.Order + case "PARSER_TYPE_NAME" => JumpTarget.PropertyDefaults.ParserTypeName + case _ => super.propertyDefaultValue(propertyKey) + } + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + JumpTarget.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "code" + case 3 => "columnNumber" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + case 7 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => code + case 3 => columnNumber + case 4 => lineNumber + case 5 => name + case 6 => order + case 7 => parserTypeName + } + + override def productPrefix = "JumpTarget" + override def productArity = 8 +} + +class JumpTargetDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with CfgNode + with JumpTargetBase { + + override def layoutInformation: NodeLayoutInformation = JumpTarget.layoutInformation + + private var _argumentIndex: scala.Int = JumpTarget.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _code: String = JumpTarget.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = JumpTarget.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = JumpTarget.PropertyDefaults.Order + def order: scala.Int = _order + private var _parserTypeName: String = JumpTarget.PropertyDefaults.ParserTypeName + def parserTypeName: String = _parserTypeName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("PARSER_TYPE_NAME", parserTypeName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == parserTypeName)) { properties.put("PARSER_TYPE_NAME", parserTypeName) } + + properties + } + + import overflowdb.traversal._ + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](0) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](5) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](6) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = argumentIn.collectAll[Call] + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = argumentIn.collectAll[Return] + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](7) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](9) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](10) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](11) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](14) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + override def label: String = { + JumpTarget.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "code" + case 3 => "columnNumber" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + case 7 => "parserTypeName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => code + case 3 => columnNumber + case 4 => lineNumber + case 5 => name + case 6 => order + case 7 => parserTypeName + } + + override def productPrefix = "JumpTarget" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[JumpTargetDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "PARSER_TYPE_NAME" => this._parserTypeName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "PARSER_TYPE_NAME" => this._parserTypeName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewJumpTarget].argumentIndex + this._code = newNode.asInstanceOf[NewJumpTarget].code + this._columnNumber = newNode.asInstanceOf[NewJumpTarget].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewJumpTarget].lineNumber.orNull + this._name = newNode.asInstanceOf[NewJumpTarget].name + this._order = newNode.asInstanceOf[NewJumpTarget].order + this._parserTypeName = newNode.asInstanceOf[NewJumpTarget].parserTypeName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala new file mode 100644 index 0000000..2b1d903 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala @@ -0,0 +1,186 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object KeyValuePair { + def apply(graph: Graph, id: Long) = new KeyValuePair(graph, id) + + val Label = "KEY_VALUE_PAIR" + + object PropertyNames { + val Key = "KEY" + val Value = "VALUE" + val all: Set[String] = Set(Key, Value) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Key = new overflowdb.PropertyKey[String]("KEY") + val Value = new overflowdb.PropertyKey[String]("VALUE") + + } + + object PropertyDefaults { + val Key = "" + val Value = "" + } + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[KeyValuePairDb] { + override val forLabel = KeyValuePair.Label + + override def createNode(ref: NodeRef[KeyValuePairDb]) = + new KeyValuePairDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = KeyValuePair(graph, id) + } +} + +trait KeyValuePairBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def key: String + def value: String + +} + +class KeyValuePair(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[KeyValuePairDb](graph_4762, id_4762) + with KeyValuePairBase + with StoredNode { + override def key: String = get().key + override def value: String = get().value + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "KEY" => KeyValuePair.PropertyDefaults.Key + case "VALUE" => KeyValuePair.PropertyDefaults.Value + case _ => super.propertyDefaultValue(propertyKey) + } + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + KeyValuePair.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "key" + case 2 => "value" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => key + case 2 => value + } + + override def productPrefix = "KeyValuePair" + override def productArity = 3 +} + +class KeyValuePairDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with KeyValuePairBase { + + override def layoutInformation: NodeLayoutInformation = KeyValuePair.layoutInformation + + private var _key: String = KeyValuePair.PropertyDefaults.Key + def key: String = _key + private var _value: String = KeyValuePair.PropertyDefaults.Value + def value: String = _value + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("KEY", key) + properties.put("VALUE", value) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == key)) { properties.put("KEY", key) } + if (!(("") == value)) { properties.put("VALUE", value) } + + properties + } + + import overflowdb.traversal._ + + override def label: String = { + KeyValuePair.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "key" + case 2 => "value" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => key + case 2 => value + } + + override def productPrefix = "KeyValuePair" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[KeyValuePairDb] + + override def property(key: String): Any = { + key match { + case "KEY" => this._key + case "VALUE" => this._value + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "KEY" => this._key = value.asInstanceOf[String] + case "VALUE" => this._value = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._key = newNode.asInstanceOf[NewKeyValuePair].key + this._value = newNode.asInstanceOf[NewKeyValuePair].value + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala new file mode 100644 index 0000000..f59c958 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala @@ -0,0 +1,1019 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Literal { + def apply(graph: Graph, id: Long) = new Literal(graph, id) + + val Label = "LITERAL" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[LiteralDb] { + override val forLabel = Literal.Label + + override def createNode(ref: NodeRef[LiteralDb]) = + new LiteralDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Literal(graph, id) + } +} + +trait LiteralBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def order: scala.Int + def typeFullName: String + +} + +class Literal(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[LiteralDb](graph_4762, id_4762) + with LiteralBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Literal.PropertyDefaults.ArgumentIndex + case "CODE" => Literal.PropertyDefaults.Code + case "ORDER" => Literal.PropertyDefaults.Order + case "TYPE_FULL_NAME" => Literal.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Option[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to ARRAY_INITIALIZER via AST IN edge. + */ + def _arrayInitializerViaAstIn: overflowdb.traversal.Traversal[ArrayInitializer] = get()._arrayInitializerViaAstIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: ControlStructure = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: Option[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Literal.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Literal" + override def productArity = 9 +} + +class LiteralDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with LiteralBase { + + override def layoutInformation: NodeLayoutInformation = Literal.layoutInformation + + private var _argumentIndex: scala.Int = Literal.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Literal.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Literal.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = Literal.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](4) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](8) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](9) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _callViaArgumentIn: Option[Call] = argumentIn.collectAll[Call].nextOption() + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](10) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _arrayInitializerViaAstIn: overflowdb.traversal.Traversal[ArrayInitializer] = astIn.collectAll[ArrayInitializer] + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: ControlStructure = try { astIn.collectAll[ControlStructure].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent CONTROL_STRUCTURE is mandatory, but not defined for this LITERAL node with id=" + id, + e + ) + } + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](11) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](13) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](14) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](15) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](19) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _callViaReceiverIn: Option[Call] = receiverIn.collectAll[Call].nextOption() + + override def label: String = { + Literal.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Literal" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[LiteralDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewLiteral].argumentIndex + this._argumentName = newNode.asInstanceOf[NewLiteral].argumentName.orNull + this._code = newNode.asInstanceOf[NewLiteral].code + this._columnNumber = newNode.asInstanceOf[NewLiteral].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewLiteral].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewLiteral].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewLiteral].lineNumber.orNull + this._order = newNode.asInstanceOf[NewLiteral].order + this._typeFullName = newNode.asInstanceOf[NewLiteral].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala new file mode 100644 index 0000000..cdaae78 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala @@ -0,0 +1,401 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Local { + def apply(graph: Graph, id: Long) = new Local(graph, id) + + val Label = "LOCAL" + + object PropertyNames { + val ClosureBindingId = "CLOSURE_BINDING_ID" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(ClosureBindingId, Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Name, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ClosureBindingId = new overflowdb.PropertyKey[String]("CLOSURE_BINDING_ID") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.CapturedBy.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("CAPTURED_BY", "EVAL_TYPE", "TAGGED_BY") + val In: Array[String] = Array("AST", "REF") + } + + val factory = new NodeFactory[LocalDb] { + override val forLabel = Local.Label + + override def createNode(ref: NodeRef[LocalDb]) = + new LocalDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Local(graph, id) + } +} + +trait LocalBase extends AbstractNode with AstNodeBase with DeclarationBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def closureBindingId: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def typeFullName: String + +} + +class Local(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[LocalDb](graph_4762, id_4762) + with LocalBase + with StoredNode + with AstNode + with Declaration { + override def closureBindingId: Option[String] = get().closureBindingId + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Local.PropertyDefaults.Code + case "NAME" => Local.PropertyDefaults.Name + case "ORDER" => Local.PropertyDefaults.Order + case "TYPE_FULL_NAME" => Local.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def capturedByOut: Iterator[ClosureBinding] = get().capturedByOut + override def _capturedByOut = get()._capturedByOut + + /** Traverse to CLOSURE_BINDING via CAPTURED_BY OUT edge. + */ + def _closureBindingViaCapturedByOut: overflowdb.traversal.Traversal[ClosureBinding] = + get()._closureBindingViaCapturedByOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** The type of the local. Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** The type of the local. */ + @overflowdb.traversal.help.Doc(info = """The type of the local.""") + def typ: overflowdb.traversal.Traversal[Type] = get().typ + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** The block in which local is declared. Traverse to BLOCK via AST IN edge. + */ + /** The block in which local is declared. */ + @overflowdb.traversal.help.Doc(info = """The block in which local is declared.""") + def definingBlock: overflowdb.traversal.Traversal[Block] = get().definingBlock + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def refIn: Iterator[StoredNode] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to CLOSURE_BINDING via REF IN edge. + */ + def _closureBindingViaRefIn: overflowdb.traversal.Traversal[ClosureBinding] = get()._closureBindingViaRefIn + + /** Places (identifier) where this local is being referenced Traverse to IDENTIFIER via REF IN edge. + */ + /** Places (identifier) where this local is being referenced */ + @overflowdb.traversal.help.Doc(info = """Places (identifier) where this local is being referenced""") + def referencingIdentifiers: overflowdb.traversal.Traversal[Identifier] = get().referencingIdentifiers + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Local.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "closureBindingId" + case 2 => "code" + case 3 => "columnNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => closureBindingId + case 2 => code + case 3 => columnNumber + case 4 => dynamicTypeHintFullName + case 5 => lineNumber + case 6 => name + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Local" + override def productArity = 9 +} + +class LocalDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with Declaration with LocalBase { + + override def layoutInformation: NodeLayoutInformation = Local.layoutInformation + + private var _closureBindingId: String = null + def closureBindingId: Option[String] = Option(_closureBindingId) + private var _code: String = Local.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = Local.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Local.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = Local.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + closureBindingId.map { value => properties.put("CLOSURE_BINDING_ID", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + closureBindingId.map { value => properties.put("CLOSURE_BINDING_ID", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def capturedByOut: Iterator[ClosureBinding] = createAdjacentNodeScalaIteratorByOffSet[ClosureBinding](0) + override def _capturedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _closureBindingViaCapturedByOut: overflowdb.traversal.Traversal[ClosureBinding] = + capturedByOut.collectAll[ClosureBinding] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](1) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def typ: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](2) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](3) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def definingBlock: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def refIn: Iterator[StoredNode] = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _closureBindingViaRefIn: overflowdb.traversal.Traversal[ClosureBinding] = refIn.collectAll[ClosureBinding] + def referencingIdentifiers: overflowdb.traversal.Traversal[Identifier] = refIn.collectAll[Identifier] + + override def label: String = { + Local.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "closureBindingId" + case 2 => "code" + case 3 => "columnNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => closureBindingId + case 2 => code + case 3 => columnNumber + case 4 => dynamicTypeHintFullName + case 5 => lineNumber + case 6 => name + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "Local" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[LocalDb] + + override def property(key: String): Any = { + key match { + case "CLOSURE_BINDING_ID" => this._closureBindingId + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CLOSURE_BINDING_ID" => this._closureBindingId = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._closureBindingId = newNode.asInstanceOf[NewLocal].closureBindingId.orNull + this._code = newNode.asInstanceOf[NewLocal].code + this._columnNumber = newNode.asInstanceOf[NewLocal].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewLocal].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewLocal].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewLocal].lineNumber.orNull + this._name = newNode.asInstanceOf[NewLocal].name + this._order = newNode.asInstanceOf[NewLocal].order + this._typeFullName = newNode.asInstanceOf[NewLocal].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala new file mode 100644 index 0000000..58d562e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala @@ -0,0 +1,331 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Location { + def apply(graph: Graph, id: Long) = new Location(graph, id) + + val Label = "LOCATION" + + object PropertyNames { + val ClassName = "CLASS_NAME" + val ClassShortName = "CLASS_SHORT_NAME" + val Filename = "FILENAME" + val LineNumber = "LINE_NUMBER" + val MethodFullName = "METHOD_FULL_NAME" + val MethodShortName = "METHOD_SHORT_NAME" + val NodeLabel = "NODE_LABEL" + val PackageName = "PACKAGE_NAME" + val Symbol = "SYMBOL" + val Node = "node" + val all: Set[String] = Set( + ClassName, + ClassShortName, + Filename, + LineNumber, + MethodFullName, + MethodShortName, + NodeLabel, + PackageName, + Symbol, + Node + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ClassName = new overflowdb.PropertyKey[String]("CLASS_NAME") + val ClassShortName = new overflowdb.PropertyKey[String]("CLASS_SHORT_NAME") + val Filename = new overflowdb.PropertyKey[String]("FILENAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val MethodFullName = new overflowdb.PropertyKey[String]("METHOD_FULL_NAME") + val MethodShortName = new overflowdb.PropertyKey[String]("METHOD_SHORT_NAME") + val NodeLabel = new overflowdb.PropertyKey[String]("NODE_LABEL") + val PackageName = new overflowdb.PropertyKey[String]("PACKAGE_NAME") + val Symbol = new overflowdb.PropertyKey[String]("SYMBOL") + val Node = new overflowdb.PropertyKey[StoredNode]("node") + } + + object PropertyDefaults { + val ClassName = "" + val ClassShortName = "" + val Filename = "" + val MethodFullName = "" + val MethodShortName = "" + val NodeLabel = "" + val PackageName = "" + val Symbol = "" + } + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[LocationDb] { + override val forLabel = Location.Label + + override def createNode(ref: NodeRef[LocationDb]) = + new LocationDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Location(graph, id) + } +} + +trait LocationBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def className: String + def classShortName: String + def filename: String + def lineNumber: Option[Integer] + def methodFullName: String + def methodShortName: String + def nodeLabel: String + def packageName: String + def symbol: String + + def node: Option[AbstractNode] +} + +class Location(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[LocationDb](graph_4762, id_4762) + with LocationBase + with StoredNode { + override def className: String = get().className + override def classShortName: String = get().classShortName + override def filename: String = get().filename + override def lineNumber: Option[Integer] = get().lineNumber + override def methodFullName: String = get().methodFullName + override def methodShortName: String = get().methodShortName + override def nodeLabel: String = get().nodeLabel + override def packageName: String = get().packageName + override def symbol: String = get().symbol + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CLASS_NAME" => Location.PropertyDefaults.ClassName + case "CLASS_SHORT_NAME" => Location.PropertyDefaults.ClassShortName + case "FILENAME" => Location.PropertyDefaults.Filename + case "METHOD_FULL_NAME" => Location.PropertyDefaults.MethodFullName + case "METHOD_SHORT_NAME" => Location.PropertyDefaults.MethodShortName + case "NODE_LABEL" => Location.PropertyDefaults.NodeLabel + case "PACKAGE_NAME" => Location.PropertyDefaults.PackageName + case "SYMBOL" => Location.PropertyDefaults.Symbol + case _ => super.propertyDefaultValue(propertyKey) + } + + def node: Option[StoredNode] = get().node + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Location.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "className" + case 2 => "classShortName" + case 3 => "filename" + case 4 => "lineNumber" + case 5 => "methodFullName" + case 6 => "methodShortName" + case 7 => "nodeLabel" + case 8 => "packageName" + case 9 => "symbol" + case 10 => "node" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => className + case 2 => classShortName + case 3 => filename + case 4 => lineNumber + case 5 => methodFullName + case 6 => methodShortName + case 7 => nodeLabel + case 8 => packageName + case 9 => symbol + case 10 => node + } + + override def productPrefix = "Location" + override def productArity = 11 +} + +class LocationDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with LocationBase { + + override def layoutInformation: NodeLayoutInformation = Location.layoutInformation + + private var _className: String = Location.PropertyDefaults.ClassName + def className: String = _className + private var _classShortName: String = Location.PropertyDefaults.ClassShortName + def classShortName: String = _classShortName + private var _filename: String = Location.PropertyDefaults.Filename + def filename: String = _filename + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _methodFullName: String = Location.PropertyDefaults.MethodFullName + def methodFullName: String = _methodFullName + private var _methodShortName: String = Location.PropertyDefaults.MethodShortName + def methodShortName: String = _methodShortName + private var _nodeLabel: String = Location.PropertyDefaults.NodeLabel + def nodeLabel: String = _nodeLabel + private var _packageName: String = Location.PropertyDefaults.PackageName + def packageName: String = _packageName + private var _symbol: String = Location.PropertyDefaults.Symbol + def symbol: String = _symbol + + private var _node: StoredNode = null + def node: Option[StoredNode] = Option(this._node) + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CLASS_NAME", className) + properties.put("CLASS_SHORT_NAME", classShortName) + properties.put("FILENAME", filename) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("METHOD_FULL_NAME", methodFullName) + properties.put("METHOD_SHORT_NAME", methodShortName) + properties.put("NODE_LABEL", nodeLabel) + properties.put("PACKAGE_NAME", packageName) + properties.put("SYMBOL", symbol) + node.map { value => properties.put("node", value) } + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == className)) { properties.put("CLASS_NAME", className) } + if (!(("") == classShortName)) { properties.put("CLASS_SHORT_NAME", classShortName) } + if (!(("") == filename)) { properties.put("FILENAME", filename) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == methodFullName)) { properties.put("METHOD_FULL_NAME", methodFullName) } + if (!(("") == methodShortName)) { properties.put("METHOD_SHORT_NAME", methodShortName) } + if (!(("") == nodeLabel)) { properties.put("NODE_LABEL", nodeLabel) } + if (!(("") == packageName)) { properties.put("PACKAGE_NAME", packageName) } + if (!(("") == symbol)) { properties.put("SYMBOL", symbol) } + node.map { value => properties.put("node", value) } + properties + } + + import overflowdb.traversal._ + + override def label: String = { + Location.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "className" + case 2 => "classShortName" + case 3 => "filename" + case 4 => "lineNumber" + case 5 => "methodFullName" + case 6 => "methodShortName" + case 7 => "nodeLabel" + case 8 => "packageName" + case 9 => "symbol" + case 10 => "node" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => className + case 2 => classShortName + case 3 => filename + case 4 => lineNumber + case 5 => methodFullName + case 6 => methodShortName + case 7 => nodeLabel + case 8 => packageName + case 9 => symbol + case 10 => node + } + + override def productPrefix = "Location" + override def productArity = 11 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[LocationDb] + + override def property(key: String): Any = { + key match { + case "CLASS_NAME" => this._className + case "CLASS_SHORT_NAME" => this._classShortName + case "FILENAME" => this._filename + case "LINE_NUMBER" => this._lineNumber + case "METHOD_FULL_NAME" => this._methodFullName + case "METHOD_SHORT_NAME" => this._methodShortName + case "NODE_LABEL" => this._nodeLabel + case "PACKAGE_NAME" => this._packageName + case "SYMBOL" => this._symbol + case "node" => this._node + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CLASS_NAME" => this._className = value.asInstanceOf[String] + case "CLASS_SHORT_NAME" => this._classShortName = value.asInstanceOf[String] + case "FILENAME" => this._filename = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "METHOD_FULL_NAME" => this._methodFullName = value.asInstanceOf[String] + case "METHOD_SHORT_NAME" => this._methodShortName = value.asInstanceOf[String] + case "NODE_LABEL" => this._nodeLabel = value.asInstanceOf[String] + case "PACKAGE_NAME" => this._packageName = value.asInstanceOf[String] + case "SYMBOL" => this._symbol = value.asInstanceOf[String] + case "node" => this._node = value.asInstanceOf[StoredNode] + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._className = newNode.asInstanceOf[NewLocation].className + this._classShortName = newNode.asInstanceOf[NewLocation].classShortName + this._filename = newNode.asInstanceOf[NewLocation].filename + this._lineNumber = newNode.asInstanceOf[NewLocation].lineNumber.orNull + this._methodFullName = newNode.asInstanceOf[NewLocation].methodFullName + this._methodShortName = newNode.asInstanceOf[NewLocation].methodShortName + this._nodeLabel = newNode.asInstanceOf[NewLocation].nodeLabel + this._packageName = newNode.asInstanceOf[NewLocation].packageName + this._symbol = newNode.asInstanceOf[NewLocation].symbol + this._node = newNode.asInstanceOf[NewLocation].node match { + case null | None => null + case Some(newNode: NewNode) => mapping(newNode).asInstanceOf[StoredNode] + case Some(oldNode: StoredNode) => oldNode.asInstanceOf[StoredNode] + case _ => throw new MatchError("unreachable") + } + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala new file mode 100644 index 0000000..047955f --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala @@ -0,0 +1,378 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Member { + def apply(graph: Graph, id: Long) = new Member(graph, id) + + val Label = "MEMBER" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set(Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Name, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST", "EVAL_TYPE", "TAGGED_BY") + val In: Array[String] = Array("AST", "REF") + } + + val factory = new NodeFactory[MemberDb] { + override val forLabel = Member.Label + + override def createNode(ref: NodeRef[MemberDb]) = + new MemberDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Member(graph, id) + } +} + +trait MemberBase extends AbstractNode with AstNodeBase with DeclarationBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def typeFullName: String + +} + +class Member(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MemberDb](graph_4762, id_4762) + with MemberBase + with StoredNode + with AstNode + with Declaration { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Member.PropertyDefaults.Code + case "NAME" => Member.PropertyDefaults.Name + case "ORDER" => Member.PropertyDefaults.Order + case "TYPE_FULL_NAME" => Member.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION via AST OUT edge. + */ + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstOut + + /** Traverse to MODIFIER via AST OUT edge. + */ + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = get()._modifierViaAstOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to member type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to member type */ + @overflowdb.traversal.help.Doc(info = """Traverse to member type""") + def typ: overflowdb.traversal.Traversal[Type] = get().typ + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** The type declaration this member is defined in Traverse to TYPE_DECL via AST IN edge. + */ + /** The type declaration this member is defined in */ + @overflowdb.traversal.help.Doc(info = """The type declaration this member is defined in""") + def typeDecl: TypeDecl = get().typeDecl + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def refIn: Iterator[Call] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to CALL via REF IN edge. + */ + def _callViaRefIn: overflowdb.traversal.Traversal[Call] = get()._callViaRefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Member.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + case 7 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => lineNumber + case 5 => name + case 6 => order + case 7 => typeFullName + } + + override def productPrefix = "Member" + override def productArity = 8 +} + +class MemberDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with Declaration with MemberBase { + + override def layoutInformation: NodeLayoutInformation = Member.layoutInformation + + private var _code: String = Member.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = Member.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Member.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = Member.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = astOut.collectAll[Annotation] + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = astOut.collectAll[Modifier] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](1) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def typ: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](2) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def typeDecl: TypeDecl = try { astIn.collectAll[TypeDecl].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent TYPE_DECL is mandatory, but not defined for this MEMBER node with id=" + id, + e + ) + } + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def refIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](4) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _callViaRefIn: overflowdb.traversal.Traversal[Call] = refIn.collectAll[Call] + + override def label: String = { + Member.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "lineNumber" + case 5 => "name" + case 6 => "order" + case 7 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => lineNumber + case 5 => name + case 6 => order + case 7 => typeFullName + } + + override def productPrefix = "Member" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MemberDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewMember].code + this._columnNumber = newNode.asInstanceOf[NewMember].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewMember].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewMember].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewMember].lineNumber.orNull + this._name = newNode.asInstanceOf[NewMember].name + this._order = newNode.asInstanceOf[NewMember].order + this._typeFullName = newNode.asInstanceOf[NewMember].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala new file mode 100644 index 0000000..9ce9622 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala @@ -0,0 +1,252 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object MetaData { + def apply(graph: Graph, id: Long) = new MetaData(graph, id) + + val Label = "META_DATA" + + object PropertyNames { + val Hash = "HASH" + val Language = "LANGUAGE" + val Overlays = "OVERLAYS" + val Root = "ROOT" + val Version = "VERSION" + val all: Set[String] = Set(Hash, Language, Overlays, Root, Version) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Hash = new overflowdb.PropertyKey[String]("HASH") + val Language = new overflowdb.PropertyKey[String]("LANGUAGE") + val Overlays = new overflowdb.PropertyKey[IndexedSeq[String]]("OVERLAYS") + val Root = new overflowdb.PropertyKey[String]("ROOT") + val Version = new overflowdb.PropertyKey[String]("VERSION") + + } + + object PropertyDefaults { + val Language = "" + val Root = "" + val Version = "" + } + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[MetaDataDb] { + override val forLabel = MetaData.Label + + override def createNode(ref: NodeRef[MetaDataDb]) = + new MetaDataDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = MetaData(graph, id) + } +} + +trait MetaDataBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def hash: Option[String] + def language: String + def overlays: IndexedSeq[String] + def root: String + def version: String + +} + +class MetaData(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MetaDataDb](graph_4762, id_4762) + with MetaDataBase + with StoredNode { + override def hash: Option[String] = get().hash + override def language: String = get().language + override def overlays: IndexedSeq[String] = get().overlays + override def root: String = get().root + override def version: String = get().version + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "LANGUAGE" => MetaData.PropertyDefaults.Language + case "ROOT" => MetaData.PropertyDefaults.Root + case "VERSION" => MetaData.PropertyDefaults.Version + case _ => super.propertyDefaultValue(propertyKey) + } + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + MetaData.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "hash" + case 2 => "language" + case 3 => "overlays" + case 4 => "root" + case 5 => "version" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => hash + case 2 => language + case 3 => overlays + case 4 => root + case 5 => version + } + + override def productPrefix = "MetaData" + override def productArity = 6 +} + +class MetaDataDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with MetaDataBase { + + override def layoutInformation: NodeLayoutInformation = MetaData.layoutInformation + + private var _hash: String = null + def hash: Option[String] = Option(_hash) + private var _language: String = MetaData.PropertyDefaults.Language + def language: String = _language + private var _overlays: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def overlays: IndexedSeq[String] = _overlays + private var _root: String = MetaData.PropertyDefaults.Root + def root: String = _root + private var _version: String = MetaData.PropertyDefaults.Version + def version: String = _version + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + hash.map { value => properties.put("HASH", value) } + properties.put("LANGUAGE", language) + if (this._overlays != null && this._overlays.nonEmpty) { properties.put("OVERLAYS", overlays) } + properties.put("ROOT", root) + properties.put("VERSION", version) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + hash.map { value => properties.put("HASH", value) } + if (!(("") == language)) { properties.put("LANGUAGE", language) } + if (this._overlays != null && this._overlays.nonEmpty) { properties.put("OVERLAYS", overlays) } + if (!(("") == root)) { properties.put("ROOT", root) } + if (!(("") == version)) { properties.put("VERSION", version) } + + properties + } + + import overflowdb.traversal._ + + override def label: String = { + MetaData.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "hash" + case 2 => "language" + case 3 => "overlays" + case 4 => "root" + case 5 => "version" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => hash + case 2 => language + case 3 => overlays + case 4 => root + case 5 => version + } + + override def productPrefix = "MetaData" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MetaDataDb] + + override def property(key: String): Any = { + key match { + case "HASH" => this._hash + case "LANGUAGE" => this._language + case "OVERLAYS" => this._overlays + case "ROOT" => this._root + case "VERSION" => this._version + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "HASH" => this._hash = value.asInstanceOf[String] + case "LANGUAGE" => this._language = value.asInstanceOf[String] + case "OVERLAYS" => + this._overlays = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "ROOT" => this._root = value.asInstanceOf[String] + case "VERSION" => this._version = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._hash = newNode.asInstanceOf[NewMetaData].hash.orNull + this._language = newNode.asInstanceOf[NewMetaData].language + this._overlays = + if (newNode.asInstanceOf[NewMetaData].overlays != null) newNode.asInstanceOf[NewMetaData].overlays + else collection.immutable.ArraySeq.empty + this._root = newNode.asInstanceOf[NewMetaData].root + this._version = newNode.asInstanceOf[NewMetaData].version + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala new file mode 100644 index 0000000..bb85e06 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala @@ -0,0 +1,869 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Method { + def apply(graph: Graph, id: Long) = new Method(graph, id) + + val Label = "METHOD" + + object PropertyNames { + val AstParentFullName = "AST_PARENT_FULL_NAME" + val AstParentType = "AST_PARENT_TYPE" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val ColumnNumberEnd = "COLUMN_NUMBER_END" + val Filename = "FILENAME" + val FullName = "FULL_NAME" + val Hash = "HASH" + val IsExternal = "IS_EXTERNAL" + val LineNumber = "LINE_NUMBER" + val LineNumberEnd = "LINE_NUMBER_END" + val Name = "NAME" + val Order = "ORDER" + val Signature = "SIGNATURE" + val all: Set[String] = Set( + AstParentFullName, + AstParentType, + Code, + ColumnNumber, + ColumnNumberEnd, + Filename, + FullName, + Hash, + IsExternal, + LineNumber, + LineNumberEnd, + Name, + Order, + Signature + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val AstParentFullName = new overflowdb.PropertyKey[String]("AST_PARENT_FULL_NAME") + val AstParentType = new overflowdb.PropertyKey[String]("AST_PARENT_TYPE") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val ColumnNumberEnd = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER_END") + val Filename = new overflowdb.PropertyKey[String]("FILENAME") + val FullName = new overflowdb.PropertyKey[String]("FULL_NAME") + val Hash = new overflowdb.PropertyKey[String]("HASH") + val IsExternal = new overflowdb.PropertyKey[Boolean]("IS_EXTERNAL") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val LineNumberEnd = new overflowdb.PropertyKey[Integer]("LINE_NUMBER_END") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val Signature = new overflowdb.PropertyKey[String]("SIGNATURE") + + } + + object PropertyDefaults { + val AstParentFullName = "" + val AstParentType = "" + val Code = "" + val Filename = "" + val FullName = "" + val IsExternal = false + val Name = "" + val Order = -1: Int + val Signature = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Call.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = + Array("AST", "CFG", "CONTAINS", "DOMINATE", "POINTS_TO", "REACHING_DEF", "SOURCE_FILE", "TAGGED_BY") + val In: Array[String] = Array("AST", "CALL", "CFG", "CONTAINS", "POINTS_TO", "POST_DOMINATE", "REF") + } + + val factory = new NodeFactory[MethodDb] { + override val forLabel = Method.Label + + override def createNode(ref: NodeRef[MethodDb]) = + new MethodDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Method(graph, id) + } +} + +trait MethodBase extends AbstractNode with AstNodeBase with CfgNodeBase with DeclarationBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def astParentFullName: String + def astParentType: String + def code: String + def columnNumber: Option[Integer] + def columnNumberEnd: Option[Integer] + def filename: String + def fullName: String + def hash: Option[String] + def isExternal: Boolean + def lineNumber: Option[Integer] + def lineNumberEnd: Option[Integer] + def name: String + def order: scala.Int + def signature: String + +} + +class Method(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MethodDb](graph_4762, id_4762) + with MethodBase + with StoredNode + with AstNode + with CfgNode + with Declaration { + override def astParentFullName: String = get().astParentFullName + override def astParentType: String = get().astParentType + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def columnNumberEnd: Option[Integer] = get().columnNumberEnd + override def filename: String = get().filename + override def fullName: String = get().fullName + override def hash: Option[String] = get().hash + override def isExternal: Boolean = get().isExternal + override def lineNumber: Option[Integer] = get().lineNumber + override def lineNumberEnd: Option[Integer] = get().lineNumberEnd + override def name: String = get().name + override def order: scala.Int = get().order + override def signature: String = get().signature + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "AST_PARENT_FULL_NAME" => Method.PropertyDefaults.AstParentFullName + case "AST_PARENT_TYPE" => Method.PropertyDefaults.AstParentType + case "CODE" => Method.PropertyDefaults.Code + case "FILENAME" => Method.PropertyDefaults.Filename + case "FULL_NAME" => Method.PropertyDefaults.FullName + case "IS_EXTERNAL" => Method.PropertyDefaults.IsExternal + case "NAME" => Method.PropertyDefaults.Name + case "ORDER" => Method.PropertyDefaults.Order + case "SIGNATURE" => Method.PropertyDefaults.Signature + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION via AST OUT edge. + */ + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstOut + + /** Root of the abstract syntax tree Traverse to BLOCK via AST OUT edge. + */ + /** Root of the abstract syntax tree */ + @overflowdb.traversal.help.Doc(info = """Root of the abstract syntax tree""") + def block: Block = get().block + + /** Traverse to METHOD via AST OUT edge. + */ + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = get()._methodViaAstOut + + /** Parameters of the method Traverse to METHOD_PARAMETER_IN via AST OUT edge. + */ + /** Parameters of the method */ + @overflowdb.traversal.help.Doc(info = """Parameters of the method""") + def parameter: overflowdb.traversal.Traversal[MethodParameterIn] = get().parameter + + /** Traverse to METHOD_PARAMETER_OUT via AST OUT edge. + */ + def _methodParameterOutViaAstOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaAstOut + + /** Formal return parameters Traverse to METHOD_RETURN via AST OUT edge. + */ + /** Formal return parameters */ + @overflowdb.traversal.help.Doc(info = """Formal return parameters""") + def methodReturn: MethodReturn = get().methodReturn + + /** Traverse to MODIFIER via AST OUT edge. + */ + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = get()._modifierViaAstOut + + /** Traverse to TYPE_DECL via AST OUT edge. + */ + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstOut + + /** Traverse to TYPE_PARAMETER via AST OUT edge. + */ + def _typeParameterViaAstOut: overflowdb.traversal.Traversal[TypeParameter] = get()._typeParameterViaAstOut + + def cfgOut: Iterator[AstNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** First control flow graph node Traverse to CFG_NODE via CFG OUT edge. + */ + /** First control flow graph node */ + @overflowdb.traversal.help.Doc(info = """First control flow graph node""") + def cfgFirst: overflowdb.traversal.Traversal[CfgNode] = get().cfgFirst + + /** Traverse to METHOD_RETURN via CFG OUT edge. + */ + def _methodReturnViaCfgOut: Option[MethodReturn] = get()._methodReturnViaCfgOut + + def containsOut: Iterator[CfgNode] = get().containsOut + override def _containsOut = get()._containsOut + + /** Traverse to BLOCK via CONTAINS OUT edge. + */ + def _blockViaContainsOut: overflowdb.traversal.Traversal[Block] = get()._blockViaContainsOut + + /** Traverse to CALL via CONTAINS OUT edge. + */ + def _callViaContainsOut: overflowdb.traversal.Traversal[Call] = get()._callViaContainsOut + + /** Traverse to CONTROL_STRUCTURE via CONTAINS OUT edge. + */ + def _controlStructureViaContainsOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaContainsOut + + /** Traverse to FIELD_IDENTIFIER via CONTAINS OUT edge. + */ + def _fieldIdentifierViaContainsOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaContainsOut + + /** Traverse to IDENTIFIER via CONTAINS OUT edge. + */ + def _identifierViaContainsOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaContainsOut + + /** Traverse to JUMP_TARGET via CONTAINS OUT edge. + */ + def _jumpTargetViaContainsOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaContainsOut + + /** Literals used in the method Traverse to LITERAL via CONTAINS OUT edge. + */ + /** Literals used in the method */ + @overflowdb.traversal.help.Doc(info = """Literals used in the method""") + def literal: overflowdb.traversal.Traversal[Literal] = get().literal + + /** Traverse to METHOD_REF via CONTAINS OUT edge. + */ + def _methodRefViaContainsOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaContainsOut + + /** Traverse to RETURN via CONTAINS OUT edge. + */ + def _returnViaContainsOut: overflowdb.traversal.Traversal[Return] = get()._returnViaContainsOut + + /** Traverse to TEMPLATE_DOM via CONTAINS OUT edge. + */ + def _templateDomViaContainsOut: overflowdb.traversal.Traversal[TemplateDom] = get()._templateDomViaContainsOut + + /** Traverse to TYPE_REF via CONTAINS OUT edge. + */ + def _typeRefViaContainsOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaContainsOut + + /** Traverse to UNKNOWN via CONTAINS OUT edge. + */ + def _unknownViaContainsOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaContainsOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF OUT edge. + */ + def _methodParameterInViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def sourceFileOut: Iterator[File] = get().sourceFileOut + override def _sourceFileOut = get()._sourceFileOut + + /** Traverse to FILE via SOURCE_FILE OUT edge. + */ + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = get()._fileViaSourceFileOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Option[Method] = get()._methodViaAstIn + + /** Traverse to NAMESPACE_BLOCK via AST IN edge. + */ + def _namespaceBlockViaAstIn: Option[NamespaceBlock] = get()._namespaceBlockViaAstIn + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: Option[TypeDecl] = get()._typeDeclViaAstIn + + def callIn: Iterator[Call] = get().callIn + override def _callIn = get()._callIn + + /** Traverse to CALL via CALL IN edge. + */ + def _callViaCallIn: overflowdb.traversal.Traversal[Call] = get()._callViaCallIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def containsIn: Iterator[AstNode] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to FILE via CONTAINS IN edge. + */ + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = get()._fileViaContainsIn + + /** Traverse to TYPE_DECL via CONTAINS IN edge. + */ + def _typeDeclViaContainsIn: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaContainsIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def refIn: Iterator[StoredNode] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to BINDING via REF IN edge. + */ + def _bindingViaRefIn: overflowdb.traversal.Traversal[Binding] = get()._bindingViaRefIn + + /** Traverse to METHOD_REF via REF IN edge. + */ + def _methodRefViaRefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaRefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Method.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "astParentFullName" + case 2 => "astParentType" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "columnNumberEnd" + case 6 => "filename" + case 7 => "fullName" + case 8 => "hash" + case 9 => "isExternal" + case 10 => "lineNumber" + case 11 => "lineNumberEnd" + case 12 => "name" + case 13 => "order" + case 14 => "signature" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => astParentFullName + case 2 => astParentType + case 3 => code + case 4 => columnNumber + case 5 => columnNumberEnd + case 6 => filename + case 7 => fullName + case 8 => hash + case 9 => isExternal + case 10 => lineNumber + case 11 => lineNumberEnd + case 12 => name + case 13 => order + case 14 => signature + } + + override def productPrefix = "Method" + override def productArity = 15 +} + +class MethodDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with CfgNode + with Declaration + with MethodBase { + + override def layoutInformation: NodeLayoutInformation = Method.layoutInformation + + private var _astParentFullName: String = Method.PropertyDefaults.AstParentFullName + def astParentFullName: String = _astParentFullName + private var _astParentType: String = Method.PropertyDefaults.AstParentType + def astParentType: String = _astParentType + private var _code: String = Method.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _columnNumberEnd: Integer = null + def columnNumberEnd: Option[Integer] = Option(_columnNumberEnd) + private var _filename: String = Method.PropertyDefaults.Filename + def filename: String = _filename + private var _fullName: String = Method.PropertyDefaults.FullName + def fullName: String = _fullName + private var _hash: String = null + def hash: Option[String] = Option(_hash) + private var _isExternal: Boolean = Method.PropertyDefaults.IsExternal + def isExternal: Boolean = _isExternal + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _lineNumberEnd: Integer = null + def lineNumberEnd: Option[Integer] = Option(_lineNumberEnd) + private var _name: String = Method.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Method.PropertyDefaults.Order + def order: scala.Int = _order + private var _signature: String = Method.PropertyDefaults.Signature + def signature: String = _signature + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("AST_PARENT_FULL_NAME", astParentFullName) + properties.put("AST_PARENT_TYPE", astParentType) + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + columnNumberEnd.map { value => properties.put("COLUMN_NUMBER_END", value) } + properties.put("FILENAME", filename) + properties.put("FULL_NAME", fullName) + hash.map { value => properties.put("HASH", value) } + properties.put("IS_EXTERNAL", isExternal) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + lineNumberEnd.map { value => properties.put("LINE_NUMBER_END", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("SIGNATURE", signature) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == astParentFullName)) { properties.put("AST_PARENT_FULL_NAME", astParentFullName) } + if (!(("") == astParentType)) { properties.put("AST_PARENT_TYPE", astParentType) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + columnNumberEnd.map { value => properties.put("COLUMN_NUMBER_END", value) } + if (!(("") == filename)) { properties.put("FILENAME", filename) } + if (!(("") == fullName)) { properties.put("FULL_NAME", fullName) } + hash.map { value => properties.put("HASH", value) } + if (!((false) == isExternal)) { properties.put("IS_EXTERNAL", isExternal) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + lineNumberEnd.map { value => properties.put("LINE_NUMBER_END", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == signature)) { properties.put("SIGNATURE", signature) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = astOut.collectAll[Annotation] + def block: Block = try { astOut.collectAll[Block].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label AST to an adjacent BLOCK is mandatory, but not defined for this METHOD node with id=" + id, + e + ) + } + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = astOut.collectAll[Method] + def parameter: overflowdb.traversal.Traversal[MethodParameterIn] = astOut.collectAll[MethodParameterIn] + def _methodParameterOutViaAstOut: overflowdb.traversal.Traversal[MethodParameterOut] = + astOut.collectAll[MethodParameterOut] + def methodReturn: MethodReturn = try { astOut.collectAll[MethodReturn].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label AST to an adjacent METHOD_RETURN is mandatory, but not defined for this METHOD node with id=" + id, + e + ) + } + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = astOut.collectAll[Modifier] + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = astOut.collectAll[TypeDecl] + def _typeParameterViaAstOut: overflowdb.traversal.Traversal[TypeParameter] = astOut.collectAll[TypeParameter] + + def cfgOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def cfgFirst: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + def _methodReturnViaCfgOut: Option[MethodReturn] = cfgOut.collectAll[MethodReturn].nextOption() + + def containsOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _containsOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaContainsOut: overflowdb.traversal.Traversal[Block] = containsOut.collectAll[Block] + def _callViaContainsOut: overflowdb.traversal.Traversal[Call] = containsOut.collectAll[Call] + def _controlStructureViaContainsOut: overflowdb.traversal.Traversal[ControlStructure] = + containsOut.collectAll[ControlStructure] + def _fieldIdentifierViaContainsOut: overflowdb.traversal.Traversal[FieldIdentifier] = + containsOut.collectAll[FieldIdentifier] + def _identifierViaContainsOut: overflowdb.traversal.Traversal[Identifier] = containsOut.collectAll[Identifier] + def _jumpTargetViaContainsOut: overflowdb.traversal.Traversal[JumpTarget] = containsOut.collectAll[JumpTarget] + def literal: overflowdb.traversal.Traversal[Literal] = containsOut.collectAll[Literal] + def _methodRefViaContainsOut: overflowdb.traversal.Traversal[MethodRef] = containsOut.collectAll[MethodRef] + def _returnViaContainsOut: overflowdb.traversal.Traversal[Return] = containsOut.collectAll[Return] + def _templateDomViaContainsOut: overflowdb.traversal.Traversal[TemplateDom] = containsOut.collectAll[TemplateDom] + def _typeRefViaContainsOut: overflowdb.traversal.Traversal[TypeRef] = containsOut.collectAll[TypeRef] + def _unknownViaContainsOut: overflowdb.traversal.Traversal[Unknown] = containsOut.collectAll[Unknown] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterInViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefOut.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def sourceFileOut: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](6) + override def _sourceFileOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = sourceFileOut.collectAll[File] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](7) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](8) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _methodViaAstIn: Option[Method] = astIn.collectAll[Method].nextOption() + def _namespaceBlockViaAstIn: Option[NamespaceBlock] = astIn.collectAll[NamespaceBlock].nextOption() + def _typeDeclViaAstIn: Option[TypeDecl] = astIn.collectAll[TypeDecl].nextOption() + + def callIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](9) + override def _callIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _callViaCallIn: overflowdb.traversal.Traversal[Call] = callIn.collectAll[Call] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](10) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + + def containsIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](11) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = containsIn.collectAll[File] + def _typeDeclViaContainsIn: overflowdb.traversal.Traversal[TypeDecl] = containsIn.collectAll[TypeDecl] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def refIn: Iterator[StoredNode] = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _bindingViaRefIn: overflowdb.traversal.Traversal[Binding] = refIn.collectAll[Binding] + def _methodRefViaRefIn: overflowdb.traversal.Traversal[MethodRef] = refIn.collectAll[MethodRef] + + override def label: String = { + Method.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "astParentFullName" + case 2 => "astParentType" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "columnNumberEnd" + case 6 => "filename" + case 7 => "fullName" + case 8 => "hash" + case 9 => "isExternal" + case 10 => "lineNumber" + case 11 => "lineNumberEnd" + case 12 => "name" + case 13 => "order" + case 14 => "signature" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => astParentFullName + case 2 => astParentType + case 3 => code + case 4 => columnNumber + case 5 => columnNumberEnd + case 6 => filename + case 7 => fullName + case 8 => hash + case 9 => isExternal + case 10 => lineNumber + case 11 => lineNumberEnd + case 12 => name + case 13 => order + case 14 => signature + } + + override def productPrefix = "Method" + override def productArity = 15 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MethodDb] + + override def property(key: String): Any = { + key match { + case "AST_PARENT_FULL_NAME" => this._astParentFullName + case "AST_PARENT_TYPE" => this._astParentType + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "COLUMN_NUMBER_END" => this._columnNumberEnd + case "FILENAME" => this._filename + case "FULL_NAME" => this._fullName + case "HASH" => this._hash + case "IS_EXTERNAL" => this._isExternal + case "LINE_NUMBER" => this._lineNumber + case "LINE_NUMBER_END" => this._lineNumberEnd + case "NAME" => this._name + case "ORDER" => this._order + case "SIGNATURE" => this._signature + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "AST_PARENT_FULL_NAME" => this._astParentFullName = value.asInstanceOf[String] + case "AST_PARENT_TYPE" => this._astParentType = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "COLUMN_NUMBER_END" => this._columnNumberEnd = value.asInstanceOf[Integer] + case "FILENAME" => this._filename = value.asInstanceOf[String] + case "FULL_NAME" => this._fullName = value.asInstanceOf[String] + case "HASH" => this._hash = value.asInstanceOf[String] + case "IS_EXTERNAL" => this._isExternal = value.asInstanceOf[Boolean] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER_END" => this._lineNumberEnd = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "SIGNATURE" => this._signature = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._astParentFullName = newNode.asInstanceOf[NewMethod].astParentFullName + this._astParentType = newNode.asInstanceOf[NewMethod].astParentType + this._code = newNode.asInstanceOf[NewMethod].code + this._columnNumber = newNode.asInstanceOf[NewMethod].columnNumber.orNull + this._columnNumberEnd = newNode.asInstanceOf[NewMethod].columnNumberEnd.orNull + this._filename = newNode.asInstanceOf[NewMethod].filename + this._fullName = newNode.asInstanceOf[NewMethod].fullName + this._hash = newNode.asInstanceOf[NewMethod].hash.orNull + this._isExternal = newNode.asInstanceOf[NewMethod].isExternal + this._lineNumber = newNode.asInstanceOf[NewMethod].lineNumber.orNull + this._lineNumberEnd = newNode.asInstanceOf[NewMethod].lineNumberEnd.orNull + this._name = newNode.asInstanceOf[NewMethod].name + this._order = newNode.asInstanceOf[NewMethod].order + this._signature = newNode.asInstanceOf[NewMethod].signature + + graph.indexManager.putIfIndexed("FULL_NAME", newNode.asInstanceOf[NewMethod].fullName, this.ref) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala new file mode 100644 index 0000000..59ed27b --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala @@ -0,0 +1,547 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object MethodParameterIn { + def apply(graph: Graph, id: Long) = new MethodParameterIn(graph, id) + + val Label = "METHOD_PARAMETER_IN" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val EvaluationStrategy = "EVALUATION_STRATEGY" + val Index = "INDEX" + val IsVariadic = "IS_VARIADIC" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set( + Code, + ColumnNumber, + DynamicTypeHintFullName, + EvaluationStrategy, + Index, + IsVariadic, + LineNumber, + Name, + Order, + TypeFullName + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val EvaluationStrategy = new overflowdb.PropertyKey[String]("EVALUATION_STRATEGY") + val Index = new overflowdb.PropertyKey[scala.Int]("INDEX") + val IsVariadic = new overflowdb.PropertyKey[Boolean]("IS_VARIADIC") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val Code = "" + val EvaluationStrategy = "" + val Index = -1: Int + val IsVariadic = false + val Name = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ParameterLink.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST", "EVAL_TYPE", "PARAMETER_LINK", "POINTS_TO", "REACHING_DEF", "TAGGED_BY") + val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF", "REF") + } + + val factory = new NodeFactory[MethodParameterInDb] { + override val forLabel = MethodParameterIn.Label + + override def createNode(ref: NodeRef[MethodParameterInDb]) = + new MethodParameterInDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = MethodParameterIn(graph, id) + } +} + +trait MethodParameterInBase extends AbstractNode with AstNodeBase with CfgNodeBase with DeclarationBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def evaluationStrategy: String + def index: scala.Int + def isVariadic: Boolean + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def typeFullName: String + +} + +class MethodParameterIn(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MethodParameterInDb](graph_4762, id_4762) + with MethodParameterInBase + with StoredNode + with AstNode + with CfgNode + with Declaration { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def evaluationStrategy: String = get().evaluationStrategy + override def index: scala.Int = get().index + override def isVariadic: Boolean = get().isVariadic + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => MethodParameterIn.PropertyDefaults.Code + case "EVALUATION_STRATEGY" => MethodParameterIn.PropertyDefaults.EvaluationStrategy + case "INDEX" => MethodParameterIn.PropertyDefaults.Index + case "IS_VARIADIC" => MethodParameterIn.PropertyDefaults.IsVariadic + case "NAME" => MethodParameterIn.PropertyDefaults.Name + case "ORDER" => MethodParameterIn.PropertyDefaults.Order + case "TYPE_FULL_NAME" => MethodParameterIn.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[Expression] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION via AST OUT edge. + */ + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstOut + + /** Traverse to UNKNOWN via AST OUT edge. + */ + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to parameter type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to parameter type */ + @overflowdb.traversal.help.Doc(info = """Traverse to parameter type""") + def typ: Type = get().typ + + def parameterLinkOut: Iterator[MethodParameterOut] = get().parameterLinkOut + override def _parameterLinkOut = get()._parameterLinkOut + + /** Traverse to corresponding formal output parameter Traverse to METHOD_PARAMETER_OUT via PARAMETER_LINK OUT edge. + */ + /** Traverse to corresponding formal output parameter */ + @overflowdb.traversal.help.Doc(info = """Traverse to corresponding formal output parameter""") + def asOutput: overflowdb.traversal.Traversal[MethodParameterOut] = get().asOutput + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[Method] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to method associated with this formal parameter Traverse to METHOD via AST IN edge. + */ + /** Traverse to method associated with this formal parameter */ + @overflowdb.traversal.help.Doc(info = """Traverse to method associated with this formal parameter""") + def method: Method = get().method + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[Method] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + def refIn: Iterator[StoredNode] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to CLOSURE_BINDING via REF IN edge. + */ + def _closureBindingViaRefIn: overflowdb.traversal.Traversal[ClosureBinding] = get()._closureBindingViaRefIn + + /** Places (identifier) where this parameter is being referenced Traverse to IDENTIFIER via REF IN edge. + */ + /** Places (identifier) where this parameter is being referenced */ + @overflowdb.traversal.help.Doc(info = """Places (identifier) where this parameter is being referenced""") + def referencingIdentifiers: overflowdb.traversal.Traversal[Identifier] = get().referencingIdentifiers + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + MethodParameterIn.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "evaluationStrategy" + case 5 => "index" + case 6 => "isVariadic" + case 7 => "lineNumber" + case 8 => "name" + case 9 => "order" + case 10 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => evaluationStrategy + case 5 => index + case 6 => isVariadic + case 7 => lineNumber + case 8 => name + case 9 => order + case 10 => typeFullName + } + + override def productPrefix = "MethodParameterIn" + override def productArity = 11 +} + +class MethodParameterInDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with CfgNode + with Declaration + with MethodParameterInBase { + + override def layoutInformation: NodeLayoutInformation = MethodParameterIn.layoutInformation + + private var _code: String = MethodParameterIn.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _evaluationStrategy: String = MethodParameterIn.PropertyDefaults.EvaluationStrategy + def evaluationStrategy: String = _evaluationStrategy + private var _index: scala.Int = MethodParameterIn.PropertyDefaults.Index + def index: scala.Int = _index + private var _isVariadic: Boolean = MethodParameterIn.PropertyDefaults.IsVariadic + def isVariadic: Boolean = _isVariadic + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = MethodParameterIn.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = MethodParameterIn.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = MethodParameterIn.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + properties.put("EVALUATION_STRATEGY", evaluationStrategy) + properties.put("INDEX", index) + properties.put("IS_VARIADIC", isVariadic) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + if (!(("") == evaluationStrategy)) { properties.put("EVALUATION_STRATEGY", evaluationStrategy) } + if (!((-1: Int) == index)) { properties.put("INDEX", index) } + if (!((false) == isVariadic)) { properties.put("IS_VARIADIC", isVariadic) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = astOut.collectAll[Annotation] + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = astOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](1) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def typ: Type = try { evalTypeOut.collectAll[Type].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label EVAL_TYPE to an adjacent TYPE is mandatory, but not defined for this METHOD_PARAMETER_IN node with id=" + id, + e + ) + } + + def parameterLinkOut: Iterator[MethodParameterOut] = createAdjacentNodeScalaIteratorByOffSet[MethodParameterOut](2) + override def _parameterLinkOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def asOutput: overflowdb.traversal.Traversal[MethodParameterOut] = parameterLinkOut.collectAll[MethodParameterOut] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](5) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](6) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def method: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this METHOD_PARAMETER_IN node with id=" + id, + e + ) + } + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + + def reachingDefIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](9) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + + def refIn: Iterator[StoredNode] = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _closureBindingViaRefIn: overflowdb.traversal.Traversal[ClosureBinding] = refIn.collectAll[ClosureBinding] + def referencingIdentifiers: overflowdb.traversal.Traversal[Identifier] = refIn.collectAll[Identifier] + + override def label: String = { + MethodParameterIn.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "evaluationStrategy" + case 5 => "index" + case 6 => "isVariadic" + case 7 => "lineNumber" + case 8 => "name" + case 9 => "order" + case 10 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => evaluationStrategy + case 5 => index + case 6 => isVariadic + case 7 => lineNumber + case 8 => name + case 9 => order + case 10 => typeFullName + } + + override def productPrefix = "MethodParameterIn" + override def productArity = 11 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MethodParameterInDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "EVALUATION_STRATEGY" => this._evaluationStrategy + case "INDEX" => this._index + case "IS_VARIADIC" => this._isVariadic + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "EVALUATION_STRATEGY" => this._evaluationStrategy = value.asInstanceOf[String] + case "INDEX" => this._index = value.asInstanceOf[scala.Int] + case "IS_VARIADIC" => this._isVariadic = value.asInstanceOf[Boolean] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewMethodParameterIn].code + this._columnNumber = newNode.asInstanceOf[NewMethodParameterIn].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewMethodParameterIn].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewMethodParameterIn].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._evaluationStrategy = newNode.asInstanceOf[NewMethodParameterIn].evaluationStrategy + this._index = newNode.asInstanceOf[NewMethodParameterIn].index + this._isVariadic = newNode.asInstanceOf[NewMethodParameterIn].isVariadic + this._lineNumber = newNode.asInstanceOf[NewMethodParameterIn].lineNumber.orNull + this._name = newNode.asInstanceOf[NewMethodParameterIn].name + this._order = newNode.asInstanceOf[NewMethodParameterIn].order + this._typeFullName = newNode.asInstanceOf[NewMethodParameterIn].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala new file mode 100644 index 0000000..797d422 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala @@ -0,0 +1,498 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object MethodParameterOut { + def apply(graph: Graph, id: Long) = new MethodParameterOut(graph, id) + + val Label = "METHOD_PARAMETER_OUT" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val EvaluationStrategy = "EVALUATION_STRATEGY" + val Index = "INDEX" + val IsVariadic = "IS_VARIADIC" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(Code, ColumnNumber, EvaluationStrategy, Index, IsVariadic, LineNumber, Name, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val EvaluationStrategy = new overflowdb.PropertyKey[String]("EVALUATION_STRATEGY") + val Index = new overflowdb.PropertyKey[scala.Int]("INDEX") + val IsVariadic = new overflowdb.PropertyKey[Boolean]("IS_VARIADIC") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val Code = "" + val EvaluationStrategy = "" + val Index = -1: Int + val IsVariadic = false + val Name = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ParameterLink.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("EVAL_TYPE", "POINTS_TO", "REACHING_DEF", "TAGGED_BY") + val In: Array[String] = Array("AST", "CFG", "PARAMETER_LINK", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[MethodParameterOutDb] { + override val forLabel = MethodParameterOut.Label + + override def createNode(ref: NodeRef[MethodParameterOutDb]) = + new MethodParameterOutDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = MethodParameterOut(graph, id) + } +} + +trait MethodParameterOutBase extends AbstractNode with AstNodeBase with CfgNodeBase with DeclarationBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def evaluationStrategy: String + def index: scala.Int + def isVariadic: Boolean + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + def typeFullName: String + +} + +class MethodParameterOut(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MethodParameterOutDb](graph_4762, id_4762) + with MethodParameterOutBase + with StoredNode + with AstNode + with CfgNode + with Declaration { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def evaluationStrategy: String = get().evaluationStrategy + override def index: scala.Int = get().index + override def isVariadic: Boolean = get().isVariadic + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => MethodParameterOut.PropertyDefaults.Code + case "EVALUATION_STRATEGY" => MethodParameterOut.PropertyDefaults.EvaluationStrategy + case "INDEX" => MethodParameterOut.PropertyDefaults.Index + case "IS_VARIADIC" => MethodParameterOut.PropertyDefaults.IsVariadic + case "NAME" => MethodParameterOut.PropertyDefaults.Name + case "ORDER" => MethodParameterOut.PropertyDefaults.Order + case "TYPE_FULL_NAME" => MethodParameterOut.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to parameter type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to parameter type */ + @overflowdb.traversal.help.Doc(info = """Traverse to parameter type""") + def typ: overflowdb.traversal.Traversal[Type] = get().typ + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def reachingDefOut: Iterator[Expression] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[Method] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to METHOD via AST IN edge. + */ + def method: Method = get().method + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def parameterLinkIn: Iterator[MethodParameterIn] = get().parameterLinkIn + override def _parameterLinkIn = get()._parameterLinkIn + + /** Traverse to METHOD_PARAMETER_IN via PARAMETER_LINK IN edge. + */ + def asInput: overflowdb.traversal.Traversal[MethodParameterIn] = get().asInput + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to RETURN via REACHING_DEF IN edge. + */ + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + MethodParameterOut.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "evaluationStrategy" + case 4 => "index" + case 5 => "isVariadic" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => evaluationStrategy + case 4 => index + case 5 => isVariadic + case 6 => lineNumber + case 7 => name + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "MethodParameterOut" + override def productArity = 10 +} + +class MethodParameterOutDb(ref: NodeRef[NodeDb]) + extends NodeDb(ref) + with StoredNode + with AstNode + with CfgNode + with Declaration + with MethodParameterOutBase { + + override def layoutInformation: NodeLayoutInformation = MethodParameterOut.layoutInformation + + private var _code: String = MethodParameterOut.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _evaluationStrategy: String = MethodParameterOut.PropertyDefaults.EvaluationStrategy + def evaluationStrategy: String = _evaluationStrategy + private var _index: scala.Int = MethodParameterOut.PropertyDefaults.Index + def index: scala.Int = _index + private var _isVariadic: Boolean = MethodParameterOut.PropertyDefaults.IsVariadic + def isVariadic: Boolean = _isVariadic + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = MethodParameterOut.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = MethodParameterOut.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = MethodParameterOut.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("EVALUATION_STRATEGY", evaluationStrategy) + properties.put("INDEX", index) + properties.put("IS_VARIADIC", isVariadic) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == evaluationStrategy)) { properties.put("EVALUATION_STRATEGY", evaluationStrategy) } + if (!((-1: Int) == index)) { properties.put("INDEX", index) } + if (!((false) == isVariadic)) { properties.put("IS_VARIADIC", isVariadic) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](0) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def typ: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + + def reachingDefOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](2) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](3) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](4) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def method: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this METHOD_PARAMETER_OUT node with id=" + id, + e + ) + } + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + + def parameterLinkIn: Iterator[MethodParameterIn] = createAdjacentNodeScalaIteratorByOffSet[MethodParameterIn](6) + override def _parameterLinkIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def asInput: overflowdb.traversal.Traversal[MethodParameterIn] = parameterLinkIn.collectAll[MethodParameterIn] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = reachingDefIn.collectAll[Return] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + override def label: String = { + MethodParameterOut.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "evaluationStrategy" + case 4 => "index" + case 5 => "isVariadic" + case 6 => "lineNumber" + case 7 => "name" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => evaluationStrategy + case 4 => index + case 5 => isVariadic + case 6 => lineNumber + case 7 => name + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "MethodParameterOut" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MethodParameterOutDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "EVALUATION_STRATEGY" => this._evaluationStrategy + case "INDEX" => this._index + case "IS_VARIADIC" => this._isVariadic + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "EVALUATION_STRATEGY" => this._evaluationStrategy = value.asInstanceOf[String] + case "INDEX" => this._index = value.asInstanceOf[scala.Int] + case "IS_VARIADIC" => this._isVariadic = value.asInstanceOf[Boolean] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewMethodParameterOut].code + this._columnNumber = newNode.asInstanceOf[NewMethodParameterOut].columnNumber.orNull + this._evaluationStrategy = newNode.asInstanceOf[NewMethodParameterOut].evaluationStrategy + this._index = newNode.asInstanceOf[NewMethodParameterOut].index + this._isVariadic = newNode.asInstanceOf[NewMethodParameterOut].isVariadic + this._lineNumber = newNode.asInstanceOf[NewMethodParameterOut].lineNumber.orNull + this._name = newNode.asInstanceOf[NewMethodParameterOut].name + this._order = newNode.asInstanceOf[NewMethodParameterOut].order + this._typeFullName = newNode.asInstanceOf[NewMethodParameterOut].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala new file mode 100644 index 0000000..848fef0 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala @@ -0,0 +1,1081 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object MethodRef { + def apply(graph: Graph, id: Long) = new MethodRef(graph, id) + + val Label = "METHOD_REF" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val MethodFullName = "METHOD_FULL_NAME" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set( + ArgumentIndex, + ArgumentName, + Code, + ColumnNumber, + DynamicTypeHintFullName, + LineNumber, + MethodFullName, + Order, + TypeFullName + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val MethodFullName = new overflowdb.PropertyKey[String]("METHOD_FULL_NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val MethodFullName = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Capture.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "CAPTURE", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "REF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[MethodRefDb] { + override val forLabel = MethodRef.Label + + override def createNode(ref: NodeRef[MethodRefDb]) = + new MethodRefDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = MethodRef(graph, id) + } +} + +trait MethodRefBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def methodFullName: String + def order: scala.Int + def typeFullName: String + +} + +class MethodRef(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MethodRefDb](graph_4762, id_4762) + with MethodRefBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def methodFullName: String = get().methodFullName + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => MethodRef.PropertyDefaults.ArgumentIndex + case "CODE" => MethodRef.PropertyDefaults.Code + case "METHOD_FULL_NAME" => MethodRef.PropertyDefaults.MethodFullName + case "ORDER" => MethodRef.PropertyDefaults.Order + case "TYPE_FULL_NAME" => MethodRef.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def captureOut: Iterator[ClosureBinding] = get().captureOut + override def _captureOut = get()._captureOut + + /** Traverse to CLOSURE_BINDING via CAPTURE OUT edge. + */ + def _closureBindingViaCaptureOut: overflowdb.traversal.Traversal[ClosureBinding] = get()._closureBindingViaCaptureOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[AstNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + /** Traverse to METHOD_RETURN via CFG OUT edge. + */ + def _methodReturnViaCfgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def refOut: Iterator[Method] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to referenced method. Traverse to METHOD via REF OUT edge. + */ + /** Traverse to referenced method. */ + @overflowdb.traversal.help.Doc(info = """Traverse to referenced method.""") + def referencedMethod: Method = get().referencedMethod + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: Option[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: ControlStructure = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to RETURN via REACHING_DEF IN edge. + */ + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: Option[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + MethodRef.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "methodFullName" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => methodFullName + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "MethodRef" + override def productArity = 10 +} + +class MethodRefDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with MethodRefBase { + + override def layoutInformation: NodeLayoutInformation = MethodRef.layoutInformation + + private var _argumentIndex: scala.Int = MethodRef.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = MethodRef.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _methodFullName: String = MethodRef.PropertyDefaults.MethodFullName + def methodFullName: String = _methodFullName + private var _order: scala.Int = MethodRef.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = MethodRef.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("METHOD_FULL_NAME", methodFullName) + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == methodFullName)) { properties.put("METHOD_FULL_NAME", methodFullName) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def captureOut: Iterator[ClosureBinding] = createAdjacentNodeScalaIteratorByOffSet[ClosureBinding](1) + override def _captureOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _closureBindingViaCaptureOut: overflowdb.traversal.Traversal[ClosureBinding] = + captureOut.collectAll[ClosureBinding] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + def _methodReturnViaCfgOut: overflowdb.traversal.Traversal[MethodReturn] = cfgOut.collectAll[MethodReturn] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](5) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def refOut: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](9) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def referencedMethod: Method = try { refOut.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label REF to an adjacent METHOD is mandatory, but not defined for this METHOD_REF node with id=" + id, + e + ) + } + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](10) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](11) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _callViaArgumentIn: Option[Call] = argumentIn.collectAll[Call].nextOption() + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](12) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: ControlStructure = try { astIn.collectAll[ControlStructure].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent CONTROL_STRUCTURE is mandatory, but not defined for this METHOD_REF node with id=" + id, + e + ) + } + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](14) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](15) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](16) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](19) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](20) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = reachingDefIn.collectAll[Return] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](21) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](21) + def _callViaReceiverIn: Option[Call] = receiverIn.collectAll[Call].nextOption() + + override def label: String = { + MethodRef.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "methodFullName" + case 8 => "order" + case 9 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => methodFullName + case 8 => order + case 9 => typeFullName + } + + override def productPrefix = "MethodRef" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MethodRefDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "METHOD_FULL_NAME" => this._methodFullName + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "METHOD_FULL_NAME" => this._methodFullName = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewMethodRef].argumentIndex + this._argumentName = newNode.asInstanceOf[NewMethodRef].argumentName.orNull + this._code = newNode.asInstanceOf[NewMethodRef].code + this._columnNumber = newNode.asInstanceOf[NewMethodRef].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewMethodRef].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewMethodRef].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewMethodRef].lineNumber.orNull + this._methodFullName = newNode.asInstanceOf[NewMethodRef].methodFullName + this._order = newNode.asInstanceOf[NewMethodRef].order + this._typeFullName = newNode.asInstanceOf[NewMethodRef].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala new file mode 100644 index 0000000..2a4262c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala @@ -0,0 +1,572 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object MethodReturn { + def apply(graph: Graph, id: Long) = new MethodReturn(graph, id) + + val Label = "METHOD_RETURN" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val EvaluationStrategy = "EVALUATION_STRATEGY" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(Code, ColumnNumber, DynamicTypeHintFullName, EvaluationStrategy, LineNumber, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val EvaluationStrategy = new overflowdb.PropertyKey[String]("EVALUATION_STRATEGY") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val Code = "" + val EvaluationStrategy = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("EVAL_TYPE", "POINTS_TO", "POST_DOMINATE", "TAGGED_BY") + val In: Array[String] = Array("AST", "CDG", "CFG", "DOMINATE", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[MethodReturnDb] { + override val forLabel = MethodReturn.Label + + override def createNode(ref: NodeRef[MethodReturnDb]) = + new MethodReturnDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = MethodReturn(graph, id) + } +} + +trait MethodReturnBase extends AbstractNode with CfgNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def evaluationStrategy: String + def lineNumber: Option[Integer] + def order: scala.Int + def typeFullName: String + +} + +class MethodReturn(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MethodReturnDb](graph_4762, id_4762) + with MethodReturnBase + with StoredNode + with CfgNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def evaluationStrategy: String = get().evaluationStrategy + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => MethodReturn.PropertyDefaults.Code + case "EVALUATION_STRATEGY" => MethodReturn.PropertyDefaults.EvaluationStrategy + case "ORDER" => MethodReturn.PropertyDefaults.Order + case "TYPE_FULL_NAME" => MethodReturn.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def astIn: Iterator[Method] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Method = get()._methodViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + /** Traverse to RETURN via CFG IN edge. + */ + def toReturn: overflowdb.traversal.Traversal[Return] = get().toReturn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[Return] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to RETURN via REACHING_DEF IN edge. + */ + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + MethodReturn.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "evaluationStrategy" + case 5 => "lineNumber" + case 6 => "order" + case 7 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => evaluationStrategy + case 5 => lineNumber + case 6 => order + case 7 => typeFullName + } + + override def productPrefix = "MethodReturn" + override def productArity = 8 +} + +class MethodReturnDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with CfgNode with MethodReturnBase { + + override def layoutInformation: NodeLayoutInformation = MethodReturn.layoutInformation + + private var _code: String = MethodReturn.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _evaluationStrategy: String = MethodReturn.PropertyDefaults.EvaluationStrategy + def evaluationStrategy: String = _evaluationStrategy + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = MethodReturn.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = MethodReturn.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + properties.put("EVALUATION_STRATEGY", evaluationStrategy) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + if (!(("") == evaluationStrategy)) { properties.put("EVALUATION_STRATEGY", evaluationStrategy) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](0) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](3) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def astIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](4) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _methodViaAstIn: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this METHOD_RETURN node with id=" + id, + e + ) + } + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def toReturn: overflowdb.traversal.Traversal[Return] = cfgIn.collectAll[Return] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + + def reachingDefIn: Iterator[Return] = createAdjacentNodeScalaIteratorByOffSet[Return](9) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = reachingDefIn.collectAll[Return] + + override def label: String = { + MethodReturn.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "evaluationStrategy" + case 5 => "lineNumber" + case 6 => "order" + case 7 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => dynamicTypeHintFullName + case 4 => evaluationStrategy + case 5 => lineNumber + case 6 => order + case 7 => typeFullName + } + + override def productPrefix = "MethodReturn" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MethodReturnDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "EVALUATION_STRATEGY" => this._evaluationStrategy + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "EVALUATION_STRATEGY" => this._evaluationStrategy = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewMethodReturn].code + this._columnNumber = newNode.asInstanceOf[NewMethodReturn].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewMethodReturn].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewMethodReturn].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._evaluationStrategy = newNode.asInstanceOf[NewMethodReturn].evaluationStrategy + this._lineNumber = newNode.asInstanceOf[NewMethodReturn].lineNumber.orNull + this._order = newNode.asInstanceOf[NewMethodReturn].order + this._typeFullName = newNode.asInstanceOf[NewMethodReturn].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala new file mode 100644 index 0000000..2612fbb --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala @@ -0,0 +1,283 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Modifier { + def apply(graph: Graph, id: Long) = new Modifier(graph, id) + + val Label = "MODIFIER" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val ModifierType = "MODIFIER_TYPE" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, ModifierType, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val ModifierType = new overflowdb.PropertyKey[String]("MODIFIER_TYPE") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val ModifierType = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[ModifierDb] { + override val forLabel = Modifier.Label + + override def createNode(ref: NodeRef[ModifierDb]) = + new ModifierDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Modifier(graph, id) + } +} + +trait ModifierBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def modifierType: String + def order: scala.Int + +} + +class Modifier(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ModifierDb](graph_4762, id_4762) + with ModifierBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def modifierType: String = get().modifierType + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Modifier.PropertyDefaults.Code + case "MODIFIER_TYPE" => Modifier.PropertyDefaults.ModifierType + case "ORDER" => Modifier.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to MEMBER via AST IN edge. + */ + def _memberViaAstIn: overflowdb.traversal.Traversal[Member] = get()._memberViaAstIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Method = get()._methodViaAstIn + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: TypeDecl = get()._typeDeclViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Modifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "modifierType" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => modifierType + case 5 => order + } + + override def productPrefix = "Modifier" + override def productArity = 6 +} + +class ModifierDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with ModifierBase { + + override def layoutInformation: NodeLayoutInformation = Modifier.layoutInformation + + private var _code: String = Modifier.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _modifierType: String = Modifier.PropertyDefaults.ModifierType + def modifierType: String = _modifierType + private var _order: scala.Int = Modifier.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("MODIFIER_TYPE", modifierType) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == modifierType)) { properties.put("MODIFIER_TYPE", modifierType) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _memberViaAstIn: overflowdb.traversal.Traversal[Member] = astIn.collectAll[Member] + def _methodViaAstIn: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this MODIFIER node with id=" + id, + e + ) + } + def _typeDeclViaAstIn: TypeDecl = try { astIn.collectAll[TypeDecl].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent TYPE_DECL is mandatory, but not defined for this MODIFIER node with id=" + id, + e + ) + } + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + override def label: String = { + Modifier.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "modifierType" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => modifierType + case 5 => order + } + + override def productPrefix = "Modifier" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ModifierDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "MODIFIER_TYPE" => this._modifierType + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "MODIFIER_TYPE" => this._modifierType = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewModifier].code + this._columnNumber = newNode.asInstanceOf[NewModifier].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewModifier].lineNumber.orNull + this._modifierType = newNode.asInstanceOf[NewModifier].modifierType + this._order = newNode.asInstanceOf[NewModifier].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Mynodetype.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Mynodetype.scala new file mode 100644 index 0000000..6ae6e00 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Mynodetype.scala @@ -0,0 +1,169 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Mynodetype { + def apply(graph: Graph, id: Long) = new Mynodetype(graph, id) + + val Label = "MYNODETYPE" + + object PropertyNames { + val Myproperty = "MYPROPERTY" + val all: Set[String] = Set(Myproperty) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Myproperty = new overflowdb.PropertyKey[String]("MYPROPERTY") + + } + + object PropertyDefaults { + val Myproperty = "" + } + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[MynodetypeDb] { + override val forLabel = Mynodetype.Label + + override def createNode(ref: NodeRef[MynodetypeDb]) = + new MynodetypeDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Mynodetype(graph, id) + } +} + +trait MynodetypeBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def myproperty: String + +} + +class Mynodetype(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[MynodetypeDb](graph_4762, id_4762) + with MynodetypeBase + with StoredNode { + override def myproperty: String = get().myproperty + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "MYPROPERTY" => Mynodetype.PropertyDefaults.Myproperty + case _ => super.propertyDefaultValue(propertyKey) + } + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Mynodetype.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "myproperty" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => myproperty + } + + override def productPrefix = "Mynodetype" + override def productArity = 2 +} + +class MynodetypeDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with MynodetypeBase { + + override def layoutInformation: NodeLayoutInformation = Mynodetype.layoutInformation + + private var _myproperty: String = Mynodetype.PropertyDefaults.Myproperty + def myproperty: String = _myproperty + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("MYPROPERTY", myproperty) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == myproperty)) { properties.put("MYPROPERTY", myproperty) } + + properties + } + + import overflowdb.traversal._ + + override def label: String = { + Mynodetype.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "myproperty" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => myproperty + } + + override def productPrefix = "Mynodetype" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[MynodetypeDb] + + override def property(key: String): Any = { + key match { + case "MYPROPERTY" => this._myproperty + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "MYPROPERTY" => this._myproperty = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._myproperty = newNode.asInstanceOf[NewMynodetype].myproperty + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala new file mode 100644 index 0000000..a07ca12 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala @@ -0,0 +1,249 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Namespace { + def apply(graph: Graph, id: Long) = new Namespace(graph, id) + + val Label = "NAMESPACE" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("REF") + } + + val factory = new NodeFactory[NamespaceDb] { + override val forLabel = Namespace.Label + + override def createNode(ref: NodeRef[NamespaceDb]) = + new NamespaceDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Namespace(graph, id) + } +} + +trait NamespaceBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class Namespace(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[NamespaceDb](graph_4762, id_4762) + with NamespaceBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => Namespace.PropertyDefaults.Code + case "NAME" => Namespace.PropertyDefaults.Name + case "ORDER" => Namespace.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def refIn: Iterator[NamespaceBlock] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to NAMESPACE_BLOCK via REF IN edge. + */ + def _namespaceBlockViaRefIn: overflowdb.traversal.Traversal[NamespaceBlock] = get()._namespaceBlockViaRefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Namespace.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + } + + override def productPrefix = "Namespace" + override def productArity = 6 +} + +class NamespaceDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with NamespaceBase { + + override def layoutInformation: NodeLayoutInformation = Namespace.layoutInformation + + private var _code: String = Namespace.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = Namespace.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = Namespace.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def refIn: Iterator[NamespaceBlock] = createAdjacentNodeScalaIteratorByOffSet[NamespaceBlock](0) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _namespaceBlockViaRefIn: overflowdb.traversal.Traversal[NamespaceBlock] = refIn.collectAll[NamespaceBlock] + + override def label: String = { + Namespace.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + } + + override def productPrefix = "Namespace" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NamespaceDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewNamespace].code + this._columnNumber = newNode.asInstanceOf[NewNamespace].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewNamespace].lineNumber.orNull + this._name = newNode.asInstanceOf[NewNamespace].name + this._order = newNode.asInstanceOf[NewNamespace].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala new file mode 100644 index 0000000..9149b74 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala @@ -0,0 +1,326 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object NamespaceBlock { + def apply(graph: Graph, id: Long) = new NamespaceBlock(graph, id) + + val Label = "NAMESPACE_BLOCK" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val Filename = "FILENAME" + val FullName = "FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, Filename, FullName, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val Filename = new overflowdb.PropertyKey[String]("FILENAME") + val FullName = new overflowdb.PropertyKey[String]("FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Filename = "" + val FullName = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation + ).asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST", "REF", "SOURCE_FILE") + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[NamespaceBlockDb] { + override val forLabel = NamespaceBlock.Label + + override def createNode(ref: NodeRef[NamespaceBlockDb]) = + new NamespaceBlockDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = NamespaceBlock(graph, id) + } +} + +trait NamespaceBlockBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def filename: String + def fullName: String + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class NamespaceBlock(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[NamespaceBlockDb](graph_4762, id_4762) + with NamespaceBlockBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def filename: String = get().filename + override def fullName: String = get().fullName + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => NamespaceBlock.PropertyDefaults.Code + case "FILENAME" => NamespaceBlock.PropertyDefaults.Filename + case "FULL_NAME" => NamespaceBlock.PropertyDefaults.FullName + case "NAME" => NamespaceBlock.PropertyDefaults.Name + case "ORDER" => NamespaceBlock.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to METHOD via AST OUT edge. + */ + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = get()._methodViaAstOut + + /** Traverse to TYPE_DECL via AST OUT edge. + */ + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstOut + + def refOut: Iterator[Namespace] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to NAMESPACE via REF OUT edge. + */ + def _namespaceViaRefOut: overflowdb.traversal.Traversal[Namespace] = get()._namespaceViaRefOut + + def sourceFileOut: Iterator[File] = get().sourceFileOut + override def _sourceFileOut = get()._sourceFileOut + + /** Traverse to FILE via SOURCE_FILE OUT edge. + */ + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = get()._fileViaSourceFileOut + + def astIn: Iterator[File] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to FILE via AST IN edge. + */ + def _fileViaAstIn: Option[File] = get()._fileViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + NamespaceBlock.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "filename" + case 4 => "fullName" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => filename + case 4 => fullName + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "NamespaceBlock" + override def productArity = 8 +} + +class NamespaceBlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with NamespaceBlockBase { + + override def layoutInformation: NodeLayoutInformation = NamespaceBlock.layoutInformation + + private var _code: String = NamespaceBlock.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _filename: String = NamespaceBlock.PropertyDefaults.Filename + def filename: String = _filename + private var _fullName: String = NamespaceBlock.PropertyDefaults.FullName + def fullName: String = _fullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = NamespaceBlock.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = NamespaceBlock.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("FILENAME", filename) + properties.put("FULL_NAME", fullName) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == filename)) { properties.put("FILENAME", filename) } + if (!(("") == fullName)) { properties.put("FULL_NAME", fullName) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = astOut.collectAll[Method] + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = astOut.collectAll[TypeDecl] + + def refOut: Iterator[Namespace] = createAdjacentNodeScalaIteratorByOffSet[Namespace](1) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _namespaceViaRefOut: overflowdb.traversal.Traversal[Namespace] = refOut.collectAll[Namespace] + + def sourceFileOut: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](2) + override def _sourceFileOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = sourceFileOut.collectAll[File] + + def astIn: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](3) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _fileViaAstIn: Option[File] = astIn.collectAll[File].nextOption() + + override def label: String = { + NamespaceBlock.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "filename" + case 4 => "fullName" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => filename + case 4 => fullName + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "NamespaceBlock" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NamespaceBlockDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "FILENAME" => this._filename + case "FULL_NAME" => this._fullName + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "FILENAME" => this._filename = value.asInstanceOf[String] + case "FULL_NAME" => this._fullName = value.asInstanceOf[String] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewNamespaceBlock].code + this._columnNumber = newNode.asInstanceOf[NewNamespaceBlock].columnNumber.orNull + this._filename = newNode.asInstanceOf[NewNamespaceBlock].filename + this._fullName = newNode.asInstanceOf[NewNamespaceBlock].fullName + this._lineNumber = newNode.asInstanceOf[NewNamespaceBlock].lineNumber.orNull + this._name = newNode.asInstanceOf[NewNamespaceBlock].name + this._order = newNode.asInstanceOf[NewNamespaceBlock].order + + graph.indexManager.putIfIndexed("FULL_NAME", newNode.asInstanceOf[NewNamespaceBlock].fullName, this.ref) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewNodes.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewNodes.scala new file mode 100644 index 0000000..c0afdbf --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewNodes.scala @@ -0,0 +1,4711 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +/** base type for all nodes that can be added to a graph, e.g. the diffgraph */ +abstract class NewNode extends AbstractNode with overflowdb.DetachedNodeData with Product { + def properties: Map[String, Any] + def copy: this.type + type StoredType <: StoredNode + private var refOrId: Object = null + override def getRefOrId(): Object = refOrId + override def setRefOrId(r: Object): Unit = { this.refOrId = r } + def stored: Option[StoredType] = + if (refOrId != null && refOrId.isInstanceOf[StoredNode]) Some(refOrId).asInstanceOf[Option[StoredType]] else None +} + +object NewAnnotation { + def apply(): NewAnnotation = new NewAnnotation +} + +class NewAnnotation extends NewNode with AnnotationBase with ExpressionNew { + type StoredType = Annotation + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var fullName: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "ANNOTATION" + + override def copy: this.type = { + val newInstance = new NewAnnotation + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.fullName = this.fullName + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def fullName(value: String): this.type = { + this.fullName = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == fullName)) { res += "FULL_NAME" -> fullName } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.fullName + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentName + case 7 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "fullName" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentName" + case 7 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewAnnotation" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewAnnotation] +} + +object NewAnnotationLiteral { + def apply(): NewAnnotationLiteral = new NewAnnotationLiteral +} + +class NewAnnotationLiteral extends NewNode with AnnotationLiteralBase with ExpressionNew { + type StoredType = AnnotationLiteral + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "ANNOTATION_LITERAL" + + override def copy: this.type = { + val newInstance = new NewAnnotationLiteral + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.columnNumber + case 4 => this.code + case 5 => this.argumentName + case 6 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "columnNumber" + case 4 => "code" + case 5 => "argumentName" + case 6 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewAnnotationLiteral" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewAnnotationLiteral] +} + +object NewAnnotationParameter { + def apply(): NewAnnotationParameter = new NewAnnotationParameter +} + +class NewAnnotationParameter extends NewNode with AnnotationParameterBase with AstNodeNew { + type StoredType = AnnotationParameter + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "ANNOTATION_PARAMETER" + + override def copy: this.type = { + val newInstance = new NewAnnotationParameter + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case _ => "" + } + + override def productPrefix = "NewAnnotationParameter" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewAnnotationParameter] +} + +object NewAnnotationParameterAssign { + def apply(): NewAnnotationParameterAssign = new NewAnnotationParameterAssign +} + +class NewAnnotationParameterAssign extends NewNode with AnnotationParameterAssignBase with AstNodeNew { + type StoredType = AnnotationParameterAssign + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "ANNOTATION_PARAMETER_ASSIGN" + + override def copy: this.type = { + val newInstance = new NewAnnotationParameterAssign + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case _ => "" + } + + override def productPrefix = "NewAnnotationParameterAssign" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewAnnotationParameterAssign] +} + +object NewArrayInitializer { + def apply(): NewArrayInitializer = new NewArrayInitializer +} + +class NewArrayInitializer extends NewNode with ArrayInitializerBase with AstNodeNew with ExpressionNew { + type StoredType = ArrayInitializer + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "ARRAY_INITIALIZER" + + override def copy: this.type = { + val newInstance = new NewArrayInitializer + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case 4 => this.argumentName + case 5 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case 4 => "argumentName" + case 5 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewArrayInitializer" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewArrayInitializer] +} + +object NewBinding { + def apply(): NewBinding = new NewBinding +} + +class NewBinding extends NewNode with BindingBase { + type StoredType = Binding + + var signature: String = "" + var name: String = "" + var methodFullName: String = "" + + override def label: String = "BINDING" + + override def copy: this.type = { + val newInstance = new NewBinding + newInstance.methodFullName = this.methodFullName + newInstance.name = this.name + newInstance.signature = this.signature + newInstance.asInstanceOf[this.type] + } + + def methodFullName(value: String): this.type = { + this.methodFullName = value + this + } + + def name(value: String): this.type = { + this.name = value + this + } + + def signature(value: String): this.type = { + this.signature = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == methodFullName)) { res += "METHOD_FULL_NAME" -> methodFullName } + if (!(("") == name)) { res += "NAME" -> name } + if (!(("") == signature)) { res += "SIGNATURE" -> signature } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.signature + case 1 => this.name + case 2 => this.methodFullName + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "signature" + case 1 => "name" + case 2 => "methodFullName" + case _ => "" + } + + override def productPrefix = "NewBinding" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewBinding] +} + +object NewBlock { + def apply(): NewBlock = new NewBlock +} + +class NewBlock extends NewNode with BlockBase with ExpressionNew { + type StoredType = Block + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "BLOCK" + + override def copy: this.type = { + val newInstance = new NewBlock + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.lineNumber + case 3 => this.dynamicTypeHintFullName + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentName + case 7 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "lineNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentName" + case 7 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewBlock" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewBlock] +} + +object NewCall { + def apply(): NewCall = new NewCall +} + +class NewCall extends NewNode with CallBase with CallReprNew with ExpressionNew { + type StoredType = Call + + var typeFullName: String = "" + var signature: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var methodFullName: String = "" + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var dispatchType: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "CALL" + + override def copy: this.type = { + val newInstance = new NewCall + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dispatchType = this.dispatchType + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.methodFullName = this.methodFullName + newInstance.name = this.name + newInstance.order = this.order + newInstance.signature = this.signature + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dispatchType(value: String): this.type = { + this.dispatchType = value + this + } + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def methodFullName(value: String): this.type = { + this.methodFullName = value + this + } + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def signature(value: String): this.type = { + this.signature = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == dispatchType)) { res += "DISPATCH_TYPE" -> dispatchType } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == methodFullName)) { res += "METHOD_FULL_NAME" -> methodFullName } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == signature)) { res += "SIGNATURE" -> signature } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.signature + case 2 => this.order + case 3 => this.name + case 4 => this.methodFullName + case 5 => this.lineNumber + case 6 => this.dynamicTypeHintFullName + case 7 => this.dispatchType + case 8 => this.columnNumber + case 9 => this.code + case 10 => this.argumentName + case 11 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "signature" + case 2 => "order" + case 3 => "name" + case 4 => "methodFullName" + case 5 => "lineNumber" + case 6 => "dynamicTypeHintFullName" + case 7 => "dispatchType" + case 8 => "columnNumber" + case 9 => "code" + case 10 => "argumentName" + case 11 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewCall" + override def productArity = 12 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewCall] +} + +object NewClosureBinding { + def apply(): NewClosureBinding = new NewClosureBinding +} + +class NewClosureBinding extends NewNode with ClosureBindingBase { + type StoredType = ClosureBinding + + var evaluationStrategy: String = "" + var closureOriginalName: Option[String] = None + var closureBindingId: Option[String] = None + + override def label: String = "CLOSURE_BINDING" + + override def copy: this.type = { + val newInstance = new NewClosureBinding + newInstance.closureBindingId = this.closureBindingId + newInstance.closureOriginalName = this.closureOriginalName + newInstance.evaluationStrategy = this.evaluationStrategy + newInstance.asInstanceOf[this.type] + } + + def closureBindingId(value: String): this.type = { + this.closureBindingId = Option(value) + this + } + + def closureBindingId(value: Option[String]): this.type = closureBindingId(value.orNull) + + def closureOriginalName(value: String): this.type = { + this.closureOriginalName = Option(value) + this + } + + def closureOriginalName(value: Option[String]): this.type = closureOriginalName(value.orNull) + + def evaluationStrategy(value: String): this.type = { + this.evaluationStrategy = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + closureBindingId.map { value => res += "CLOSURE_BINDING_ID" -> value } + closureOriginalName.map { value => res += "CLOSURE_ORIGINAL_NAME" -> value } + if (!(("") == evaluationStrategy)) { res += "EVALUATION_STRATEGY" -> evaluationStrategy } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.evaluationStrategy + case 1 => this.closureOriginalName + case 2 => this.closureBindingId + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "evaluationStrategy" + case 1 => "closureOriginalName" + case 2 => "closureBindingId" + case _ => "" + } + + override def productPrefix = "NewClosureBinding" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewClosureBinding] +} + +object NewComment { + def apply(): NewComment = new NewComment +} + +class NewComment extends NewNode with CommentBase with AstNodeNew { + type StoredType = Comment + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var filename: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "COMMENT" + + override def copy: this.type = { + val newInstance = new NewComment + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.filename = this.filename + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def filename(value: String): this.type = { + this.filename = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == filename)) { res += "FILENAME" -> filename } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.filename + case 3 => this.columnNumber + case 4 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "filename" + case 3 => "columnNumber" + case 4 => "code" + case _ => "" + } + + override def productPrefix = "NewComment" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewComment] +} + +object NewConfigFile { + def apply(): NewConfigFile = new NewConfigFile +} + +class NewConfigFile extends NewNode with ConfigFileBase { + type StoredType = ConfigFile + + var name: String = "" + var content: String = "" + + override def label: String = "CONFIG_FILE" + + override def copy: this.type = { + val newInstance = new NewConfigFile + newInstance.content = this.content + newInstance.name = this.name + newInstance.asInstanceOf[this.type] + } + + def content(value: String): this.type = { + this.content = value + this + } + + def name(value: String): this.type = { + this.name = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == content)) { res += "CONTENT" -> content } + if (!(("") == name)) { res += "NAME" -> name } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.name + case 1 => this.content + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "name" + case 1 => "content" + case _ => "" + } + + override def productPrefix = "NewConfigFile" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewConfigFile] +} + +object NewControlStructure { + def apply(): NewControlStructure = new NewControlStructure +} + +class NewControlStructure extends NewNode with ControlStructureBase with ExpressionNew { + type StoredType = ControlStructure + + var parserTypeName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var controlStructureType: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "CONTROL_STRUCTURE" + + override def copy: this.type = { + val newInstance = new NewControlStructure + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.controlStructureType = this.controlStructureType + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.parserTypeName = this.parserTypeName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def controlStructureType(value: String): this.type = { + this.controlStructureType = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def parserTypeName(value: String): this.type = { + this.parserTypeName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == controlStructureType)) { res += "CONTROL_STRUCTURE_TYPE" -> controlStructureType } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == parserTypeName)) { res += "PARSER_TYPE_NAME" -> parserTypeName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.parserTypeName + case 1 => this.order + case 2 => this.lineNumber + case 3 => this.controlStructureType + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentName + case 7 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "parserTypeName" + case 1 => "order" + case 2 => "lineNumber" + case 3 => "controlStructureType" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentName" + case 7 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewControlStructure" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewControlStructure] +} + +object NewDependency { + def apply(): NewDependency = new NewDependency +} + +class NewDependency extends NewNode with DependencyBase { + type StoredType = Dependency + + var version: String = "" + var name: String = "" + var dependencyGroupId: Option[String] = None + + override def label: String = "DEPENDENCY" + + override def copy: this.type = { + val newInstance = new NewDependency + newInstance.dependencyGroupId = this.dependencyGroupId + newInstance.name = this.name + newInstance.version = this.version + newInstance.asInstanceOf[this.type] + } + + def dependencyGroupId(value: String): this.type = { + this.dependencyGroupId = Option(value) + this + } + + def dependencyGroupId(value: Option[String]): this.type = dependencyGroupId(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def version(value: String): this.type = { + this.version = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + dependencyGroupId.map { value => res += "DEPENDENCY_GROUP_ID" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!(("") == version)) { res += "VERSION" -> version } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.version + case 1 => this.name + case 2 => this.dependencyGroupId + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "version" + case 1 => "name" + case 2 => "dependencyGroupId" + case _ => "" + } + + override def productPrefix = "NewDependency" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewDependency] +} + +object NewFieldIdentifier { + def apply(): NewFieldIdentifier = new NewFieldIdentifier +} + +class NewFieldIdentifier extends NewNode with FieldIdentifierBase with ExpressionNew { + type StoredType = FieldIdentifier + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var canonicalName: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "FIELD_IDENTIFIER" + + override def copy: this.type = { + val newInstance = new NewFieldIdentifier + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.canonicalName = this.canonicalName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def canonicalName(value: String): this.type = { + this.canonicalName = value + this + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == canonicalName)) { res += "CANONICAL_NAME" -> canonicalName } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case 4 => this.canonicalName + case 5 => this.argumentName + case 6 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case 4 => "canonicalName" + case 5 => "argumentName" + case 6 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewFieldIdentifier" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewFieldIdentifier] +} + +object NewFile { + def apply(): NewFile = new NewFile +} + +class NewFile extends NewNode with FileBase with AstNodeNew { + type StoredType = File + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var hash: Option[String] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "FILE" + + override def copy: this.type = { + val newInstance = new NewFile + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.hash = this.hash + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def hash(value: String): this.type = { + this.hash = Option(value) + this + } + + def hash(value: Option[String]): this.type = hash(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + hash.map { value => res += "HASH" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.hash + case 4 => this.columnNumber + case 5 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "hash" + case 4 => "columnNumber" + case 5 => "code" + case _ => "" + } + + override def productPrefix = "NewFile" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewFile] +} + +object NewFinding { + def apply(): NewFinding = new NewFinding +} + +class NewFinding extends NewNode with FindingBase { + type StoredType = Finding + + var keyValuePairs: IndexedSeq[KeyValuePairBase] = collection.immutable.ArraySeq.empty + var evidence: IndexedSeq[AbstractNode] = collection.immutable.ArraySeq.empty + + override def label: String = "FINDING" + + override def copy: this.type = { + val newInstance = new NewFinding + newInstance.evidence = this.evidence + newInstance.keyValuePairs = this.keyValuePairs + newInstance.asInstanceOf[this.type] + } + + def evidence(value: IterableOnce[AbstractNode]): this.type = { + this.evidence = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def keyValuePairs(value: IterableOnce[KeyValuePairBase]): this.type = { + this.keyValuePairs = value.iterator.to(collection.immutable.ArraySeq) + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (evidence != null && evidence.nonEmpty) { res += "evidence" -> evidence } + if (keyValuePairs != null && keyValuePairs.nonEmpty) { res += "keyValuePairs" -> keyValuePairs } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.keyValuePairs + case 1 => this.evidence + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "keyValuePairs" + case 1 => "evidence" + case _ => "" + } + + override def productPrefix = "NewFinding" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewFinding] +} + +object NewIdentifier { + def apply(): NewIdentifier = new NewIdentifier +} + +class NewIdentifier extends NewNode with IdentifierBase with ExpressionNew { + type StoredType = Identifier + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "IDENTIFIER" + + override def copy: this.type = { + val newInstance = new NewIdentifier + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.dynamicTypeHintFullName + case 5 => this.columnNumber + case 6 => this.code + case 7 => this.argumentName + case 8 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "columnNumber" + case 6 => "code" + case 7 => "argumentName" + case 8 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewIdentifier" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewIdentifier] +} + +object NewImport { + def apply(): NewImport = new NewImport +} + +class NewImport extends NewNode with ImportBase with AstNodeNew { + type StoredType = Import + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var isWildcard: Option[java.lang.Boolean] = None + var isExplicit: Option[java.lang.Boolean] = None + var importedEntity: Option[String] = None + var importedAs: Option[String] = None + var explicitAs: Option[java.lang.Boolean] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "IMPORT" + + override def copy: this.type = { + val newInstance = new NewImport + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.explicitAs = this.explicitAs + newInstance.importedAs = this.importedAs + newInstance.importedEntity = this.importedEntity + newInstance.isExplicit = this.isExplicit + newInstance.isWildcard = this.isWildcard + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def explicitAs(value: java.lang.Boolean): this.type = { + this.explicitAs = Option(value) + this + } + + def explicitAs(value: Option[java.lang.Boolean]): this.type = explicitAs(value.orNull) + + def importedAs(value: String): this.type = { + this.importedAs = Option(value) + this + } + + def importedAs(value: Option[String]): this.type = importedAs(value.orNull) + + def importedEntity(value: String): this.type = { + this.importedEntity = Option(value) + this + } + + def importedEntity(value: Option[String]): this.type = importedEntity(value.orNull) + + def isExplicit(value: java.lang.Boolean): this.type = { + this.isExplicit = Option(value) + this + } + + def isExplicit(value: Option[java.lang.Boolean]): this.type = isExplicit(value.orNull) + + def isWildcard(value: java.lang.Boolean): this.type = { + this.isWildcard = Option(value) + this + } + + def isWildcard(value: Option[java.lang.Boolean]): this.type = isWildcard(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + explicitAs.map { value => res += "EXPLICIT_AS" -> value } + importedAs.map { value => res += "IMPORTED_AS" -> value } + importedEntity.map { value => res += "IMPORTED_ENTITY" -> value } + isExplicit.map { value => res += "IS_EXPLICIT" -> value } + isWildcard.map { value => res += "IS_WILDCARD" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.isWildcard + case 3 => this.isExplicit + case 4 => this.importedEntity + case 5 => this.importedAs + case 6 => this.explicitAs + case 7 => this.columnNumber + case 8 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "isWildcard" + case 3 => "isExplicit" + case 4 => "importedEntity" + case 5 => "importedAs" + case 6 => "explicitAs" + case 7 => "columnNumber" + case 8 => "code" + case _ => "" + } + + override def productPrefix = "NewImport" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewImport] +} + +object NewJumpLabel { + def apply(): NewJumpLabel = new NewJumpLabel +} + +class NewJumpLabel extends NewNode with JumpLabelBase with AstNodeNew { + type StoredType = JumpLabel + + var parserTypeName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "JUMP_LABEL" + + override def copy: this.type = { + val newInstance = new NewJumpLabel + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.parserTypeName = this.parserTypeName + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def parserTypeName(value: String): this.type = { + this.parserTypeName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == parserTypeName)) { res += "PARSER_TYPE_NAME" -> parserTypeName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.parserTypeName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.columnNumber + case 5 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "parserTypeName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "columnNumber" + case 5 => "code" + case _ => "" + } + + override def productPrefix = "NewJumpLabel" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewJumpLabel] +} + +object NewJumpTarget { + def apply(): NewJumpTarget = new NewJumpTarget +} + +class NewJumpTarget extends NewNode with JumpTargetBase with AstNodeNew with CfgNodeNew { + type StoredType = JumpTarget + + var parserTypeName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentIndex: scala.Int = -1: Int + + override def label: String = "JUMP_TARGET" + + override def copy: this.type = { + val newInstance = new NewJumpTarget + newInstance.argumentIndex = this.argumentIndex + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.parserTypeName = this.parserTypeName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def parserTypeName(value: String): this.type = { + this.parserTypeName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == parserTypeName)) { res += "PARSER_TYPE_NAME" -> parserTypeName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.parserTypeName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "parserTypeName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewJumpTarget" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewJumpTarget] +} + +object NewKeyValuePair { + def apply(): NewKeyValuePair = new NewKeyValuePair +} + +class NewKeyValuePair extends NewNode with KeyValuePairBase { + type StoredType = KeyValuePair + + var value: String = "" + var key: String = "" + + override def label: String = "KEY_VALUE_PAIR" + + override def copy: this.type = { + val newInstance = new NewKeyValuePair + newInstance.key = this.key + newInstance.value = this.value + newInstance.asInstanceOf[this.type] + } + + def key(value: String): this.type = { + this.key = value + this + } + + def value(value: String): this.type = { + this.value = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == key)) { res += "KEY" -> key } + if (!(("") == value)) { res += "VALUE" -> value } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.value + case 1 => this.key + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "value" + case 1 => "key" + case _ => "" + } + + override def productPrefix = "NewKeyValuePair" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewKeyValuePair] +} + +object NewLiteral { + def apply(): NewLiteral = new NewLiteral +} + +class NewLiteral extends NewNode with LiteralBase with ExpressionNew { + type StoredType = Literal + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "LITERAL" + + override def copy: this.type = { + val newInstance = new NewLiteral + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.lineNumber + case 3 => this.dynamicTypeHintFullName + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentName + case 7 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "lineNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentName" + case 7 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewLiteral" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewLiteral] +} + +object NewLocal { + def apply(): NewLocal = new NewLocal +} + +class NewLocal extends NewNode with LocalBase with AstNodeNew with DeclarationNew { + type StoredType = Local + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var closureBindingId: Option[String] = None + + override def label: String = "LOCAL" + + override def copy: this.type = { + val newInstance = new NewLocal + newInstance.closureBindingId = this.closureBindingId + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def closureBindingId(value: String): this.type = { + this.closureBindingId = Option(value) + this + } + + def closureBindingId(value: Option[String]): this.type = closureBindingId(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + closureBindingId.map { value => res += "CLOSURE_BINDING_ID" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.dynamicTypeHintFullName + case 5 => this.columnNumber + case 6 => this.code + case 7 => this.closureBindingId + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "columnNumber" + case 6 => "code" + case 7 => "closureBindingId" + case _ => "" + } + + override def productPrefix = "NewLocal" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewLocal] +} + +object NewLocation { + def apply(): NewLocation = new NewLocation +} + +class NewLocation extends NewNode with LocationBase { + type StoredType = Location + + var node: Option[AbstractNode] = None + var symbol: String = "" + var packageName: String = "" + var nodeLabel: String = "" + var methodShortName: String = "" + var methodFullName: String = "" + var lineNumber: Option[Integer] = None + var filename: String = "" + var classShortName: String = "" + var className: String = "" + + override def label: String = "LOCATION" + + override def copy: this.type = { + val newInstance = new NewLocation + newInstance.className = this.className + newInstance.classShortName = this.classShortName + newInstance.filename = this.filename + newInstance.lineNumber = this.lineNumber + newInstance.methodFullName = this.methodFullName + newInstance.methodShortName = this.methodShortName + newInstance.nodeLabel = this.nodeLabel + newInstance.packageName = this.packageName + newInstance.symbol = this.symbol + newInstance.node = this.node + newInstance.asInstanceOf[this.type] + } + + def className(value: String): this.type = { + this.className = value + this + } + + def classShortName(value: String): this.type = { + this.classShortName = value + this + } + + def filename(value: String): this.type = { + this.filename = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def methodFullName(value: String): this.type = { + this.methodFullName = value + this + } + + def methodShortName(value: String): this.type = { + this.methodShortName = value + this + } + + def nodeLabel(value: String): this.type = { + this.nodeLabel = value + this + } + + def packageName(value: String): this.type = { + this.packageName = value + this + } + + def symbol(value: String): this.type = { + this.symbol = value + this + } + + def node(value: AbstractNode): this.type = { + this.node = Option(value) + this + } + + def node(value: Option[AbstractNode]): this.type = node(value.orNull) + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == className)) { res += "CLASS_NAME" -> className } + if (!(("") == classShortName)) { res += "CLASS_SHORT_NAME" -> classShortName } + if (!(("") == filename)) { res += "FILENAME" -> filename } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == methodFullName)) { res += "METHOD_FULL_NAME" -> methodFullName } + if (!(("") == methodShortName)) { res += "METHOD_SHORT_NAME" -> methodShortName } + if (!(("") == nodeLabel)) { res += "NODE_LABEL" -> nodeLabel } + if (!(("") == packageName)) { res += "PACKAGE_NAME" -> packageName } + if (!(("") == symbol)) { res += "SYMBOL" -> symbol } + node.map { value => res += "node" -> value } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.node + case 1 => this.symbol + case 2 => this.packageName + case 3 => this.nodeLabel + case 4 => this.methodShortName + case 5 => this.methodFullName + case 6 => this.lineNumber + case 7 => this.filename + case 8 => this.classShortName + case 9 => this.className + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "node" + case 1 => "symbol" + case 2 => "packageName" + case 3 => "nodeLabel" + case 4 => "methodShortName" + case 5 => "methodFullName" + case 6 => "lineNumber" + case 7 => "filename" + case 8 => "classShortName" + case 9 => "className" + case _ => "" + } + + override def productPrefix = "NewLocation" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewLocation] +} + +object NewMember { + def apply(): NewMember = new NewMember +} + +class NewMember extends NewNode with MemberBase with AstNodeNew with DeclarationNew { + type StoredType = Member + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "MEMBER" + + override def copy: this.type = { + val newInstance = new NewMember + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.dynamicTypeHintFullName + case 5 => this.columnNumber + case 6 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "columnNumber" + case 6 => "code" + case _ => "" + } + + override def productPrefix = "NewMember" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMember] +} + +object NewMetaData { + def apply(): NewMetaData = new NewMetaData +} + +class NewMetaData extends NewNode with MetaDataBase { + type StoredType = MetaData + + var version: String = "" + var root: String = "" + var overlays: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var language: String = "" + var hash: Option[String] = None + + override def label: String = "META_DATA" + + override def copy: this.type = { + val newInstance = new NewMetaData + newInstance.hash = this.hash + newInstance.language = this.language + newInstance.overlays = this.overlays + newInstance.root = this.root + newInstance.version = this.version + newInstance.asInstanceOf[this.type] + } + + def hash(value: String): this.type = { + this.hash = Option(value) + this + } + + def hash(value: Option[String]): this.type = hash(value.orNull) + + def language(value: String): this.type = { + this.language = value + this + } + + def overlays(value: IterableOnce[String]): this.type = { + this.overlays = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def root(value: String): this.type = { + this.root = value + this + } + + def version(value: String): this.type = { + this.version = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + hash.map { value => res += "HASH" -> value } + if (!(("") == language)) { res += "LANGUAGE" -> language } + if (overlays != null && overlays.nonEmpty) { res += "OVERLAYS" -> overlays } + if (!(("") == root)) { res += "ROOT" -> root } + if (!(("") == version)) { res += "VERSION" -> version } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.version + case 1 => this.root + case 2 => this.overlays + case 3 => this.language + case 4 => this.hash + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "version" + case 1 => "root" + case 2 => "overlays" + case 3 => "language" + case 4 => "hash" + case _ => "" + } + + override def productPrefix = "NewMetaData" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMetaData] +} + +object NewMethod { + def apply(): NewMethod = new NewMethod +} + +class NewMethod extends NewNode with MethodBase with AstNodeNew with CfgNodeNew with DeclarationNew { + type StoredType = Method + + var signature: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumberEnd: Option[Integer] = None + var lineNumber: Option[Integer] = None + var isExternal: Boolean = false + var hash: Option[String] = None + var fullName: String = "" + var filename: String = "" + var columnNumberEnd: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var astParentType: String = "" + var astParentFullName: String = "" + + override def label: String = "METHOD" + + override def copy: this.type = { + val newInstance = new NewMethod + newInstance.astParentFullName = this.astParentFullName + newInstance.astParentType = this.astParentType + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.columnNumberEnd = this.columnNumberEnd + newInstance.filename = this.filename + newInstance.fullName = this.fullName + newInstance.hash = this.hash + newInstance.isExternal = this.isExternal + newInstance.lineNumber = this.lineNumber + newInstance.lineNumberEnd = this.lineNumberEnd + newInstance.name = this.name + newInstance.order = this.order + newInstance.signature = this.signature + newInstance.asInstanceOf[this.type] + } + + def astParentFullName(value: String): this.type = { + this.astParentFullName = value + this + } + + def astParentType(value: String): this.type = { + this.astParentType = value + this + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def columnNumberEnd(value: Integer): this.type = { + this.columnNumberEnd = Option(value) + this + } + + def columnNumberEnd(value: Option[Integer]): this.type = columnNumberEnd(value.orNull) + + def filename(value: String): this.type = { + this.filename = value + this + } + + def fullName(value: String): this.type = { + this.fullName = value + this + } + + def hash(value: String): this.type = { + this.hash = Option(value) + this + } + + def hash(value: Option[String]): this.type = hash(value.orNull) + + def isExternal(value: Boolean): this.type = { + this.isExternal = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def lineNumberEnd(value: Integer): this.type = { + this.lineNumberEnd = Option(value) + this + } + + def lineNumberEnd(value: Option[Integer]): this.type = lineNumberEnd(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def signature(value: String): this.type = { + this.signature = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == astParentFullName)) { res += "AST_PARENT_FULL_NAME" -> astParentFullName } + if (!(("") == astParentType)) { res += "AST_PARENT_TYPE" -> astParentType } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + columnNumberEnd.map { value => res += "COLUMN_NUMBER_END" -> value } + if (!(("") == filename)) { res += "FILENAME" -> filename } + if (!(("") == fullName)) { res += "FULL_NAME" -> fullName } + hash.map { value => res += "HASH" -> value } + if (!((false) == isExternal)) { res += "IS_EXTERNAL" -> isExternal } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + lineNumberEnd.map { value => res += "LINE_NUMBER_END" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == signature)) { res += "SIGNATURE" -> signature } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.signature + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumberEnd + case 4 => this.lineNumber + case 5 => this.isExternal + case 6 => this.hash + case 7 => this.fullName + case 8 => this.filename + case 9 => this.columnNumberEnd + case 10 => this.columnNumber + case 11 => this.code + case 12 => this.astParentType + case 13 => this.astParentFullName + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "signature" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumberEnd" + case 4 => "lineNumber" + case 5 => "isExternal" + case 6 => "hash" + case 7 => "fullName" + case 8 => "filename" + case 9 => "columnNumberEnd" + case 10 => "columnNumber" + case 11 => "code" + case 12 => "astParentType" + case 13 => "astParentFullName" + case _ => "" + } + + override def productPrefix = "NewMethod" + override def productArity = 14 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMethod] +} + +object NewMethodParameterIn { + def apply(): NewMethodParameterIn = new NewMethodParameterIn +} + +class NewMethodParameterIn + extends NewNode + with MethodParameterInBase + with AstNodeNew + with CfgNodeNew + with DeclarationNew { + type StoredType = MethodParameterIn + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var isVariadic: Boolean = false + var index: scala.Int = -1: Int + var evaluationStrategy: String = "" + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "METHOD_PARAMETER_IN" + + override def copy: this.type = { + val newInstance = new NewMethodParameterIn + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.evaluationStrategy = this.evaluationStrategy + newInstance.index = this.index + newInstance.isVariadic = this.isVariadic + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def evaluationStrategy(value: String): this.type = { + this.evaluationStrategy = value + this + } + + def index(value: scala.Int): this.type = { + this.index = value + this + } + + def isVariadic(value: Boolean): this.type = { + this.isVariadic = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + if (!(("") == evaluationStrategy)) { res += "EVALUATION_STRATEGY" -> evaluationStrategy } + if (!((-1: Int) == index)) { res += "INDEX" -> index } + if (!((false) == isVariadic)) { res += "IS_VARIADIC" -> isVariadic } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.isVariadic + case 5 => this.index + case 6 => this.evaluationStrategy + case 7 => this.dynamicTypeHintFullName + case 8 => this.columnNumber + case 9 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "isVariadic" + case 5 => "index" + case 6 => "evaluationStrategy" + case 7 => "dynamicTypeHintFullName" + case 8 => "columnNumber" + case 9 => "code" + case _ => "" + } + + override def productPrefix = "NewMethodParameterIn" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMethodParameterIn] +} + +object NewMethodParameterOut { + def apply(): NewMethodParameterOut = new NewMethodParameterOut +} + +class NewMethodParameterOut + extends NewNode + with MethodParameterOutBase + with AstNodeNew + with CfgNodeNew + with DeclarationNew { + type StoredType = MethodParameterOut + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var isVariadic: Boolean = false + var index: scala.Int = -1: Int + var evaluationStrategy: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "METHOD_PARAMETER_OUT" + + override def copy: this.type = { + val newInstance = new NewMethodParameterOut + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.evaluationStrategy = this.evaluationStrategy + newInstance.index = this.index + newInstance.isVariadic = this.isVariadic + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def evaluationStrategy(value: String): this.type = { + this.evaluationStrategy = value + this + } + + def index(value: scala.Int): this.type = { + this.index = value + this + } + + def isVariadic(value: Boolean): this.type = { + this.isVariadic = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == evaluationStrategy)) { res += "EVALUATION_STRATEGY" -> evaluationStrategy } + if (!((-1: Int) == index)) { res += "INDEX" -> index } + if (!((false) == isVariadic)) { res += "IS_VARIADIC" -> isVariadic } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.name + case 3 => this.lineNumber + case 4 => this.isVariadic + case 5 => this.index + case 6 => this.evaluationStrategy + case 7 => this.columnNumber + case 8 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "name" + case 3 => "lineNumber" + case 4 => "isVariadic" + case 5 => "index" + case 6 => "evaluationStrategy" + case 7 => "columnNumber" + case 8 => "code" + case _ => "" + } + + override def productPrefix = "NewMethodParameterOut" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMethodParameterOut] +} + +object NewMethodRef { + def apply(): NewMethodRef = new NewMethodRef +} + +class NewMethodRef extends NewNode with MethodRefBase with ExpressionNew { + type StoredType = MethodRef + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var methodFullName: String = "" + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "METHOD_REF" + + override def copy: this.type = { + val newInstance = new NewMethodRef + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.methodFullName = this.methodFullName + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def methodFullName(value: String): this.type = { + this.methodFullName = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == methodFullName)) { res += "METHOD_FULL_NAME" -> methodFullName } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.methodFullName + case 3 => this.lineNumber + case 4 => this.dynamicTypeHintFullName + case 5 => this.columnNumber + case 6 => this.code + case 7 => this.argumentName + case 8 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "methodFullName" + case 3 => "lineNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "columnNumber" + case 6 => "code" + case 7 => "argumentName" + case 8 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewMethodRef" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMethodRef] +} + +object NewMethodReturn { + def apply(): NewMethodReturn = new NewMethodReturn +} + +class NewMethodReturn extends NewNode with MethodReturnBase with CfgNodeNew { + type StoredType = MethodReturn + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var evaluationStrategy: String = "" + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "METHOD_RETURN" + + override def copy: this.type = { + val newInstance = new NewMethodReturn + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.evaluationStrategy = this.evaluationStrategy + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def evaluationStrategy(value: String): this.type = { + this.evaluationStrategy = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + if (!(("") == evaluationStrategy)) { res += "EVALUATION_STRATEGY" -> evaluationStrategy } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.lineNumber + case 3 => this.evaluationStrategy + case 4 => this.dynamicTypeHintFullName + case 5 => this.columnNumber + case 6 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "lineNumber" + case 3 => "evaluationStrategy" + case 4 => "dynamicTypeHintFullName" + case 5 => "columnNumber" + case 6 => "code" + case _ => "" + } + + override def productPrefix = "NewMethodReturn" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMethodReturn] +} + +object NewModifier { + def apply(): NewModifier = new NewModifier +} + +class NewModifier extends NewNode with ModifierBase with AstNodeNew { + type StoredType = Modifier + + var order: scala.Int = -1: Int + var modifierType: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "MODIFIER" + + override def copy: this.type = { + val newInstance = new NewModifier + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.modifierType = this.modifierType + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def modifierType(value: String): this.type = { + this.modifierType = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == modifierType)) { res += "MODIFIER_TYPE" -> modifierType } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.modifierType + case 2 => this.lineNumber + case 3 => this.columnNumber + case 4 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "modifierType" + case 2 => "lineNumber" + case 3 => "columnNumber" + case 4 => "code" + case _ => "" + } + + override def productPrefix = "NewModifier" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewModifier] +} + +object NewMynodetype { + def apply(): NewMynodetype = new NewMynodetype +} + +class NewMynodetype extends NewNode with MynodetypeBase { + type StoredType = Mynodetype + + var myproperty: String = "" + + override def label: String = "MYNODETYPE" + + override def copy: this.type = { + val newInstance = new NewMynodetype + newInstance.myproperty = this.myproperty + newInstance.asInstanceOf[this.type] + } + + def myproperty(value: String): this.type = { + this.myproperty = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == myproperty)) { res += "MYPROPERTY" -> myproperty } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.myproperty + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "myproperty" + case _ => "" + } + + override def productPrefix = "NewMynodetype" + override def productArity = 1 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewMynodetype] +} + +object NewNamespace { + def apply(): NewNamespace = new NewNamespace +} + +class NewNamespace extends NewNode with NamespaceBase with AstNodeNew { + type StoredType = Namespace + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "NAMESPACE" + + override def copy: this.type = { + val newInstance = new NewNamespace + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.columnNumber + case 4 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "columnNumber" + case 4 => "code" + case _ => "" + } + + override def productPrefix = "NewNamespace" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewNamespace] +} + +object NewNamespaceBlock { + def apply(): NewNamespaceBlock = new NewNamespaceBlock +} + +class NewNamespaceBlock extends NewNode with NamespaceBlockBase with AstNodeNew { + type StoredType = NamespaceBlock + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var fullName: String = "" + var filename: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "NAMESPACE_BLOCK" + + override def copy: this.type = { + val newInstance = new NewNamespaceBlock + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.filename = this.filename + newInstance.fullName = this.fullName + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def filename(value: String): this.type = { + this.filename = value + this + } + + def fullName(value: String): this.type = { + this.fullName = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == filename)) { res += "FILENAME" -> filename } + if (!(("") == fullName)) { res += "FULL_NAME" -> fullName } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.fullName + case 4 => this.filename + case 5 => this.columnNumber + case 6 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "fullName" + case 4 => "filename" + case 5 => "columnNumber" + case 6 => "code" + case _ => "" + } + + override def productPrefix = "NewNamespaceBlock" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewNamespaceBlock] +} + +object NewReturn { + def apply(): NewReturn = new NewReturn +} + +class NewReturn extends NewNode with ReturnBase with ExpressionNew { + type StoredType = Return + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "RETURN" + + override def copy: this.type = { + val newInstance = new NewReturn + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case 4 => this.argumentName + case 5 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case 4 => "argumentName" + case 5 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewReturn" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewReturn] +} + +object NewTag { + def apply(): NewTag = new NewTag +} + +class NewTag extends NewNode with TagBase { + type StoredType = Tag + + var value: String = "" + var name: String = "" + + override def label: String = "TAG" + + override def copy: this.type = { + val newInstance = new NewTag + newInstance.name = this.name + newInstance.value = this.value + newInstance.asInstanceOf[this.type] + } + + def name(value: String): this.type = { + this.name = value + this + } + + def value(value: String): this.type = { + this.value = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == name)) { res += "NAME" -> name } + if (!(("") == value)) { res += "VALUE" -> value } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.value + case 1 => this.name + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "value" + case 1 => "name" + case _ => "" + } + + override def productPrefix = "NewTag" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTag] +} + +object NewTagNodePair { + def apply(): NewTagNodePair = new NewTagNodePair +} + +class NewTagNodePair extends NewNode with TagNodePairBase { + type StoredType = TagNodePair + + var tag: TagBase = null + var node: AbstractNode = null + + override def label: String = "TAG_NODE_PAIR" + + override def copy: this.type = { + val newInstance = new NewTagNodePair + newInstance.node = this.node + newInstance.tag = this.tag + newInstance.asInstanceOf[this.type] + } + + def node(value: AbstractNode): this.type = { + this.node = value + this + } + + def tag(value: TagBase): this.type = { + this.tag = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((null) == node)) { res += "node" -> node } + if (!((null) == tag)) { res += "tag" -> tag } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.tag + case 1 => this.node + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "tag" + case 1 => "node" + case _ => "" + } + + override def productPrefix = "NewTagNodePair" + override def productArity = 2 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTagNodePair] +} + +object NewTemplateDom { + def apply(): NewTemplateDom = new NewTemplateDom +} + +class NewTemplateDom extends NewNode with TemplateDomBase with ExpressionNew { + type StoredType = TemplateDom + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "TEMPLATE_DOM" + + override def copy: this.type = { + val newInstance = new NewTemplateDom + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.columnNumber + case 4 => this.code + case 5 => this.argumentName + case 6 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "columnNumber" + case 4 => "code" + case 5 => "argumentName" + case 6 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewTemplateDom" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTemplateDom] +} + +object NewType { + def apply(): NewType = new NewType +} + +class NewType extends NewNode with TypeBase { + type StoredType = Type + + var typeDeclFullName: String = "" + var name: String = "" + var fullName: String = "" + + override def label: String = "TYPE" + + override def copy: this.type = { + val newInstance = new NewType + newInstance.fullName = this.fullName + newInstance.name = this.name + newInstance.typeDeclFullName = this.typeDeclFullName + newInstance.asInstanceOf[this.type] + } + + def fullName(value: String): this.type = { + this.fullName = value + this + } + + def name(value: String): this.type = { + this.name = value + this + } + + def typeDeclFullName(value: String): this.type = { + this.typeDeclFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == fullName)) { res += "FULL_NAME" -> fullName } + if (!(("") == name)) { res += "NAME" -> name } + if (!(("") == typeDeclFullName)) { res += "TYPE_DECL_FULL_NAME" -> typeDeclFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeDeclFullName + case 1 => this.name + case 2 => this.fullName + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeDeclFullName" + case 1 => "name" + case 2 => "fullName" + case _ => "" + } + + override def productPrefix = "NewType" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewType] +} + +object NewTypeArgument { + def apply(): NewTypeArgument = new NewTypeArgument +} + +class NewTypeArgument extends NewNode with TypeArgumentBase with AstNodeNew { + type StoredType = TypeArgument + + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "TYPE_ARGUMENT" + + override def copy: this.type = { + val newInstance = new NewTypeArgument + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.lineNumber + case 2 => this.columnNumber + case 3 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "lineNumber" + case 2 => "columnNumber" + case 3 => "code" + case _ => "" + } + + override def productPrefix = "NewTypeArgument" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTypeArgument] +} + +object NewTypeDecl { + def apply(): NewTypeDecl = new NewTypeDecl +} + +class NewTypeDecl extends NewNode with TypeDeclBase with AstNodeNew { + type StoredType = TypeDecl + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var isExternal: Boolean = false + var inheritsFromTypeFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var fullName: String = "" + var filename: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + var astParentType: String = "" + var astParentFullName: String = "" + var aliasTypeFullName: Option[String] = None + + override def label: String = "TYPE_DECL" + + override def copy: this.type = { + val newInstance = new NewTypeDecl + newInstance.aliasTypeFullName = this.aliasTypeFullName + newInstance.astParentFullName = this.astParentFullName + newInstance.astParentType = this.astParentType + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.filename = this.filename + newInstance.fullName = this.fullName + newInstance.inheritsFromTypeFullName = this.inheritsFromTypeFullName + newInstance.isExternal = this.isExternal + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def aliasTypeFullName(value: String): this.type = { + this.aliasTypeFullName = Option(value) + this + } + + def aliasTypeFullName(value: Option[String]): this.type = aliasTypeFullName(value.orNull) + + def astParentFullName(value: String): this.type = { + this.astParentFullName = value + this + } + + def astParentType(value: String): this.type = { + this.astParentType = value + this + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def filename(value: String): this.type = { + this.filename = value + this + } + + def fullName(value: String): this.type = { + this.fullName = value + this + } + + def inheritsFromTypeFullName(value: IterableOnce[String]): this.type = { + this.inheritsFromTypeFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def isExternal(value: Boolean): this.type = { + this.isExternal = value + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + aliasTypeFullName.map { value => res += "ALIAS_TYPE_FULL_NAME" -> value } + if (!(("") == astParentFullName)) { res += "AST_PARENT_FULL_NAME" -> astParentFullName } + if (!(("") == astParentType)) { res += "AST_PARENT_TYPE" -> astParentType } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == filename)) { res += "FILENAME" -> filename } + if (!(("") == fullName)) { res += "FULL_NAME" -> fullName } + if (inheritsFromTypeFullName != null && inheritsFromTypeFullName.nonEmpty) { + res += "INHERITS_FROM_TYPE_FULL_NAME" -> inheritsFromTypeFullName + } + if (!((false) == isExternal)) { res += "IS_EXTERNAL" -> isExternal } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.isExternal + case 4 => this.inheritsFromTypeFullName + case 5 => this.fullName + case 6 => this.filename + case 7 => this.columnNumber + case 8 => this.code + case 9 => this.astParentType + case 10 => this.astParentFullName + case 11 => this.aliasTypeFullName + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "isExternal" + case 4 => "inheritsFromTypeFullName" + case 5 => "fullName" + case 6 => "filename" + case 7 => "columnNumber" + case 8 => "code" + case 9 => "astParentType" + case 10 => "astParentFullName" + case 11 => "aliasTypeFullName" + case _ => "" + } + + override def productPrefix = "NewTypeDecl" + override def productArity = 12 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTypeDecl] +} + +object NewTypeParameter { + def apply(): NewTypeParameter = new NewTypeParameter +} + +class NewTypeParameter extends NewNode with TypeParameterBase with AstNodeNew { + type StoredType = TypeParameter + + var order: scala.Int = -1: Int + var name: String = "" + var lineNumber: Option[Integer] = None + var columnNumber: Option[Integer] = None + var code: String = "" + + override def label: String = "TYPE_PARAMETER" + + override def copy: this.type = { + val newInstance = new NewTypeParameter + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.lineNumber = this.lineNumber + newInstance.name = this.name + newInstance.order = this.order + newInstance.asInstanceOf[this.type] + } + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def name(value: String): this.type = { + this.name = value + this + } + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!(("") == name)) { res += "NAME" -> name } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.order + case 1 => this.name + case 2 => this.lineNumber + case 3 => this.columnNumber + case 4 => this.code + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "order" + case 1 => "name" + case 2 => "lineNumber" + case 3 => "columnNumber" + case 4 => "code" + case _ => "" + } + + override def productPrefix = "NewTypeParameter" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTypeParameter] +} + +object NewTypeRef { + def apply(): NewTypeRef = new NewTypeRef +} + +class NewTypeRef extends NewNode with TypeRefBase with ExpressionNew { + type StoredType = TypeRef + + var typeFullName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "TYPE_REF" + + override def copy: this.type = { + val newInstance = new NewTypeRef + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.order + case 2 => this.lineNumber + case 3 => this.dynamicTypeHintFullName + case 4 => this.columnNumber + case 5 => this.code + case 6 => this.argumentName + case 7 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "order" + case 2 => "lineNumber" + case 3 => "dynamicTypeHintFullName" + case 4 => "columnNumber" + case 5 => "code" + case 6 => "argumentName" + case 7 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewTypeRef" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewTypeRef] +} + +object NewUnknown { + def apply(): NewUnknown = new NewUnknown +} + +class NewUnknown extends NewNode with UnknownBase with ExpressionNew { + type StoredType = Unknown + + var typeFullName: String = "" + var parserTypeName: String = "" + var order: scala.Int = -1: Int + var lineNumber: Option[Integer] = None + var dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + var containedRef: String = "" + var columnNumber: Option[Integer] = None + var code: String = "" + var argumentName: Option[String] = None + var argumentIndex: scala.Int = -1: Int + + override def label: String = "UNKNOWN" + + override def copy: this.type = { + val newInstance = new NewUnknown + newInstance.argumentIndex = this.argumentIndex + newInstance.argumentName = this.argumentName + newInstance.code = this.code + newInstance.columnNumber = this.columnNumber + newInstance.containedRef = this.containedRef + newInstance.dynamicTypeHintFullName = this.dynamicTypeHintFullName + newInstance.lineNumber = this.lineNumber + newInstance.order = this.order + newInstance.parserTypeName = this.parserTypeName + newInstance.typeFullName = this.typeFullName + newInstance.asInstanceOf[this.type] + } + + def argumentIndex(value: scala.Int): this.type = { + this.argumentIndex = value + this + } + + def argumentName(value: String): this.type = { + this.argumentName = Option(value) + this + } + + def argumentName(value: Option[String]): this.type = argumentName(value.orNull) + + def code(value: String): this.type = { + this.code = value + this + } + + def columnNumber(value: Integer): this.type = { + this.columnNumber = Option(value) + this + } + + def columnNumber(value: Option[Integer]): this.type = columnNumber(value.orNull) + + def containedRef(value: String): this.type = { + this.containedRef = value + this + } + + def dynamicTypeHintFullName(value: IterableOnce[String]): this.type = { + this.dynamicTypeHintFullName = value.iterator.to(collection.immutable.ArraySeq) + this + } + + def lineNumber(value: Integer): this.type = { + this.lineNumber = Option(value) + this + } + + def lineNumber(value: Option[Integer]): this.type = lineNumber(value.orNull) + + def order(value: scala.Int): this.type = { + this.order = value + this + } + + def parserTypeName(value: String): this.type = { + this.parserTypeName = value + this + } + + def typeFullName(value: String): this.type = { + this.typeFullName = value + this + } + + override def properties: Map[String, Any] = { + var res = Map[String, Any]() + if (!((-1: Int) == argumentIndex)) { res += "ARGUMENT_INDEX" -> argumentIndex } + argumentName.map { value => res += "ARGUMENT_NAME" -> value } + if (!(("") == code)) { res += "CODE" -> code } + columnNumber.map { value => res += "COLUMN_NUMBER" -> value } + if (!(("") == containedRef)) { res += "CONTAINED_REF" -> containedRef } + if (dynamicTypeHintFullName != null && dynamicTypeHintFullName.nonEmpty) { + res += "DYNAMIC_TYPE_HINT_FULL_NAME" -> dynamicTypeHintFullName + } + lineNumber.map { value => res += "LINE_NUMBER" -> value } + if (!((-1: Int) == order)) { res += "ORDER" -> order } + if (!(("") == parserTypeName)) { res += "PARSER_TYPE_NAME" -> parserTypeName } + if (!(("") == typeFullName)) { res += "TYPE_FULL_NAME" -> typeFullName } + res + } + + override def productElement(n: Int): Any = + n match { + case 0 => this.typeFullName + case 1 => this.parserTypeName + case 2 => this.order + case 3 => this.lineNumber + case 4 => this.dynamicTypeHintFullName + case 5 => this.containedRef + case 6 => this.columnNumber + case 7 => this.code + case 8 => this.argumentName + case 9 => this.argumentIndex + case _ => null + } + + override def productElementName(n: Int): String = + n match { + case 0 => "typeFullName" + case 1 => "parserTypeName" + case 2 => "order" + case 3 => "lineNumber" + case 4 => "dynamicTypeHintFullName" + case 5 => "containedRef" + case 6 => "columnNumber" + case 7 => "code" + case 8 => "argumentName" + case 9 => "argumentIndex" + case _ => "" + } + + override def productPrefix = "NewUnknown" + override def productArity = 10 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[NewUnknown] +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala new file mode 100644 index 0000000..5d0411e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala @@ -0,0 +1,952 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Return { + def apply(graph: Graph, id: Long) = new Return(graph, id) + + val Label = "RETURN" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = + Array("ARGUMENT", "AST", "CFG", "DOMINATE", "POINTS_TO", "POST_DOMINATE", "REACHING_DEF", "TAGGED_BY") + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF" + ) + } + + val factory = new NodeFactory[ReturnDb] { + override val forLabel = Return.Label + + override def createNode(ref: NodeRef[ReturnDb]) = + new ReturnDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Return(graph, id) + } +} + +trait ReturnBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class Return(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[ReturnDb](graph_4762, id_4762) + with ReturnBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Return.PropertyDefaults.ArgumentIndex + case "CODE" => Return.PropertyDefaults.Code + case "ORDER" => Return.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[CfgNode] = get().argumentOut + override def _argumentOut = get()._argumentOut + + /** Traverse to BLOCK via ARGUMENT OUT edge. + */ + def _blockViaArgumentOut: Option[Block] = get()._blockViaArgumentOut + + /** Traverse to CALL via ARGUMENT OUT edge. + */ + def _callViaArgumentOut: Option[Call] = get()._callViaArgumentOut + + /** Traverse to CONTROL_STRUCTURE via ARGUMENT OUT edge. + */ + def _controlStructureViaArgumentOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaArgumentOut + + /** Traverse to IDENTIFIER via ARGUMENT OUT edge. + */ + def _identifierViaArgumentOut: Option[Identifier] = get()._identifierViaArgumentOut + + /** Traverse to JUMP_TARGET via ARGUMENT OUT edge. + */ + def _jumpTargetViaArgumentOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaArgumentOut + + /** Traverse to LITERAL via ARGUMENT OUT edge. + */ + def _literalViaArgumentOut: Option[Literal] = get()._literalViaArgumentOut + + /** Traverse to METHOD_REF via ARGUMENT OUT edge. + */ + def _methodRefViaArgumentOut: Option[MethodRef] = get()._methodRefViaArgumentOut + + /** Traverse to RETURN via ARGUMENT OUT edge. + */ + def _returnViaArgumentOut: Option[Return] = get()._returnViaArgumentOut + + /** Traverse to TYPE_REF via ARGUMENT OUT edge. + */ + def _typeRefViaArgumentOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaArgumentOut + + /** Traverse to UNKNOWN via ARGUMENT OUT edge. + */ + def _unknownViaArgumentOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaArgumentOut + + def astOut: Iterator[CfgNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to BLOCK via AST OUT edge. + */ + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = get()._blockViaAstOut + + /** Traverse to CALL via AST OUT edge. + */ + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = get()._callViaAstOut + + /** Traverse to CONTROL_STRUCTURE via AST OUT edge. + */ + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstOut + + /** Traverse to IDENTIFIER via AST OUT edge. + */ + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaAstOut + + /** Traverse to JUMP_TARGET via AST OUT edge. + */ + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaAstOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + /** Traverse to METHOD_REF via AST OUT edge. + */ + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaAstOut + + /** Traverse to RETURN via AST OUT edge. + */ + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = get()._returnViaAstOut + + /** Traverse to TYPE_REF via AST OUT edge. + */ + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaAstOut + + /** Traverse to UNKNOWN via AST OUT edge. + */ + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstOut + + def cfgOut: Iterator[MethodReturn] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to METHOD_RETURN via CFG OUT edge. + */ + def _methodReturnViaCfgOut: MethodReturn = get()._methodReturnViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to METHOD_RETURN via REACHING_DEF OUT edge. + */ + def _methodReturnViaReachingDefOut: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Return] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: Option[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: Option[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Return.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => order + } + + override def productPrefix = "Return" + override def productArity = 7 +} + +class ReturnDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with ReturnBase { + + override def layoutInformation: NodeLayoutInformation = Return.layoutInformation + + private var _argumentIndex: scala.Int = Return.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Return.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Return.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _blockViaArgumentOut: Option[Block] = argumentOut.collectAll[Block].nextOption() + def _callViaArgumentOut: Option[Call] = argumentOut.collectAll[Call].nextOption() + def _controlStructureViaArgumentOut: overflowdb.traversal.Traversal[ControlStructure] = + argumentOut.collectAll[ControlStructure] + def _identifierViaArgumentOut: Option[Identifier] = argumentOut.collectAll[Identifier].nextOption() + def _jumpTargetViaArgumentOut: overflowdb.traversal.Traversal[JumpTarget] = argumentOut.collectAll[JumpTarget] + def _literalViaArgumentOut: Option[Literal] = argumentOut.collectAll[Literal].nextOption() + def _methodRefViaArgumentOut: Option[MethodRef] = argumentOut.collectAll[MethodRef].nextOption() + def _returnViaArgumentOut: Option[Return] = argumentOut.collectAll[Return].nextOption() + def _typeRefViaArgumentOut: overflowdb.traversal.Traversal[TypeRef] = argumentOut.collectAll[TypeRef] + def _unknownViaArgumentOut: overflowdb.traversal.Traversal[Unknown] = argumentOut.collectAll[Unknown] + + def astOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = astOut.collectAll[Block] + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = astOut.collectAll[Call] + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = astOut.collectAll[ControlStructure] + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = astOut.collectAll[Identifier] + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = astOut.collectAll[JumpTarget] + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + def _methodRefViaAstOut: overflowdb.traversal.Traversal[MethodRef] = astOut.collectAll[MethodRef] + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = astOut.collectAll[Return] + def _typeRefViaAstOut: overflowdb.traversal.Traversal[TypeRef] = astOut.collectAll[TypeRef] + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = astOut.collectAll[Unknown] + + def cfgOut: Iterator[MethodReturn] = createAdjacentNodeScalaIteratorByOffSet[MethodReturn](2) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _methodReturnViaCfgOut: MethodReturn = try { cfgOut.collectAll[MethodReturn].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "OUT edge with label CFG to an adjacent METHOD_RETURN is mandatory, but not defined for this RETURN node with id=" + id, + e + ) + } + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _methodReturnViaReachingDefOut: overflowdb.traversal.Traversal[MethodReturn] = + reachingDefOut.collectAll[MethodReturn] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](7) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Return] = createAdjacentNodeScalaIteratorByOffSet[Return](8) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _returnViaArgumentIn: Option[Return] = argumentIn.collectAll[Return].nextOption() + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](9) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: Option[ControlStructure] = astIn.collectAll[ControlStructure].nextOption() + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](10) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](11) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](12) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](13) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](14) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](15) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + override def label: String = { + Return.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => order + } + + override def productPrefix = "Return" + override def productArity = 7 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[ReturnDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewReturn].argumentIndex + this._argumentName = newNode.asInstanceOf[NewReturn].argumentName.orNull + this._code = newNode.asInstanceOf[NewReturn].code + this._columnNumber = newNode.asInstanceOf[NewReturn].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewReturn].lineNumber.orNull + this._order = newNode.asInstanceOf[NewReturn].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/RootTypes.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/RootTypes.scala new file mode 100644 index 0000000..9cdd754 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/RootTypes.scala @@ -0,0 +1,148 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object PropertyErrorRegister { + private var errorMap = Set[(Class[_], String)]() + private val logger = org.slf4j.LoggerFactory.getLogger(getClass) + + def logPropertyErrorIfFirst(clazz: Class[_], propertyName: String): Unit = { + if (!errorMap.contains((clazz, propertyName))) { + logger.warn("Property " + propertyName + " is deprecated for " + clazz.getName + ".") + errorMap += ((clazz, propertyName)) + } + } +} + +object Misc { + val reChars = "[](){}*+&|?.,\\$" + def isRegex(pattern: String): Boolean = pattern.exists(reChars.contains(_)) +} + +trait StaticType[+T] + +/** Abstract supertype for overflowdb.Node and NewNode */ +trait AbstractNode extends overflowdb.NodeOrDetachedNode with StaticType[AnyRef] { + def label: String +} + +/* A node that is stored inside an Graph (rather than e.g. DiffGraph) */ +trait StoredNode extends Node with AbstractNode with Product { + /* underlying Node in the graph. + * since this is a StoredNode, this is always set */ + def underlying: Node = this + + /* all properties plus label and id */ + def toMap: Map[String, Any] = { + val map = propertiesMap() + map.put("_label", label) + map.put("_id", id: java.lang.Long) + map.asScala.toMap + } + + /*Sets fields from newNode*/ + def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = ??? + + def _aliasOfIn: Iterator[StoredNode] = Iterator.empty + def _argumentIn: Iterator[StoredNode] = Iterator.empty + def _astIn: Iterator[StoredNode] = Iterator.empty + def _bindsIn: Iterator[StoredNode] = Iterator.empty + def _bindsToIn: Iterator[StoredNode] = Iterator.empty + def _callIn: Iterator[StoredNode] = Iterator.empty + def _captureIn: Iterator[StoredNode] = Iterator.empty + def _capturedByIn: Iterator[StoredNode] = Iterator.empty + def _cdgIn: Iterator[StoredNode] = Iterator.empty + def _cfgIn: Iterator[StoredNode] = Iterator.empty + def _conditionIn: Iterator[StoredNode] = Iterator.empty + def _containsIn: Iterator[StoredNode] = Iterator.empty + def _dominateIn: Iterator[StoredNode] = Iterator.empty + def _evalTypeIn: Iterator[StoredNode] = Iterator.empty + def _importsIn: Iterator[StoredNode] = Iterator.empty + def _inheritsFromIn: Iterator[StoredNode] = Iterator.empty + def _isCallForImportIn: Iterator[StoredNode] = Iterator.empty + def _parameterLinkIn: Iterator[StoredNode] = Iterator.empty + def _pointsToIn: Iterator[StoredNode] = Iterator.empty + def _postDominateIn: Iterator[StoredNode] = Iterator.empty + def _reachingDefIn: Iterator[StoredNode] = Iterator.empty + def _receiverIn: Iterator[StoredNode] = Iterator.empty + def _refIn: Iterator[StoredNode] = Iterator.empty + def _sourceFileIn: Iterator[StoredNode] = Iterator.empty + def _taggedByIn: Iterator[StoredNode] = Iterator.empty + def _aliasOfOut: Iterator[StoredNode] = Iterator.empty + def _argumentOut: Iterator[StoredNode] = Iterator.empty + def _astOut: Iterator[StoredNode] = Iterator.empty + def _bindsOut: Iterator[StoredNode] = Iterator.empty + def _bindsToOut: Iterator[StoredNode] = Iterator.empty + def _callOut: Iterator[StoredNode] = Iterator.empty + def _captureOut: Iterator[StoredNode] = Iterator.empty + def _capturedByOut: Iterator[StoredNode] = Iterator.empty + def _cdgOut: Iterator[StoredNode] = Iterator.empty + def _cfgOut: Iterator[StoredNode] = Iterator.empty + def _conditionOut: Iterator[StoredNode] = Iterator.empty + def _containsOut: Iterator[StoredNode] = Iterator.empty + def _dominateOut: Iterator[StoredNode] = Iterator.empty + def _evalTypeOut: Iterator[StoredNode] = Iterator.empty + def _importsOut: Iterator[StoredNode] = Iterator.empty + def _inheritsFromOut: Iterator[StoredNode] = Iterator.empty + def _isCallForImportOut: Iterator[StoredNode] = Iterator.empty + def _parameterLinkOut: Iterator[StoredNode] = Iterator.empty + def _pointsToOut: Iterator[StoredNode] = Iterator.empty + def _postDominateOut: Iterator[StoredNode] = Iterator.empty + def _reachingDefOut: Iterator[StoredNode] = Iterator.empty + def _receiverOut: Iterator[StoredNode] = Iterator.empty + def _refOut: Iterator[StoredNode] = Iterator.empty + def _sourceFileOut: Iterator[StoredNode] = Iterator.empty + def _taggedByOut: Iterator[StoredNode] = Iterator.empty +} + +object Factories { + lazy val all: Seq[NodeFactory[_]] = Seq( + Annotation.factory, + AnnotationLiteral.factory, + AnnotationParameter.factory, + AnnotationParameterAssign.factory, + ArrayInitializer.factory, + Binding.factory, + Block.factory, + Call.factory, + ClosureBinding.factory, + Comment.factory, + ConfigFile.factory, + ControlStructure.factory, + Dependency.factory, + FieldIdentifier.factory, + File.factory, + Finding.factory, + Identifier.factory, + Import.factory, + JumpLabel.factory, + JumpTarget.factory, + KeyValuePair.factory, + Literal.factory, + Local.factory, + Location.factory, + Member.factory, + MetaData.factory, + Method.factory, + MethodParameterIn.factory, + MethodParameterOut.factory, + MethodRef.factory, + MethodReturn.factory, + Modifier.factory, + Mynodetype.factory, + Namespace.factory, + NamespaceBlock.factory, + Return.factory, + Tag.factory, + TagNodePair.factory, + TemplateDom.factory, + Type.factory, + TypeArgument.factory, + TypeDecl.factory, + TypeParameter.factory, + TypeRef.factory, + Unknown.factory + ) + lazy val allAsJava: java.util.List[NodeFactory[_]] = all.asJava +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala new file mode 100644 index 0000000..f41a0ee --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala @@ -0,0 +1,299 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Tag { + def apply(graph: Graph, id: Long) = new Tag(graph, id) + + val Label = "TAG" + + object PropertyNames { + val Name = "NAME" + val Value = "VALUE" + val all: Set[String] = Set(Name, Value) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Name = new overflowdb.PropertyKey[String]("NAME") + val Value = new overflowdb.PropertyKey[String]("VALUE") + + } + + object PropertyDefaults { + val Name = "" + val Value = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List(io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("TAGGED_BY") + } + + val factory = new NodeFactory[TagDb] { + override val forLabel = Tag.Label + + override def createNode(ref: NodeRef[TagDb]) = + new TagDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Tag(graph, id) + } +} + +trait TagBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def name: String + def value: String + +} + +class Tag(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TagDb](graph_4762, id_4762) + with TagBase + with StoredNode { + override def name: String = get().name + override def value: String = get().value + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "NAME" => Tag.PropertyDefaults.Name + case "VALUE" => Tag.PropertyDefaults.Value + case _ => super.propertyDefaultValue(propertyKey) + } + + def taggedByIn: Iterator[AstNode] = get().taggedByIn + override def _taggedByIn = get()._taggedByIn + + /** Traverse to BLOCK via TAGGED_BY IN edge. + */ + def _blockViaTaggedByIn: overflowdb.traversal.Traversal[Block] = get()._blockViaTaggedByIn + + /** Traverse to CALL via TAGGED_BY IN edge. + */ + def _callViaTaggedByIn: overflowdb.traversal.Traversal[Call] = get()._callViaTaggedByIn + + /** Traverse to CONTROL_STRUCTURE via TAGGED_BY IN edge. + */ + def _controlStructureViaTaggedByIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaTaggedByIn + + /** Traverse to FIELD_IDENTIFIER via TAGGED_BY IN edge. + */ + def _fieldIdentifierViaTaggedByIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaTaggedByIn + + /** Traverse to FILE via TAGGED_BY IN edge. + */ + def _fileViaTaggedByIn: overflowdb.traversal.Traversal[File] = get()._fileViaTaggedByIn + + /** Traverse to IDENTIFIER via TAGGED_BY IN edge. + */ + def _identifierViaTaggedByIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaTaggedByIn + + /** Traverse to JUMP_TARGET via TAGGED_BY IN edge. + */ + def _jumpTargetViaTaggedByIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaTaggedByIn + + /** Traverse to LITERAL via TAGGED_BY IN edge. + */ + def _literalViaTaggedByIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaTaggedByIn + + /** Traverse to LOCAL via TAGGED_BY IN edge. + */ + def _localViaTaggedByIn: overflowdb.traversal.Traversal[Local] = get()._localViaTaggedByIn + + /** Traverse to MEMBER via TAGGED_BY IN edge. + */ + def _memberViaTaggedByIn: overflowdb.traversal.Traversal[Member] = get()._memberViaTaggedByIn + + /** Traverse to METHOD via TAGGED_BY IN edge. + */ + def _methodViaTaggedByIn: overflowdb.traversal.Traversal[Method] = get()._methodViaTaggedByIn + + /** Traverse to METHOD_PARAMETER_IN via TAGGED_BY IN edge. + */ + def _methodParameterInViaTaggedByIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaTaggedByIn + + /** Traverse to METHOD_PARAMETER_OUT via TAGGED_BY IN edge. + */ + def _methodParameterOutViaTaggedByIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaTaggedByIn + + /** Traverse to METHOD_REF via TAGGED_BY IN edge. + */ + def _methodRefViaTaggedByIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaTaggedByIn + + /** Traverse to METHOD_RETURN via TAGGED_BY IN edge. + */ + def _methodReturnViaTaggedByIn: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaTaggedByIn + + /** Traverse to RETURN via TAGGED_BY IN edge. + */ + def _returnViaTaggedByIn: overflowdb.traversal.Traversal[Return] = get()._returnViaTaggedByIn + + /** Traverse to TEMPLATE_DOM via TAGGED_BY IN edge. + */ + def _templateDomViaTaggedByIn: overflowdb.traversal.Traversal[TemplateDom] = get()._templateDomViaTaggedByIn + + /** Traverse to TYPE_REF via TAGGED_BY IN edge. + */ + def _typeRefViaTaggedByIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaTaggedByIn + + /** Traverse to UNKNOWN via TAGGED_BY IN edge. + */ + def _unknownViaTaggedByIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaTaggedByIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Tag.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "name" + case 2 => "value" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => name + case 2 => value + } + + override def productPrefix = "Tag" + override def productArity = 3 +} + +class TagDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with TagBase { + + override def layoutInformation: NodeLayoutInformation = Tag.layoutInformation + + private var _name: String = Tag.PropertyDefaults.Name + def name: String = _name + private var _value: String = Tag.PropertyDefaults.Value + def value: String = _value + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("NAME", name) + properties.put("VALUE", value) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == name)) { properties.put("NAME", name) } + if (!(("") == value)) { properties.put("VALUE", value) } + + properties + } + + import overflowdb.traversal._ + def taggedByIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _taggedByIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _blockViaTaggedByIn: overflowdb.traversal.Traversal[Block] = taggedByIn.collectAll[Block] + def _callViaTaggedByIn: overflowdb.traversal.Traversal[Call] = taggedByIn.collectAll[Call] + def _controlStructureViaTaggedByIn: overflowdb.traversal.Traversal[ControlStructure] = + taggedByIn.collectAll[ControlStructure] + def _fieldIdentifierViaTaggedByIn: overflowdb.traversal.Traversal[FieldIdentifier] = + taggedByIn.collectAll[FieldIdentifier] + def _fileViaTaggedByIn: overflowdb.traversal.Traversal[File] = taggedByIn.collectAll[File] + def _identifierViaTaggedByIn: overflowdb.traversal.Traversal[Identifier] = taggedByIn.collectAll[Identifier] + def _jumpTargetViaTaggedByIn: overflowdb.traversal.Traversal[JumpTarget] = taggedByIn.collectAll[JumpTarget] + def _literalViaTaggedByIn: overflowdb.traversal.Traversal[Literal] = taggedByIn.collectAll[Literal] + def _localViaTaggedByIn: overflowdb.traversal.Traversal[Local] = taggedByIn.collectAll[Local] + def _memberViaTaggedByIn: overflowdb.traversal.Traversal[Member] = taggedByIn.collectAll[Member] + def _methodViaTaggedByIn: overflowdb.traversal.Traversal[Method] = taggedByIn.collectAll[Method] + def _methodParameterInViaTaggedByIn: overflowdb.traversal.Traversal[MethodParameterIn] = + taggedByIn.collectAll[MethodParameterIn] + def _methodParameterOutViaTaggedByIn: overflowdb.traversal.Traversal[MethodParameterOut] = + taggedByIn.collectAll[MethodParameterOut] + def _methodRefViaTaggedByIn: overflowdb.traversal.Traversal[MethodRef] = taggedByIn.collectAll[MethodRef] + def _methodReturnViaTaggedByIn: overflowdb.traversal.Traversal[MethodReturn] = taggedByIn.collectAll[MethodReturn] + def _returnViaTaggedByIn: overflowdb.traversal.Traversal[Return] = taggedByIn.collectAll[Return] + def _templateDomViaTaggedByIn: overflowdb.traversal.Traversal[TemplateDom] = taggedByIn.collectAll[TemplateDom] + def _typeRefViaTaggedByIn: overflowdb.traversal.Traversal[TypeRef] = taggedByIn.collectAll[TypeRef] + def _unknownViaTaggedByIn: overflowdb.traversal.Traversal[Unknown] = taggedByIn.collectAll[Unknown] + + override def label: String = { + Tag.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "name" + case 2 => "value" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => name + case 2 => value + } + + override def productPrefix = "Tag" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TagDb] + + override def property(key: String): Any = { + key match { + case "NAME" => this._name + case "VALUE" => this._value + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "NAME" => this._name = value.asInstanceOf[String] + case "VALUE" => this._value = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._name = newNode.asInstanceOf[NewTag].name + this._value = newNode.asInstanceOf[NewTag].value + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala new file mode 100644 index 0000000..bd59691 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala @@ -0,0 +1,196 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TagNodePair { + def apply(graph: Graph, id: Long) = new TagNodePair(graph, id) + + val Label = "TAG_NODE_PAIR" + + object PropertyNames { + val Node = "node" + val Tag = "tag" + val all: Set[String] = Set(Node, Tag) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + + val Node = new overflowdb.PropertyKey[StoredNode]("node") + val Tag = new overflowdb.PropertyKey[Tag]("tag") + } + + object PropertyDefaults {} + + val layoutInformation = new NodeLayoutInformation(Label, PropertyNames.allAsJava, List().asJava, List().asJava) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array() + } + + val factory = new NodeFactory[TagNodePairDb] { + override val forLabel = TagNodePair.Label + + override def createNode(ref: NodeRef[TagNodePairDb]) = + new TagNodePairDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TagNodePair(graph, id) + } +} + +trait TagNodePairBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def node: AbstractNode + def tag: TagBase +} + +class TagNodePair(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TagNodePairDb](graph_4762, id_4762) + with TagNodePairBase + with StoredNode { + + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + + case _ => super.propertyDefaultValue(propertyKey) + } + + def node: StoredNode = get().node + + def tag: Tag = get().tag + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TagNodePair.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "node" + case 2 => "tag" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => node + case 2 => tag + } + + override def productPrefix = "TagNodePair" + override def productArity = 3 +} + +class TagNodePairDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with TagNodePairBase { + + override def layoutInformation: NodeLayoutInformation = TagNodePair.layoutInformation + + private var _node: StoredNode = null + def node: StoredNode = this._node + + private var _tag: Tag = null + def tag: Tag = this._tag + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + + properties.put("node", this._node) + properties.put("tag", this._tag) + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + + if (!((null) == this._node)) { properties.put("node", this._node) } + if (!((null) == this._tag)) { properties.put("tag", this._tag) } + properties + } + + import overflowdb.traversal._ + + override def label: String = { + TagNodePair.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "node" + case 2 => "tag" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => node + case 2 => tag + } + + override def productPrefix = "TagNodePair" + override def productArity = 3 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TagNodePairDb] + + override def property(key: String): Any = { + key match { + + case "node" => this._node + case "tag" => this._tag + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + + case "node" => this._node = value.asInstanceOf[StoredNode] + case "tag" => this._tag = value.asInstanceOf[Tag] + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + + this._node = newNode.asInstanceOf[NewTagNodePair].node match { + case null => null + case newNode: NewNode => mapping(newNode).asInstanceOf[StoredNode] + case oldNode: StoredNode => oldNode.asInstanceOf[StoredNode] + case _ => throw new MatchError("unreachable") + } + this._tag = newNode.asInstanceOf[NewTagNodePair].tag match { + case null => null + case newNode: NewNode => mapping(newNode).asInstanceOf[Tag] + case oldNode: StoredNode => oldNode.asInstanceOf[Tag] + case _ => throw new MatchError("unreachable") + } + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala new file mode 100644 index 0000000..a888ed3 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala @@ -0,0 +1,379 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TemplateDom { + def apply(graph: Graph, id: Long) = new TemplateDom(graph, id) + + val Label = "TEMPLATE_DOM" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ARGUMENT", "AST", "POINTS_TO", "REACHING_DEF", "TAGGED_BY") + val In: Array[String] = Array("ARGUMENT", "AST", "CFG", "CONTAINS", "POINTS_TO", "REACHING_DEF") + } + + val factory = new NodeFactory[TemplateDomDb] { + override val forLabel = TemplateDom.Label + + override def createNode(ref: NodeRef[TemplateDomDb]) = + new TemplateDomDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TemplateDom(graph, id) + } +} + +trait TemplateDomBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class TemplateDom(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TemplateDomDb](graph_4762, id_4762) + with TemplateDomBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => TemplateDom.PropertyDefaults.ArgumentIndex + case "CODE" => TemplateDom.PropertyDefaults.Code + case "NAME" => TemplateDom.PropertyDefaults.Name + case "ORDER" => TemplateDom.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[Expression] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to EXPRESSION via AST OUT edge. + */ + def _expressionViaAstOut: overflowdb.traversal.Traversal[Expression] = get()._expressionViaAstOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def reachingDefOut: Iterator[Expression] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to EXPRESSION via REACHING_DEF OUT edge. + */ + def _expressionViaReachingDefOut: overflowdb.traversal.Traversal[Expression] = get()._expressionViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to EXPRESSION via ARGUMENT IN edge. + */ + def _expressionViaArgumentIn: overflowdb.traversal.Traversal[Expression] = get()._expressionViaArgumentIn + + def astIn: Iterator[TemplateDom] = get().astIn + override def _astIn = get()._astIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def containsIn: Iterator[AstNode] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to FILE via CONTAINS IN edge. + */ + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = get()._fileViaContainsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TemplateDom.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "TemplateDom" + override def productArity = 8 +} + +class TemplateDomDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with TemplateDomBase { + + override def layoutInformation: NodeLayoutInformation = TemplateDom.layoutInformation + + private var _argumentIndex: scala.Int = TemplateDom.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = TemplateDom.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = TemplateDom.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = TemplateDom.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _expressionViaAstOut: overflowdb.traversal.Traversal[Expression] = astOut.collectAll[Expression] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + + def reachingDefOut: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](3) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _expressionViaReachingDefOut: overflowdb.traversal.Traversal[Expression] = reachingDefOut.collectAll[Expression] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](4) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](5) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _expressionViaArgumentIn: overflowdb.traversal.Traversal[Expression] = argumentIn.collectAll[Expression] + + def astIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](6) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + + def containsIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](8) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = containsIn.collectAll[File] + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](9) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](10) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + + override def label: String = { + TemplateDom.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "lineNumber" + case 6 => "name" + case 7 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => lineNumber + case 6 => name + case 7 => order + } + + override def productPrefix = "TemplateDom" + override def productArity = 8 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TemplateDomDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewTemplateDom].argumentIndex + this._argumentName = newNode.asInstanceOf[NewTemplateDom].argumentName.orNull + this._code = newNode.asInstanceOf[NewTemplateDom].code + this._columnNumber = newNode.asInstanceOf[NewTemplateDom].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewTemplateDom].lineNumber.orNull + this._name = newNode.asInstanceOf[NewTemplateDom].name + this._order = newNode.asInstanceOf[NewTemplateDom].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala new file mode 100644 index 0000000..4ef2dfe --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala @@ -0,0 +1,359 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Type { + def apply(graph: Graph, id: Long) = new Type(graph, id) + + val Label = "TYPE" + + object PropertyNames { + val FullName = "FULL_NAME" + val Name = "NAME" + val TypeDeclFullName = "TYPE_DECL_FULL_NAME" + val all: Set[String] = Set(FullName, Name, TypeDeclFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val FullName = new overflowdb.PropertyKey[String]("FULL_NAME") + val Name = new overflowdb.PropertyKey[String]("NAME") + val TypeDeclFullName = new overflowdb.PropertyKey[String]("TYPE_DECL_FULL_NAME") + + } + + object PropertyDefaults { + val FullName = "" + val Name = "" + val TypeDeclFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.AliasOf.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.InheritsFrom.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("AST", "REF") + val In: Array[String] = Array("ALIAS_OF", "EVAL_TYPE", "INHERITS_FROM", "REF") + } + + val factory = new NodeFactory[TypeDb] { + override val forLabel = Type.Label + + override def createNode(ref: NodeRef[TypeDb]) = + new TypeDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Type(graph, id) + } +} + +trait TypeBase extends AbstractNode { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def fullName: String + def name: String + def typeDeclFullName: String + +} + +class Type(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TypeDb](graph_4762, id_4762) + with TypeBase + with StoredNode { + override def fullName: String = get().fullName + override def name: String = get().name + override def typeDeclFullName: String = get().typeDeclFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "FULL_NAME" => Type.PropertyDefaults.FullName + case "NAME" => Type.PropertyDefaults.Name + case "TYPE_DECL_FULL_NAME" => Type.PropertyDefaults.TypeDeclFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def astOut: Iterator[TypeArgument] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to TYPE_ARGUMENT via AST OUT edge. + */ + def _typeArgumentViaAstOut: overflowdb.traversal.Traversal[TypeArgument] = get()._typeArgumentViaAstOut + + def refOut: Iterator[TypeDecl] = get().refOut + override def _refOut = get()._refOut + + /** Type declaration which is referenced by this type. Traverse to TYPE_DECL via REF OUT edge. + */ + /** Type declaration which is referenced by this type. */ + @overflowdb.traversal.help.Doc(info = """Type declaration which is referenced by this type.""") + def referencedTypeDecl: overflowdb.traversal.Traversal[TypeDecl] = get().referencedTypeDecl + + def aliasOfIn: Iterator[TypeDecl] = get().aliasOfIn + override def _aliasOfIn = get()._aliasOfIn + + /** Direct alias type declarations. Traverse to TYPE_DECL via ALIAS_OF IN edge. + */ + /** Direct alias type declarations. */ + @overflowdb.traversal.help.Doc(info = """Direct alias type declarations.""") + def aliasTypeDecl: overflowdb.traversal.Traversal[TypeDecl] = get().aliasTypeDecl + + def evalTypeIn: Iterator[AstNode] = get().evalTypeIn + override def _evalTypeIn = get()._evalTypeIn + + /** Traverse to ARRAY_INITIALIZER via EVAL_TYPE IN edge. + */ + def _arrayInitializerViaEvalTypeIn: overflowdb.traversal.Traversal[ArrayInitializer] = + get()._arrayInitializerViaEvalTypeIn + + /** Traverse to BLOCK via EVAL_TYPE IN edge. + */ + def _blockViaEvalTypeIn: overflowdb.traversal.Traversal[Block] = get()._blockViaEvalTypeIn + + /** Traverse to CALL via EVAL_TYPE IN edge. + */ + def _callViaEvalTypeIn: overflowdb.traversal.Traversal[Call] = get()._callViaEvalTypeIn + + /** Traverse to CONTROL_STRUCTURE via EVAL_TYPE IN edge. + */ + def _controlStructureViaEvalTypeIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaEvalTypeIn + + /** Traverse to IDENTIFIER via EVAL_TYPE IN edge. + */ + def _identifierViaEvalTypeIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaEvalTypeIn + + /** Traverse to LITERAL via EVAL_TYPE IN edge. + */ + def _literalViaEvalTypeIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaEvalTypeIn + + /** Traverse to LOCAL via EVAL_TYPE IN edge. + */ + def _localViaEvalTypeIn: overflowdb.traversal.Traversal[Local] = get()._localViaEvalTypeIn + + /** Traverse to MEMBER via EVAL_TYPE IN edge. + */ + def _memberViaEvalTypeIn: overflowdb.traversal.Traversal[Member] = get()._memberViaEvalTypeIn + + /** Traverse to METHOD_PARAMETER_IN via EVAL_TYPE IN edge. + */ + def _methodParameterInViaEvalTypeIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaEvalTypeIn + + /** Traverse to METHOD_PARAMETER_OUT via EVAL_TYPE IN edge. + */ + def _methodParameterOutViaEvalTypeIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaEvalTypeIn + + /** Traverse to METHOD_REF via EVAL_TYPE IN edge. + */ + def _methodRefViaEvalTypeIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaEvalTypeIn + + /** Traverse to METHOD_RETURN via EVAL_TYPE IN edge. + */ + def _methodReturnViaEvalTypeIn: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaEvalTypeIn + + /** Traverse to TYPE_REF via EVAL_TYPE IN edge. + */ + def _typeRefViaEvalTypeIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaEvalTypeIn + + /** Traverse to UNKNOWN via EVAL_TYPE IN edge. + */ + def _unknownViaEvalTypeIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaEvalTypeIn + + def inheritsFromIn: Iterator[TypeDecl] = get().inheritsFromIn + override def _inheritsFromIn = get()._inheritsFromIn + + /** Traverse to TYPE_DECL via INHERITS_FROM IN edge. + */ + def _typeDeclViaInheritsFromIn: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaInheritsFromIn + + def refIn: Iterator[TypeArgument] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to TYPE_ARGUMENT via REF IN edge. + */ + def _typeArgumentViaRefIn: overflowdb.traversal.Traversal[TypeArgument] = get()._typeArgumentViaRefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Type.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "fullName" + case 2 => "name" + case 3 => "typeDeclFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => fullName + case 2 => name + case 3 => typeDeclFullName + } + + override def productPrefix = "Type" + override def productArity = 4 +} + +class TypeDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with TypeBase { + + override def layoutInformation: NodeLayoutInformation = Type.layoutInformation + + private var _fullName: String = Type.PropertyDefaults.FullName + def fullName: String = _fullName + private var _name: String = Type.PropertyDefaults.Name + def name: String = _name + private var _typeDeclFullName: String = Type.PropertyDefaults.TypeDeclFullName + def typeDeclFullName: String = _typeDeclFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("FULL_NAME", fullName) + properties.put("NAME", name) + properties.put("TYPE_DECL_FULL_NAME", typeDeclFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == fullName)) { properties.put("FULL_NAME", fullName) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!(("") == typeDeclFullName)) { properties.put("TYPE_DECL_FULL_NAME", typeDeclFullName) } + + properties + } + + import overflowdb.traversal._ + def astOut: Iterator[TypeArgument] = createAdjacentNodeScalaIteratorByOffSet[TypeArgument](0) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _typeArgumentViaAstOut: overflowdb.traversal.Traversal[TypeArgument] = astOut.collectAll[TypeArgument] + + def refOut: Iterator[TypeDecl] = createAdjacentNodeScalaIteratorByOffSet[TypeDecl](1) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def referencedTypeDecl: overflowdb.traversal.Traversal[TypeDecl] = refOut.collectAll[TypeDecl] + + def aliasOfIn: Iterator[TypeDecl] = createAdjacentNodeScalaIteratorByOffSet[TypeDecl](2) + override def _aliasOfIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def aliasTypeDecl: overflowdb.traversal.Traversal[TypeDecl] = aliasOfIn.collectAll[TypeDecl] + + def evalTypeIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _evalTypeIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _arrayInitializerViaEvalTypeIn: overflowdb.traversal.Traversal[ArrayInitializer] = + evalTypeIn.collectAll[ArrayInitializer] + def _blockViaEvalTypeIn: overflowdb.traversal.Traversal[Block] = evalTypeIn.collectAll[Block] + def _callViaEvalTypeIn: overflowdb.traversal.Traversal[Call] = evalTypeIn.collectAll[Call] + def _controlStructureViaEvalTypeIn: overflowdb.traversal.Traversal[ControlStructure] = + evalTypeIn.collectAll[ControlStructure] + def _identifierViaEvalTypeIn: overflowdb.traversal.Traversal[Identifier] = evalTypeIn.collectAll[Identifier] + def _literalViaEvalTypeIn: overflowdb.traversal.Traversal[Literal] = evalTypeIn.collectAll[Literal] + def _localViaEvalTypeIn: overflowdb.traversal.Traversal[Local] = evalTypeIn.collectAll[Local] + def _memberViaEvalTypeIn: overflowdb.traversal.Traversal[Member] = evalTypeIn.collectAll[Member] + def _methodParameterInViaEvalTypeIn: overflowdb.traversal.Traversal[MethodParameterIn] = + evalTypeIn.collectAll[MethodParameterIn] + def _methodParameterOutViaEvalTypeIn: overflowdb.traversal.Traversal[MethodParameterOut] = + evalTypeIn.collectAll[MethodParameterOut] + def _methodRefViaEvalTypeIn: overflowdb.traversal.Traversal[MethodRef] = evalTypeIn.collectAll[MethodRef] + def _methodReturnViaEvalTypeIn: overflowdb.traversal.Traversal[MethodReturn] = evalTypeIn.collectAll[MethodReturn] + def _typeRefViaEvalTypeIn: overflowdb.traversal.Traversal[TypeRef] = evalTypeIn.collectAll[TypeRef] + def _unknownViaEvalTypeIn: overflowdb.traversal.Traversal[Unknown] = evalTypeIn.collectAll[Unknown] + + def inheritsFromIn: Iterator[TypeDecl] = createAdjacentNodeScalaIteratorByOffSet[TypeDecl](4) + override def _inheritsFromIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _typeDeclViaInheritsFromIn: overflowdb.traversal.Traversal[TypeDecl] = inheritsFromIn.collectAll[TypeDecl] + + def refIn: Iterator[TypeArgument] = createAdjacentNodeScalaIteratorByOffSet[TypeArgument](5) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _typeArgumentViaRefIn: overflowdb.traversal.Traversal[TypeArgument] = refIn.collectAll[TypeArgument] + + override def label: String = { + Type.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "fullName" + case 2 => "name" + case 3 => "typeDeclFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => fullName + case 2 => name + case 3 => typeDeclFullName + } + + override def productPrefix = "Type" + override def productArity = 4 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TypeDb] + + override def property(key: String): Any = { + key match { + case "FULL_NAME" => this._fullName + case "NAME" => this._name + case "TYPE_DECL_FULL_NAME" => this._typeDeclFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "FULL_NAME" => this._fullName = value.asInstanceOf[String] + case "NAME" => this._name = value.asInstanceOf[String] + case "TYPE_DECL_FULL_NAME" => this._typeDeclFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._fullName = newNode.asInstanceOf[NewType].fullName + this._name = newNode.asInstanceOf[NewType].name + this._typeDeclFullName = newNode.asInstanceOf[NewType].typeDeclFullName + + graph.indexManager.putIfIndexed("FULL_NAME", newNode.asInstanceOf[NewType].fullName, this.ref) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala new file mode 100644 index 0000000..9d5c389 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala @@ -0,0 +1,257 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TypeArgument { + def apply(graph: Graph, id: Long) = new TypeArgument(graph, id) + + val Label = "TYPE_ARGUMENT" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.BindsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava, + List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava + ) + + object Edges { + val Out: Array[String] = Array("BINDS_TO", "REF") + val In: Array[String] = Array("AST") + } + + val factory = new NodeFactory[TypeArgumentDb] { + override val forLabel = TypeArgument.Label + + override def createNode(ref: NodeRef[TypeArgumentDb]) = + new TypeArgumentDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TypeArgument(graph, id) + } +} + +trait TypeArgumentBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def order: scala.Int + +} + +class TypeArgument(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TypeArgumentDb](graph_4762, id_4762) + with TypeArgumentBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => TypeArgument.PropertyDefaults.Code + case "ORDER" => TypeArgument.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def bindsToOut: Iterator[TypeParameter] = get().bindsToOut + override def _bindsToOut = get()._bindsToOut + + /** Traverse to TYPE_PARAMETER via BINDS_TO OUT edge. + */ + def _typeParameterViaBindsToOut: overflowdb.traversal.Traversal[TypeParameter] = get()._typeParameterViaBindsToOut + + def refOut: Iterator[Type] = get().refOut + override def _refOut = get()._refOut + + /** Traverse to TYPE via REF OUT edge. + */ + def _typeViaRefOut: overflowdb.traversal.Traversal[Type] = get()._typeViaRefOut + + def astIn: Iterator[Type] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to TYPE via AST IN edge. + */ + def _typeViaAstIn: overflowdb.traversal.Traversal[Type] = get()._typeViaAstIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TypeArgument.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "TypeArgument" + override def productArity = 5 +} + +class TypeArgumentDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with TypeArgumentBase { + + override def layoutInformation: NodeLayoutInformation = TypeArgument.layoutInformation + + private var _code: String = TypeArgument.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = TypeArgument.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def bindsToOut: Iterator[TypeParameter] = createAdjacentNodeScalaIteratorByOffSet[TypeParameter](0) + override def _bindsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _typeParameterViaBindsToOut: overflowdb.traversal.Traversal[TypeParameter] = bindsToOut.collectAll[TypeParameter] + + def refOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](1) + override def _refOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _typeViaRefOut: overflowdb.traversal.Traversal[Type] = refOut.collectAll[Type] + + def astIn: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](2) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _typeViaAstIn: overflowdb.traversal.Traversal[Type] = astIn.collectAll[Type] + + override def label: String = { + TypeArgument.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => order + } + + override def productPrefix = "TypeArgument" + override def productArity = 5 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TypeArgumentDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewTypeArgument].code + this._columnNumber = newNode.asInstanceOf[NewTypeArgument].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewTypeArgument].lineNumber.orNull + this._order = newNode.asInstanceOf[NewTypeArgument].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala new file mode 100644 index 0000000..9697060 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala @@ -0,0 +1,541 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TypeDecl { + def apply(graph: Graph, id: Long) = new TypeDecl(graph, id) + + val Label = "TYPE_DECL" + + object PropertyNames { + val AliasTypeFullName = "ALIAS_TYPE_FULL_NAME" + val AstParentFullName = "AST_PARENT_FULL_NAME" + val AstParentType = "AST_PARENT_TYPE" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val Filename = "FILENAME" + val FullName = "FULL_NAME" + val InheritsFromTypeFullName = "INHERITS_FROM_TYPE_FULL_NAME" + val IsExternal = "IS_EXTERNAL" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set( + AliasTypeFullName, + AstParentFullName, + AstParentType, + Code, + ColumnNumber, + Filename, + FullName, + InheritsFromTypeFullName, + IsExternal, + LineNumber, + Name, + Order + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val AliasTypeFullName = new overflowdb.PropertyKey[String]("ALIAS_TYPE_FULL_NAME") + val AstParentFullName = new overflowdb.PropertyKey[String]("AST_PARENT_FULL_NAME") + val AstParentType = new overflowdb.PropertyKey[String]("AST_PARENT_TYPE") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val Filename = new overflowdb.PropertyKey[String]("FILENAME") + val FullName = new overflowdb.PropertyKey[String]("FULL_NAME") + val InheritsFromTypeFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("INHERITS_FROM_TYPE_FULL_NAME") + val IsExternal = new overflowdb.PropertyKey[Boolean]("IS_EXTERNAL") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val AstParentFullName = "" + val AstParentType = "" + val Code = "" + val Filename = "" + val FullName = "" + val IsExternal = false + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.AliasOf.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Binds.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.InheritsFrom.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.SourceFile.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ref.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array("ALIAS_OF", "AST", "BINDS", "CONTAINS", "INHERITS_FROM", "SOURCE_FILE") + val In: Array[String] = Array("AST", "CONTAINS", "REF") + } + + val factory = new NodeFactory[TypeDeclDb] { + override val forLabel = TypeDecl.Label + + override def createNode(ref: NodeRef[TypeDeclDb]) = + new TypeDeclDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TypeDecl(graph, id) + } +} + +trait TypeDeclBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def aliasTypeFullName: Option[String] + def astParentFullName: String + def astParentType: String + def code: String + def columnNumber: Option[Integer] + def filename: String + def fullName: String + def inheritsFromTypeFullName: IndexedSeq[String] + def isExternal: Boolean + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class TypeDecl(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TypeDeclDb](graph_4762, id_4762) + with TypeDeclBase + with StoredNode + with AstNode { + override def aliasTypeFullName: Option[String] = get().aliasTypeFullName + override def astParentFullName: String = get().astParentFullName + override def astParentType: String = get().astParentType + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def filename: String = get().filename + override def fullName: String = get().fullName + override def inheritsFromTypeFullName: IndexedSeq[String] = get().inheritsFromTypeFullName + override def isExternal: Boolean = get().isExternal + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "AST_PARENT_FULL_NAME" => TypeDecl.PropertyDefaults.AstParentFullName + case "AST_PARENT_TYPE" => TypeDecl.PropertyDefaults.AstParentType + case "CODE" => TypeDecl.PropertyDefaults.Code + case "FILENAME" => TypeDecl.PropertyDefaults.Filename + case "FULL_NAME" => TypeDecl.PropertyDefaults.FullName + case "IS_EXTERNAL" => TypeDecl.PropertyDefaults.IsExternal + case "NAME" => TypeDecl.PropertyDefaults.Name + case "ORDER" => TypeDecl.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def aliasOfOut: Iterator[Type] = get().aliasOfOut + override def _aliasOfOut = get()._aliasOfOut + + /** Traverse to TYPE via ALIAS_OF OUT edge. + */ + def aliasedType: overflowdb.traversal.Traversal[Type] = get().aliasedType + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to ANNOTATION via AST OUT edge. + */ + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = get()._annotationViaAstOut + + /** Traverse to IMPORT via AST OUT edge. + */ + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = get()._importViaAstOut + + /** Traverse to MEMBER via AST OUT edge. + */ + def _memberViaAstOut: overflowdb.traversal.Traversal[Member] = get()._memberViaAstOut + + /** Traverse to METHOD via AST OUT edge. + */ + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = get()._methodViaAstOut + + /** Traverse to MODIFIER via AST OUT edge. + */ + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = get()._modifierViaAstOut + + /** Traverse to TYPE_DECL via AST OUT edge. + */ + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstOut + + /** Traverse to TYPE_PARAMETER via AST OUT edge. + */ + def _typeParameterViaAstOut: overflowdb.traversal.Traversal[TypeParameter] = get()._typeParameterViaAstOut + + def bindsOut: Iterator[Binding] = get().bindsOut + override def _bindsOut = get()._bindsOut + + /** Traverse to BINDING via BINDS OUT edge. + */ + def _bindingViaBindsOut: overflowdb.traversal.Traversal[Binding] = get()._bindingViaBindsOut + + def containsOut: Iterator[Method] = get().containsOut + override def _containsOut = get()._containsOut + + /** Traverse to METHOD via CONTAINS OUT edge. + */ + def _methodViaContainsOut: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsOut + + def inheritsFromOut: Iterator[Type] = get().inheritsFromOut + override def _inheritsFromOut = get()._inheritsFromOut + + /** Traverse to TYPE via INHERITS_FROM OUT edge. + */ + def _typeViaInheritsFromOut: overflowdb.traversal.Traversal[Type] = get()._typeViaInheritsFromOut + + def sourceFileOut: Iterator[File] = get().sourceFileOut + override def _sourceFileOut = get()._sourceFileOut + + /** Traverse to FILE via SOURCE_FILE OUT edge. + */ + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = get()._fileViaSourceFileOut + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Option[Method] = get()._methodViaAstIn + + /** Traverse to NAMESPACE_BLOCK via AST IN edge. + */ + def namespaceBlock: Option[NamespaceBlock] = get().namespaceBlock + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: Option[TypeDecl] = get()._typeDeclViaAstIn + + def containsIn: Iterator[File] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to FILE via CONTAINS IN edge. + */ + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = get()._fileViaContainsIn + + def refIn: Iterator[Type] = get().refIn + override def _refIn = get()._refIn + + /** Traverse to TYPE via REF IN edge. + */ + def _typeViaRefIn: overflowdb.traversal.Traversal[Type] = get()._typeViaRefIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TypeDecl.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "aliasTypeFullName" + case 2 => "astParentFullName" + case 3 => "astParentType" + case 4 => "code" + case 5 => "columnNumber" + case 6 => "filename" + case 7 => "fullName" + case 8 => "inheritsFromTypeFullName" + case 9 => "isExternal" + case 10 => "lineNumber" + case 11 => "name" + case 12 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => aliasTypeFullName + case 2 => astParentFullName + case 3 => astParentType + case 4 => code + case 5 => columnNumber + case 6 => filename + case 7 => fullName + case 8 => inheritsFromTypeFullName + case 9 => isExternal + case 10 => lineNumber + case 11 => name + case 12 => order + } + + override def productPrefix = "TypeDecl" + override def productArity = 13 +} + +class TypeDeclDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with TypeDeclBase { + + override def layoutInformation: NodeLayoutInformation = TypeDecl.layoutInformation + + private var _aliasTypeFullName: String = null + def aliasTypeFullName: Option[String] = Option(_aliasTypeFullName) + private var _astParentFullName: String = TypeDecl.PropertyDefaults.AstParentFullName + def astParentFullName: String = _astParentFullName + private var _astParentType: String = TypeDecl.PropertyDefaults.AstParentType + def astParentType: String = _astParentType + private var _code: String = TypeDecl.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _filename: String = TypeDecl.PropertyDefaults.Filename + def filename: String = _filename + private var _fullName: String = TypeDecl.PropertyDefaults.FullName + def fullName: String = _fullName + private var _inheritsFromTypeFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def inheritsFromTypeFullName: IndexedSeq[String] = _inheritsFromTypeFullName + private var _isExternal: Boolean = TypeDecl.PropertyDefaults.IsExternal + def isExternal: Boolean = _isExternal + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = TypeDecl.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = TypeDecl.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + aliasTypeFullName.map { value => properties.put("ALIAS_TYPE_FULL_NAME", value) } + properties.put("AST_PARENT_FULL_NAME", astParentFullName) + properties.put("AST_PARENT_TYPE", astParentType) + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("FILENAME", filename) + properties.put("FULL_NAME", fullName) + if (this._inheritsFromTypeFullName != null && this._inheritsFromTypeFullName.nonEmpty) { + properties.put("INHERITS_FROM_TYPE_FULL_NAME", inheritsFromTypeFullName) + } + properties.put("IS_EXTERNAL", isExternal) + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + aliasTypeFullName.map { value => properties.put("ALIAS_TYPE_FULL_NAME", value) } + if (!(("") == astParentFullName)) { properties.put("AST_PARENT_FULL_NAME", astParentFullName) } + if (!(("") == astParentType)) { properties.put("AST_PARENT_TYPE", astParentType) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == filename)) { properties.put("FILENAME", filename) } + if (!(("") == fullName)) { properties.put("FULL_NAME", fullName) } + if (this._inheritsFromTypeFullName != null && this._inheritsFromTypeFullName.nonEmpty) { + properties.put("INHERITS_FROM_TYPE_FULL_NAME", inheritsFromTypeFullName) + } + if (!((false) == isExternal)) { properties.put("IS_EXTERNAL", isExternal) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def aliasOfOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](0) + override def _aliasOfOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def aliasedType: overflowdb.traversal.Traversal[Type] = aliasOfOut.collectAll[Type] + + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _annotationViaAstOut: overflowdb.traversal.Traversal[Annotation] = astOut.collectAll[Annotation] + def _importViaAstOut: overflowdb.traversal.Traversal[Import] = astOut.collectAll[Import] + def _memberViaAstOut: overflowdb.traversal.Traversal[Member] = astOut.collectAll[Member] + def _methodViaAstOut: overflowdb.traversal.Traversal[Method] = astOut.collectAll[Method] + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = astOut.collectAll[Modifier] + def _typeDeclViaAstOut: overflowdb.traversal.Traversal[TypeDecl] = astOut.collectAll[TypeDecl] + def _typeParameterViaAstOut: overflowdb.traversal.Traversal[TypeParameter] = astOut.collectAll[TypeParameter] + + def bindsOut: Iterator[Binding] = createAdjacentNodeScalaIteratorByOffSet[Binding](2) + override def _bindsOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _bindingViaBindsOut: overflowdb.traversal.Traversal[Binding] = bindsOut.collectAll[Binding] + + def containsOut: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](3) + override def _containsOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _methodViaContainsOut: overflowdb.traversal.Traversal[Method] = containsOut.collectAll[Method] + + def inheritsFromOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](4) + override def _inheritsFromOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _typeViaInheritsFromOut: overflowdb.traversal.Traversal[Type] = inheritsFromOut.collectAll[Type] + + def sourceFileOut: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](5) + override def _sourceFileOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _fileViaSourceFileOut: overflowdb.traversal.Traversal[File] = sourceFileOut.collectAll[File] + + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](6) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + def _methodViaAstIn: Option[Method] = astIn.collectAll[Method].nextOption() + def namespaceBlock: Option[NamespaceBlock] = astIn.collectAll[NamespaceBlock].nextOption() + def _typeDeclViaAstIn: Option[TypeDecl] = astIn.collectAll[TypeDecl].nextOption() + + def containsIn: Iterator[File] = createAdjacentNodeScalaIteratorByOffSet[File](7) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _fileViaContainsIn: overflowdb.traversal.Traversal[File] = containsIn.collectAll[File] + + def refIn: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](8) + override def _refIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _typeViaRefIn: overflowdb.traversal.Traversal[Type] = refIn.collectAll[Type] + + override def label: String = { + TypeDecl.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "aliasTypeFullName" + case 2 => "astParentFullName" + case 3 => "astParentType" + case 4 => "code" + case 5 => "columnNumber" + case 6 => "filename" + case 7 => "fullName" + case 8 => "inheritsFromTypeFullName" + case 9 => "isExternal" + case 10 => "lineNumber" + case 11 => "name" + case 12 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => aliasTypeFullName + case 2 => astParentFullName + case 3 => astParentType + case 4 => code + case 5 => columnNumber + case 6 => filename + case 7 => fullName + case 8 => inheritsFromTypeFullName + case 9 => isExternal + case 10 => lineNumber + case 11 => name + case 12 => order + } + + override def productPrefix = "TypeDecl" + override def productArity = 13 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TypeDeclDb] + + override def property(key: String): Any = { + key match { + case "ALIAS_TYPE_FULL_NAME" => this._aliasTypeFullName + case "AST_PARENT_FULL_NAME" => this._astParentFullName + case "AST_PARENT_TYPE" => this._astParentType + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "FILENAME" => this._filename + case "FULL_NAME" => this._fullName + case "INHERITS_FROM_TYPE_FULL_NAME" => this._inheritsFromTypeFullName + case "IS_EXTERNAL" => this._isExternal + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ALIAS_TYPE_FULL_NAME" => this._aliasTypeFullName = value.asInstanceOf[String] + case "AST_PARENT_FULL_NAME" => this._astParentFullName = value.asInstanceOf[String] + case "AST_PARENT_TYPE" => this._astParentType = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "FILENAME" => this._filename = value.asInstanceOf[String] + case "FULL_NAME" => this._fullName = value.asInstanceOf[String] + case "INHERITS_FROM_TYPE_FULL_NAME" => + this._inheritsFromTypeFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "IS_EXTERNAL" => this._isExternal = value.asInstanceOf[Boolean] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._aliasTypeFullName = newNode.asInstanceOf[NewTypeDecl].aliasTypeFullName.orNull + this._astParentFullName = newNode.asInstanceOf[NewTypeDecl].astParentFullName + this._astParentType = newNode.asInstanceOf[NewTypeDecl].astParentType + this._code = newNode.asInstanceOf[NewTypeDecl].code + this._columnNumber = newNode.asInstanceOf[NewTypeDecl].columnNumber.orNull + this._filename = newNode.asInstanceOf[NewTypeDecl].filename + this._fullName = newNode.asInstanceOf[NewTypeDecl].fullName + this._inheritsFromTypeFullName = + if (newNode.asInstanceOf[NewTypeDecl].inheritsFromTypeFullName != null) + newNode.asInstanceOf[NewTypeDecl].inheritsFromTypeFullName + else collection.immutable.ArraySeq.empty + this._isExternal = newNode.asInstanceOf[NewTypeDecl].isExternal + this._lineNumber = newNode.asInstanceOf[NewTypeDecl].lineNumber.orNull + this._name = newNode.asInstanceOf[NewTypeDecl].name + this._order = newNode.asInstanceOf[NewTypeDecl].order + + graph.indexManager.putIfIndexed("FULL_NAME", newNode.asInstanceOf[NewTypeDecl].fullName, this.ref) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala new file mode 100644 index 0000000..f6ba596 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala @@ -0,0 +1,275 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TypeParameter { + def apply(graph: Graph, id: Long) = new TypeParameter(graph, id) + + val Label = "TYPE_PARAMETER" + + object PropertyNames { + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val LineNumber = "LINE_NUMBER" + val Name = "NAME" + val Order = "ORDER" + val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Name, Order) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Name = new overflowdb.PropertyKey[String]("NAME") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + + } + + object PropertyDefaults { + val Code = "" + val Name = "" + val Order = -1: Int + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List().asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.BindsTo.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array() + val In: Array[String] = Array("AST", "BINDS_TO") + } + + val factory = new NodeFactory[TypeParameterDb] { + override val forLabel = TypeParameter.Label + + override def createNode(ref: NodeRef[TypeParameterDb]) = + new TypeParameterDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TypeParameter(graph, id) + } +} + +trait TypeParameterBase extends AbstractNode with AstNodeBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def code: String + def columnNumber: Option[Integer] + def lineNumber: Option[Integer] + def name: String + def order: scala.Int + +} + +class TypeParameter(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TypeParameterDb](graph_4762, id_4762) + with TypeParameterBase + with StoredNode + with AstNode { + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def lineNumber: Option[Integer] = get().lineNumber + override def name: String = get().name + override def order: scala.Int = get().order + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "CODE" => TypeParameter.PropertyDefaults.Code + case "NAME" => TypeParameter.PropertyDefaults.Name + case "ORDER" => TypeParameter.PropertyDefaults.Order + case _ => super.propertyDefaultValue(propertyKey) + } + + def astIn: Iterator[AstNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to METHOD via AST IN edge. + */ + def _methodViaAstIn: Method = get()._methodViaAstIn + + /** Traverse to TYPE_DECL via AST IN edge. + */ + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = get()._typeDeclViaAstIn + + def bindsToIn: Iterator[TypeArgument] = get().bindsToIn + override def _bindsToIn = get()._bindsToIn + + /** Traverse to TYPE_ARGUMENT via BINDS_TO IN edge. + */ + def _typeArgumentViaBindsToIn: overflowdb.traversal.Traversal[TypeArgument] = get()._typeArgumentViaBindsToIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TypeParameter.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + } + + override def productPrefix = "TypeParameter" + override def productArity = 6 +} + +class TypeParameterDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with AstNode with TypeParameterBase { + + override def layoutInformation: NodeLayoutInformation = TypeParameter.layoutInformation + + private var _code: String = TypeParameter.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _name: String = TypeParameter.PropertyDefaults.Name + def name: String = _name + private var _order: scala.Int = TypeParameter.PropertyDefaults.Order + def order: scala.Int = _order + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("NAME", name) + properties.put("ORDER", order) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!(("") == name)) { properties.put("NAME", name) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + + properties + } + + import overflowdb.traversal._ + def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](0) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + def _methodViaAstIn: Method = try { astIn.collectAll[Method].next() } + catch { + case e: java.util.NoSuchElementException => + throw new overflowdb.SchemaViolationException( + "IN edge with label AST to an adjacent METHOD is mandatory, but not defined for this TYPE_PARAMETER node with id=" + id, + e + ) + } + def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = astIn.collectAll[TypeDecl] + + def bindsToIn: Iterator[TypeArgument] = createAdjacentNodeScalaIteratorByOffSet[TypeArgument](1) + override def _bindsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _typeArgumentViaBindsToIn: overflowdb.traversal.Traversal[TypeArgument] = bindsToIn.collectAll[TypeArgument] + + override def label: String = { + TypeParameter.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "code" + case 2 => "columnNumber" + case 3 => "lineNumber" + case 4 => "name" + case 5 => "order" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => code + case 2 => columnNumber + case 3 => lineNumber + case 4 => name + case 5 => order + } + + override def productPrefix = "TypeParameter" + override def productArity = 6 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TypeParameterDb] + + override def property(key: String): Any = { + key match { + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "LINE_NUMBER" => this._lineNumber + case "NAME" => this._name + case "ORDER" => this._order + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "NAME" => this._name = value.asInstanceOf[String] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._code = newNode.asInstanceOf[NewTypeParameter].code + this._columnNumber = newNode.asInstanceOf[NewTypeParameter].columnNumber.orNull + this._lineNumber = newNode.asInstanceOf[NewTypeParameter].lineNumber.orNull + this._name = newNode.asInstanceOf[NewTypeParameter].name + this._order = newNode.asInstanceOf[NewTypeParameter].order + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala new file mode 100644 index 0000000..978de1e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala @@ -0,0 +1,1026 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object TypeRef { + def apply(graph: Graph, id: Long) = new TypeRef(graph, id) + + val Label = "TYPE_REF" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = + Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Order, TypeFullName) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val Order = -1: Int + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Capture.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "CAPTURE", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[TypeRefDb] { + override val forLabel = TypeRef.Label + + override def createNode(ref: NodeRef[TypeRefDb]) = + new TypeRefDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = TypeRef(graph, id) + } +} + +trait TypeRefBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def order: scala.Int + def typeFullName: String + +} + +class TypeRef(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[TypeRefDb](graph_4762, id_4762) + with TypeRefBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => TypeRef.PropertyDefaults.ArgumentIndex + case "CODE" => TypeRef.PropertyDefaults.Code + case "ORDER" => TypeRef.PropertyDefaults.Order + case "TYPE_FULL_NAME" => TypeRef.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def captureOut: Iterator[ClosureBinding] = get().captureOut + override def _captureOut = get()._captureOut + + /** Traverse to CLOSURE_BINDING via CAPTURE OUT edge. + */ + def _closureBindingViaCaptureOut: overflowdb.traversal.Traversal[ClosureBinding] = get()._closureBindingViaCaptureOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[AstNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + /** Traverse to METHOD_RETURN via CFG OUT edge. + */ + def _methodReturnViaCfgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[Expression] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CALL via AST IN edge. + */ + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = get()._callViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[CfgNode] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + /** Traverse to BLOCK via REACHING_DEF IN edge. + */ + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = get()._blockViaReachingDefIn + + /** Traverse to CALL via REACHING_DEF IN edge. + */ + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefIn + + /** Traverse to CONTROL_STRUCTURE via REACHING_DEF IN edge. + */ + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaReachingDefIn + + /** Traverse to IDENTIFIER via REACHING_DEF IN edge. + */ + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefIn + + /** Traverse to LITERAL via REACHING_DEF IN edge. + */ + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefIn + + /** Traverse to METHOD via REACHING_DEF IN edge. + */ + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = get()._methodViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_IN via REACHING_DEF IN edge. + */ + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + get()._methodParameterInViaReachingDefIn + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF IN edge. + */ + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefIn + + /** Traverse to METHOD_REF via REACHING_DEF IN edge. + */ + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefIn + + /** Traverse to RETURN via REACHING_DEF IN edge. + */ + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefIn + + /** Traverse to TYPE_REF via REACHING_DEF IN edge. + */ + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefIn + + /** Traverse to UNKNOWN via REACHING_DEF IN edge. + */ + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaReachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + TypeRef.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "TypeRef" + override def productArity = 9 +} + +class TypeRefDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with TypeRefBase { + + override def layoutInformation: NodeLayoutInformation = TypeRef.layoutInformation + + private var _argumentIndex: scala.Int = TypeRef.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = TypeRef.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = TypeRef.PropertyDefaults.Order + def order: scala.Int = _order + private var _typeFullName: String = TypeRef.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def captureOut: Iterator[ClosureBinding] = createAdjacentNodeScalaIteratorByOffSet[ClosureBinding](1) + override def _captureOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _closureBindingViaCaptureOut: overflowdb.traversal.Traversal[ClosureBinding] = + captureOut.collectAll[ClosureBinding] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + def _methodReturnViaCfgOut: overflowdb.traversal.Traversal[MethodReturn] = cfgOut.collectAll[MethodReturn] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](5) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](9) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](10) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = argumentIn.collectAll[Call] + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = argumentIn.collectAll[Return] + + def astIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](11) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _callViaAstIn: overflowdb.traversal.Traversal[Call] = astIn.collectAll[Call] + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](14) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](15) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](19) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + def _blockViaReachingDefIn: overflowdb.traversal.Traversal[Block] = reachingDefIn.collectAll[Block] + def _callViaReachingDefIn: overflowdb.traversal.Traversal[Call] = reachingDefIn.collectAll[Call] + def _controlStructureViaReachingDefIn: overflowdb.traversal.Traversal[ControlStructure] = + reachingDefIn.collectAll[ControlStructure] + def _identifierViaReachingDefIn: overflowdb.traversal.Traversal[Identifier] = reachingDefIn.collectAll[Identifier] + def _literalViaReachingDefIn: overflowdb.traversal.Traversal[Literal] = reachingDefIn.collectAll[Literal] + def _methodViaReachingDefIn: overflowdb.traversal.Traversal[Method] = reachingDefIn.collectAll[Method] + def _methodParameterInViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterIn] = + reachingDefIn.collectAll[MethodParameterIn] + def _methodParameterOutViaReachingDefIn: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefIn.collectAll[MethodParameterOut] + def _methodRefViaReachingDefIn: overflowdb.traversal.Traversal[MethodRef] = reachingDefIn.collectAll[MethodRef] + def _returnViaReachingDefIn: overflowdb.traversal.Traversal[Return] = reachingDefIn.collectAll[Return] + def _typeRefViaReachingDefIn: overflowdb.traversal.Traversal[TypeRef] = reachingDefIn.collectAll[TypeRef] + def _unknownViaReachingDefIn: overflowdb.traversal.Traversal[Unknown] = reachingDefIn.collectAll[Unknown] + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](20) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = receiverIn.collectAll[Call] + + override def label: String = { + TypeRef.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "dynamicTypeHintFullName" + case 6 => "lineNumber" + case 7 => "order" + case 8 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => dynamicTypeHintFullName + case 6 => lineNumber + case 7 => order + case 8 => typeFullName + } + + override def productPrefix = "TypeRef" + override def productArity = 9 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[TypeRefDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewTypeRef].argumentIndex + this._argumentName = newNode.asInstanceOf[NewTypeRef].argumentName.orNull + this._code = newNode.asInstanceOf[NewTypeRef].code + this._columnNumber = newNode.asInstanceOf[NewTypeRef].columnNumber.orNull + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewTypeRef].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewTypeRef].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewTypeRef].lineNumber.orNull + this._order = newNode.asInstanceOf[NewTypeRef].order + this._typeFullName = newNode.asInstanceOf[NewTypeRef].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala new file mode 100644 index 0000000..9410784 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala @@ -0,0 +1,1059 @@ +package io.shiftleft.codepropertygraph.generated.nodes + +import overflowdb._ +import scala.jdk.CollectionConverters._ + +object Unknown { + def apply(graph: Graph, id: Long) = new Unknown(graph, id) + + val Label = "UNKNOWN" + + object PropertyNames { + val ArgumentIndex = "ARGUMENT_INDEX" + val ArgumentName = "ARGUMENT_NAME" + val Code = "CODE" + val ColumnNumber = "COLUMN_NUMBER" + val ContainedRef = "CONTAINED_REF" + val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME" + val LineNumber = "LINE_NUMBER" + val Order = "ORDER" + val ParserTypeName = "PARSER_TYPE_NAME" + val TypeFullName = "TYPE_FULL_NAME" + val all: Set[String] = Set( + ArgumentIndex, + ArgumentName, + Code, + ColumnNumber, + ContainedRef, + DynamicTypeHintFullName, + LineNumber, + Order, + ParserTypeName, + TypeFullName + ) + val allAsJava: java.util.Set[String] = all.asJava + } + + object Properties { + val ArgumentIndex = new overflowdb.PropertyKey[scala.Int]("ARGUMENT_INDEX") + val ArgumentName = new overflowdb.PropertyKey[String]("ARGUMENT_NAME") + val Code = new overflowdb.PropertyKey[String]("CODE") + val ColumnNumber = new overflowdb.PropertyKey[Integer]("COLUMN_NUMBER") + val ContainedRef = new overflowdb.PropertyKey[String]("CONTAINED_REF") + val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME") + val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER") + val Order = new overflowdb.PropertyKey[scala.Int]("ORDER") + val ParserTypeName = new overflowdb.PropertyKey[String]("PARSER_TYPE_NAME") + val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME") + + } + + object PropertyDefaults { + val ArgumentIndex = -1: Int + val Code = "" + val ContainedRef = "" + val Order = -1: Int + val ParserTypeName = "" + val TypeFullName = "" + } + + val layoutInformation = new NodeLayoutInformation( + Label, + PropertyNames.allAsJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.TaggedBy.layoutInformation + ).asJava, + List( + io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cdg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Condition.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Contains.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Dominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.PostDominate.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation, + io.shiftleft.codepropertygraph.generated.edges.Receiver.layoutInformation + ).asJava + ) + + object Edges { + val Out: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "DOMINATE", + "EVAL_TYPE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "TAGGED_BY" + ) + val In: Array[String] = Array( + "ARGUMENT", + "AST", + "CDG", + "CFG", + "CONDITION", + "CONTAINS", + "DOMINATE", + "POINTS_TO", + "POST_DOMINATE", + "REACHING_DEF", + "RECEIVER" + ) + } + + val factory = new NodeFactory[UnknownDb] { + override val forLabel = Unknown.Label + + override def createNode(ref: NodeRef[UnknownDb]) = + new UnknownDb(ref.asInstanceOf[NodeRef[NodeDb]]) + + override def createNodeRef(graph: Graph, id: Long) = Unknown(graph, id) + } +} + +trait UnknownBase extends AbstractNode with ExpressionBase { + def asStored: StoredNode = this.asInstanceOf[StoredNode] + + def argumentIndex: scala.Int + def argumentName: Option[String] + def code: String + def columnNumber: Option[Integer] + def containedRef: String + def dynamicTypeHintFullName: IndexedSeq[String] + def lineNumber: Option[Integer] + def order: scala.Int + def parserTypeName: String + def typeFullName: String + +} + +class Unknown(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ ) + extends NodeRef[UnknownDb](graph_4762, id_4762) + with UnknownBase + with StoredNode + with Expression { + override def argumentIndex: scala.Int = get().argumentIndex + override def argumentName: Option[String] = get().argumentName + override def code: String = get().code + override def columnNumber: Option[Integer] = get().columnNumber + override def containedRef: String = get().containedRef + override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName + override def lineNumber: Option[Integer] = get().lineNumber + override def order: scala.Int = get().order + override def parserTypeName: String = get().parserTypeName + override def typeFullName: String = get().typeFullName + override def propertyDefaultValue(propertyKey: String) = + propertyKey match { + case "ARGUMENT_INDEX" => Unknown.PropertyDefaults.ArgumentIndex + case "CODE" => Unknown.PropertyDefaults.Code + case "CONTAINED_REF" => Unknown.PropertyDefaults.ContainedRef + case "ORDER" => Unknown.PropertyDefaults.Order + case "PARSER_TYPE_NAME" => Unknown.PropertyDefaults.ParserTypeName + case "TYPE_FULL_NAME" => Unknown.PropertyDefaults.TypeFullName + case _ => super.propertyDefaultValue(propertyKey) + } + + def argumentOut: Iterator[TemplateDom] = get().argumentOut + override def _argumentOut = get()._argumentOut + + def astOut: Iterator[AstNode] = get().astOut + override def _astOut = get()._astOut + + /** Traverse to BLOCK via AST OUT edge. + */ + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = get()._blockViaAstOut + + /** Traverse to CALL via AST OUT edge. + */ + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = get()._callViaAstOut + + /** Traverse to CONTROL_STRUCTURE via AST OUT edge. + */ + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstOut + + /** Traverse to FIELD_IDENTIFIER via AST OUT edge. + */ + def _fieldIdentifierViaAstOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaAstOut + + /** Traverse to IDENTIFIER via AST OUT edge. + */ + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaAstOut + + /** Traverse to JUMP_TARGET via AST OUT edge. + */ + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaAstOut + + /** Traverse to LITERAL via AST OUT edge. + */ + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaAstOut + + /** Traverse to LOCAL via AST OUT edge. + */ + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = get()._localViaAstOut + + /** Traverse to MEMBER via AST OUT edge. + */ + def _memberViaAstOut: overflowdb.traversal.Traversal[Member] = get()._memberViaAstOut + + /** Traverse to MODIFIER via AST OUT edge. + */ + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = get()._modifierViaAstOut + + /** Traverse to RETURN via AST OUT edge. + */ + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = get()._returnViaAstOut + + /** Traverse to UNKNOWN via AST OUT edge. + */ + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstOut + + def cdgOut: Iterator[CfgNode] = get().cdgOut + override def _cdgOut = get()._cdgOut + + /** Traverse to BLOCK via CDG OUT edge. + */ + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgOut + + /** Traverse to CALL via CDG OUT edge. + */ + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = get()._callViaCdgOut + + /** Traverse to CONTROL_STRUCTURE via CDG OUT edge. + */ + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgOut + + /** Traverse to FIELD_IDENTIFIER via CDG OUT edge. + */ + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgOut + + /** Traverse to IDENTIFIER via CDG OUT edge. + */ + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgOut + + /** Traverse to JUMP_TARGET via CDG OUT edge. + */ + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgOut + + /** Traverse to LITERAL via CDG OUT edge. + */ + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgOut + + /** Traverse to METHOD_REF via CDG OUT edge. + */ + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgOut + + /** Traverse to METHOD_RETURN via CDG OUT edge. + */ + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaCdgOut + + /** Traverse to RETURN via CDG OUT edge. + */ + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = get()._returnViaCdgOut + + /** Traverse to TYPE_REF via CDG OUT edge. + */ + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgOut + + /** Traverse to UNKNOWN via CDG OUT edge. + */ + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgOut + + def cfgOut: Iterator[CfgNode] = get().cfgOut + override def _cfgOut = get()._cfgOut + + /** Traverse to CFG_NODE via CFG OUT edge. + */ + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = get()._cfgNodeViaCfgOut + + def dominateOut: Iterator[CfgNode] = get().dominateOut + override def _dominateOut = get()._dominateOut + + /** Traverse to BLOCK via DOMINATE OUT edge. + */ + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateOut + + /** Traverse to CALL via DOMINATE OUT edge. + */ + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaDominateOut + + /** Traverse to CONTROL_STRUCTURE via DOMINATE OUT edge. + */ + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateOut + + /** Traverse to FIELD_IDENTIFIER via DOMINATE OUT edge. + */ + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateOut + + /** Traverse to IDENTIFIER via DOMINATE OUT edge. + */ + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateOut + + /** Traverse to JUMP_TARGET via DOMINATE OUT edge. + */ + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateOut + + /** Traverse to LITERAL via DOMINATE OUT edge. + */ + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateOut + + /** Traverse to METHOD_REF via DOMINATE OUT edge. + */ + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateOut + + /** Traverse to METHOD_RETURN via DOMINATE OUT edge. + */ + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = get()._methodReturnViaDominateOut + + /** Traverse to RETURN via DOMINATE OUT edge. + */ + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateOut + + /** Traverse to TYPE_REF via DOMINATE OUT edge. + */ + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateOut + + /** Traverse to UNKNOWN via DOMINATE OUT edge. + */ + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateOut + + def evalTypeOut: Iterator[Type] = get().evalTypeOut + override def _evalTypeOut = get()._evalTypeOut + + /** Traverse to TYPE via EVAL_TYPE OUT edge. + */ + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut + + def pointsToOut: Iterator[CfgNode] = get().pointsToOut + override def _pointsToOut = get()._pointsToOut + + def postDominateOut: Iterator[CfgNode] = get().postDominateOut + override def _postDominateOut = get()._postDominateOut + + /** Traverse to BLOCK via POST_DOMINATE OUT edge. + */ + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateOut + + /** Traverse to CALL via POST_DOMINATE OUT edge. + */ + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateOut + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE OUT edge. + */ + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateOut + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateOut + + /** Traverse to IDENTIFIER via POST_DOMINATE OUT edge. + */ + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateOut + + /** Traverse to JUMP_TARGET via POST_DOMINATE OUT edge. + */ + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateOut + + /** Traverse to LITERAL via POST_DOMINATE OUT edge. + */ + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateOut + + /** Traverse to METHOD via POST_DOMINATE OUT edge. + */ + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = get()._methodViaPostDominateOut + + /** Traverse to METHOD_REF via POST_DOMINATE OUT edge. + */ + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateOut + + /** Traverse to RETURN via POST_DOMINATE OUT edge. + */ + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateOut + + /** Traverse to TYPE_REF via POST_DOMINATE OUT edge. + */ + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateOut + + /** Traverse to UNKNOWN via POST_DOMINATE OUT edge. + */ + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateOut + + def reachingDefOut: Iterator[CfgNode] = get().reachingDefOut + override def _reachingDefOut = get()._reachingDefOut + + /** Traverse to CALL via REACHING_DEF OUT edge. + */ + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = get()._callViaReachingDefOut + + /** Traverse to IDENTIFIER via REACHING_DEF OUT edge. + */ + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaReachingDefOut + + /** Traverse to LITERAL via REACHING_DEF OUT edge. + */ + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = get()._literalViaReachingDefOut + + /** Traverse to METHOD_PARAMETER_OUT via REACHING_DEF OUT edge. + */ + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + get()._methodParameterOutViaReachingDefOut + + /** Traverse to METHOD_REF via REACHING_DEF OUT edge. + */ + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaReachingDefOut + + /** Traverse to RETURN via REACHING_DEF OUT edge. + */ + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = get()._returnViaReachingDefOut + + /** Traverse to TYPE_REF via REACHING_DEF OUT edge. + */ + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaReachingDefOut + + def taggedByOut: Iterator[Tag] = get().taggedByOut + override def _taggedByOut = get()._taggedByOut + + /** Traverse to TAG via TAGGED_BY OUT edge. + */ + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = get()._tagViaTaggedByOut + + def argumentIn: Iterator[Expression] = get().argumentIn + override def _argumentIn = get()._argumentIn + + /** Traverse to CALL via ARGUMENT IN edge. + */ + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = get()._callViaArgumentIn + + /** Traverse to RETURN via ARGUMENT IN edge. + */ + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = get()._returnViaArgumentIn + + def astIn: Iterator[CfgNode] = get().astIn + override def _astIn = get()._astIn + + /** Traverse to BLOCK via AST IN edge. + */ + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = get()._blockViaAstIn + + /** Traverse to CONTROL_STRUCTURE via AST IN edge. + */ + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaAstIn + + /** Traverse to METHOD_PARAMETER_IN via AST IN edge. + */ + def _methodParameterInViaAstIn: overflowdb.traversal.Traversal[MethodParameterIn] = get()._methodParameterInViaAstIn + + /** Traverse to RETURN via AST IN edge. + */ + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = get()._returnViaAstIn + + /** Traverse to UNKNOWN via AST IN edge. + */ + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaAstIn + + def cdgIn: Iterator[CfgNode] = get().cdgIn + override def _cdgIn = get()._cdgIn + + /** Traverse to BLOCK via CDG IN edge. + */ + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = get()._blockViaCdgIn + + /** Traverse to CALL via CDG IN edge. + */ + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = get()._callViaCdgIn + + /** Traverse to CONTROL_STRUCTURE via CDG IN edge. + */ + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = get()._controlStructureViaCdgIn + + /** Traverse to FIELD_IDENTIFIER via CDG IN edge. + */ + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = get()._fieldIdentifierViaCdgIn + + /** Traverse to IDENTIFIER via CDG IN edge. + */ + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaCdgIn + + /** Traverse to JUMP_TARGET via CDG IN edge. + */ + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaCdgIn + + /** Traverse to LITERAL via CDG IN edge. + */ + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaCdgIn + + /** Traverse to METHOD_REF via CDG IN edge. + */ + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaCdgIn + + /** Traverse to TYPE_REF via CDG IN edge. + */ + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaCdgIn + + /** Traverse to UNKNOWN via CDG IN edge. + */ + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaCdgIn + + def cfgIn: Iterator[CfgNode] = get().cfgIn + override def _cfgIn = get()._cfgIn + + def conditionIn: Iterator[ControlStructure] = get().conditionIn + override def _conditionIn = get()._conditionIn + + /** Traverse to CONTROL_STRUCTURE via CONDITION IN edge. + */ + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaConditionIn + + def containsIn: Iterator[Method] = get().containsIn + override def _containsIn = get()._containsIn + + /** Traverse to METHOD via CONTAINS IN edge. + */ + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = get()._methodViaContainsIn + + def dominateIn: Iterator[CfgNode] = get().dominateIn + override def _dominateIn = get()._dominateIn + + /** Traverse to BLOCK via DOMINATE IN edge. + */ + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaDominateIn + + /** Traverse to CALL via DOMINATE IN edge. + */ + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaDominateIn + + /** Traverse to CONTROL_STRUCTURE via DOMINATE IN edge. + */ + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaDominateIn + + /** Traverse to FIELD_IDENTIFIER via DOMINATE IN edge. + */ + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaDominateIn + + /** Traverse to IDENTIFIER via DOMINATE IN edge. + */ + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaDominateIn + + /** Traverse to JUMP_TARGET via DOMINATE IN edge. + */ + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaDominateIn + + /** Traverse to LITERAL via DOMINATE IN edge. + */ + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaDominateIn + + /** Traverse to METHOD via DOMINATE IN edge. + */ + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = get()._methodViaDominateIn + + /** Traverse to METHOD_REF via DOMINATE IN edge. + */ + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaDominateIn + + /** Traverse to RETURN via DOMINATE IN edge. + */ + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaDominateIn + + /** Traverse to TYPE_REF via DOMINATE IN edge. + */ + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaDominateIn + + /** Traverse to UNKNOWN via DOMINATE IN edge. + */ + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaDominateIn + + def pointsToIn: Iterator[CfgNode] = get().pointsToIn + override def _pointsToIn = get()._pointsToIn + + def postDominateIn: Iterator[CfgNode] = get().postDominateIn + override def _postDominateIn = get()._postDominateIn + + /** Traverse to BLOCK via POST_DOMINATE IN edge. + */ + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = get()._blockViaPostDominateIn + + /** Traverse to CALL via POST_DOMINATE IN edge. + */ + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = get()._callViaPostDominateIn + + /** Traverse to CONTROL_STRUCTURE via POST_DOMINATE IN edge. + */ + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + get()._controlStructureViaPostDominateIn + + /** Traverse to FIELD_IDENTIFIER via POST_DOMINATE IN edge. + */ + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + get()._fieldIdentifierViaPostDominateIn + + /** Traverse to IDENTIFIER via POST_DOMINATE IN edge. + */ + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = get()._identifierViaPostDominateIn + + /** Traverse to JUMP_TARGET via POST_DOMINATE IN edge. + */ + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = get()._jumpTargetViaPostDominateIn + + /** Traverse to LITERAL via POST_DOMINATE IN edge. + */ + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = get()._literalViaPostDominateIn + + /** Traverse to METHOD_REF via POST_DOMINATE IN edge. + */ + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = get()._methodRefViaPostDominateIn + + /** Traverse to METHOD_RETURN via POST_DOMINATE IN edge. + */ + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + get()._methodReturnViaPostDominateIn + + /** Traverse to RETURN via POST_DOMINATE IN edge. + */ + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = get()._returnViaPostDominateIn + + /** Traverse to TYPE_REF via POST_DOMINATE IN edge. + */ + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = get()._typeRefViaPostDominateIn + + /** Traverse to UNKNOWN via POST_DOMINATE IN edge. + */ + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = get()._unknownViaPostDominateIn + + def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn + override def _reachingDefIn = get()._reachingDefIn + + def receiverIn: Iterator[Call] = get().receiverIn + override def _receiverIn = get()._receiverIn + + /** Traverse to CALL via RECEIVER IN edge. + */ + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = get()._callViaReceiverIn + + // In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in + // patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`. + // This must become `class Derived(x_4762:Int) extends Base(x_4762)`. + // Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x + // or the derived class x. + // When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)` + // clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor + // parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory; + // at worst both fields go out-of-sync for hard-to-debug correctness bugs. + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping) + override def canEqual(that: Any): Boolean = get.canEqual(that) + override def label: String = { + Unknown.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "containedRef" + case 6 => "dynamicTypeHintFullName" + case 7 => "lineNumber" + case 8 => "order" + case 9 => "parserTypeName" + case 10 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => containedRef + case 6 => dynamicTypeHintFullName + case 7 => lineNumber + case 8 => order + case 9 => parserTypeName + case 10 => typeFullName + } + + override def productPrefix = "Unknown" + override def productArity = 11 +} + +class UnknownDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with UnknownBase { + + override def layoutInformation: NodeLayoutInformation = Unknown.layoutInformation + + private var _argumentIndex: scala.Int = Unknown.PropertyDefaults.ArgumentIndex + def argumentIndex: scala.Int = _argumentIndex + private var _argumentName: String = null + def argumentName: Option[String] = Option(_argumentName) + private var _code: String = Unknown.PropertyDefaults.Code + def code: String = _code + private var _columnNumber: Integer = null + def columnNumber: Option[Integer] = Option(_columnNumber) + private var _containedRef: String = Unknown.PropertyDefaults.ContainedRef + def containedRef: String = _containedRef + private var _dynamicTypeHintFullName: IndexedSeq[String] = collection.immutable.ArraySeq.empty + def dynamicTypeHintFullName: IndexedSeq[String] = _dynamicTypeHintFullName + private var _lineNumber: Integer = null + def lineNumber: Option[Integer] = Option(_lineNumber) + private var _order: scala.Int = Unknown.PropertyDefaults.Order + def order: scala.Int = _order + private var _parserTypeName: String = Unknown.PropertyDefaults.ParserTypeName + def parserTypeName: String = _parserTypeName + private var _typeFullName: String = Unknown.PropertyDefaults.TypeFullName + def typeFullName: String = _typeFullName + + /** faster than the default implementation */ + override def propertiesMap: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + properties.put("ARGUMENT_INDEX", argumentIndex) + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + properties.put("CODE", code) + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + properties.put("CONTAINED_REF", containedRef) + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + properties.put("ORDER", order) + properties.put("PARSER_TYPE_NAME", parserTypeName) + properties.put("TYPE_FULL_NAME", typeFullName) + + properties + } + + /** faster than the default implementation */ + override def propertiesMapForStorage: java.util.Map[String, Any] = { + val properties = new java.util.HashMap[String, Any] + if (!((-1: Int) == argumentIndex)) { properties.put("ARGUMENT_INDEX", argumentIndex) } + argumentName.map { value => properties.put("ARGUMENT_NAME", value) } + if (!(("") == code)) { properties.put("CODE", code) } + columnNumber.map { value => properties.put("COLUMN_NUMBER", value) } + if (!(("") == containedRef)) { properties.put("CONTAINED_REF", containedRef) } + if (this._dynamicTypeHintFullName != null && this._dynamicTypeHintFullName.nonEmpty) { + properties.put("DYNAMIC_TYPE_HINT_FULL_NAME", dynamicTypeHintFullName) + } + lineNumber.map { value => properties.put("LINE_NUMBER", value) } + if (!((-1: Int) == order)) { properties.put("ORDER", order) } + if (!(("") == parserTypeName)) { properties.put("PARSER_TYPE_NAME", parserTypeName) } + if (!(("") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) } + + properties + } + + import overflowdb.traversal._ + def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0) + override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0) + + def astOut: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1) + override def _astOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1) + def _blockViaAstOut: overflowdb.traversal.Traversal[Block] = astOut.collectAll[Block] + def _callViaAstOut: overflowdb.traversal.Traversal[Call] = astOut.collectAll[Call] + def _controlStructureViaAstOut: overflowdb.traversal.Traversal[ControlStructure] = astOut.collectAll[ControlStructure] + def _fieldIdentifierViaAstOut: overflowdb.traversal.Traversal[FieldIdentifier] = astOut.collectAll[FieldIdentifier] + def _identifierViaAstOut: overflowdb.traversal.Traversal[Identifier] = astOut.collectAll[Identifier] + def _jumpTargetViaAstOut: overflowdb.traversal.Traversal[JumpTarget] = astOut.collectAll[JumpTarget] + def _literalViaAstOut: overflowdb.traversal.Traversal[Literal] = astOut.collectAll[Literal] + def _localViaAstOut: overflowdb.traversal.Traversal[Local] = astOut.collectAll[Local] + def _memberViaAstOut: overflowdb.traversal.Traversal[Member] = astOut.collectAll[Member] + def _modifierViaAstOut: overflowdb.traversal.Traversal[Modifier] = astOut.collectAll[Modifier] + def _returnViaAstOut: overflowdb.traversal.Traversal[Return] = astOut.collectAll[Return] + def _unknownViaAstOut: overflowdb.traversal.Traversal[Unknown] = astOut.collectAll[Unknown] + + def cdgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2) + override def _cdgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2) + def _blockViaCdgOut: overflowdb.traversal.Traversal[Block] = cdgOut.collectAll[Block] + def _callViaCdgOut: overflowdb.traversal.Traversal[Call] = cdgOut.collectAll[Call] + def _controlStructureViaCdgOut: overflowdb.traversal.Traversal[ControlStructure] = cdgOut.collectAll[ControlStructure] + def _fieldIdentifierViaCdgOut: overflowdb.traversal.Traversal[FieldIdentifier] = cdgOut.collectAll[FieldIdentifier] + def _identifierViaCdgOut: overflowdb.traversal.Traversal[Identifier] = cdgOut.collectAll[Identifier] + def _jumpTargetViaCdgOut: overflowdb.traversal.Traversal[JumpTarget] = cdgOut.collectAll[JumpTarget] + def _literalViaCdgOut: overflowdb.traversal.Traversal[Literal] = cdgOut.collectAll[Literal] + def _methodRefViaCdgOut: overflowdb.traversal.Traversal[MethodRef] = cdgOut.collectAll[MethodRef] + def _methodReturnViaCdgOut: overflowdb.traversal.Traversal[MethodReturn] = cdgOut.collectAll[MethodReturn] + def _returnViaCdgOut: overflowdb.traversal.Traversal[Return] = cdgOut.collectAll[Return] + def _typeRefViaCdgOut: overflowdb.traversal.Traversal[TypeRef] = cdgOut.collectAll[TypeRef] + def _unknownViaCdgOut: overflowdb.traversal.Traversal[Unknown] = cdgOut.collectAll[Unknown] + + def cfgOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3) + override def _cfgOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3) + def _cfgNodeViaCfgOut: overflowdb.traversal.Traversal[CfgNode] = cfgOut.collectAll[CfgNode] + + def dominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4) + override def _dominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4) + def _blockViaDominateOut: overflowdb.traversal.Traversal[Block] = dominateOut.collectAll[Block] + def _callViaDominateOut: overflowdb.traversal.Traversal[Call] = dominateOut.collectAll[Call] + def _controlStructureViaDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + dominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateOut.collectAll[FieldIdentifier] + def _identifierViaDominateOut: overflowdb.traversal.Traversal[Identifier] = dominateOut.collectAll[Identifier] + def _jumpTargetViaDominateOut: overflowdb.traversal.Traversal[JumpTarget] = dominateOut.collectAll[JumpTarget] + def _literalViaDominateOut: overflowdb.traversal.Traversal[Literal] = dominateOut.collectAll[Literal] + def _methodRefViaDominateOut: overflowdb.traversal.Traversal[MethodRef] = dominateOut.collectAll[MethodRef] + def _methodReturnViaDominateOut: overflowdb.traversal.Traversal[MethodReturn] = dominateOut.collectAll[MethodReturn] + def _returnViaDominateOut: overflowdb.traversal.Traversal[Return] = dominateOut.collectAll[Return] + def _typeRefViaDominateOut: overflowdb.traversal.Traversal[TypeRef] = dominateOut.collectAll[TypeRef] + def _unknownViaDominateOut: overflowdb.traversal.Traversal[Unknown] = dominateOut.collectAll[Unknown] + + def evalTypeOut: Iterator[Type] = createAdjacentNodeScalaIteratorByOffSet[Type](5) + override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5) + def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type] + + def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6) + override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6) + + def postDominateOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](7) + override def _postDominateOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7) + def _blockViaPostDominateOut: overflowdb.traversal.Traversal[Block] = postDominateOut.collectAll[Block] + def _callViaPostDominateOut: overflowdb.traversal.Traversal[Call] = postDominateOut.collectAll[Call] + def _controlStructureViaPostDominateOut: overflowdb.traversal.Traversal[ControlStructure] = + postDominateOut.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateOut: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateOut.collectAll[FieldIdentifier] + def _identifierViaPostDominateOut: overflowdb.traversal.Traversal[Identifier] = postDominateOut.collectAll[Identifier] + def _jumpTargetViaPostDominateOut: overflowdb.traversal.Traversal[JumpTarget] = postDominateOut.collectAll[JumpTarget] + def _literalViaPostDominateOut: overflowdb.traversal.Traversal[Literal] = postDominateOut.collectAll[Literal] + def _methodViaPostDominateOut: overflowdb.traversal.Traversal[Method] = postDominateOut.collectAll[Method] + def _methodRefViaPostDominateOut: overflowdb.traversal.Traversal[MethodRef] = postDominateOut.collectAll[MethodRef] + def _returnViaPostDominateOut: overflowdb.traversal.Traversal[Return] = postDominateOut.collectAll[Return] + def _typeRefViaPostDominateOut: overflowdb.traversal.Traversal[TypeRef] = postDominateOut.collectAll[TypeRef] + def _unknownViaPostDominateOut: overflowdb.traversal.Traversal[Unknown] = postDominateOut.collectAll[Unknown] + + def reachingDefOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](8) + override def _reachingDefOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](8) + def _callViaReachingDefOut: overflowdb.traversal.Traversal[Call] = reachingDefOut.collectAll[Call] + def _identifierViaReachingDefOut: overflowdb.traversal.Traversal[Identifier] = reachingDefOut.collectAll[Identifier] + def _literalViaReachingDefOut: overflowdb.traversal.Traversal[Literal] = reachingDefOut.collectAll[Literal] + def _methodParameterOutViaReachingDefOut: overflowdb.traversal.Traversal[MethodParameterOut] = + reachingDefOut.collectAll[MethodParameterOut] + def _methodRefViaReachingDefOut: overflowdb.traversal.Traversal[MethodRef] = reachingDefOut.collectAll[MethodRef] + def _returnViaReachingDefOut: overflowdb.traversal.Traversal[Return] = reachingDefOut.collectAll[Return] + def _typeRefViaReachingDefOut: overflowdb.traversal.Traversal[TypeRef] = reachingDefOut.collectAll[TypeRef] + + def taggedByOut: Iterator[Tag] = createAdjacentNodeScalaIteratorByOffSet[Tag](9) + override def _taggedByOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](9) + def _tagViaTaggedByOut: overflowdb.traversal.Traversal[Tag] = taggedByOut.collectAll[Tag] + + def argumentIn: Iterator[Expression] = createAdjacentNodeScalaIteratorByOffSet[Expression](10) + override def _argumentIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](10) + def _callViaArgumentIn: overflowdb.traversal.Traversal[Call] = argumentIn.collectAll[Call] + def _returnViaArgumentIn: overflowdb.traversal.Traversal[Return] = argumentIn.collectAll[Return] + + def astIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](11) + override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](11) + def _blockViaAstIn: overflowdb.traversal.Traversal[Block] = astIn.collectAll[Block] + def _controlStructureViaAstIn: overflowdb.traversal.Traversal[ControlStructure] = astIn.collectAll[ControlStructure] + def _methodParameterInViaAstIn: overflowdb.traversal.Traversal[MethodParameterIn] = + astIn.collectAll[MethodParameterIn] + def _returnViaAstIn: overflowdb.traversal.Traversal[Return] = astIn.collectAll[Return] + def _unknownViaAstIn: overflowdb.traversal.Traversal[Unknown] = astIn.collectAll[Unknown] + + def cdgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](12) + override def _cdgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](12) + def _blockViaCdgIn: overflowdb.traversal.Traversal[Block] = cdgIn.collectAll[Block] + def _callViaCdgIn: overflowdb.traversal.Traversal[Call] = cdgIn.collectAll[Call] + def _controlStructureViaCdgIn: overflowdb.traversal.Traversal[ControlStructure] = cdgIn.collectAll[ControlStructure] + def _fieldIdentifierViaCdgIn: overflowdb.traversal.Traversal[FieldIdentifier] = cdgIn.collectAll[FieldIdentifier] + def _identifierViaCdgIn: overflowdb.traversal.Traversal[Identifier] = cdgIn.collectAll[Identifier] + def _jumpTargetViaCdgIn: overflowdb.traversal.Traversal[JumpTarget] = cdgIn.collectAll[JumpTarget] + def _literalViaCdgIn: overflowdb.traversal.Traversal[Literal] = cdgIn.collectAll[Literal] + def _methodRefViaCdgIn: overflowdb.traversal.Traversal[MethodRef] = cdgIn.collectAll[MethodRef] + def _typeRefViaCdgIn: overflowdb.traversal.Traversal[TypeRef] = cdgIn.collectAll[TypeRef] + def _unknownViaCdgIn: overflowdb.traversal.Traversal[Unknown] = cdgIn.collectAll[Unknown] + + def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](13) + override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](13) + + def conditionIn: Iterator[ControlStructure] = createAdjacentNodeScalaIteratorByOffSet[ControlStructure](14) + override def _conditionIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](14) + def _controlStructureViaConditionIn: overflowdb.traversal.Traversal[ControlStructure] = + conditionIn.collectAll[ControlStructure] + + def containsIn: Iterator[Method] = createAdjacentNodeScalaIteratorByOffSet[Method](15) + override def _containsIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](15) + def _methodViaContainsIn: overflowdb.traversal.Traversal[Method] = containsIn.collectAll[Method] + + def dominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](16) + override def _dominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](16) + def _blockViaDominateIn: overflowdb.traversal.Traversal[Block] = dominateIn.collectAll[Block] + def _callViaDominateIn: overflowdb.traversal.Traversal[Call] = dominateIn.collectAll[Call] + def _controlStructureViaDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + dominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + dominateIn.collectAll[FieldIdentifier] + def _identifierViaDominateIn: overflowdb.traversal.Traversal[Identifier] = dominateIn.collectAll[Identifier] + def _jumpTargetViaDominateIn: overflowdb.traversal.Traversal[JumpTarget] = dominateIn.collectAll[JumpTarget] + def _literalViaDominateIn: overflowdb.traversal.Traversal[Literal] = dominateIn.collectAll[Literal] + def _methodViaDominateIn: overflowdb.traversal.Traversal[Method] = dominateIn.collectAll[Method] + def _methodRefViaDominateIn: overflowdb.traversal.Traversal[MethodRef] = dominateIn.collectAll[MethodRef] + def _returnViaDominateIn: overflowdb.traversal.Traversal[Return] = dominateIn.collectAll[Return] + def _typeRefViaDominateIn: overflowdb.traversal.Traversal[TypeRef] = dominateIn.collectAll[TypeRef] + def _unknownViaDominateIn: overflowdb.traversal.Traversal[Unknown] = dominateIn.collectAll[Unknown] + + def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](17) + override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](17) + + def postDominateIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](18) + override def _postDominateIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](18) + def _blockViaPostDominateIn: overflowdb.traversal.Traversal[Block] = postDominateIn.collectAll[Block] + def _callViaPostDominateIn: overflowdb.traversal.Traversal[Call] = postDominateIn.collectAll[Call] + def _controlStructureViaPostDominateIn: overflowdb.traversal.Traversal[ControlStructure] = + postDominateIn.collectAll[ControlStructure] + def _fieldIdentifierViaPostDominateIn: overflowdb.traversal.Traversal[FieldIdentifier] = + postDominateIn.collectAll[FieldIdentifier] + def _identifierViaPostDominateIn: overflowdb.traversal.Traversal[Identifier] = postDominateIn.collectAll[Identifier] + def _jumpTargetViaPostDominateIn: overflowdb.traversal.Traversal[JumpTarget] = postDominateIn.collectAll[JumpTarget] + def _literalViaPostDominateIn: overflowdb.traversal.Traversal[Literal] = postDominateIn.collectAll[Literal] + def _methodRefViaPostDominateIn: overflowdb.traversal.Traversal[MethodRef] = postDominateIn.collectAll[MethodRef] + def _methodReturnViaPostDominateIn: overflowdb.traversal.Traversal[MethodReturn] = + postDominateIn.collectAll[MethodReturn] + def _returnViaPostDominateIn: overflowdb.traversal.Traversal[Return] = postDominateIn.collectAll[Return] + def _typeRefViaPostDominateIn: overflowdb.traversal.Traversal[TypeRef] = postDominateIn.collectAll[TypeRef] + def _unknownViaPostDominateIn: overflowdb.traversal.Traversal[Unknown] = postDominateIn.collectAll[Unknown] + + def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](19) + override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](19) + + def receiverIn: Iterator[Call] = createAdjacentNodeScalaIteratorByOffSet[Call](20) + override def _receiverIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](20) + def _callViaReceiverIn: overflowdb.traversal.Traversal[Call] = receiverIn.collectAll[Call] + + override def label: String = { + Unknown.Label + } + + override def productElementName(n: Int): String = + n match { + case 0 => "id" + case 1 => "argumentIndex" + case 2 => "argumentName" + case 3 => "code" + case 4 => "columnNumber" + case 5 => "containedRef" + case 6 => "dynamicTypeHintFullName" + case 7 => "lineNumber" + case 8 => "order" + case 9 => "parserTypeName" + case 10 => "typeFullName" + } + + override def productElement(n: Int): Any = + n match { + case 0 => id + case 1 => argumentIndex + case 2 => argumentName + case 3 => code + case 4 => columnNumber + case 5 => containedRef + case 6 => dynamicTypeHintFullName + case 7 => lineNumber + case 8 => order + case 9 => parserTypeName + case 10 => typeFullName + } + + override def productPrefix = "Unknown" + override def productArity = 11 + + override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[UnknownDb] + + override def property(key: String): Any = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex + case "ARGUMENT_NAME" => this._argumentName + case "CODE" => this._code + case "COLUMN_NUMBER" => this._columnNumber + case "CONTAINED_REF" => this._containedRef + case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName + case "LINE_NUMBER" => this._lineNumber + case "ORDER" => this._order + case "PARSER_TYPE_NAME" => this._parserTypeName + case "TYPE_FULL_NAME" => this._typeFullName + + case _ => null + } + } + + override protected def updateSpecificProperty(key: String, value: Object): Unit = { + key match { + case "ARGUMENT_INDEX" => this._argumentIndex = value.asInstanceOf[scala.Int] + case "ARGUMENT_NAME" => this._argumentName = value.asInstanceOf[String] + case "CODE" => this._code = value.asInstanceOf[String] + case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[Integer] + case "CONTAINED_REF" => this._containedRef = value.asInstanceOf[String] + case "DYNAMIC_TYPE_HINT_FULL_NAME" => + this._dynamicTypeHintFullName = value match { + case null => collection.immutable.ArraySeq.empty + case singleValue: String => collection.immutable.ArraySeq(singleValue) + case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty + case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]] + case jCollection: java.lang.Iterable[_] => + if (jCollection.iterator.hasNext) { + collection.immutable.ArraySeq.unsafeWrapArray( + jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray + ) + } else collection.immutable.ArraySeq.empty + case iter: Iterable[_] => + if (iter.nonEmpty) { + collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray) + } else collection.immutable.ArraySeq.empty + } + case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer] + case "ORDER" => this._order = value.asInstanceOf[scala.Int] + case "PARSER_TYPE_NAME" => this._parserTypeName = value.asInstanceOf[String] + case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String] + + case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key) + } + } + + override def removeSpecificProperty(key: String): Unit = + this.updateSpecificProperty(key, null) + + override def _initializeFromDetached( + data: overflowdb.DetachedNodeData, + mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node] + ) = + fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode]) + + override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = { + this._argumentIndex = newNode.asInstanceOf[NewUnknown].argumentIndex + this._argumentName = newNode.asInstanceOf[NewUnknown].argumentName.orNull + this._code = newNode.asInstanceOf[NewUnknown].code + this._columnNumber = newNode.asInstanceOf[NewUnknown].columnNumber.orNull + this._containedRef = newNode.asInstanceOf[NewUnknown].containedRef + this._dynamicTypeHintFullName = + if (newNode.asInstanceOf[NewUnknown].dynamicTypeHintFullName != null) + newNode.asInstanceOf[NewUnknown].dynamicTypeHintFullName + else collection.immutable.ArraySeq.empty + this._lineNumber = newNode.asInstanceOf[NewUnknown].lineNumber.orNull + this._order = newNode.asInstanceOf[NewUnknown].order + this._parserTypeName = newNode.asInstanceOf[NewUnknown].parserTypeName + this._typeFullName = newNode.asInstanceOf[NewUnknown].typeFullName + + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Annotation.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Annotation.scala new file mode 100644 index 0000000..6a5727f --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Annotation.scala @@ -0,0 +1,424 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Annotation */ +class AnnotationTraversalExtGen[NodeType <: Annotation](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to fullName property */ + def fullName: Iterator[String] = + traversal.map(_.fullName) + + /** Traverse to nodes where the fullName matches the regular expression `value` + */ + def fullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + fullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where the fullName matches at least one of the regular expressions in `values` + */ + def fullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.fullName, patterns) + + /** Traverse to nodes where fullName matches `value` exactly. + */ + def fullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.fullName == value } + } + + /** Traverse to nodes where fullName matches one of the elements in `values` exactly. + */ + def fullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + fullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.fullName), values, "FULL_NAME") + } + + /** Traverse to nodes where fullName does not match the regular expression `value`. + */ + def fullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.fullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where fullName does not match any of the regular expressions in `values`. + */ + def fullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.fullName, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationLiteral.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationLiteral.scala new file mode 100644 index 0000000..8b51118 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationLiteral.scala @@ -0,0 +1,369 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for AnnotationLiteral */ +class AnnotationLiteralTraversalExtGen[NodeType <: AnnotationLiteral](val traversal: Iterator[NodeType]) + extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameter.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameter.scala new file mode 100644 index 0000000..051fe8e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameter.scala @@ -0,0 +1,210 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for AnnotationParameter */ +class AnnotationParameterTraversalExtGen[NodeType <: AnnotationParameter](val traversal: Iterator[NodeType]) + extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameterAssign.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameterAssign.scala new file mode 100644 index 0000000..8701d01 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AnnotationParameterAssign.scala @@ -0,0 +1,210 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for AnnotationParameterAssign */ +class AnnotationParameterAssignTraversalExtGen[NodeType <: AnnotationParameterAssign](val traversal: Iterator[NodeType]) + extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ArrayInitializer.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ArrayInitializer.scala new file mode 100644 index 0000000..3705573 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ArrayInitializer.scala @@ -0,0 +1,312 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for ArrayInitializer */ +class ArrayInitializerTraversalExtGen[NodeType <: ArrayInitializer](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AstNode.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AstNode.scala new file mode 100644 index 0000000..4c86830 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/AstNode.scala @@ -0,0 +1,209 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for AstNode */ +class AstNodeTraversalExtGen[NodeType <: AstNode](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Binding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Binding.scala new file mode 100644 index 0000000..0762907 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Binding.scala @@ -0,0 +1,188 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Binding */ +class BindingTraversalExtGen[NodeType <: Binding](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to TYPE_DECL via BINDS IN edge. + */ + def bindingTypeDecl: Iterator[TypeDecl] = + traversal.map(_.bindingTypeDecl) + + /** Traverse to METHOD via REF OUT edge. + */ + def boundMethod: Iterator[Method] = + traversal.map(_.boundMethod) + + /** Traverse to methodFullName property */ + def methodFullName: Iterator[String] = + traversal.map(_.methodFullName) + + /** Traverse to nodes where the methodFullName matches the regular expression `value` + */ + def methodFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + methodFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where the methodFullName matches at least one of the regular expressions in `values` + */ + def methodFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.methodFullName, patterns) + + /** Traverse to nodes where methodFullName matches `value` exactly. + */ + def methodFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("METHOD_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.methodFullName == value } + } + + /** Traverse to nodes where methodFullName matches one of the elements in `values` exactly. + */ + def methodFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + methodFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.methodFullName), values, "METHOD_FULL_NAME") + } + + /** Traverse to nodes where methodFullName does not match the regular expression `value`. + */ + def methodFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.methodFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where methodFullName does not match any of the regular expressions in `values`. + */ + def methodFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.methodFullName, patterns) + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to signature property */ + def signature: Iterator[String] = + traversal.map(_.signature) + + /** Traverse to nodes where the signature matches the regular expression `value` + */ + def signature(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + signatureExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where the signature matches at least one of the regular expressions in `values` + */ + def signature(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.signature, patterns) + + /** Traverse to nodes where signature matches `value` exactly. + */ + def signatureExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("SIGNATURE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.signature == value } + } + + /** Traverse to nodes where signature matches one of the elements in `values` exactly. + */ + def signatureExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + signatureExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.signature), values, "SIGNATURE") + } + + /** Traverse to nodes where signature does not match the regular expression `value`. + */ + def signatureNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.signature != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where signature does not match any of the regular expressions in `values`. + */ + def signatureNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.signature, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Block.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Block.scala new file mode 100644 index 0000000..3dc68e4 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Block.scala @@ -0,0 +1,380 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Block */ +class BlockTraversalExtGen[NodeType <: Block](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to locals of this block. Traverse to LOCAL via AST OUT edge. + */ + /** Traverse to locals of this block. */ + @overflowdb.traversal.help.Doc(info = """Traverse to locals of this block.""") + def local: Iterator[Local] = + traversal.flatMap(_.local) + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Call.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Call.scala new file mode 100644 index 0000000..941c489 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Call.scala @@ -0,0 +1,606 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Call */ +class CallTraversalExtGen[NodeType <: Call](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to referenced members Traverse to MEMBER via REF OUT edge. + */ + /** Traverse to referenced members */ + @overflowdb.traversal.help.Doc(info = """Traverse to referenced members""") + def referencedMember: Iterator[Member] = + traversal.flatMap(_.referencedMember) + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dispatchType property */ + def dispatchType: Iterator[String] = + traversal.map(_.dispatchType) + + /** Traverse to nodes where the dispatchType matches the regular expression `value` + */ + def dispatchType(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + dispatchTypeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.dispatchType, pattern) + } + } + + /** Traverse to nodes where the dispatchType matches at least one of the regular expressions in `values` + */ + def dispatchType(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.dispatchType, patterns) + + /** Traverse to nodes where dispatchType matches `value` exactly. + */ + def dispatchTypeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("DISPATCH_TYPE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.dispatchType == value } + } + + /** Traverse to nodes where dispatchType matches one of the elements in `values` exactly. + */ + def dispatchTypeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + dispatchTypeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.dispatchType), values, "DISPATCH_TYPE") + } + + /** Traverse to nodes where dispatchType does not match the regular expression `value`. + */ + def dispatchTypeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.dispatchType != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.dispatchType, pattern) + } + } + + /** Traverse to nodes where dispatchType does not match any of the regular expressions in `values`. + */ + def dispatchTypeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.dispatchType, patterns) + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to methodFullName property */ + def methodFullName: Iterator[String] = + traversal.map(_.methodFullName) + + /** Traverse to nodes where the methodFullName matches the regular expression `value` + */ + def methodFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + methodFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where the methodFullName matches at least one of the regular expressions in `values` + */ + def methodFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.methodFullName, patterns) + + /** Traverse to nodes where methodFullName matches `value` exactly. + */ + def methodFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("METHOD_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.methodFullName == value } + } + + /** Traverse to nodes where methodFullName matches one of the elements in `values` exactly. + */ + def methodFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + methodFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.methodFullName), values, "METHOD_FULL_NAME") + } + + /** Traverse to nodes where methodFullName does not match the regular expression `value`. + */ + def methodFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.methodFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where methodFullName does not match any of the regular expressions in `values`. + */ + def methodFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.methodFullName, patterns) + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to signature property */ + def signature: Iterator[String] = + traversal.map(_.signature) + + /** Traverse to nodes where the signature matches the regular expression `value` + */ + def signature(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + signatureExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where the signature matches at least one of the regular expressions in `values` + */ + def signature(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.signature, patterns) + + /** Traverse to nodes where signature matches `value` exactly. + */ + def signatureExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("SIGNATURE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.signature == value } + } + + /** Traverse to nodes where signature matches one of the elements in `values` exactly. + */ + def signatureExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + signatureExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.signature), values, "SIGNATURE") + } + + /** Traverse to nodes where signature does not match the regular expression `value`. + */ + def signatureNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.signature != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where signature does not match any of the regular expressions in `values`. + */ + def signatureNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.signature, patterns) + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CallRepr.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CallRepr.scala new file mode 100644 index 0000000..c8d9768 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CallRepr.scala @@ -0,0 +1,321 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for CallRepr */ +class CallReprTraversalExtGen[NodeType <: CallRepr](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to signature property */ + def signature: Iterator[String] = + traversal.map(_.signature) + + /** Traverse to nodes where the signature matches the regular expression `value` + */ + def signature(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + signatureExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where the signature matches at least one of the regular expressions in `values` + */ + def signature(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.signature, patterns) + + /** Traverse to nodes where signature matches `value` exactly. + */ + def signatureExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("SIGNATURE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.signature == value } + } + + /** Traverse to nodes where signature matches one of the elements in `values` exactly. + */ + def signatureExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + signatureExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.signature), values, "SIGNATURE") + } + + /** Traverse to nodes where signature does not match the regular expression `value`. + */ + def signatureNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.signature != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where signature does not match any of the regular expressions in `values`. + */ + def signatureNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.signature, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CfgNode.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CfgNode.scala new file mode 100644 index 0000000..76a9a32 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/CfgNode.scala @@ -0,0 +1,209 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for CfgNode */ +class CfgNodeTraversalExtGen[NodeType <: CfgNode](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ClosureBinding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ClosureBinding.scala new file mode 100644 index 0000000..5f7471a --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ClosureBinding.scala @@ -0,0 +1,180 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for ClosureBinding */ +class ClosureBindingTraversalExtGen[NodeType <: ClosureBinding](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to closureBindingId property */ + def closureBindingId: Iterator[String] = + traversal.flatMap(_.closureBindingId) + + /** Traverse to nodes where the closureBindingId matches the regular expression `value` + */ + def closureBindingId(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureBindingId.isDefined && node.closureBindingId.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, pattern) + } + } + + /** Traverse to nodes where the closureBindingId matches at least one of the regular expressions in `values` + */ + def closureBindingId(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, patterns) + } + + /** Traverse to nodes where closureBindingId matches `value` exactly. + */ + def closureBindingIdExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.closureBindingId.contains(value) } + + /** Traverse to nodes where closureBindingId matches one of the elements in `values` exactly. + */ + def closureBindingIdExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + closureBindingIdExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.closureBindingId, values, "CLOSURE_BINDING_ID") + } + + /** Traverse to nodes where closureBindingId does not match the regular expression `value`. + */ + def closureBindingIdNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureBindingId.isEmpty || node.closureBindingId.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, pattern) + } + } + + /** Traverse to nodes where closureBindingId does not match any of the regular expressions in `values`. + */ + def closureBindingIdNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, patterns) + } + + /** Traverse to closureOriginalName property */ + def closureOriginalName: Iterator[String] = + traversal.flatMap(_.closureOriginalName) + + /** Traverse to nodes where the closureOriginalName matches the regular expression `value` + */ + def closureOriginalName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureOriginalName.isDefined && node.closureOriginalName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.closureOriginalName.isDefined))(_.closureOriginalName.get, pattern) + } + } + + /** Traverse to nodes where the closureOriginalName matches at least one of the regular expressions in `values` + */ + def closureOriginalName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.closureOriginalName.isDefined))(_.closureOriginalName.get, patterns) + } + + /** Traverse to nodes where closureOriginalName matches `value` exactly. + */ + def closureOriginalNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.closureOriginalName.contains(value) } + + /** Traverse to nodes where closureOriginalName matches one of the elements in `values` exactly. + */ + def closureOriginalNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + closureOriginalNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.closureOriginalName, values, "CLOSURE_ORIGINAL_NAME") + } + + /** Traverse to nodes where closureOriginalName does not match the regular expression `value`. + */ + def closureOriginalNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureOriginalName.isEmpty || node.closureOriginalName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.closureOriginalName.isDefined))(_.closureOriginalName.get, pattern) + } + } + + /** Traverse to nodes where closureOriginalName does not match any of the regular expressions in `values`. + */ + def closureOriginalNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.closureOriginalName.isDefined))(_.closureOriginalName.get, patterns) + } + + /** Traverse to evaluationStrategy property */ + def evaluationStrategy: Iterator[String] = + traversal.map(_.evaluationStrategy) + + /** Traverse to nodes where the evaluationStrategy matches the regular expression `value` + */ + def evaluationStrategy(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + evaluationStrategyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where the evaluationStrategy matches at least one of the regular expressions in `values` + */ + def evaluationStrategy(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.evaluationStrategy, patterns) + + /** Traverse to nodes where evaluationStrategy matches `value` exactly. + */ + def evaluationStrategyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("EVALUATION_STRATEGY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.evaluationStrategy == value } + } + + /** Traverse to nodes where evaluationStrategy matches one of the elements in `values` exactly. + */ + def evaluationStrategyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + evaluationStrategyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.evaluationStrategy), + values, + "EVALUATION_STRATEGY" + ) + } + + /** Traverse to nodes where evaluationStrategy does not match the regular expression `value`. + */ + def evaluationStrategyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.evaluationStrategy != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where evaluationStrategy does not match any of the regular expressions in `values`. + */ + def evaluationStrategyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.evaluationStrategy, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Comment.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Comment.scala new file mode 100644 index 0000000..edd0795 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Comment.scala @@ -0,0 +1,270 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Comment */ +class CommentTraversalExtGen[NodeType <: Comment](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to COMMENT via SOURCE_FILE OUT edge. + */ + def file: Iterator[Comment] = + traversal.flatMap(_.file) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to filename property */ + def filename: Iterator[String] = + traversal.map(_.filename) + + /** Traverse to nodes where the filename matches the regular expression `value` + */ + def filename(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + filenameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where the filename matches at least one of the regular expressions in `values` + */ + def filename(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.filename, patterns) + + /** Traverse to nodes where filename matches `value` exactly. + */ + def filenameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FILENAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.filename == value } + } + + /** Traverse to nodes where filename matches one of the elements in `values` exactly. + */ + def filenameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + filenameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.filename), values, "FILENAME") + } + + /** Traverse to nodes where filename does not match the regular expression `value`. + */ + def filenameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.filename != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where filename does not match any of the regular expressions in `values`. + */ + def filenameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.filename, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ConfigFile.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ConfigFile.scala new file mode 100644 index 0000000..5604d5c --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ConfigFile.scala @@ -0,0 +1,121 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for ConfigFile */ +class ConfigFileTraversalExtGen[NodeType <: ConfigFile](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to content property */ + def content: Iterator[String] = + traversal.map(_.content) + + /** Traverse to nodes where the content matches the regular expression `value` + */ + def content(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + contentExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.content, pattern) + } + } + + /** Traverse to nodes where the content matches at least one of the regular expressions in `values` + */ + def content(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.content, patterns) + + /** Traverse to nodes where content matches `value` exactly. + */ + def contentExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CONTENT", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.content == value } + } + + /** Traverse to nodes where content matches one of the elements in `values` exactly. + */ + def contentExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + contentExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.content), values, "CONTENT") + } + + /** Traverse to nodes where content does not match the regular expression `value`. + */ + def contentNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.content != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.content, pattern) + } + } + + /** Traverse to nodes where content does not match any of the regular expressions in `values`. + */ + def contentNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.content, patterns) + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ControlStructure.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ControlStructure.scala new file mode 100644 index 0000000..63d7857 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/ControlStructure.scala @@ -0,0 +1,430 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for ControlStructure */ +class ControlStructureTraversalExtGen[NodeType <: ControlStructure](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to controlStructureType property */ + def controlStructureType: Iterator[String] = + traversal.map(_.controlStructureType) + + /** Traverse to nodes where the controlStructureType matches the regular expression `value` + */ + def controlStructureType(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + controlStructureTypeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.controlStructureType, pattern) + } + } + + /** Traverse to nodes where the controlStructureType matches at least one of the regular expressions in `values` + */ + def controlStructureType(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.controlStructureType, patterns) + + /** Traverse to nodes where controlStructureType matches `value` exactly. + */ + def controlStructureTypeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("CONTROL_STRUCTURE_TYPE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.controlStructureType == value } + } + + /** Traverse to nodes where controlStructureType matches one of the elements in `values` exactly. + */ + def controlStructureTypeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + controlStructureTypeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.controlStructureType), + values, + "CONTROL_STRUCTURE_TYPE" + ) + } + + /** Traverse to nodes where controlStructureType does not match the regular expression `value`. + */ + def controlStructureTypeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.controlStructureType != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.controlStructureType, pattern) + } + } + + /** Traverse to nodes where controlStructureType does not match any of the regular expressions in `values`. + */ + def controlStructureTypeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.controlStructureType, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to parserTypeName property */ + def parserTypeName: Iterator[String] = + traversal.map(_.parserTypeName) + + /** Traverse to nodes where the parserTypeName matches the regular expression `value` + */ + def parserTypeName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + parserTypeNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where the parserTypeName matches at least one of the regular expressions in `values` + */ + def parserTypeName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.parserTypeName, patterns) + + /** Traverse to nodes where parserTypeName matches `value` exactly. + */ + def parserTypeNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("PARSER_TYPE_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.parserTypeName == value } + } + + /** Traverse to nodes where parserTypeName matches one of the elements in `values` exactly. + */ + def parserTypeNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + parserTypeNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.parserTypeName), values, "PARSER_TYPE_NAME") + } + + /** Traverse to nodes where parserTypeName does not match the regular expression `value`. + */ + def parserTypeNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.parserTypeName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where parserTypeName does not match any of the regular expressions in `values`. + */ + def parserTypeNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.parserTypeName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Declaration.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Declaration.scala new file mode 100644 index 0000000..a299161 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Declaration.scala @@ -0,0 +1,65 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Declaration */ +class DeclarationTraversalExtGen[NodeType <: Declaration](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Dependency.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Dependency.scala new file mode 100644 index 0000000..49f6429 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Dependency.scala @@ -0,0 +1,176 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Dependency */ +class DependencyTraversalExtGen[NodeType <: Dependency](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to dependencyGroupId property */ + def dependencyGroupId: Iterator[String] = + traversal.flatMap(_.dependencyGroupId) + + /** Traverse to nodes where the dependencyGroupId matches the regular expression `value` + */ + def dependencyGroupId(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.dependencyGroupId.isDefined && node.dependencyGroupId.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.dependencyGroupId.isDefined))(_.dependencyGroupId.get, pattern) + } + } + + /** Traverse to nodes where the dependencyGroupId matches at least one of the regular expressions in `values` + */ + def dependencyGroupId(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.dependencyGroupId.isDefined))(_.dependencyGroupId.get, patterns) + } + + /** Traverse to nodes where dependencyGroupId matches `value` exactly. + */ + def dependencyGroupIdExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.dependencyGroupId.contains(value) } + + /** Traverse to nodes where dependencyGroupId matches one of the elements in `values` exactly. + */ + def dependencyGroupIdExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + dependencyGroupIdExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.dependencyGroupId, values, "DEPENDENCY_GROUP_ID") + } + + /** Traverse to nodes where dependencyGroupId does not match the regular expression `value`. + */ + def dependencyGroupIdNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.dependencyGroupId.isEmpty || node.dependencyGroupId.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.dependencyGroupId.isDefined))(_.dependencyGroupId.get, pattern) + } + } + + /** Traverse to nodes where dependencyGroupId does not match any of the regular expressions in `values`. + */ + def dependencyGroupIdNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.dependencyGroupId.isDefined))(_.dependencyGroupId.get, patterns) + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to version property */ + def version: Iterator[String] = + traversal.map(_.version) + + /** Traverse to nodes where the version matches the regular expression `value` + */ + def version(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + versionExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.version, pattern) + } + } + + /** Traverse to nodes where the version matches at least one of the regular expressions in `values` + */ + def version(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.version, patterns) + + /** Traverse to nodes where version matches `value` exactly. + */ + def versionExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("VERSION", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.version == value } + } + + /** Traverse to nodes where version matches one of the elements in `values` exactly. + */ + def versionExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + versionExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.version), values, "VERSION") + } + + /** Traverse to nodes where version does not match the regular expression `value`. + */ + def versionNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.version != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.version, pattern) + } + } + + /** Traverse to nodes where version does not match any of the regular expressions in `values`. + */ + def versionNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.version, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Expression.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Expression.scala new file mode 100644 index 0000000..9299079 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Expression.scala @@ -0,0 +1,312 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Expression */ +class ExpressionTraversalExtGen[NodeType <: Expression](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/FieldIdentifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/FieldIdentifier.scala new file mode 100644 index 0000000..0b3d3e4 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/FieldIdentifier.scala @@ -0,0 +1,369 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for FieldIdentifier */ +class FieldIdentifierTraversalExtGen[NodeType <: FieldIdentifier](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to canonicalName property */ + def canonicalName: Iterator[String] = + traversal.map(_.canonicalName) + + /** Traverse to nodes where the canonicalName matches the regular expression `value` + */ + def canonicalName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + canonicalNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.canonicalName, pattern) + } + } + + /** Traverse to nodes where the canonicalName matches at least one of the regular expressions in `values` + */ + def canonicalName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.canonicalName, patterns) + + /** Traverse to nodes where canonicalName matches `value` exactly. + */ + def canonicalNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("CANONICAL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.canonicalName == value } + } + + /** Traverse to nodes where canonicalName matches one of the elements in `values` exactly. + */ + def canonicalNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + canonicalNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.canonicalName), values, "CANONICAL_NAME") + } + + /** Traverse to nodes where canonicalName does not match the regular expression `value`. + */ + def canonicalNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.canonicalName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.canonicalName, pattern) + } + } + + /** Traverse to nodes where canonicalName does not match any of the regular expressions in `values`. + */ + def canonicalNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.canonicalName, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/File.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/File.scala new file mode 100644 index 0000000..3af44b4 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/File.scala @@ -0,0 +1,339 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for File */ +class FileTraversalExtGen[NodeType <: File](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to METHOD via SOURCE_FILE IN edge. + */ + def method: Iterator[Method] = + traversal.flatMap(_.method) + + /** Traverse to NAMESPACE_BLOCK via SOURCE_FILE IN edge. + */ + def namespaceBlock: Iterator[NamespaceBlock] = + traversal.flatMap(_.namespaceBlock) + + /** Traverse to TYPE_DECL via SOURCE_FILE IN edge. + */ + def typeDecl: Iterator[TypeDecl] = + traversal.flatMap(_.typeDecl) + + /** Traverse to COMMENT via AST OUT edge. + */ + def comment: Iterator[Comment] = + traversal.flatMap(_.comment) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to hash property */ + def hash: Iterator[String] = + traversal.flatMap(_.hash) + + /** Traverse to nodes where the hash matches the regular expression `value` + */ + def hash(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isDefined && node.hash.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where the hash matches at least one of the regular expressions in `values` + */ + def hash(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to nodes where hash matches `value` exactly. + */ + def hashExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.hash.contains(value) } + + /** Traverse to nodes where hash matches one of the elements in `values` exactly. + */ + def hashExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + hashExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.hash, values, "HASH") + } + + /** Traverse to nodes where hash does not match the regular expression `value`. + */ + def hashNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isEmpty || node.hash.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where hash does not match any of the regular expressions in `values`. + */ + def hashNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Finding.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Finding.scala new file mode 100644 index 0000000..367e6fe --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Finding.scala @@ -0,0 +1,7 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Finding */ +class FindingTraversalExtGen[NodeType <: Finding](val traversal: Iterator[NodeType]) extends AnyVal {} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Identifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Identifier.scala new file mode 100644 index 0000000..87f91b3 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Identifier.scala @@ -0,0 +1,429 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Identifier */ +class IdentifierTraversalExtGen[NodeType <: Identifier](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Import.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Import.scala new file mode 100644 index 0000000..a585f33 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Import.scala @@ -0,0 +1,361 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Import */ +class ImportTraversalExtGen[NodeType <: Import](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to explicitAs property */ + def explicitAs: Iterator[java.lang.Boolean] = + traversal.flatMap(_.explicitAs) + + /** Traverse to nodes where the explicitAs equals the given `value` + */ + def explicitAs(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => node.explicitAs.isDefined && node.explicitAs.get == value } + + /** Traverse to nodes where explicitAs is not equal to the given `value`. + */ + def explicitAsNot(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => !node.explicitAs.isDefined || node.explicitAs.get == value } + + /** Traverse to importedAs property */ + def importedAs: Iterator[String] = + traversal.flatMap(_.importedAs) + + /** Traverse to nodes where the importedAs matches the regular expression `value` + */ + def importedAs(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.importedAs.isDefined && node.importedAs.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.importedAs.isDefined))(_.importedAs.get, pattern) + } + } + + /** Traverse to nodes where the importedAs matches at least one of the regular expressions in `values` + */ + def importedAs(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.importedAs.isDefined))(_.importedAs.get, patterns) + } + + /** Traverse to nodes where importedAs matches `value` exactly. + */ + def importedAsExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.importedAs.contains(value) } + + /** Traverse to nodes where importedAs matches one of the elements in `values` exactly. + */ + def importedAsExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + importedAsExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.importedAs, values, "IMPORTED_AS") + } + + /** Traverse to nodes where importedAs does not match the regular expression `value`. + */ + def importedAsNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.importedAs.isEmpty || node.importedAs.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.importedAs.isDefined))(_.importedAs.get, pattern) + } + } + + /** Traverse to nodes where importedAs does not match any of the regular expressions in `values`. + */ + def importedAsNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.importedAs.isDefined))(_.importedAs.get, patterns) + } + + /** Traverse to importedEntity property */ + def importedEntity: Iterator[String] = + traversal.flatMap(_.importedEntity) + + /** Traverse to nodes where the importedEntity matches the regular expression `value` + */ + def importedEntity(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.importedEntity.isDefined && node.importedEntity.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.importedEntity.isDefined))(_.importedEntity.get, pattern) + } + } + + /** Traverse to nodes where the importedEntity matches at least one of the regular expressions in `values` + */ + def importedEntity(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.importedEntity.isDefined))(_.importedEntity.get, patterns) + } + + /** Traverse to nodes where importedEntity matches `value` exactly. + */ + def importedEntityExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.importedEntity.contains(value) } + + /** Traverse to nodes where importedEntity matches one of the elements in `values` exactly. + */ + def importedEntityExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + importedEntityExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.importedEntity, values, "IMPORTED_ENTITY") + } + + /** Traverse to nodes where importedEntity does not match the regular expression `value`. + */ + def importedEntityNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.importedEntity.isEmpty || node.importedEntity.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.importedEntity.isDefined))(_.importedEntity.get, pattern) + } + } + + /** Traverse to nodes where importedEntity does not match any of the regular expressions in `values`. + */ + def importedEntityNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.importedEntity.isDefined))(_.importedEntity.get, patterns) + } + + /** Traverse to isExplicit property */ + def isExplicit: Iterator[java.lang.Boolean] = + traversal.flatMap(_.isExplicit) + + /** Traverse to nodes where the isExplicit equals the given `value` + */ + def isExplicit(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => node.isExplicit.isDefined && node.isExplicit.get == value } + + /** Traverse to nodes where isExplicit is not equal to the given `value`. + */ + def isExplicitNot(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => !node.isExplicit.isDefined || node.isExplicit.get == value } + + /** Traverse to isWildcard property */ + def isWildcard: Iterator[java.lang.Boolean] = + traversal.flatMap(_.isWildcard) + + /** Traverse to nodes where the isWildcard equals the given `value` + */ + def isWildcard(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => node.isWildcard.isDefined && node.isWildcard.get == value } + + /** Traverse to nodes where isWildcard is not equal to the given `value`. + */ + def isWildcardNot(value: java.lang.Boolean): Iterator[NodeType] = + traversal.filter { node => !node.isWildcard.isDefined || node.isWildcard.get == value } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpLabel.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpLabel.scala new file mode 100644 index 0000000..bb01840 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpLabel.scala @@ -0,0 +1,322 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for JumpLabel */ +class JumpLabelTraversalExtGen[NodeType <: JumpLabel](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to parserTypeName property */ + def parserTypeName: Iterator[String] = + traversal.map(_.parserTypeName) + + /** Traverse to nodes where the parserTypeName matches the regular expression `value` + */ + def parserTypeName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + parserTypeNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where the parserTypeName matches at least one of the regular expressions in `values` + */ + def parserTypeName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.parserTypeName, patterns) + + /** Traverse to nodes where parserTypeName matches `value` exactly. + */ + def parserTypeNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("PARSER_TYPE_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.parserTypeName == value } + } + + /** Traverse to nodes where parserTypeName matches one of the elements in `values` exactly. + */ + def parserTypeNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + parserTypeNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.parserTypeName), values, "PARSER_TYPE_NAME") + } + + /** Traverse to nodes where parserTypeName does not match the regular expression `value`. + */ + def parserTypeNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.parserTypeName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where parserTypeName does not match any of the regular expressions in `values`. + */ + def parserTypeNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.parserTypeName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpTarget.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpTarget.scala new file mode 100644 index 0000000..9d1f4c9 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/JumpTarget.scala @@ -0,0 +1,370 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for JumpTarget */ +class JumpTargetTraversalExtGen[NodeType <: JumpTarget](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to parserTypeName property */ + def parserTypeName: Iterator[String] = + traversal.map(_.parserTypeName) + + /** Traverse to nodes where the parserTypeName matches the regular expression `value` + */ + def parserTypeName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + parserTypeNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where the parserTypeName matches at least one of the regular expressions in `values` + */ + def parserTypeName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.parserTypeName, patterns) + + /** Traverse to nodes where parserTypeName matches `value` exactly. + */ + def parserTypeNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("PARSER_TYPE_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.parserTypeName == value } + } + + /** Traverse to nodes where parserTypeName matches one of the elements in `values` exactly. + */ + def parserTypeNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + parserTypeNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.parserTypeName), values, "PARSER_TYPE_NAME") + } + + /** Traverse to nodes where parserTypeName does not match the regular expression `value`. + */ + def parserTypeNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.parserTypeName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where parserTypeName does not match any of the regular expressions in `values`. + */ + def parserTypeNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.parserTypeName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/KeyValuePair.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/KeyValuePair.scala new file mode 100644 index 0000000..c82f3dd --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/KeyValuePair.scala @@ -0,0 +1,121 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for KeyValuePair */ +class KeyValuePairTraversalExtGen[NodeType <: KeyValuePair](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to key property */ + def key: Iterator[String] = + traversal.map(_.key) + + /** Traverse to nodes where the key matches the regular expression `value` + */ + def key(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + keyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.key, pattern) + } + } + + /** Traverse to nodes where the key matches at least one of the regular expressions in `values` + */ + def key(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.key, patterns) + + /** Traverse to nodes where key matches `value` exactly. + */ + def keyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("KEY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.key == value } + } + + /** Traverse to nodes where key matches one of the elements in `values` exactly. + */ + def keyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + keyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.key), values, "KEY") + } + + /** Traverse to nodes where key does not match the regular expression `value`. + */ + def keyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.key != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.key, pattern) + } + } + + /** Traverse to nodes where key does not match any of the regular expressions in `values`. + */ + def keyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.key, patterns) + } + + /** Traverse to value property */ + def value: Iterator[String] = + traversal.map(_.value) + + /** Traverse to nodes where the value matches the regular expression `value` + */ + def value(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + valueExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.value, pattern) + } + } + + /** Traverse to nodes where the value matches at least one of the regular expressions in `values` + */ + def value(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.value, patterns) + + /** Traverse to nodes where value matches `value` exactly. + */ + def valueExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("VALUE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.value == value } + } + + /** Traverse to nodes where value matches one of the elements in `values` exactly. + */ + def valueExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + valueExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.value), values, "VALUE") + } + + /** Traverse to nodes where value does not match the regular expression `value`. + */ + def valueNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.value != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.value, pattern) + } + } + + /** Traverse to nodes where value does not match any of the regular expressions in `values`. + */ + def valueNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.value, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Literal.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Literal.scala new file mode 100644 index 0000000..bcf38b1 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Literal.scala @@ -0,0 +1,373 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Literal */ +class LiteralTraversalExtGen[NodeType <: Literal](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Local.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Local.scala new file mode 100644 index 0000000..493ad1e --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Local.scala @@ -0,0 +1,402 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Local */ +class LocalTraversalExtGen[NodeType <: Local](val traversal: Iterator[NodeType]) extends AnyVal { + + /** The block in which local is declared. Traverse to BLOCK via AST IN edge. + */ + /** The block in which local is declared. */ + @overflowdb.traversal.help.Doc(info = """The block in which local is declared.""") + def definingBlock: Iterator[Block] = + traversal.flatMap(_.definingBlock) + + /** Places (identifier) where this local is being referenced Traverse to IDENTIFIER via REF IN edge. + */ + /** Places (identifier) where this local is being referenced */ + @overflowdb.traversal.help.Doc(info = """Places (identifier) where this local is being referenced""") + def referencingIdentifiers: Iterator[Identifier] = + traversal.flatMap(_.referencingIdentifiers) + + /** The type of the local. Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** The type of the local. */ + @overflowdb.traversal.help.Doc(info = """The type of the local.""") + def typ: Iterator[Type] = + traversal.flatMap(_.typ) + + /** Traverse to closureBindingId property */ + def closureBindingId: Iterator[String] = + traversal.flatMap(_.closureBindingId) + + /** Traverse to nodes where the closureBindingId matches the regular expression `value` + */ + def closureBindingId(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureBindingId.isDefined && node.closureBindingId.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, pattern) + } + } + + /** Traverse to nodes where the closureBindingId matches at least one of the regular expressions in `values` + */ + def closureBindingId(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, patterns) + } + + /** Traverse to nodes where closureBindingId matches `value` exactly. + */ + def closureBindingIdExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.closureBindingId.contains(value) } + + /** Traverse to nodes where closureBindingId matches one of the elements in `values` exactly. + */ + def closureBindingIdExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + closureBindingIdExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.closureBindingId, values, "CLOSURE_BINDING_ID") + } + + /** Traverse to nodes where closureBindingId does not match the regular expression `value`. + */ + def closureBindingIdNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.closureBindingId.isEmpty || node.closureBindingId.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, pattern) + } + } + + /** Traverse to nodes where closureBindingId does not match any of the regular expressions in `values`. + */ + def closureBindingIdNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.closureBindingId.isDefined))(_.closureBindingId.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Location.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Location.scala new file mode 100644 index 0000000..5fc0333 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Location.scala @@ -0,0 +1,509 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Location */ +class LocationTraversalExtGen[NodeType <: Location](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to className property */ + def className: Iterator[String] = + traversal.map(_.className) + + /** Traverse to nodes where the className matches the regular expression `value` + */ + def className(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + classNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.className, pattern) + } + } + + /** Traverse to nodes where the className matches at least one of the regular expressions in `values` + */ + def className(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.className, patterns) + + /** Traverse to nodes where className matches `value` exactly. + */ + def classNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CLASS_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.className == value } + } + + /** Traverse to nodes where className matches one of the elements in `values` exactly. + */ + def classNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + classNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.className), values, "CLASS_NAME") + } + + /** Traverse to nodes where className does not match the regular expression `value`. + */ + def classNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.className != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.className, pattern) + } + } + + /** Traverse to nodes where className does not match any of the regular expressions in `values`. + */ + def classNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.className, patterns) + } + + /** Traverse to classShortName property */ + def classShortName: Iterator[String] = + traversal.map(_.classShortName) + + /** Traverse to nodes where the classShortName matches the regular expression `value` + */ + def classShortName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + classShortNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.classShortName, pattern) + } + } + + /** Traverse to nodes where the classShortName matches at least one of the regular expressions in `values` + */ + def classShortName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.classShortName, patterns) + + /** Traverse to nodes where classShortName matches `value` exactly. + */ + def classShortNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("CLASS_SHORT_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.classShortName == value } + } + + /** Traverse to nodes where classShortName matches one of the elements in `values` exactly. + */ + def classShortNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + classShortNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.classShortName), values, "CLASS_SHORT_NAME") + } + + /** Traverse to nodes where classShortName does not match the regular expression `value`. + */ + def classShortNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.classShortName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.classShortName, pattern) + } + } + + /** Traverse to nodes where classShortName does not match any of the regular expressions in `values`. + */ + def classShortNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.classShortName, patterns) + } + + /** Traverse to filename property */ + def filename: Iterator[String] = + traversal.map(_.filename) + + /** Traverse to nodes where the filename matches the regular expression `value` + */ + def filename(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + filenameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where the filename matches at least one of the regular expressions in `values` + */ + def filename(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.filename, patterns) + + /** Traverse to nodes where filename matches `value` exactly. + */ + def filenameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FILENAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.filename == value } + } + + /** Traverse to nodes where filename matches one of the elements in `values` exactly. + */ + def filenameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + filenameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.filename), values, "FILENAME") + } + + /** Traverse to nodes where filename does not match the regular expression `value`. + */ + def filenameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.filename != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where filename does not match any of the regular expressions in `values`. + */ + def filenameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.filename, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to methodFullName property */ + def methodFullName: Iterator[String] = + traversal.map(_.methodFullName) + + /** Traverse to nodes where the methodFullName matches the regular expression `value` + */ + def methodFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + methodFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where the methodFullName matches at least one of the regular expressions in `values` + */ + def methodFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.methodFullName, patterns) + + /** Traverse to nodes where methodFullName matches `value` exactly. + */ + def methodFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("METHOD_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.methodFullName == value } + } + + /** Traverse to nodes where methodFullName matches one of the elements in `values` exactly. + */ + def methodFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + methodFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.methodFullName), values, "METHOD_FULL_NAME") + } + + /** Traverse to nodes where methodFullName does not match the regular expression `value`. + */ + def methodFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.methodFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where methodFullName does not match any of the regular expressions in `values`. + */ + def methodFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.methodFullName, patterns) + } + + /** Traverse to methodShortName property */ + def methodShortName: Iterator[String] = + traversal.map(_.methodShortName) + + /** Traverse to nodes where the methodShortName matches the regular expression `value` + */ + def methodShortName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + methodShortNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.methodShortName, pattern) + } + } + + /** Traverse to nodes where the methodShortName matches at least one of the regular expressions in `values` + */ + def methodShortName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.methodShortName, patterns) + + /** Traverse to nodes where methodShortName matches `value` exactly. + */ + def methodShortNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("METHOD_SHORT_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.methodShortName == value } + } + + /** Traverse to nodes where methodShortName matches one of the elements in `values` exactly. + */ + def methodShortNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + methodShortNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.methodShortName), values, "METHOD_SHORT_NAME") + } + + /** Traverse to nodes where methodShortName does not match the regular expression `value`. + */ + def methodShortNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.methodShortName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.methodShortName, pattern) + } + } + + /** Traverse to nodes where methodShortName does not match any of the regular expressions in `values`. + */ + def methodShortNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.methodShortName, patterns) + } + + /** Traverse to nodeLabel property */ + def nodeLabel: Iterator[String] = + traversal.map(_.nodeLabel) + + /** Traverse to nodes where the nodeLabel matches the regular expression `value` + */ + def nodeLabel(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nodeLabelExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.nodeLabel, pattern) + } + } + + /** Traverse to nodes where the nodeLabel matches at least one of the regular expressions in `values` + */ + def nodeLabel(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.nodeLabel, patterns) + + /** Traverse to nodes where nodeLabel matches `value` exactly. + */ + def nodeLabelExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NODE_LABEL", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.nodeLabel == value } + } + + /** Traverse to nodes where nodeLabel matches one of the elements in `values` exactly. + */ + def nodeLabelExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nodeLabelExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.nodeLabel), values, "NODE_LABEL") + } + + /** Traverse to nodes where nodeLabel does not match the regular expression `value`. + */ + def nodeLabelNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.nodeLabel != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.nodeLabel, pattern) + } + } + + /** Traverse to nodes where nodeLabel does not match any of the regular expressions in `values`. + */ + def nodeLabelNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.nodeLabel, patterns) + } + + /** Traverse to packageName property */ + def packageName: Iterator[String] = + traversal.map(_.packageName) + + /** Traverse to nodes where the packageName matches the regular expression `value` + */ + def packageName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + packageNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.packageName, pattern) + } + } + + /** Traverse to nodes where the packageName matches at least one of the regular expressions in `values` + */ + def packageName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.packageName, patterns) + + /** Traverse to nodes where packageName matches `value` exactly. + */ + def packageNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("PACKAGE_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.packageName == value } + } + + /** Traverse to nodes where packageName matches one of the elements in `values` exactly. + */ + def packageNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + packageNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.packageName), values, "PACKAGE_NAME") + } + + /** Traverse to nodes where packageName does not match the regular expression `value`. + */ + def packageNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.packageName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.packageName, pattern) + } + } + + /** Traverse to nodes where packageName does not match any of the regular expressions in `values`. + */ + def packageNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.packageName, patterns) + } + + /** Traverse to symbol property */ + def symbol: Iterator[String] = + traversal.map(_.symbol) + + /** Traverse to nodes where the symbol matches the regular expression `value` + */ + def symbol(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + symbolExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.symbol, pattern) + } + } + + /** Traverse to nodes where the symbol matches at least one of the regular expressions in `values` + */ + def symbol(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.symbol, patterns) + + /** Traverse to nodes where symbol matches `value` exactly. + */ + def symbolExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("SYMBOL", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.symbol == value } + } + + /** Traverse to nodes where symbol matches one of the elements in `values` exactly. + */ + def symbolExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + symbolExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.symbol), values, "SYMBOL") + } + + /** Traverse to nodes where symbol does not match the regular expression `value`. + */ + def symbolNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.symbol != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.symbol, pattern) + } + } + + /** Traverse to nodes where symbol does not match any of the regular expressions in `values`. + */ + def symbolNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.symbol, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Member.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Member.scala new file mode 100644 index 0000000..f90d80f --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Member.scala @@ -0,0 +1,340 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Member */ +class MemberTraversalExtGen[NodeType <: Member](val traversal: Iterator[NodeType]) extends AnyVal { + + /** The type declaration this member is defined in Traverse to TYPE_DECL via AST IN edge. + */ + /** The type declaration this member is defined in */ + @overflowdb.traversal.help.Doc(info = """The type declaration this member is defined in""") + def typeDecl: Iterator[TypeDecl] = + traversal.map(_.typeDecl) + + /** Traverse to member type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to member type */ + @overflowdb.traversal.help.Doc(info = """Traverse to member type""") + def typ: Iterator[Type] = + traversal.flatMap(_.typ) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MetaData.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MetaData.scala new file mode 100644 index 0000000..31f2414 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MetaData.scala @@ -0,0 +1,235 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for MetaData */ +class MetaDataTraversalExtGen[NodeType <: MetaData](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to hash property */ + def hash: Iterator[String] = + traversal.flatMap(_.hash) + + /** Traverse to nodes where the hash matches the regular expression `value` + */ + def hash(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isDefined && node.hash.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where the hash matches at least one of the regular expressions in `values` + */ + def hash(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to nodes where hash matches `value` exactly. + */ + def hashExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.hash.contains(value) } + + /** Traverse to nodes where hash matches one of the elements in `values` exactly. + */ + def hashExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + hashExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.hash, values, "HASH") + } + + /** Traverse to nodes where hash does not match the regular expression `value`. + */ + def hashNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isEmpty || node.hash.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where hash does not match any of the regular expressions in `values`. + */ + def hashNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to language property */ + def language: Iterator[String] = + traversal.map(_.language) + + /** Traverse to nodes where the language matches the regular expression `value` + */ + def language(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + languageExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.language, pattern) + } + } + + /** Traverse to nodes where the language matches at least one of the regular expressions in `values` + */ + def language(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.language, patterns) + + /** Traverse to nodes where language matches `value` exactly. + */ + def languageExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("LANGUAGE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.language == value } + } + + /** Traverse to nodes where language matches one of the elements in `values` exactly. + */ + def languageExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + languageExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.language), values, "LANGUAGE") + } + + /** Traverse to nodes where language does not match the regular expression `value`. + */ + def languageNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.language != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.language, pattern) + } + } + + /** Traverse to nodes where language does not match any of the regular expressions in `values`. + */ + def languageNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.language, patterns) + } + + /** Traverse to overlays property */ + def overlays: Iterator[String] = + traversal.flatMap(_.overlays) + + /** Traverse to root property */ + def root: Iterator[String] = + traversal.map(_.root) + + /** Traverse to nodes where the root matches the regular expression `value` + */ + def root(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + rootExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.root, pattern) + } + } + + /** Traverse to nodes where the root matches at least one of the regular expressions in `values` + */ + def root(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.root, patterns) + + /** Traverse to nodes where root matches `value` exactly. + */ + def rootExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("ROOT", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.root == value } + } + + /** Traverse to nodes where root matches one of the elements in `values` exactly. + */ + def rootExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + rootExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.root), values, "ROOT") + } + + /** Traverse to nodes where root does not match the regular expression `value`. + */ + def rootNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.root != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.root, pattern) + } + } + + /** Traverse to nodes where root does not match any of the regular expressions in `values`. + */ + def rootNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.root, patterns) + } + + /** Traverse to version property */ + def version: Iterator[String] = + traversal.map(_.version) + + /** Traverse to nodes where the version matches the regular expression `value` + */ + def version(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + versionExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.version, pattern) + } + } + + /** Traverse to nodes where the version matches at least one of the regular expressions in `values` + */ + def version(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.version, patterns) + + /** Traverse to nodes where version matches `value` exactly. + */ + def versionExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("VERSION", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.version == value } + } + + /** Traverse to nodes where version matches one of the elements in `values` exactly. + */ + def versionExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + versionExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.version), values, "VERSION") + } + + /** Traverse to nodes where version does not match the regular expression `value`. + */ + def versionNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.version != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.version, pattern) + } + } + + /** Traverse to nodes where version does not match any of the regular expressions in `values`. + */ + def versionNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.version, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Method.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Method.scala new file mode 100644 index 0000000..e0f9af3 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Method.scala @@ -0,0 +1,750 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Method */ +class MethodTraversalExtGen[NodeType <: Method](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Root of the abstract syntax tree Traverse to BLOCK via AST OUT edge. + */ + /** Root of the abstract syntax tree */ + @overflowdb.traversal.help.Doc(info = """Root of the abstract syntax tree""") + def block: Iterator[Block] = + traversal.map(_.block) + + /** First control flow graph node Traverse to CFG_NODE via CFG OUT edge. + */ + /** First control flow graph node */ + @overflowdb.traversal.help.Doc(info = """First control flow graph node""") + def cfgFirst: Iterator[CfgNode] = + traversal.flatMap(_.cfgFirst) + + /** Literals used in the method Traverse to LITERAL via CONTAINS OUT edge. + */ + /** Literals used in the method */ + @overflowdb.traversal.help.Doc(info = """Literals used in the method""") + def literal: Iterator[Literal] = + traversal.flatMap(_.literal) + + /** Formal return parameters Traverse to METHOD_RETURN via AST OUT edge. + */ + /** Formal return parameters */ + @overflowdb.traversal.help.Doc(info = """Formal return parameters""") + def methodReturn: Iterator[MethodReturn] = + traversal.map(_.methodReturn) + + /** Parameters of the method Traverse to METHOD_PARAMETER_IN via AST OUT edge. + */ + /** Parameters of the method */ + @overflowdb.traversal.help.Doc(info = """Parameters of the method""") + def parameter: Iterator[MethodParameterIn] = + traversal.flatMap(_.parameter) + + /** Traverse to astParentFullName property */ + def astParentFullName: Iterator[String] = + traversal.map(_.astParentFullName) + + /** Traverse to nodes where the astParentFullName matches the regular expression `value` + */ + def astParentFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + astParentFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.astParentFullName, pattern) + } + } + + /** Traverse to nodes where the astParentFullName matches at least one of the regular expressions in `values` + */ + def astParentFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.astParentFullName, patterns) + + /** Traverse to nodes where astParentFullName matches `value` exactly. + */ + def astParentFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("AST_PARENT_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.astParentFullName == value } + } + + /** Traverse to nodes where astParentFullName matches one of the elements in `values` exactly. + */ + def astParentFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + astParentFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.astParentFullName), + values, + "AST_PARENT_FULL_NAME" + ) + } + + /** Traverse to nodes where astParentFullName does not match the regular expression `value`. + */ + def astParentFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.astParentFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.astParentFullName, pattern) + } + } + + /** Traverse to nodes where astParentFullName does not match any of the regular expressions in `values`. + */ + def astParentFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.astParentFullName, patterns) + } + + /** Traverse to astParentType property */ + def astParentType: Iterator[String] = + traversal.map(_.astParentType) + + /** Traverse to nodes where the astParentType matches the regular expression `value` + */ + def astParentType(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + astParentTypeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.astParentType, pattern) + } + } + + /** Traverse to nodes where the astParentType matches at least one of the regular expressions in `values` + */ + def astParentType(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.astParentType, patterns) + + /** Traverse to nodes where astParentType matches `value` exactly. + */ + def astParentTypeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("AST_PARENT_TYPE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.astParentType == value } + } + + /** Traverse to nodes where astParentType matches one of the elements in `values` exactly. + */ + def astParentTypeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + astParentTypeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.astParentType), values, "AST_PARENT_TYPE") + } + + /** Traverse to nodes where astParentType does not match the regular expression `value`. + */ + def astParentTypeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.astParentType != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.astParentType, pattern) + } + } + + /** Traverse to nodes where astParentType does not match any of the regular expressions in `values`. + */ + def astParentTypeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.astParentType, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to columnNumberEnd property */ + def columnNumberEnd: Iterator[Integer] = + traversal.flatMap(_.columnNumberEnd) + + /** Traverse to nodes where the columnNumberEnd equals the given `value` + */ + def columnNumberEnd(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumberEnd.isDefined && node.columnNumberEnd.get == value } + + /** Traverse to nodes where the columnNumberEnd equals at least one of the given `values` + */ + def columnNumberEnd(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumberEnd.isDefined && vset.contains(node.columnNumberEnd.get) } + } + + /** Traverse to nodes where the columnNumberEnd is greater than the given `value` + */ + def columnNumberEndGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumberEnd.isDefined && node.columnNumberEnd.get > value } + + /** Traverse to nodes where the columnNumberEnd is greater than or equal the given `value` + */ + def columnNumberEndGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumberEnd.isDefined && node.columnNumberEnd.get >= value } + + /** Traverse to nodes where the columnNumberEnd is less than the given `value` + */ + def columnNumberEndLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumberEnd.isDefined && node.columnNumberEnd.get < value } + + /** Traverse to nodes where the columnNumberEnd is less than or equal the given `value` + */ + def columnNumberEndLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumberEnd.isDefined && node.columnNumberEnd.get <= value } + + /** Traverse to nodes where columnNumberEnd is not equal to the given `value`. + */ + def columnNumberEndNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumberEnd.isDefined || node.columnNumberEnd.get != value } + + /** Traverse to nodes where columnNumberEnd is not equal to any of the given `values`. + */ + def columnNumberEndNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumberEnd.isDefined || !vset.contains(node.columnNumberEnd.get) } + } + + /** Traverse to filename property */ + def filename: Iterator[String] = + traversal.map(_.filename) + + /** Traverse to nodes where the filename matches the regular expression `value` + */ + def filename(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + filenameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where the filename matches at least one of the regular expressions in `values` + */ + def filename(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.filename, patterns) + + /** Traverse to nodes where filename matches `value` exactly. + */ + def filenameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FILENAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.filename == value } + } + + /** Traverse to nodes where filename matches one of the elements in `values` exactly. + */ + def filenameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + filenameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.filename), values, "FILENAME") + } + + /** Traverse to nodes where filename does not match the regular expression `value`. + */ + def filenameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.filename != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where filename does not match any of the regular expressions in `values`. + */ + def filenameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.filename, patterns) + } + + /** Traverse to fullName property */ + def fullName: Iterator[String] = + traversal.map(_.fullName) + + /** Traverse to nodes where the fullName matches the regular expression `value` + */ + def fullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + fullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where the fullName matches at least one of the regular expressions in `values` + */ + def fullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.fullName, patterns) + + /** Traverse to nodes where fullName matches `value` exactly. + */ + def fullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.fullName == value } + } + + /** Traverse to nodes where fullName matches one of the elements in `values` exactly. + */ + def fullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + fullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.fullName), values, "FULL_NAME") + } + + /** Traverse to nodes where fullName does not match the regular expression `value`. + */ + def fullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.fullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where fullName does not match any of the regular expressions in `values`. + */ + def fullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.fullName, patterns) + } + + /** Traverse to hash property */ + def hash: Iterator[String] = + traversal.flatMap(_.hash) + + /** Traverse to nodes where the hash matches the regular expression `value` + */ + def hash(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isDefined && node.hash.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where the hash matches at least one of the regular expressions in `values` + */ + def hash(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to nodes where hash matches `value` exactly. + */ + def hashExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.hash.contains(value) } + + /** Traverse to nodes where hash matches one of the elements in `values` exactly. + */ + def hashExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + hashExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.hash, values, "HASH") + } + + /** Traverse to nodes where hash does not match the regular expression `value`. + */ + def hashNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.hash.isEmpty || node.hash.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.hash.isDefined))(_.hash.get, pattern) + } + } + + /** Traverse to nodes where hash does not match any of the regular expressions in `values`. + */ + def hashNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.hash.isDefined))(_.hash.get, patterns) + } + + /** Traverse to isExternal property */ + def isExternal: Iterator[Boolean] = + traversal.map(_.isExternal) + + /** Traverse to nodes where the isExternal equals the given `value` + */ + def isExternal(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isExternal == value } + + /** Traverse to nodes where isExternal is not equal to the given `value`. + */ + def isExternalNot(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isExternal != value } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to lineNumberEnd property */ + def lineNumberEnd: Iterator[Integer] = + traversal.flatMap(_.lineNumberEnd) + + /** Traverse to nodes where the lineNumberEnd equals the given `value` + */ + def lineNumberEnd(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumberEnd.isDefined && node.lineNumberEnd.get == value } + + /** Traverse to nodes where the lineNumberEnd equals at least one of the given `values` + */ + def lineNumberEnd(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumberEnd.isDefined && vset.contains(node.lineNumberEnd.get) } + } + + /** Traverse to nodes where the lineNumberEnd is greater than the given `value` + */ + def lineNumberEndGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumberEnd.isDefined && node.lineNumberEnd.get > value } + + /** Traverse to nodes where the lineNumberEnd is greater than or equal the given `value` + */ + def lineNumberEndGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumberEnd.isDefined && node.lineNumberEnd.get >= value } + + /** Traverse to nodes where the lineNumberEnd is less than the given `value` + */ + def lineNumberEndLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumberEnd.isDefined && node.lineNumberEnd.get < value } + + /** Traverse to nodes where the lineNumberEnd is less than or equal the given `value` + */ + def lineNumberEndLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumberEnd.isDefined && node.lineNumberEnd.get <= value } + + /** Traverse to nodes where lineNumberEnd is not equal to the given `value`. + */ + def lineNumberEndNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumberEnd.isDefined || node.lineNumberEnd.get != value } + + /** Traverse to nodes where lineNumberEnd is not equal to any of the given `values`. + */ + def lineNumberEndNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumberEnd.isDefined || !vset.contains(node.lineNumberEnd.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to signature property */ + def signature: Iterator[String] = + traversal.map(_.signature) + + /** Traverse to nodes where the signature matches the regular expression `value` + */ + def signature(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + signatureExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where the signature matches at least one of the regular expressions in `values` + */ + def signature(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.signature, patterns) + + /** Traverse to nodes where signature matches `value` exactly. + */ + def signatureExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("SIGNATURE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.signature == value } + } + + /** Traverse to nodes where signature matches one of the elements in `values` exactly. + */ + def signatureExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + signatureExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.signature), values, "SIGNATURE") + } + + /** Traverse to nodes where signature does not match the regular expression `value`. + */ + def signatureNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.signature != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.signature, pattern) + } + } + + /** Traverse to nodes where signature does not match any of the regular expressions in `values`. + */ + def signatureNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.signature, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterIn.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterIn.scala new file mode 100644 index 0000000..e8b2248 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterIn.scala @@ -0,0 +1,478 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for MethodParameterIn */ +class MethodParameterInTraversalExtGen[NodeType <: MethodParameterIn](val traversal: Iterator[NodeType]) + extends AnyVal { + + /** Traverse to method associated with this formal parameter Traverse to METHOD via AST IN edge. + */ + /** Traverse to method associated with this formal parameter */ + @overflowdb.traversal.help.Doc(info = """Traverse to method associated with this formal parameter""") + def method: Iterator[Method] = + traversal.map(_.method) + + /** Places (identifier) where this parameter is being referenced Traverse to IDENTIFIER via REF IN edge. + */ + /** Places (identifier) where this parameter is being referenced */ + @overflowdb.traversal.help.Doc(info = """Places (identifier) where this parameter is being referenced""") + def referencingIdentifiers: Iterator[Identifier] = + traversal.flatMap(_.referencingIdentifiers) + + /** Traverse to corresponding formal output parameter Traverse to METHOD_PARAMETER_OUT via PARAMETER_LINK OUT edge. + */ + /** Traverse to corresponding formal output parameter */ + @overflowdb.traversal.help.Doc(info = """Traverse to corresponding formal output parameter""") + def asOutput: Iterator[MethodParameterOut] = + traversal.flatMap(_.asOutput) + + /** Traverse to parameter type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to parameter type */ + @overflowdb.traversal.help.Doc(info = """Traverse to parameter type""") + def typ: Iterator[Type] = + traversal.map(_.typ) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to evaluationStrategy property */ + def evaluationStrategy: Iterator[String] = + traversal.map(_.evaluationStrategy) + + /** Traverse to nodes where the evaluationStrategy matches the regular expression `value` + */ + def evaluationStrategy(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + evaluationStrategyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where the evaluationStrategy matches at least one of the regular expressions in `values` + */ + def evaluationStrategy(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.evaluationStrategy, patterns) + + /** Traverse to nodes where evaluationStrategy matches `value` exactly. + */ + def evaluationStrategyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("EVALUATION_STRATEGY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.evaluationStrategy == value } + } + + /** Traverse to nodes where evaluationStrategy matches one of the elements in `values` exactly. + */ + def evaluationStrategyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + evaluationStrategyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.evaluationStrategy), + values, + "EVALUATION_STRATEGY" + ) + } + + /** Traverse to nodes where evaluationStrategy does not match the regular expression `value`. + */ + def evaluationStrategyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.evaluationStrategy != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where evaluationStrategy does not match any of the regular expressions in `values`. + */ + def evaluationStrategyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.evaluationStrategy, patterns) + } + + /** Traverse to index property */ + def index: Iterator[scala.Int] = + traversal.map(_.index) + + /** Traverse to nodes where the index equals the given `value` + */ + def index(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index == value } + + /** Traverse to nodes where the index equals at least one of the given `values` + */ + def index(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.index) } + } + + /** Traverse to nodes where the index is greater than the given `value` + */ + def indexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index > value } + + /** Traverse to nodes where the index is greater than or equal the given `value` + */ + def indexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index >= value } + + /** Traverse to nodes where the index is less than the given `value` + */ + def indexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index < value } + + /** Traverse to nodes where the index is less than or equal the given `value` + */ + def indexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index <= value } + + /** Traverse to nodes where index is not equal to the given `value`. + */ + def indexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index != value } + + /** Traverse to nodes where index is not equal to any of the given `values`. + */ + def indexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.index) } + } + + /** Traverse to isVariadic property */ + def isVariadic: Iterator[Boolean] = + traversal.map(_.isVariadic) + + /** Traverse to nodes where the isVariadic equals the given `value` + */ + def isVariadic(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isVariadic == value } + + /** Traverse to nodes where isVariadic is not equal to the given `value`. + */ + def isVariadicNot(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isVariadic != value } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterOut.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterOut.scala new file mode 100644 index 0000000..7a0a736 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodParameterOut.scala @@ -0,0 +1,463 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for MethodParameterOut */ +class MethodParameterOutTraversalExtGen[NodeType <: MethodParameterOut](val traversal: Iterator[NodeType]) + extends AnyVal { + + /** Traverse to METHOD_PARAMETER_IN via PARAMETER_LINK IN edge. + */ + def asInput: Iterator[MethodParameterIn] = + traversal.flatMap(_.asInput) + + /** Traverse to METHOD via AST IN edge. + */ + def method: Iterator[Method] = + traversal.map(_.method) + + /** Traverse to parameter type Traverse to TYPE via EVAL_TYPE OUT edge. + */ + /** Traverse to parameter type */ + @overflowdb.traversal.help.Doc(info = """Traverse to parameter type""") + def typ: Iterator[Type] = + traversal.flatMap(_.typ) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to evaluationStrategy property */ + def evaluationStrategy: Iterator[String] = + traversal.map(_.evaluationStrategy) + + /** Traverse to nodes where the evaluationStrategy matches the regular expression `value` + */ + def evaluationStrategy(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + evaluationStrategyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where the evaluationStrategy matches at least one of the regular expressions in `values` + */ + def evaluationStrategy(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.evaluationStrategy, patterns) + + /** Traverse to nodes where evaluationStrategy matches `value` exactly. + */ + def evaluationStrategyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("EVALUATION_STRATEGY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.evaluationStrategy == value } + } + + /** Traverse to nodes where evaluationStrategy matches one of the elements in `values` exactly. + */ + def evaluationStrategyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + evaluationStrategyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.evaluationStrategy), + values, + "EVALUATION_STRATEGY" + ) + } + + /** Traverse to nodes where evaluationStrategy does not match the regular expression `value`. + */ + def evaluationStrategyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.evaluationStrategy != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where evaluationStrategy does not match any of the regular expressions in `values`. + */ + def evaluationStrategyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.evaluationStrategy, patterns) + } + + /** Traverse to index property */ + def index: Iterator[scala.Int] = + traversal.map(_.index) + + /** Traverse to nodes where the index equals the given `value` + */ + def index(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index == value } + + /** Traverse to nodes where the index equals at least one of the given `values` + */ + def index(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.index) } + } + + /** Traverse to nodes where the index is greater than the given `value` + */ + def indexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index > value } + + /** Traverse to nodes where the index is greater than or equal the given `value` + */ + def indexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index >= value } + + /** Traverse to nodes where the index is less than the given `value` + */ + def indexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index < value } + + /** Traverse to nodes where the index is less than or equal the given `value` + */ + def indexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index <= value } + + /** Traverse to nodes where index is not equal to the given `value`. + */ + def indexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.index != value } + + /** Traverse to nodes where index is not equal to any of the given `values`. + */ + def indexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.index) } + } + + /** Traverse to isVariadic property */ + def isVariadic: Iterator[Boolean] = + traversal.map(_.isVariadic) + + /** Traverse to nodes where the isVariadic equals the given `value` + */ + def isVariadic(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isVariadic == value } + + /** Traverse to nodes where isVariadic is not equal to the given `value`. + */ + def isVariadicNot(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isVariadic != value } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodRef.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodRef.scala new file mode 100644 index 0000000..52e6e2f --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodRef.scala @@ -0,0 +1,437 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for MethodRef */ +class MethodRefTraversalExtGen[NodeType <: MethodRef](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to referenced method. Traverse to METHOD via REF OUT edge. + */ + /** Traverse to referenced method. */ + @overflowdb.traversal.help.Doc(info = """Traverse to referenced method.""") + def referencedMethod: Iterator[Method] = + traversal.map(_.referencedMethod) + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to methodFullName property */ + def methodFullName: Iterator[String] = + traversal.map(_.methodFullName) + + /** Traverse to nodes where the methodFullName matches the regular expression `value` + */ + def methodFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + methodFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where the methodFullName matches at least one of the regular expressions in `values` + */ + def methodFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.methodFullName, patterns) + + /** Traverse to nodes where methodFullName matches `value` exactly. + */ + def methodFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("METHOD_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.methodFullName == value } + } + + /** Traverse to nodes where methodFullName matches one of the elements in `values` exactly. + */ + def methodFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + methodFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.methodFullName), values, "METHOD_FULL_NAME") + } + + /** Traverse to nodes where methodFullName does not match the regular expression `value`. + */ + def methodFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.methodFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.methodFullName, pattern) + } + } + + /** Traverse to nodes where methodFullName does not match any of the regular expressions in `values`. + */ + def methodFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.methodFullName, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodReturn.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodReturn.scala new file mode 100644 index 0000000..38f84b8 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/MethodReturn.scala @@ -0,0 +1,336 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for MethodReturn */ +class MethodReturnTraversalExtGen[NodeType <: MethodReturn](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to RETURN via CFG IN edge. + */ + def toReturn: Iterator[Return] = + traversal.flatMap(_.toReturn) + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to evaluationStrategy property */ + def evaluationStrategy: Iterator[String] = + traversal.map(_.evaluationStrategy) + + /** Traverse to nodes where the evaluationStrategy matches the regular expression `value` + */ + def evaluationStrategy(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + evaluationStrategyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where the evaluationStrategy matches at least one of the regular expressions in `values` + */ + def evaluationStrategy(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.evaluationStrategy, patterns) + + /** Traverse to nodes where evaluationStrategy matches `value` exactly. + */ + def evaluationStrategyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("EVALUATION_STRATEGY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.evaluationStrategy == value } + } + + /** Traverse to nodes where evaluationStrategy matches one of the elements in `values` exactly. + */ + def evaluationStrategyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + evaluationStrategyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.evaluationStrategy), + values, + "EVALUATION_STRATEGY" + ) + } + + /** Traverse to nodes where evaluationStrategy does not match the regular expression `value`. + */ + def evaluationStrategyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.evaluationStrategy != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.evaluationStrategy, pattern) + } + } + + /** Traverse to nodes where evaluationStrategy does not match any of the regular expressions in `values`. + */ + def evaluationStrategyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.evaluationStrategy, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Modifier.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Modifier.scala new file mode 100644 index 0000000..f072f77 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Modifier.scala @@ -0,0 +1,266 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Modifier */ +class ModifierTraversalExtGen[NodeType <: Modifier](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to modifierType property */ + def modifierType: Iterator[String] = + traversal.map(_.modifierType) + + /** Traverse to nodes where the modifierType matches the regular expression `value` + */ + def modifierType(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + modifierTypeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.modifierType, pattern) + } + } + + /** Traverse to nodes where the modifierType matches at least one of the regular expressions in `values` + */ + def modifierType(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.modifierType, patterns) + + /** Traverse to nodes where modifierType matches `value` exactly. + */ + def modifierTypeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("MODIFIER_TYPE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.modifierType == value } + } + + /** Traverse to nodes where modifierType matches one of the elements in `values` exactly. + */ + def modifierTypeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + modifierTypeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.modifierType), values, "MODIFIER_TYPE") + } + + /** Traverse to nodes where modifierType does not match the regular expression `value`. + */ + def modifierTypeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.modifierType != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.modifierType, pattern) + } + } + + /** Traverse to nodes where modifierType does not match any of the regular expressions in `values`. + */ + def modifierTypeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.modifierType, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Mynodetype.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Mynodetype.scala new file mode 100644 index 0000000..99da7ab --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Mynodetype.scala @@ -0,0 +1,65 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Mynodetype */ +class MynodetypeTraversalExtGen[NodeType <: Mynodetype](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to myproperty property */ + def myproperty: Iterator[String] = + traversal.map(_.myproperty) + + /** Traverse to nodes where the myproperty matches the regular expression `value` + */ + def myproperty(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + mypropertyExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.myproperty, pattern) + } + } + + /** Traverse to nodes where the myproperty matches at least one of the regular expressions in `values` + */ + def myproperty(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.myproperty, patterns) + + /** Traverse to nodes where myproperty matches `value` exactly. + */ + def mypropertyExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("MYPROPERTY", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.myproperty == value } + } + + /** Traverse to nodes where myproperty matches one of the elements in `values` exactly. + */ + def mypropertyExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + mypropertyExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.myproperty), values, "MYPROPERTY") + } + + /** Traverse to nodes where myproperty does not match the regular expression `value`. + */ + def mypropertyNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.myproperty != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.myproperty, pattern) + } + } + + /** Traverse to nodes where myproperty does not match any of the regular expressions in `values`. + */ + def mypropertyNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.myproperty, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Namespace.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Namespace.scala new file mode 100644 index 0000000..35e8d11 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Namespace.scala @@ -0,0 +1,265 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Namespace */ +class NamespaceTraversalExtGen[NodeType <: Namespace](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NamespaceBlock.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NamespaceBlock.scala new file mode 100644 index 0000000..14b2abe --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NamespaceBlock.scala @@ -0,0 +1,377 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for NamespaceBlock */ +class NamespaceBlockTraversalExtGen[NodeType <: NamespaceBlock](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to filename property */ + def filename: Iterator[String] = + traversal.map(_.filename) + + /** Traverse to nodes where the filename matches the regular expression `value` + */ + def filename(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + filenameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where the filename matches at least one of the regular expressions in `values` + */ + def filename(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.filename, patterns) + + /** Traverse to nodes where filename matches `value` exactly. + */ + def filenameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FILENAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.filename == value } + } + + /** Traverse to nodes where filename matches one of the elements in `values` exactly. + */ + def filenameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + filenameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.filename), values, "FILENAME") + } + + /** Traverse to nodes where filename does not match the regular expression `value`. + */ + def filenameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.filename != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where filename does not match any of the regular expressions in `values`. + */ + def filenameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.filename, patterns) + } + + /** Traverse to fullName property */ + def fullName: Iterator[String] = + traversal.map(_.fullName) + + /** Traverse to nodes where the fullName matches the regular expression `value` + */ + def fullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + fullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where the fullName matches at least one of the regular expressions in `values` + */ + def fullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.fullName, patterns) + + /** Traverse to nodes where fullName matches `value` exactly. + */ + def fullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.fullName == value } + } + + /** Traverse to nodes where fullName matches one of the elements in `values` exactly. + */ + def fullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + fullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.fullName), values, "FULL_NAME") + } + + /** Traverse to nodes where fullName does not match the regular expression `value`. + */ + def fullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.fullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where fullName does not match any of the regular expressions in `values`. + */ + def fullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.fullName, patterns) + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NodeTraversalImplicits.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NodeTraversalImplicits.scala new file mode 100644 index 0000000..f0dad9d --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/NodeTraversalImplicits.scala @@ -0,0 +1,211 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import io.shiftleft.codepropertygraph.generated.nodes._ + +trait NodeTraversalImplicits extends NodeBaseTypeTraversalImplicits { + implicit def toStoredNodeTraversalExtGen[NodeType <: StoredNode]( + trav: IterableOnce[NodeType] + ): StoredNodeTraversalExtGen[NodeType] = new StoredNodeTraversalExtGen(trav.iterator) + + implicit def toAnnotationTraversalExtGen[NodeType <: Annotation]( + trav: IterableOnce[NodeType] + ): AnnotationTraversalExtGen[NodeType] = new AnnotationTraversalExtGen(trav.iterator) + implicit def toAnnotationLiteralTraversalExtGen[NodeType <: AnnotationLiteral]( + trav: IterableOnce[NodeType] + ): AnnotationLiteralTraversalExtGen[NodeType] = new AnnotationLiteralTraversalExtGen(trav.iterator) + implicit def toAnnotationParameterTraversalExtGen[NodeType <: AnnotationParameter]( + trav: IterableOnce[NodeType] + ): AnnotationParameterTraversalExtGen[NodeType] = new AnnotationParameterTraversalExtGen(trav.iterator) + implicit def toAnnotationParameterAssignTraversalExtGen[NodeType <: AnnotationParameterAssign]( + trav: IterableOnce[NodeType] + ): AnnotationParameterAssignTraversalExtGen[NodeType] = new AnnotationParameterAssignTraversalExtGen(trav.iterator) + implicit def toArrayInitializerTraversalExtGen[NodeType <: ArrayInitializer]( + trav: IterableOnce[NodeType] + ): ArrayInitializerTraversalExtGen[NodeType] = new ArrayInitializerTraversalExtGen(trav.iterator) + implicit def toBindingTraversalExtGen[NodeType <: Binding]( + trav: IterableOnce[NodeType] + ): BindingTraversalExtGen[NodeType] = new BindingTraversalExtGen(trav.iterator) + implicit def toBlockTraversalExtGen[NodeType <: Block](trav: IterableOnce[NodeType]): BlockTraversalExtGen[NodeType] = + new BlockTraversalExtGen(trav.iterator) + implicit def toCallTraversalExtGen[NodeType <: Call](trav: IterableOnce[NodeType]): CallTraversalExtGen[NodeType] = + new CallTraversalExtGen(trav.iterator) + implicit def toClosureBindingTraversalExtGen[NodeType <: ClosureBinding]( + trav: IterableOnce[NodeType] + ): ClosureBindingTraversalExtGen[NodeType] = new ClosureBindingTraversalExtGen(trav.iterator) + implicit def toCommentTraversalExtGen[NodeType <: Comment]( + trav: IterableOnce[NodeType] + ): CommentTraversalExtGen[NodeType] = new CommentTraversalExtGen(trav.iterator) + implicit def toConfigFileTraversalExtGen[NodeType <: ConfigFile]( + trav: IterableOnce[NodeType] + ): ConfigFileTraversalExtGen[NodeType] = new ConfigFileTraversalExtGen(trav.iterator) + implicit def toControlStructureTraversalExtGen[NodeType <: ControlStructure]( + trav: IterableOnce[NodeType] + ): ControlStructureTraversalExtGen[NodeType] = new ControlStructureTraversalExtGen(trav.iterator) + implicit def toDependencyTraversalExtGen[NodeType <: Dependency]( + trav: IterableOnce[NodeType] + ): DependencyTraversalExtGen[NodeType] = new DependencyTraversalExtGen(trav.iterator) + implicit def toFieldIdentifierTraversalExtGen[NodeType <: FieldIdentifier]( + trav: IterableOnce[NodeType] + ): FieldIdentifierTraversalExtGen[NodeType] = new FieldIdentifierTraversalExtGen(trav.iterator) + implicit def toFileTraversalExtGen[NodeType <: File](trav: IterableOnce[NodeType]): FileTraversalExtGen[NodeType] = + new FileTraversalExtGen(trav.iterator) + implicit def toFindingTraversalExtGen[NodeType <: Finding]( + trav: IterableOnce[NodeType] + ): FindingTraversalExtGen[NodeType] = new FindingTraversalExtGen(trav.iterator) + implicit def toIdentifierTraversalExtGen[NodeType <: Identifier]( + trav: IterableOnce[NodeType] + ): IdentifierTraversalExtGen[NodeType] = new IdentifierTraversalExtGen(trav.iterator) + implicit def toImportTraversalExtGen[NodeType <: Import]( + trav: IterableOnce[NodeType] + ): ImportTraversalExtGen[NodeType] = new ImportTraversalExtGen(trav.iterator) + implicit def toJumpLabelTraversalExtGen[NodeType <: JumpLabel]( + trav: IterableOnce[NodeType] + ): JumpLabelTraversalExtGen[NodeType] = new JumpLabelTraversalExtGen(trav.iterator) + implicit def toJumpTargetTraversalExtGen[NodeType <: JumpTarget]( + trav: IterableOnce[NodeType] + ): JumpTargetTraversalExtGen[NodeType] = new JumpTargetTraversalExtGen(trav.iterator) + implicit def toKeyValuePairTraversalExtGen[NodeType <: KeyValuePair]( + trav: IterableOnce[NodeType] + ): KeyValuePairTraversalExtGen[NodeType] = new KeyValuePairTraversalExtGen(trav.iterator) + implicit def toLiteralTraversalExtGen[NodeType <: Literal]( + trav: IterableOnce[NodeType] + ): LiteralTraversalExtGen[NodeType] = new LiteralTraversalExtGen(trav.iterator) + implicit def toLocalTraversalExtGen[NodeType <: Local](trav: IterableOnce[NodeType]): LocalTraversalExtGen[NodeType] = + new LocalTraversalExtGen(trav.iterator) + implicit def toLocationTraversalExtGen[NodeType <: Location]( + trav: IterableOnce[NodeType] + ): LocationTraversalExtGen[NodeType] = new LocationTraversalExtGen(trav.iterator) + implicit def toMemberTraversalExtGen[NodeType <: Member]( + trav: IterableOnce[NodeType] + ): MemberTraversalExtGen[NodeType] = new MemberTraversalExtGen(trav.iterator) + implicit def toMetaDataTraversalExtGen[NodeType <: MetaData]( + trav: IterableOnce[NodeType] + ): MetaDataTraversalExtGen[NodeType] = new MetaDataTraversalExtGen(trav.iterator) + implicit def toMethodTraversalExtGen[NodeType <: Method]( + trav: IterableOnce[NodeType] + ): MethodTraversalExtGen[NodeType] = new MethodTraversalExtGen(trav.iterator) + implicit def toMethodParameterInTraversalExtGen[NodeType <: MethodParameterIn]( + trav: IterableOnce[NodeType] + ): MethodParameterInTraversalExtGen[NodeType] = new MethodParameterInTraversalExtGen(trav.iterator) + implicit def toMethodParameterOutTraversalExtGen[NodeType <: MethodParameterOut]( + trav: IterableOnce[NodeType] + ): MethodParameterOutTraversalExtGen[NodeType] = new MethodParameterOutTraversalExtGen(trav.iterator) + implicit def toMethodRefTraversalExtGen[NodeType <: MethodRef]( + trav: IterableOnce[NodeType] + ): MethodRefTraversalExtGen[NodeType] = new MethodRefTraversalExtGen(trav.iterator) + implicit def toMethodReturnTraversalExtGen[NodeType <: MethodReturn]( + trav: IterableOnce[NodeType] + ): MethodReturnTraversalExtGen[NodeType] = new MethodReturnTraversalExtGen(trav.iterator) + implicit def toModifierTraversalExtGen[NodeType <: Modifier]( + trav: IterableOnce[NodeType] + ): ModifierTraversalExtGen[NodeType] = new ModifierTraversalExtGen(trav.iterator) + implicit def toMynodetypeTraversalExtGen[NodeType <: Mynodetype]( + trav: IterableOnce[NodeType] + ): MynodetypeTraversalExtGen[NodeType] = new MynodetypeTraversalExtGen(trav.iterator) + implicit def toNamespaceTraversalExtGen[NodeType <: Namespace]( + trav: IterableOnce[NodeType] + ): NamespaceTraversalExtGen[NodeType] = new NamespaceTraversalExtGen(trav.iterator) + implicit def toNamespaceBlockTraversalExtGen[NodeType <: NamespaceBlock]( + trav: IterableOnce[NodeType] + ): NamespaceBlockTraversalExtGen[NodeType] = new NamespaceBlockTraversalExtGen(trav.iterator) + implicit def toReturnTraversalExtGen[NodeType <: Return]( + trav: IterableOnce[NodeType] + ): ReturnTraversalExtGen[NodeType] = new ReturnTraversalExtGen(trav.iterator) + implicit def toTagTraversalExtGen[NodeType <: Tag](trav: IterableOnce[NodeType]): TagTraversalExtGen[NodeType] = + new TagTraversalExtGen(trav.iterator) + implicit def toTagNodePairTraversalExtGen[NodeType <: TagNodePair]( + trav: IterableOnce[NodeType] + ): TagNodePairTraversalExtGen[NodeType] = new TagNodePairTraversalExtGen(trav.iterator) + implicit def toTemplateDomTraversalExtGen[NodeType <: TemplateDom]( + trav: IterableOnce[NodeType] + ): TemplateDomTraversalExtGen[NodeType] = new TemplateDomTraversalExtGen(trav.iterator) + implicit def toTypeTraversalExtGen[NodeType <: Type](trav: IterableOnce[NodeType]): TypeTraversalExtGen[NodeType] = + new TypeTraversalExtGen(trav.iterator) + implicit def toTypeArgumentTraversalExtGen[NodeType <: TypeArgument]( + trav: IterableOnce[NodeType] + ): TypeArgumentTraversalExtGen[NodeType] = new TypeArgumentTraversalExtGen(trav.iterator) + implicit def toTypeDeclTraversalExtGen[NodeType <: TypeDecl]( + trav: IterableOnce[NodeType] + ): TypeDeclTraversalExtGen[NodeType] = new TypeDeclTraversalExtGen(trav.iterator) + implicit def toTypeParameterTraversalExtGen[NodeType <: TypeParameter]( + trav: IterableOnce[NodeType] + ): TypeParameterTraversalExtGen[NodeType] = new TypeParameterTraversalExtGen(trav.iterator) + implicit def toTypeRefTraversalExtGen[NodeType <: TypeRef]( + trav: IterableOnce[NodeType] + ): TypeRefTraversalExtGen[NodeType] = new TypeRefTraversalExtGen(trav.iterator) + implicit def toUnknownTraversalExtGen[NodeType <: Unknown]( + trav: IterableOnce[NodeType] + ): UnknownTraversalExtGen[NodeType] = new UnknownTraversalExtGen(trav.iterator) +} + +// lower priority implicits for base types +trait NodeBaseTypeTraversalImplicits extends overflowdb.traversal.Implicits { + implicit def toAstNodeTraversalExtGen[NodeType <: AstNode]( + trav: IterableOnce[NodeType] + ): AstNodeTraversalExtGen[NodeType] = new AstNodeTraversalExtGen(trav.iterator) + implicit def toCallReprTraversalExtGen[NodeType <: CallRepr]( + trav: IterableOnce[NodeType] + ): CallReprTraversalExtGen[NodeType] = new CallReprTraversalExtGen(trav.iterator) + implicit def toCfgNodeTraversalExtGen[NodeType <: CfgNode]( + trav: IterableOnce[NodeType] + ): CfgNodeTraversalExtGen[NodeType] = new CfgNodeTraversalExtGen(trav.iterator) + implicit def toDeclarationTraversalExtGen[NodeType <: Declaration]( + trav: IterableOnce[NodeType] + ): DeclarationTraversalExtGen[NodeType] = new DeclarationTraversalExtGen(trav.iterator) + implicit def toExpressionTraversalExtGen[NodeType <: Expression]( + trav: IterableOnce[NodeType] + ): ExpressionTraversalExtGen[NodeType] = new ExpressionTraversalExtGen(trav.iterator) +} + +class StoredNodeTraversalExtGen[NodeType <: StoredNode](val traversal: Iterator[NodeType]) extends AnyVal { + def _aliasOfOut: Iterator[StoredNode] = traversal.flatMap { _._aliasOfOut } + def _aliasOfIn: Iterator[StoredNode] = traversal.flatMap { _._aliasOfIn } + def _argumentOut: Iterator[StoredNode] = traversal.flatMap { _._argumentOut } + def _argumentIn: Iterator[StoredNode] = traversal.flatMap { _._argumentIn } + def _astOut: Iterator[StoredNode] = traversal.flatMap { _._astOut } + def _astIn: Iterator[StoredNode] = traversal.flatMap { _._astIn } + def _bindsOut: Iterator[StoredNode] = traversal.flatMap { _._bindsOut } + def _bindsIn: Iterator[StoredNode] = traversal.flatMap { _._bindsIn } + def _bindsToOut: Iterator[StoredNode] = traversal.flatMap { _._bindsToOut } + def _bindsToIn: Iterator[StoredNode] = traversal.flatMap { _._bindsToIn } + def _callOut: Iterator[StoredNode] = traversal.flatMap { _._callOut } + def _callIn: Iterator[StoredNode] = traversal.flatMap { _._callIn } + def _captureOut: Iterator[StoredNode] = traversal.flatMap { _._captureOut } + def _captureIn: Iterator[StoredNode] = traversal.flatMap { _._captureIn } + def _capturedByOut: Iterator[StoredNode] = traversal.flatMap { _._capturedByOut } + def _capturedByIn: Iterator[StoredNode] = traversal.flatMap { _._capturedByIn } + def _cdgOut: Iterator[StoredNode] = traversal.flatMap { _._cdgOut } + def _cdgIn: Iterator[StoredNode] = traversal.flatMap { _._cdgIn } + def _cfgOut: Iterator[StoredNode] = traversal.flatMap { _._cfgOut } + def _cfgIn: Iterator[StoredNode] = traversal.flatMap { _._cfgIn } + def _conditionOut: Iterator[StoredNode] = traversal.flatMap { _._conditionOut } + def _conditionIn: Iterator[StoredNode] = traversal.flatMap { _._conditionIn } + def _containsOut: Iterator[StoredNode] = traversal.flatMap { _._containsOut } + def _containsIn: Iterator[StoredNode] = traversal.flatMap { _._containsIn } + def _dominateOut: Iterator[StoredNode] = traversal.flatMap { _._dominateOut } + def _dominateIn: Iterator[StoredNode] = traversal.flatMap { _._dominateIn } + def _evalTypeOut: Iterator[StoredNode] = traversal.flatMap { _._evalTypeOut } + def _evalTypeIn: Iterator[StoredNode] = traversal.flatMap { _._evalTypeIn } + def _importsOut: Iterator[StoredNode] = traversal.flatMap { _._importsOut } + def _importsIn: Iterator[StoredNode] = traversal.flatMap { _._importsIn } + def _inheritsFromOut: Iterator[StoredNode] = traversal.flatMap { _._inheritsFromOut } + def _inheritsFromIn: Iterator[StoredNode] = traversal.flatMap { _._inheritsFromIn } + def _isCallForImportOut: Iterator[StoredNode] = traversal.flatMap { _._isCallForImportOut } + def _isCallForImportIn: Iterator[StoredNode] = traversal.flatMap { _._isCallForImportIn } + def _parameterLinkOut: Iterator[StoredNode] = traversal.flatMap { _._parameterLinkOut } + def _parameterLinkIn: Iterator[StoredNode] = traversal.flatMap { _._parameterLinkIn } + def _pointsToOut: Iterator[StoredNode] = traversal.flatMap { _._pointsToOut } + def _pointsToIn: Iterator[StoredNode] = traversal.flatMap { _._pointsToIn } + def _postDominateOut: Iterator[StoredNode] = traversal.flatMap { _._postDominateOut } + def _postDominateIn: Iterator[StoredNode] = traversal.flatMap { _._postDominateIn } + def _reachingDefOut: Iterator[StoredNode] = traversal.flatMap { _._reachingDefOut } + def _reachingDefIn: Iterator[StoredNode] = traversal.flatMap { _._reachingDefIn } + def _receiverOut: Iterator[StoredNode] = traversal.flatMap { _._receiverOut } + def _receiverIn: Iterator[StoredNode] = traversal.flatMap { _._receiverIn } + def _refOut: Iterator[StoredNode] = traversal.flatMap { _._refOut } + def _refIn: Iterator[StoredNode] = traversal.flatMap { _._refIn } + def _sourceFileOut: Iterator[StoredNode] = traversal.flatMap { _._sourceFileOut } + def _sourceFileIn: Iterator[StoredNode] = traversal.flatMap { _._sourceFileIn } + def _taggedByOut: Iterator[StoredNode] = traversal.flatMap { _._taggedByOut } + def _taggedByIn: Iterator[StoredNode] = traversal.flatMap { _._taggedByIn } +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Return.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Return.scala new file mode 100644 index 0000000..0bcb310 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Return.scala @@ -0,0 +1,312 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Return */ +class ReturnTraversalExtGen[NodeType <: Return](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Tag.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Tag.scala new file mode 100644 index 0000000..978b3c7 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Tag.scala @@ -0,0 +1,121 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Tag */ +class TagTraversalExtGen[NodeType <: Tag](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to value property */ + def value: Iterator[String] = + traversal.map(_.value) + + /** Traverse to nodes where the value matches the regular expression `value` + */ + def value(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + valueExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.value, pattern) + } + } + + /** Traverse to nodes where the value matches at least one of the regular expressions in `values` + */ + def value(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.value, patterns) + + /** Traverse to nodes where value matches `value` exactly. + */ + def valueExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("VALUE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.value == value } + } + + /** Traverse to nodes where value matches one of the elements in `values` exactly. + */ + def valueExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + valueExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.value), values, "VALUE") + } + + /** Traverse to nodes where value does not match the regular expression `value`. + */ + def valueNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.value != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.value, pattern) + } + } + + /** Traverse to nodes where value does not match any of the regular expressions in `values`. + */ + def valueNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.value, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TagNodePair.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TagNodePair.scala new file mode 100644 index 0000000..4840c3b --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TagNodePair.scala @@ -0,0 +1,7 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TagNodePair */ +class TagNodePairTraversalExtGen[NodeType <: TagNodePair](val traversal: Iterator[NodeType]) extends AnyVal {} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TemplateDom.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TemplateDom.scala new file mode 100644 index 0000000..1186dcd --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TemplateDom.scala @@ -0,0 +1,368 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TemplateDom */ +class TemplateDomTraversalExtGen[NodeType <: TemplateDom](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Type.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Type.scala new file mode 100644 index 0000000..90ad33f --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Type.scala @@ -0,0 +1,192 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Type */ +class TypeTraversalExtGen[NodeType <: Type](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Direct alias type declarations. Traverse to TYPE_DECL via ALIAS_OF IN edge. + */ + /** Direct alias type declarations. */ + @overflowdb.traversal.help.Doc(info = """Direct alias type declarations.""") + def aliasTypeDecl: Iterator[TypeDecl] = + traversal.flatMap(_.aliasTypeDecl) + + /** Type declaration which is referenced by this type. Traverse to TYPE_DECL via REF OUT edge. + */ + /** Type declaration which is referenced by this type. */ + @overflowdb.traversal.help.Doc(info = """Type declaration which is referenced by this type.""") + def referencedTypeDecl: Iterator[TypeDecl] = + traversal.flatMap(_.referencedTypeDecl) + + /** Traverse to fullName property */ + def fullName: Iterator[String] = + traversal.map(_.fullName) + + /** Traverse to nodes where the fullName matches the regular expression `value` + */ + def fullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + fullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where the fullName matches at least one of the regular expressions in `values` + */ + def fullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.fullName, patterns) + + /** Traverse to nodes where fullName matches `value` exactly. + */ + def fullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.fullName == value } + } + + /** Traverse to nodes where fullName matches one of the elements in `values` exactly. + */ + def fullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + fullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.fullName), values, "FULL_NAME") + } + + /** Traverse to nodes where fullName does not match the regular expression `value`. + */ + def fullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.fullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where fullName does not match any of the regular expressions in `values`. + */ + def fullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.fullName, patterns) + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to typeDeclFullName property */ + def typeDeclFullName: Iterator[String] = + traversal.map(_.typeDeclFullName) + + /** Traverse to nodes where the typeDeclFullName matches the regular expression `value` + */ + def typeDeclFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeDeclFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeDeclFullName, pattern) + } + } + + /** Traverse to nodes where the typeDeclFullName matches at least one of the regular expressions in `values` + */ + def typeDeclFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeDeclFullName, patterns) + + /** Traverse to nodes where typeDeclFullName matches `value` exactly. + */ + def typeDeclFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_DECL_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeDeclFullName == value } + } + + /** Traverse to nodes where typeDeclFullName matches one of the elements in `values` exactly. + */ + def typeDeclFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeDeclFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeDeclFullName), values, "TYPE_DECL_FULL_NAME") + } + + /** Traverse to nodes where typeDeclFullName does not match the regular expression `value`. + */ + def typeDeclFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeDeclFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeDeclFullName, pattern) + } + } + + /** Traverse to nodes where typeDeclFullName does not match any of the regular expressions in `values`. + */ + def typeDeclFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeDeclFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeArgument.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeArgument.scala new file mode 100644 index 0000000..5553045 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeArgument.scala @@ -0,0 +1,209 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TypeArgument */ +class TypeArgumentTraversalExtGen[NodeType <: TypeArgument](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeDecl.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeDecl.scala new file mode 100644 index 0000000..4dcdd84 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeDecl.scala @@ -0,0 +1,578 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TypeDecl */ +class TypeDeclTraversalExtGen[NodeType <: TypeDecl](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to NAMESPACE_BLOCK via AST IN edge. + */ + def namespaceBlock: Iterator[NamespaceBlock] = + traversal.flatMap(_.namespaceBlock) + + /** Traverse to TYPE via ALIAS_OF OUT edge. + */ + def aliasedType: Iterator[Type] = + traversal.flatMap(_.aliasedType) + + /** Traverse to aliasTypeFullName property */ + def aliasTypeFullName: Iterator[String] = + traversal.flatMap(_.aliasTypeFullName) + + /** Traverse to nodes where the aliasTypeFullName matches the regular expression `value` + */ + def aliasTypeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.aliasTypeFullName.isDefined && node.aliasTypeFullName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.aliasTypeFullName.isDefined))(_.aliasTypeFullName.get, pattern) + } + } + + /** Traverse to nodes where the aliasTypeFullName matches at least one of the regular expressions in `values` + */ + def aliasTypeFullName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.aliasTypeFullName.isDefined))(_.aliasTypeFullName.get, patterns) + } + + /** Traverse to nodes where aliasTypeFullName matches `value` exactly. + */ + def aliasTypeFullNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.aliasTypeFullName.contains(value) } + + /** Traverse to nodes where aliasTypeFullName matches one of the elements in `values` exactly. + */ + def aliasTypeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + aliasTypeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.aliasTypeFullName, values, "ALIAS_TYPE_FULL_NAME") + } + + /** Traverse to nodes where aliasTypeFullName does not match the regular expression `value`. + */ + def aliasTypeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.aliasTypeFullName.isEmpty || node.aliasTypeFullName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.aliasTypeFullName.isDefined))(_.aliasTypeFullName.get, pattern) + } + } + + /** Traverse to nodes where aliasTypeFullName does not match any of the regular expressions in `values`. + */ + def aliasTypeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.aliasTypeFullName.isDefined))(_.aliasTypeFullName.get, patterns) + } + + /** Traverse to astParentFullName property */ + def astParentFullName: Iterator[String] = + traversal.map(_.astParentFullName) + + /** Traverse to nodes where the astParentFullName matches the regular expression `value` + */ + def astParentFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + astParentFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.astParentFullName, pattern) + } + } + + /** Traverse to nodes where the astParentFullName matches at least one of the regular expressions in `values` + */ + def astParentFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.astParentFullName, patterns) + + /** Traverse to nodes where astParentFullName matches `value` exactly. + */ + def astParentFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("AST_PARENT_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.astParentFullName == value } + } + + /** Traverse to nodes where astParentFullName matches one of the elements in `values` exactly. + */ + def astParentFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + astParentFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter.exactMultiple[NodeType, String]( + traversal, + node => Some(node.astParentFullName), + values, + "AST_PARENT_FULL_NAME" + ) + } + + /** Traverse to nodes where astParentFullName does not match the regular expression `value`. + */ + def astParentFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.astParentFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.astParentFullName, pattern) + } + } + + /** Traverse to nodes where astParentFullName does not match any of the regular expressions in `values`. + */ + def astParentFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.astParentFullName, patterns) + } + + /** Traverse to astParentType property */ + def astParentType: Iterator[String] = + traversal.map(_.astParentType) + + /** Traverse to nodes where the astParentType matches the regular expression `value` + */ + def astParentType(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + astParentTypeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.astParentType, pattern) + } + } + + /** Traverse to nodes where the astParentType matches at least one of the regular expressions in `values` + */ + def astParentType(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.astParentType, patterns) + + /** Traverse to nodes where astParentType matches `value` exactly. + */ + def astParentTypeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("AST_PARENT_TYPE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.astParentType == value } + } + + /** Traverse to nodes where astParentType matches one of the elements in `values` exactly. + */ + def astParentTypeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + astParentTypeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.astParentType), values, "AST_PARENT_TYPE") + } + + /** Traverse to nodes where astParentType does not match the regular expression `value`. + */ + def astParentTypeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.astParentType != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.astParentType, pattern) + } + } + + /** Traverse to nodes where astParentType does not match any of the regular expressions in `values`. + */ + def astParentTypeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.astParentType, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to filename property */ + def filename: Iterator[String] = + traversal.map(_.filename) + + /** Traverse to nodes where the filename matches the regular expression `value` + */ + def filename(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + filenameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where the filename matches at least one of the regular expressions in `values` + */ + def filename(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.filename, patterns) + + /** Traverse to nodes where filename matches `value` exactly. + */ + def filenameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FILENAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.filename == value } + } + + /** Traverse to nodes where filename matches one of the elements in `values` exactly. + */ + def filenameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + filenameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.filename), values, "FILENAME") + } + + /** Traverse to nodes where filename does not match the regular expression `value`. + */ + def filenameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.filename != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.filename, pattern) + } + } + + /** Traverse to nodes where filename does not match any of the regular expressions in `values`. + */ + def filenameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.filename, patterns) + } + + /** Traverse to fullName property */ + def fullName: Iterator[String] = + traversal.map(_.fullName) + + /** Traverse to nodes where the fullName matches the regular expression `value` + */ + def fullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + fullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where the fullName matches at least one of the regular expressions in `values` + */ + def fullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.fullName, patterns) + + /** Traverse to nodes where fullName matches `value` exactly. + */ + def fullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.fullName == value } + } + + /** Traverse to nodes where fullName matches one of the elements in `values` exactly. + */ + def fullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + fullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.fullName), values, "FULL_NAME") + } + + /** Traverse to nodes where fullName does not match the regular expression `value`. + */ + def fullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.fullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.fullName, pattern) + } + } + + /** Traverse to nodes where fullName does not match any of the regular expressions in `values`. + */ + def fullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.fullName, patterns) + } + + /** Traverse to inheritsFromTypeFullName property */ + def inheritsFromTypeFullName: Iterator[String] = + traversal.flatMap(_.inheritsFromTypeFullName) + + /** Traverse to isExternal property */ + def isExternal: Iterator[Boolean] = + traversal.map(_.isExternal) + + /** Traverse to nodes where the isExternal equals the given `value` + */ + def isExternal(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isExternal == value } + + /** Traverse to nodes where isExternal is not equal to the given `value`. + */ + def isExternalNot(value: Boolean): Iterator[NodeType] = + traversal.filter { _.isExternal != value } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeParameter.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeParameter.scala new file mode 100644 index 0000000..2f030d1 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeParameter.scala @@ -0,0 +1,265 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TypeParameter */ +class TypeParameterTraversalExtGen[NodeType <: TypeParameter](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to name property */ + def name: Iterator[String] = + traversal.map(_.name) + + /** Traverse to nodes where the name matches the regular expression `value` + */ + def name(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + nameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where the name matches at least one of the regular expressions in `values` + */ + def name(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.name, patterns) + + /** Traverse to nodes where name matches `value` exactly. + */ + def nameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.name == value } + } + + /** Traverse to nodes where name matches one of the elements in `values` exactly. + */ + def nameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + nameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.name), values, "NAME") + } + + /** Traverse to nodes where name does not match the regular expression `value`. + */ + def nameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.name != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.name, pattern) + } + } + + /** Traverse to nodes where name does not match any of the regular expressions in `values`. + */ + def nameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.name, patterns) + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeRef.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeRef.scala new file mode 100644 index 0000000..bbe6b0b --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/TypeRef.scala @@ -0,0 +1,373 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for TypeRef */ +class TypeRefTraversalExtGen[NodeType <: TypeRef](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Unknown.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Unknown.scala new file mode 100644 index 0000000..5487fd4 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/Unknown.scala @@ -0,0 +1,487 @@ +package io.shiftleft.codepropertygraph.generated.traversal + +import overflowdb.traversal._ +import io.shiftleft.codepropertygraph.generated.nodes._ + +/** Traversal steps for Unknown */ +class UnknownTraversalExtGen[NodeType <: Unknown](val traversal: Iterator[NodeType]) extends AnyVal { + + /** Traverse to argumentIndex property */ + def argumentIndex: Iterator[scala.Int] = + traversal.map(_.argumentIndex) + + /** Traverse to nodes where the argumentIndex equals the given `value` + */ + def argumentIndex(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex == value } + + /** Traverse to nodes where the argumentIndex equals at least one of the given `values` + */ + def argumentIndex(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.argumentIndex) } + } + + /** Traverse to nodes where the argumentIndex is greater than the given `value` + */ + def argumentIndexGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex > value } + + /** Traverse to nodes where the argumentIndex is greater than or equal the given `value` + */ + def argumentIndexGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex >= value } + + /** Traverse to nodes where the argumentIndex is less than the given `value` + */ + def argumentIndexLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex < value } + + /** Traverse to nodes where the argumentIndex is less than or equal the given `value` + */ + def argumentIndexLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex <= value } + + /** Traverse to nodes where argumentIndex is not equal to the given `value`. + */ + def argumentIndexNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.argumentIndex != value } + + /** Traverse to nodes where argumentIndex is not equal to any of the given `values`. + */ + def argumentIndexNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.argumentIndex) } + } + + /** Traverse to argumentName property */ + def argumentName: Iterator[String] = + traversal.flatMap(_.argumentName) + + /** Traverse to nodes where the argumentName matches the regular expression `value` + */ + def argumentName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isDefined && node.argumentName.get == pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexp(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where the argumentName matches at least one of the regular expressions in `values` + */ + def argumentName(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to nodes where argumentName matches `value` exactly. + */ + def argumentNameExact(value: String): Iterator[NodeType] = + traversal.filter { node => node.argumentName.contains(value) } + + /** Traverse to nodes where argumentName matches one of the elements in `values` exactly. + */ + def argumentNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + argumentNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, _.argumentName, values, "ARGUMENT_NAME") + } + + /** Traverse to nodes where argumentName does not match the regular expression `value`. + */ + def argumentNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.argumentName.isEmpty || node.argumentName.get != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNot(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, pattern) + } + } + + /** Traverse to nodes where argumentName does not match any of the regular expressions in `values`. + */ + def argumentNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter + .regexpNotMultiple(traversal.filter(_.argumentName.isDefined))(_.argumentName.get, patterns) + } + + /** Traverse to code property */ + def code: Iterator[String] = + traversal.map(_.code) + + /** Traverse to nodes where the code matches the regular expression `value` + */ + def code(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + codeExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where the code matches at least one of the regular expressions in `values` + */ + def code(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.code, patterns) + + /** Traverse to nodes where code matches `value` exactly. + */ + def codeExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => init.getByIndex("CODE", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.code == value } + } + + /** Traverse to nodes where code matches one of the elements in `values` exactly. + */ + def codeExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + codeExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.code), values, "CODE") + } + + /** Traverse to nodes where code does not match the regular expression `value`. + */ + def codeNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.code != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.code, pattern) + } + } + + /** Traverse to nodes where code does not match any of the regular expressions in `values`. + */ + def codeNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.code, patterns) + } + + /** Traverse to columnNumber property */ + def columnNumber: Iterator[Integer] = + traversal.flatMap(_.columnNumber) + + /** Traverse to nodes where the columnNumber equals the given `value` + */ + def columnNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get == value } + + /** Traverse to nodes where the columnNumber equals at least one of the given `values` + */ + def columnNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.columnNumber.isDefined && vset.contains(node.columnNumber.get) } + } + + /** Traverse to nodes where the columnNumber is greater than the given `value` + */ + def columnNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get > value } + + /** Traverse to nodes where the columnNumber is greater than or equal the given `value` + */ + def columnNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get >= value } + + /** Traverse to nodes where the columnNumber is less than the given `value` + */ + def columnNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get < value } + + /** Traverse to nodes where the columnNumber is less than or equal the given `value` + */ + def columnNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.columnNumber.isDefined && node.columnNumber.get <= value } + + /** Traverse to nodes where columnNumber is not equal to the given `value`. + */ + def columnNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.columnNumber.isDefined || node.columnNumber.get != value } + + /** Traverse to nodes where columnNumber is not equal to any of the given `values`. + */ + def columnNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.columnNumber.isDefined || !vset.contains(node.columnNumber.get) } + } + + /** Traverse to containedRef property */ + def containedRef: Iterator[String] = + traversal.map(_.containedRef) + + /** Traverse to nodes where the containedRef matches the regular expression `value` + */ + def containedRef(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + containedRefExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.containedRef, pattern) + } + } + + /** Traverse to nodes where the containedRef matches at least one of the regular expressions in `values` + */ + def containedRef(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.containedRef, patterns) + + /** Traverse to nodes where containedRef matches `value` exactly. + */ + def containedRefExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("CONTAINED_REF", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.containedRef == value } + } + + /** Traverse to nodes where containedRef matches one of the elements in `values` exactly. + */ + def containedRefExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + containedRefExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.containedRef), values, "CONTAINED_REF") + } + + /** Traverse to nodes where containedRef does not match the regular expression `value`. + */ + def containedRefNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.containedRef != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.containedRef, pattern) + } + } + + /** Traverse to nodes where containedRef does not match any of the regular expressions in `values`. + */ + def containedRefNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.containedRef, patterns) + } + + /** Traverse to dynamicTypeHintFullName property */ + def dynamicTypeHintFullName: Iterator[String] = + traversal.flatMap(_.dynamicTypeHintFullName) + + /** Traverse to lineNumber property */ + def lineNumber: Iterator[Integer] = + traversal.flatMap(_.lineNumber) + + /** Traverse to nodes where the lineNumber equals the given `value` + */ + def lineNumber(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get == value } + + /** Traverse to nodes where the lineNumber equals at least one of the given `values` + */ + def lineNumber(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => node.lineNumber.isDefined && vset.contains(node.lineNumber.get) } + } + + /** Traverse to nodes where the lineNumber is greater than the given `value` + */ + def lineNumberGt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get > value } + + /** Traverse to nodes where the lineNumber is greater than or equal the given `value` + */ + def lineNumberGte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get >= value } + + /** Traverse to nodes where the lineNumber is less than the given `value` + */ + def lineNumberLt(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get < value } + + /** Traverse to nodes where the lineNumber is less than or equal the given `value` + */ + def lineNumberLte(value: Integer): Iterator[NodeType] = + traversal.filter { node => node.lineNumber.isDefined && node.lineNumber.get <= value } + + /** Traverse to nodes where lineNumber is not equal to the given `value`. + */ + def lineNumberNot(value: Integer): Iterator[NodeType] = + traversal.filter { node => !node.lineNumber.isDefined || node.lineNumber.get != value } + + /** Traverse to nodes where lineNumber is not equal to any of the given `values`. + */ + def lineNumberNot(values: Integer*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !node.lineNumber.isDefined || !vset.contains(node.lineNumber.get) } + } + + /** Traverse to order property */ + def order: Iterator[scala.Int] = + traversal.map(_.order) + + /** Traverse to nodes where the order equals the given `value` + */ + def order(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order == value } + + /** Traverse to nodes where the order equals at least one of the given `values` + */ + def order(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => vset.contains(node.order) } + } + + /** Traverse to nodes where the order is greater than the given `value` + */ + def orderGt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order > value } + + /** Traverse to nodes where the order is greater than or equal the given `value` + */ + def orderGte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order >= value } + + /** Traverse to nodes where the order is less than the given `value` + */ + def orderLt(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order < value } + + /** Traverse to nodes where the order is less than or equal the given `value` + */ + def orderLte(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order <= value } + + /** Traverse to nodes where order is not equal to the given `value`. + */ + def orderNot(value: scala.Int): Iterator[NodeType] = + traversal.filter { _.order != value } + + /** Traverse to nodes where order is not equal to any of the given `values`. + */ + def orderNot(values: scala.Int*): Iterator[NodeType] = { + val vset = values.toSet + traversal.filter { node => !vset.contains(node.order) } + } + + /** Traverse to parserTypeName property */ + def parserTypeName: Iterator[String] = + traversal.map(_.parserTypeName) + + /** Traverse to nodes where the parserTypeName matches the regular expression `value` + */ + def parserTypeName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + parserTypeNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where the parserTypeName matches at least one of the regular expressions in `values` + */ + def parserTypeName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.parserTypeName, patterns) + + /** Traverse to nodes where parserTypeName matches `value` exactly. + */ + def parserTypeNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("PARSER_TYPE_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.parserTypeName == value } + } + + /** Traverse to nodes where parserTypeName matches one of the elements in `values` exactly. + */ + def parserTypeNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + parserTypeNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.parserTypeName), values, "PARSER_TYPE_NAME") + } + + /** Traverse to nodes where parserTypeName does not match the regular expression `value`. + */ + def parserTypeNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.parserTypeName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.parserTypeName, pattern) + } + } + + /** Traverse to nodes where parserTypeName does not match any of the regular expressions in `values`. + */ + def parserTypeNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.parserTypeName, patterns) + } + + /** Traverse to typeFullName property */ + def typeFullName: Iterator[String] = + traversal.map(_.typeFullName) + + /** Traverse to nodes where the typeFullName matches the regular expression `value` + */ + def typeFullName(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + typeFullNameExact(pattern) + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexp(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where the typeFullName matches at least one of the regular expressions in `values` + */ + def typeFullName(patterns: String*): Iterator[NodeType] = + overflowdb.traversal.filter.StringPropertyFilter.regexpMultiple(traversal)(_.typeFullName, patterns) + + /** Traverse to nodes where typeFullName matches `value` exactly. + */ + def typeFullNameExact(value: String): Iterator[NodeType] = { + val fastResult = traversal match { + case init: overflowdb.traversal.InitialTraversal[NodeType] => + init.getByIndex("TYPE_FULL_NAME", value).getOrElse(null) + case _ => null + } + if (fastResult != null) fastResult + else traversal.filter { node => node.typeFullName == value } + } + + /** Traverse to nodes where typeFullName matches one of the elements in `values` exactly. + */ + def typeFullNameExact(values: String*): Iterator[NodeType] = { + if (values.size == 1) + typeFullNameExact(values.head) + else + overflowdb.traversal.filter.StringPropertyFilter + .exactMultiple[NodeType, String](traversal, node => Some(node.typeFullName), values, "TYPE_FULL_NAME") + } + + /** Traverse to nodes where typeFullName does not match the regular expression `value`. + */ + def typeFullNameNot(pattern: String): Iterator[NodeType] = { + if (!Misc.isRegex(pattern)) { + traversal.filter { node => node.typeFullName != pattern } + } else { + overflowdb.traversal.filter.StringPropertyFilter.regexpNot(traversal)(_.typeFullName, pattern) + } + } + + /** Traverse to nodes where typeFullName does not match any of the regular expressions in `values`. + */ + def typeFullNameNot(patterns: String*): Iterator[NodeType] = { + overflowdb.traversal.filter.StringPropertyFilter.regexpNotMultiple(traversal)(_.typeFullName, patterns) + } + +} diff --git a/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/package.scala b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/package.scala new file mode 100644 index 0000000..9e016a0 --- /dev/null +++ b/domain-classes/src/main/generated/io/shiftleft/codepropertygraph/generated/traversal/package.scala @@ -0,0 +1,2 @@ +package io.shiftleft.codepropertygraph.generated +package object traversal extends NodeTraversalImplicits diff --git a/install-local-joern.sh b/install-local-joern.sh new file mode 100755 index 0000000..b2baf3c --- /dev/null +++ b/install-local-joern.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -o errexit +set -o pipefail +set -o nounset + +# extract joern_version from build.sbt - parsing just like in project/Versions.scala +readonly JOERN_VERSION=$(grep 'val joernVersion = "' build.sbt | sed 's/.*"\(.*\)"/\1/') + +# get script location, use as a root dir for this script +if [ "$(uname)" = 'Darwin' ]; then + # https://unix.stackexchange.com/a/96238 + if [ "${BASH_SOURCE:-x}" != 'x' ]; then + this_script=$BASH_SOURCE + elif [ "${ZSH_VERSION:-x}" != 'x' ]; then + setopt function_argzero + this_script=$0 + elif eval '[[ -n ${.sh.file} ]]' 2>/dev/null; then + eval 'this_script=${.sh.file}' + else + echo 1>&2 "Unsupported shell. Please use bash, ksh93 or zsh." + exit 2 + fi + relative_directory=$(dirname "$this_script") + SCRIPT_ABS_DIR=$(cd "$relative_directory" && pwd) +else + SCRIPT_ABS_PATH=$(readlink -f "$0") + SCRIPT_ABS_DIR=$(dirname "$SCRIPT_ABS_PATH") +fi + +# Check required tools are installed. +check_installed() { + if ! type "$1" > /dev/null; then + echo "Please ensure you have $1 installed." + exit 1 + fi +} + +readonly JOERN_INSTALL="$SCRIPT_ABS_DIR/joern-inst" + +if [ -d "${JOERN_INSTALL}" ]; then + echo "found existing local joern installation in $JOERN_INSTALL" + echo "should we wipe it and start fresh? [y/N]" + read ANSWER + if [ ! -z $ANSWER ]; then + if [ "y" == $ANSWER ] || [ "Y" == $ANSWER ]; then + rm -rf "$JOERN_INSTALL" + fi + fi +fi + +if [ ! -d "${JOERN_INSTALL}" ]; then + echo "downloading and installing joern $JOERN_VERSION..." + check_installed "curl" + + # Fetch installer + echo "https://github.com/ShiftLeftSecurity/joern/releases/download/v$JOERN_VERSION/joern-install.sh" + curl -L "https://github.com/ShiftLeftSecurity/joern/releases/download/v$JOERN_VERSION/joern-install.sh" -o "$SCRIPT_ABS_DIR/joern-install.sh" + + # Install into `joern-inst` + chmod +x $SCRIPT_ABS_DIR/joern-install.sh + $SCRIPT_ABS_DIR/joern-install.sh --install-dir="$JOERN_INSTALL" --version=v$JOERN_VERSION --without-plugins + rm $SCRIPT_ABS_DIR/joern-install.sh + rm joern-cli.zip +fi + +readonly JAR_INSTALL_DIR=${JOERN_INSTALL}/joern-cli/lib/ + +echo "Building extension" +sbt clean stage + +echo "Installing jars into: ${JAR_INSTALL_DIR}" +rm ${JAR_INSTALL_DIR}/io.shiftleft.codepropertygraph-domain-classes* +cp target/universal/stage/lib/org.codeminers.standalone-* ${JAR_INSTALL_DIR} +cp target/universal/stage/lib/org.codeminers.*domain* ${JAR_INSTALL_DIR} + +echo "All done, you're ready to go in $JOERN_INSTALL" diff --git a/joern b/joern new file mode 120000 index 0000000..7df6070 --- /dev/null +++ b/joern @@ -0,0 +1 @@ +joern-inst/joern-cli/joern \ No newline at end of file diff --git a/log4j2.xml b/log4j2.xml new file mode 100644 index 0000000..4752de6 --- /dev/null +++ b/log4j2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/project/Projects.scala b/project/Projects.scala new file mode 100644 index 0000000..d8fc9d6 --- /dev/null +++ b/project/Projects.scala @@ -0,0 +1,7 @@ +import sbt._ + +object Projects { + lazy val schema = project.in(file("schema")) + lazy val domainClasses = project.in(file("domain-classes")) + lazy val schemaExtender = project.in(file("schema-extender")) +} diff --git a/project/Versions.scala b/project/Versions.scala new file mode 100644 index 0000000..bd781e9 --- /dev/null +++ b/project/Versions.scala @@ -0,0 +1,20 @@ +object Versions { + val cpg = parseVersion("cpgVersion") + val joern = parseVersion("joernVersion") + val overflowdb = parseVersion("overflowdbVersion") + + private def parseVersion(key: String): String = { + val versionRegexp = s""".*val $key[ ]+=[ ]?"(.*?)"""".r + val versions: List[String] = scala.io.Source + .fromFile("build.sbt") + .getLines + .filter(_.contains(s"val $key")) + .collect { case versionRegexp(version) => version } + .toList + assert( + versions.size == 1, + s"""unable to extract $key from build.sbt, expected exactly one line like `val $key= "0.0.0-SNAPSHOT"`.""") + versions.head + } +} + diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..40b3b8e --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.9.0 diff --git a/project/meta-build.sbt b/project/meta-build.sbt new file mode 100644 index 0000000..9f4e5b6 --- /dev/null +++ b/project/meta-build.sbt @@ -0,0 +1,4 @@ +libraryDependencies ++= Seq( + "com.github.pathikrit" %% "better-files" % "3.8.0", +) + diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..035a822 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,5 @@ +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") +addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0") +addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7") +addSbtPlugin("io.shiftleft" % "sbt-overflowdb" % "2.98") diff --git a/schema-extender/build.sbt b/schema-extender/build.sbt new file mode 100644 index 0000000..8bad79d --- /dev/null +++ b/schema-extender/build.sbt @@ -0,0 +1,18 @@ +name := "standalone-schema-extender" + +val joernInstallPath = settingKey[File]("path to joern installation") +// joernInstallPath := Path.userHome / "bin/joern/joern-cli" +joernInstallPath := baseDirectory.value / "../joern-inst/joern-cli" + +val replaceDomainClassesInJoern = taskKey[Unit]("generates new domain classes based on the given schema, and installs them in the joern distribution") + +replaceDomainClassesInJoern := { + import java.nio.file._ + val newDomainClassesJar = (Projects.domainClasses/Compile/packageBin).value + + val targetFile = joernInstallPath.value / "lib" / s"io.shiftleft.codepropertygraph-domain-classes_2.13-${Versions.cpg}.jar" + assert(targetFile.exists, s"target jar assumed to be $targetFile, but that file doesn't exist...") + + println(s"copying $newDomainClassesJar to $targetFile") + Files.copy(newDomainClassesJar.toPath, targetFile.toPath, StandardCopyOption.REPLACE_EXISTING) +} diff --git a/schema/build.sbt b/schema/build.sbt new file mode 100644 index 0000000..3c1b316 --- /dev/null +++ b/schema/build.sbt @@ -0,0 +1,10 @@ +name := "standalone-schema" + +libraryDependencies += "io.shiftleft" %% "overflowdb-codegen" % "2.98" +libraryDependencies += "io.shiftleft" %% "codepropertygraph-schema" % Versions.cpg + +lazy val generatedSrcDir = settingKey[File]("root for generated sources - we want to check those in") +enablePlugins(OdbCodegenSbtPlugin) +generateDomainClasses / classWithSchema := "CpgExtSchema$" +generateDomainClasses / fieldName := "instance" +generateDomainClasses/outputDir := (Projects.domainClasses / generatedSrcDir).value diff --git a/schema/src/main/scala/CpgExtSchema.scala b/schema/src/main/scala/CpgExtSchema.scala new file mode 100644 index 0000000..c7910c9 --- /dev/null +++ b/schema/src/main/scala/CpgExtSchema.scala @@ -0,0 +1,24 @@ +import io.shiftleft.codepropertygraph.schema._ +import overflowdb.schema.SchemaBuilder +import overflowdb.schema.Property.ValueType + +class CpgExtSchema(builder: SchemaBuilder, cpgSchema: CpgSchema) { + + // Add node types, edge types, and properties here + + val myProperty = builder + .addProperty(name = "MYPROPERTY", valueType = ValueType.String) + .mandatory("") + + val myNodeType = builder + .addNodeType("MYNODETYPE") + .addProperty(myProperty) + +} + +object CpgExtSchema { + val builder = new SchemaBuilder(domainShortName = "Cpg", basePackage = "io.shiftleft.codepropertygraph.generated") + val cpgSchema = new CpgSchema(builder) + val cpgExtSchema = new CpgExtSchema(builder, cpgSchema) + val instance = builder.build +} diff --git a/src/main/scala/org/codeminers/standalone/Main.scala b/src/main/scala/org/codeminers/standalone/Main.scala new file mode 100644 index 0000000..7794d56 --- /dev/null +++ b/src/main/scala/org/codeminers/standalone/Main.scala @@ -0,0 +1,50 @@ +package org.codeminers.standalone + +import io.joern.javasrc2cpg.{Config, JavaSrc2Cpg} +import io.joern.x2cpg.X2Cpg.applyDefaultOverlays +import io.shiftleft.codepropertygraph.generated.Cpg +import io.shiftleft.codepropertygraph.generated.nodes.NewMynodetype +import io.shiftleft.passes.SimpleCpgPass +import io.shiftleft.semanticcpg.language._ +import overflowdb.BatchedUpdate + +import scala.util.{Failure, Success} + +/** Example program that makes use of Joern as a library + */ +object Main extends App { + + println("Hello Joern") + print("Creating CPG... ") + val directory = "testprogram" + val config = Config(inputPath = directory) + val cpgOrException = JavaSrc2Cpg().createCpg(config) + + cpgOrException match { + case Success(cpg) => + println("[DONE]") + println("Applying default overlays") + applyDefaultOverlays(cpg) + println("Printing all methods:") + println("=====================") + cpg.method.name.foreach(println) + println("=====================") + println("Running a custom pass to add some custom nodes") + new MyPass(cpg).createAndApply() + println("Running custom queries") + cpg.mynodetype.foreach(println) + cpg.mynodetype.myCustomStep.l + case Failure(exception) => + println("[FAILED]") + println(exception) + } +} + +/** Example of a custom pass that creates and stores a node in the CPG. + */ +class MyPass(cpg: Cpg) extends SimpleCpgPass(cpg) { + override def run(builder: BatchedUpdate.DiffGraphBuilder): Unit = { + val n = NewMynodetype().myproperty("foo") + builder.addNode(n) + } +} diff --git a/src/main/scala/org/codeminers/standalone/package.scala b/src/main/scala/org/codeminers/standalone/package.scala new file mode 100644 index 0000000..0f72452 --- /dev/null +++ b/src/main/scala/org/codeminers/standalone/package.scala @@ -0,0 +1,30 @@ +package org.codeminers + +import io.shiftleft.codepropertygraph.generated.{Cpg, NodeTypes} +import io.shiftleft.codepropertygraph.generated.nodes.Mynodetype +import overflowdb.traversal._ +import scala.jdk.CollectionConverters.IteratorHasAsScala + +package object standalone { + + /** Example of a custom language step + */ + implicit class MynodetypeSteps(val traversal: Traversal[Mynodetype]) extends AnyVal { + def myCustomStep: Traversal[Mynodetype] = { + println("custom step executed") + traversal + } + } + + /** Example implicit conversion that forwards to the `StandaloneStarters` class + */ + implicit def toStandaloneStarters(cpg: Cpg): StandaloneStarters = + new StandaloneStarters(cpg) +} + +/** Example of custom node type starters + */ +class StandaloneStarters(cpg: Cpg) { + def mynodetype: Traversal[Mynodetype] = + cpg.graph.nodes(NodeTypes.MYNODETYPE).asScala.cast[Mynodetype] +} diff --git a/src/test/scala/org/codeminers/standalone/MyTest.scala b/src/test/scala/org/codeminers/standalone/MyTest.scala new file mode 100644 index 0000000..5b90e1c --- /dev/null +++ b/src/test/scala/org/codeminers/standalone/MyTest.scala @@ -0,0 +1,37 @@ +package org.codeminers.standalone + +import io.shiftleft.codepropertygraph.generated.{Cpg, EdgeTypes} +import io.shiftleft.codepropertygraph.generated.nodes.{NewLiteral, NewMethod} +import io.shiftleft.passes.SimpleCpgPass +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec +import overflowdb.BatchedUpdate +import io.shiftleft.semanticcpg.language._ +import io.shiftleft.semanticcpg.testing.MockCpg +import better.files.{File => F} + +class MyTest extends AnyWordSpec with Matchers { + + "Foo" should { + + "description1" in { + val cpg = MockCpg().withMethod("foo") + .withCallInMethod("foo", "bar") + .withCustom{ case (diffGraph, cpg) => + val literal = NewLiteral().code("abc") + diffGraph.addNode(literal) + val block = cpg.method.block.head + diffGraph.addEdge(block, literal, EdgeTypes.AST) + } + .cpg + cpg.method.block.astChildren.isLiteral.foreach(println) + } + + "description2" in { + F.usingTemporaryFile("standalone"){ file => + println(file) + } + } + } + +} diff --git a/standalone b/standalone new file mode 120000 index 0000000..8d9dd7a --- /dev/null +++ b/standalone @@ -0,0 +1 @@ +target/universal/stage/bin/standalone \ No newline at end of file diff --git a/testprogram/Foo.java b/testprogram/Foo.java new file mode 100644 index 0000000..f0936c0 --- /dev/null +++ b/testprogram/Foo.java @@ -0,0 +1,4 @@ +class Foo { + + void myMethod(int x) { } +} diff --git a/updateDependencies.sh b/updateDependencies.sh new file mode 100755 index 0000000..c2f842b --- /dev/null +++ b/updateDependencies.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +NON_INTERACTIVE_OPTION=$1 +DEPENDENCY=$2 + +check_installed() { + if ! type "$1" > /dev/null; then + echo "Please ensure you have $1 installed." + exit 1 + fi +} + +check_installed curl + +# check if xmllint is installed +if type xmllint > /dev/null; then + USE_XMLLINT=1 #true +else + echo "warning: xmllint is not installed - will try with 'grep' as a fallback..." + USE_XMLLINT=0 #false +fi + +declare -A repos=( + [cpg]=https://repo1.maven.org/maven2/io/shiftleft/codepropertygraph-schema_3 + [joern]=https://repo1.maven.org/maven2/io/joern/console_2.13 + [overflowdb]=https://repo1.maven.org/maven2/io/shiftleft/overflowdb-core +) + +function latest_version { + local NAME=$1 + local REPO_URL=${repos[$NAME]} + local MVN_META_URL=$REPO_URL/maven-metadata.xml + local CURL_PARAMS="--silent --show-error $MVN_META_URL" + + if (( $USE_XMLLINT )) + then + curl $CURL_PARAMS | xmllint --xpath "/metadata/versioning/latest/text()" - + else + curl $CURL_PARAMS | grep '' | sed 's/[ ]*\([0-9.]*\)<\/latest>/\1/' + fi +} + +function update { + local NAME=$1 + if [[ -z "${repos[$NAME]}" ]]; then + echo "error: no repo url defined for $NAME" + exit 1; + fi + + local VERSION=$(latest_version $NAME) + local SEARCH="val ${NAME}Version\([ ]*\)= .*" + local OLD_VERSION=$(grep "$SEARCH" build.sbt | sed 's/.*"\(.*\)"/\1/') + + if [ "$VERSION" == "$OLD_VERSION" ] + then + echo "$NAME: unchanged ($VERSION)" + else + local REPLACE="val ${NAME}Version\1= \"$VERSION\"" + + if [ "$NON_INTERACTIVE_OPTION" == "--non-interactive" ] + then + echo "non-interactive mode, auto-updating $NAME: $OLD_VERSION -> $VERSION" + sed -i "s/$SEARCH/$REPLACE/" build.sbt + else + echo "update $NAME: $OLD_VERSION -> $VERSION? [Y/n]" + read ANSWER + if [ -z $ANSWER ] || [ "y" == $ANSWER ] || [ "Y" == $ANSWER ] + then + sed -i "s/$SEARCH/$REPLACE/" build.sbt + fi + fi + fi +} + +if [ "$DEPENDENCY" == "" ]; then + update cpg + update joern + update overflowdb +else + DEPENDENCY="${DEPENDENCY#--only=}" + update $DEPENDENCY +fi