Invokes the 9 relational predicates of Line vs Line.
552214
private boolean lineLinePredicates_(int half_edge, int id_a, int id_b) {
        boolean bRelationKnown = true;

        if (m_perform_predicates[MatrixPredicate.InteriorInterior])
        {
            interiorLineInteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorInterior);
        }

        if (m_perform_predicates[MatrixPredicate.InteriorBoundary])
        {
            interiorLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b, MatrixPredicate.InteriorBoundary);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorBoundary);
        }

        if (m_perform_predicates[MatrixPredicate.InteriorExterior])
        {
            interiorLineExteriorLine_(half_edge, id_a, id_b, MatrixPredicate.InteriorExterior);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorExterior);
        }

        if (m_perform_predicates[MatrixPredicate.BoundaryInterior])
        {
            interiorLineBoundaryLine_(half_edge, id_b, id_a, m_cluster_index_b, m_cluster_index_a, MatrixPredicate.BoundaryInterior);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryInterior);
        }

        if (m_perform_predicates[MatrixPredicate.BoundaryBoundary])
        {
            boundaryLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryBoundary);
        }

        if (m_perform_predicates[MatrixPredicate.BoundaryExterior])
        {
            boundaryLineExteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, MatrixPredicate.BoundaryExterior);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryExterior);
        }

        if (m_perform_predicates[MatrixPredicate.ExteriorInterior])
        {
            interiorLineExteriorLine_(half_edge, id_b, id_a, MatrixPredicate.ExteriorInterior);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorInterior);
        }

        if (m_perform_predicates[MatrixPredicate.ExteriorBoundary])
        {
            boundaryLineExteriorLine_(half_edge, id_b, id_a, m_cluster_index_b, MatrixPredicate.ExteriorBoundary);
            bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorBoundary);
        }

        return bRelationKnown;
	}
1270361
private static void analyzeNode(TreeGraphNode t, TreeGraphNode root, Collection<GrammaticalRelation> relations) {
    // if (t.numChildren() > 0) {          // don't do leaves
    if (t.isPhrasal()) {    // don't do leaves or preterminals!
      TreeGraphNode tHigh = t.highestNodeWithSameHead();
      for (GrammaticalRelation egr : relations) {
        if (egr.isApplicable(t)) {
          for (Tree u : egr.getRelatedNodes(t, root)) {
            tHigh.addArc(GrammaticalRelation.getAnnotationClass(egr), (TreeGraphNode) u);
          }
        }
      }
      // now recurse into children
      for (TreeGraphNode kid : t.children()) {
        analyzeNode(kid, root, relations);
      }
    }
  }
515489
def filter(self,
               predicate: Callable[[FileLine], 'FileLineSet']
               ) -> 'FileLineSet':
        
        filtered = [fileline for fileline in self if predicate(fileline)]
        return FileLineSet.from_list(filtered)
835478
def get_lines(handle, line):
    
    for i, l in enumerate(handle):
        if i == line:
            return l
1310358
def handle_nested_relation(self, line: str, position: int, tokens: ParseResults):
        
        if not self.allow_nested:
            raise NestedRelationWarning(self.get_line_number(), line, position)

        self._handle_relation_harness(line, position, {
            SUBJECT: tokens[SUBJECT],
            RELATION: tokens[RELATION],
            OBJECT: tokens[OBJECT][SUBJECT],
        })

        self._handle_relation_harness(line, position, {
            SUBJECT: tokens[OBJECT][SUBJECT],
            RELATION: tokens[OBJECT][RELATION],
            OBJECT: tokens[OBJECT][OBJECT],
        })
        return tokens
771029
public static Parser<Void> many1(CharPredicate predicate) {
    return Patterns.many1(predicate).toScanner(predicate + "+");
  }
279478
private void setAreaLinePredicates_() {
        m_predicates_half_edge = Predicates.AreaLinePredicates;
        m_predicates_cluster = Predicates.AreaPointPredicates;

        m_max_dim[MatrixPredicate.InteriorInterior] = 1;
        m_max_dim[MatrixPredicate.InteriorBoundary] = 0;
        m_max_dim[MatrixPredicate.InteriorExterior] = 2;
        m_max_dim[MatrixPredicate.BoundaryInterior] = 1;
        m_max_dim[MatrixPredicate.BoundaryBoundary] = 0;
        m_max_dim[MatrixPredicate.BoundaryExterior] = 1;
        m_max_dim[MatrixPredicate.ExteriorInterior] = 1;
        m_max_dim[MatrixPredicate.ExteriorBoundary] = 0;
        m_max_dim[MatrixPredicate.ExteriorExterior] = 2;

        if (m_perform_predicates[MatrixPredicate.ExteriorExterior])
        {
            m_matrix[MatrixPredicate.ExteriorExterior] = 2; // Always true
            m_perform_predicates[MatrixPredicate.ExteriorExterior] = false;
            m_predicate_count--;
        }
	}
236030
public Predicate connect(List<Predicate> predicates, Connective connective) {
        Predicate[] predicateArray = predicates.toArray(new Predicate[predicates.size()]);

        switch (connective) {
            case AND:
                return cb.and(predicateArray);
            case OR:
                return cb.or(predicateArray);
            default:
                throw new UnsupportedOperationException("Unknown connective " + connective);
        }
    }
617332
def And(*predicates, **kwargs):
    
    if kwargs:
        predicates += Query(**kwargs),
    return _flatten(_And, *predicates)
1298417
def p_iteration_statement_2(self, p):
        """"""
        p[0] = ast.While(predicate=p[3], statement=p[5])
95273
private void interiorLineBoundaryLine_(int half_edge, int id_a, int id_b,
			int cluster_index_a, int cluster_index_b, int predicate) {
		if (m_matrix[predicate] == 0)
			return;

		if (m_topo_graph.getHalfEdgeUserIndex(m_topo_graph
				.getHalfEdgePrev(m_topo_graph.getHalfEdgeTwin(half_edge)),
				m_visited_index) != 1) {
			int cluster = m_topo_graph.getHalfEdgeTo(half_edge);
			int clusterParentage = m_topo_graph.getClusterParentage(cluster);

			if ((clusterParentage & id_a) != 0
					&& (clusterParentage & id_b) != 0) {
				int index_a = m_topo_graph.getClusterUserIndex(cluster,
						cluster_index_a);
				int index_b = m_topo_graph.getClusterUserIndex(cluster,
						cluster_index_b);
				assert (index_a != -1);
				assert (index_b != -1);

				if ((index_a % 2 == 0) && (index_b % 2 != 0)) {
					assert ((m_topo_graph.getClusterParentage(cluster) & id_a) != 0 && (m_topo_graph
							.getClusterParentage(cluster) & id_b) != 0);
					m_matrix[predicate] = 0;
				}
			}
		}
	}
224788
def directed_predicates_in_expression(expression: ShExJ.shapeExpr, cntxt: Context) -> Dict[IRIREF, PredDirection]:
    
    dir_predicates: Dict[IRIREF, PredDirection] = {}

    def predicate_finder(predicates: Dict[IRIREF, PredDirection], tc: ShExJ.TripleConstraint, _: Context) -> None:
        if isinstance(tc, ShExJ.TripleConstraint):
            predicates.setdefault(tc.predicate, PredDirection()).dir(tc.inverse is None or not tc.inverse)

    def triple_expr_finder(predicates: Dict[IRIREF, PredDirection], expr: ShExJ.shapeExpr, cntxt_: Context) -> None:
        if isinstance(expr, ShExJ.Shape) and expr.expression is not None:
            cntxt_.visit_triple_expressions(expr.expression, predicate_finder, predicates)

    # TODO: follow_inner_shapes as True probably goes too far, but we definitely need to cross shape/triplecons
    cntxt.visit_shapes(expression, triple_expr_finder, dir_predicates, follow_inner_shapes=False)
    return dir_predicates
1101865
public void optimizeLineSection() {

/* Some debugging code
        for (int i = 0; i < lineData.size(); i++) {
            LineInfo li = (LineInfo)lineData.get(i);
            System.out.print(li.toString());
        }
*/
        //Incorporate each LineInfo into the previous LineInfo's 
        //outputLineIncrement, if possible
        int i = 0;
        while (i < lineData.size() - 1) {
            LineInfo li = lineData.get(i);
            LineInfo liNext = lineData.get(i + 1);
            if (!liNext.lineFileIDSet
                && liNext.inputStartLine == li.inputStartLine
                && liNext.inputLineCount == 1
                && li.inputLineCount == 1
                && liNext.outputStartLine
                    == li.outputStartLine
                        + li.inputLineCount * li.outputLineIncrement) {
                li.setOutputLineIncrement(
                    liNext.outputStartLine
                        - li.outputStartLine
                        + liNext.outputLineIncrement);
                lineData.remove(i + 1);
            } else {
                i++;
            }
        }

        //Incorporate each LineInfo into the previous LineInfo's
        //inputLineCount, if possible
        i = 0;
        while (i < lineData.size() - 1) {
            LineInfo li = lineData.get(i);
            LineInfo liNext = lineData.get(i + 1);
            if (!liNext.lineFileIDSet
                && liNext.inputStartLine == li.inputStartLine + li.inputLineCount
                && liNext.outputLineIncrement == li.outputLineIncrement
                && liNext.outputStartLine
                    == li.outputStartLine
                        + li.inputLineCount * li.outputLineIncrement) {
                li.setInputLineCount(li.inputLineCount + liNext.inputLineCount);
                lineData.remove(i + 1);
            } else {
                i++;
            }
        }
    }
718109
private int countRelations(String relationName, Set<RelationshipTuple> objectRelations) {

        int count = 0;
        if (objectRelations == null) {
            return 0;
        }
        for (RelationshipTuple objectRelation : objectRelations) {
            if (objectRelation.predicate.equals(relationName)) {//This is one of the restricted relations
                count++;
            }

        }
        return count;
    }
124985
def string_on_predicate0(compiler, cont, test):
  ''''''
  test = test.interlang()
  text = compiler.new_var(il.ConstLocalVar('text'))
  pos = compiler.new_var(il.ConstLocalVar('pos'))
  length = compiler.new_var(il.ConstLocalVar('length'))
  p = compiler.new_var(il.LocalVar('p'))
  if not isinstance(test, il.PyFunction):
    raise DaoCompileTypeError(test)
  return il.Begin((
    il.AssignFromList(text, pos, il.parse_state),
    il.Assign(length, il.Len(text)),
    il.If(il.Ge(pos,il.Len(text)), 
      cont(il.String('')),
      il.begin(
        il.Assign(p, pos),
        il.While(il.And(il.Lt(p, length), il.Call(test, il.GetItem(text, p))),
               il.AddAssign(p, il.Integer(1))),
        il.SetParseState(il.Tuple(text, p)),
        il.append_failcont(compiler, 
                           il.SetParseState(il.Tuple(text, pos))),
        cont(il.GetItem(text, il.Slice2(pos, p)))))))
599881
private static int getPredefinedRelation_(String scl, int dim_a, int dim_b) {
		if (equals_(scl))
			return RelationalOperations.Relation.equals;

		if (disjoint_(scl))
			return RelationalOperations.Relation.disjoint;

		if (touches_(scl, dim_a, dim_b))
			return RelationalOperations.Relation.touches;

		if (crosses_(scl, dim_a, dim_b))
			return RelationalOperations.Relation.crosses;

		if (contains_(scl))
			return RelationalOperations.Relation.contains;

		if (overlaps_(scl, dim_a, dim_b))
			return RelationalOperations.Relation.overlaps;

		return RelationalOperations.Relation.unknown;
	}
985269
public static <T1, T2> BiPredicate<T1, T2> and(BiPredicate<T1, T2>... predicates) {
        dbc.precondition(predicates != null, "predicates is null");
        return Logic.Binary.and(Iterations.iterable(predicates));
    }