io.shiftleft.codepropertygraph.generated.traversals.TraversalClosurebindingBase.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codepropertygraph-domain-classes_3 Show documentation
Show all versions of codepropertygraph-domain-classes_3 Show documentation
codepropertygraph-domain-classes
package io.shiftleft.codepropertygraph.generated.traversals
import io.shiftleft.codepropertygraph.generated.nodes
import io.shiftleft.codepropertygraph.generated.accessors.languagebootstrap.*
final class TraversalClosurebindingBase[NodeType <: nodes.ClosureBindingBase](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 (!flatgraph.misc.Regex.isRegex(pattern)) {
closureBindingIdExact(pattern)
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filter { item =>
val tmp = item.closureBindingId; tmp.isDefined && matcher.reset(tmp.get).matches
}
}
}
/** Traverse to nodes where the closureBindingId matches at least one of the regular expressions in `values`
*/
def closureBindingId(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filter { item =>
val tmp = item.closureBindingId; tmp.isDefined && matchers.exists { _.reset(tmp.get).matches }
}
}
/** Traverse to nodes where closureBindingId matches `value` exactly.
*/
def closureBindingIdExact(value: String): Iterator[NodeType] = traversal match {
case init: flatgraph.misc.InitNodeIterator[flatgraph.GNode @unchecked] if init.isVirgin && init.hasNext =>
val someNode = init.next
flatgraph.Accessors
.getWithInverseIndex(someNode.graph, someNode.nodeKind, 8, value)
.asInstanceOf[Iterator[NodeType]]
case _ =>
traversal.filter { node =>
val tmp = node.closureBindingId; tmp.isDefined && tmp.get == value
}
}
/** Traverse to nodes where closureBindingId matches one of the elements in `values` exactly.
*/
def closureBindingIdExact(values: String*): Iterator[NodeType] =
if (values.length == 1) closureBindingIdExact(values.head)
else {
val valueSet = values.toSet
traversal.filter { item =>
val tmp = item.closureBindingId; tmp.isDefined && valueSet.contains(tmp.get)
}
}
/** Traverse to nodes where closureBindingId does not match the regular expression `value`.
*/
def closureBindingIdNot(pattern: String): Iterator[NodeType] = {
if (!flatgraph.misc.Regex.isRegex(pattern)) {
traversal.filter { node => node.closureBindingId.isEmpty || node.closureBindingId.get != pattern }
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filterNot { item =>
val tmp = item.closureBindingId; tmp.isDefined && matcher.reset(tmp.get).matches
}
}
}
/** Traverse to nodes where closureBindingId does not match any of the regular expressions in `values`.
*/
def closureBindingIdNot(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filterNot { item =>
val tmp = item.closureBindingId; tmp.isDefined && matchers.exists { _.reset(tmp.get).matches }
}
}
/** 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 (!flatgraph.misc.Regex.isRegex(pattern)) {
closureOriginalNameExact(pattern)
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filter { item =>
val tmp = item.closureOriginalName; tmp.isDefined && matcher.reset(tmp.get).matches
}
}
}
/** Traverse to nodes where the closureOriginalName matches at least one of the regular expressions in `values`
*/
def closureOriginalName(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filter { item =>
val tmp = item.closureOriginalName; tmp.isDefined && matchers.exists { _.reset(tmp.get).matches }
}
}
/** Traverse to nodes where closureOriginalName matches `value` exactly.
*/
def closureOriginalNameExact(value: String): Iterator[NodeType] = traversal match {
case init: flatgraph.misc.InitNodeIterator[flatgraph.GNode @unchecked] if init.isVirgin && init.hasNext =>
val someNode = init.next
flatgraph.Accessors
.getWithInverseIndex(someNode.graph, someNode.nodeKind, 9, value)
.asInstanceOf[Iterator[NodeType]]
case _ =>
traversal.filter { node =>
val tmp = node.closureOriginalName; tmp.isDefined && tmp.get == value
}
}
/** Traverse to nodes where closureOriginalName matches one of the elements in `values` exactly.
*/
def closureOriginalNameExact(values: String*): Iterator[NodeType] =
if (values.length == 1) closureOriginalNameExact(values.head)
else {
val valueSet = values.toSet
traversal.filter { item =>
val tmp = item.closureOriginalName; tmp.isDefined && valueSet.contains(tmp.get)
}
}
/** Traverse to nodes where closureOriginalName does not match the regular expression `value`.
*/
def closureOriginalNameNot(pattern: String): Iterator[NodeType] = {
if (!flatgraph.misc.Regex.isRegex(pattern)) {
traversal.filter { node => node.closureOriginalName.isEmpty || node.closureOriginalName.get != pattern }
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filterNot { item =>
val tmp = item.closureOriginalName; tmp.isDefined && matcher.reset(tmp.get).matches
}
}
}
/** Traverse to nodes where closureOriginalName does not match any of the regular expressions in `values`.
*/
def closureOriginalNameNot(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filterNot { item =>
val tmp = item.closureOriginalName; tmp.isDefined && matchers.exists { _.reset(tmp.get).matches }
}
}
/** 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 (!flatgraph.misc.Regex.isRegex(pattern)) {
evaluationStrategyExact(pattern)
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filter { item => matcher.reset(item.evaluationStrategy).matches }
}
/** Traverse to nodes where the evaluationStrategy matches at least one of the regular expressions in `values`
*/
def evaluationStrategy(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filter { item => matchers.exists { _.reset(item.evaluationStrategy).matches } }
}
/** Traverse to nodes where evaluationStrategy matches `value` exactly.
*/
def evaluationStrategyExact(value: String): Iterator[NodeType] = traversal match {
case init: flatgraph.misc.InitNodeIterator[flatgraph.GNode @unchecked] if init.isVirgin && init.hasNext =>
val someNode = init.next
flatgraph.Accessors
.getWithInverseIndex(someNode.graph, someNode.nodeKind, 19, value)
.asInstanceOf[Iterator[NodeType]]
case _ => traversal.filter { _.evaluationStrategy == value }
}
/** Traverse to nodes where evaluationStrategy matches one of the elements in `values` exactly.
*/
def evaluationStrategyExact(values: String*): Iterator[NodeType] =
if (values.length == 1) evaluationStrategyExact(values.head)
else {
val valueSet = values.toSet
traversal.filter { item => valueSet.contains(item.evaluationStrategy) }
}
/** Traverse to nodes where evaluationStrategy does not match the regular expression `value`.
*/
def evaluationStrategyNot(pattern: String): Iterator[NodeType] = {
if (!flatgraph.misc.Regex.isRegex(pattern)) {
traversal.filter { node => node.evaluationStrategy != pattern }
} else {
val matcher = flatgraph.misc.Regex.multilineMatcher(pattern)
traversal.filterNot { item => matcher.reset(item.evaluationStrategy).matches }
}
}
/** Traverse to nodes where evaluationStrategy does not match any of the regular expressions in `values`.
*/
def evaluationStrategyNot(patterns: String*): Iterator[NodeType] = {
val matchers = patterns.map(flatgraph.misc.Regex.multilineMatcher)
traversal.filter { item => matchers.find { _.reset(item.evaluationStrategy).matches }.isEmpty }
}
}