Returns true if this patterns matches at least the direction of one
of the relations in the other relation patterns. Matching is defined
by {@linkplain RelationDirection#contains(RelationDirection)}
@param relationPattern
@return
439381
public boolean matchesOne(RelationPattern relationPattern) {
	for (int i = 0; i < directions.length; i++) {
	    if (directions[i].contains(relationPattern.directions[i]))
		return true;
	}
	return false;
    }
332507
@Override
	public boolean hasNextCase() {
		// this method only returns true if dependent values are grouped
		if (!dependent) {
			return false;
		}
		for (Constraint c : constraints) {
			if (c.hasNextCase()) {
				return true;
			}
		}
		return false;
	}
972654
private static boolean multiPointRelatePoint_(MultiPoint multipoint_a,
			Point point_b, double tolerance, int relation,
			ProgressTracker progress_tracker) {
		switch (relation) {
		case Relation.disjoint:
			return multiPointDisjointPoint_(multipoint_a, point_b, tolerance,
					progress_tracker);

		case Relation.within:
			return multiPointWithinPoint_(multipoint_a, point_b, tolerance,
					progress_tracker);

		case Relation.contains:
			return multiPointContainsPoint_(multipoint_a, point_b, tolerance,
					progress_tracker);

		case Relation.equals:
			return multiPointEqualsPoint_(multipoint_a, point_b, tolerance,
					progress_tracker);

		default:
			break; // warning fix
		}

		return false;
	}
650601
private final boolean matchPattern(byte[][] patterns, int bufferIndex)
   {
      boolean match = false;
      for (byte[] pattern : patterns)
      {
         int index = 0;
         match = true;
         for (byte b : pattern)
         {
            if (b != m_buffer[bufferIndex + index])
            {
               match = false;
               break;
            }
            ++index;
         }
         if (match)
         {
            break;
         }
      }
      return match;
   }
449780
public static Predicate<MailMessage> forSubject(final Pattern subjectPattern) {
		return new Predicate<MailMessage>() {
			@Override
			public boolean apply(final MailMessage input) {
				return subjectPattern.matcher(input.getSubject()).matches();
			}

			@Override
			public String toString() {
				return String.format("subject to match pattern '%s'", subjectPattern);
			}
		};
	}
1253718
static boolean isNestedArrayPattern(Node n) {
    checkState(n.isArrayPattern());
    for (Node key = n.getFirstChild(); key != null; key = key.getNext()) {
      if (key.hasChildren()) {
        return true;
      }
    }
    return false;
  }
1369491
public static boolean matches(Collection<PathPattern> patterns, List<String> path) {
		for (PathPattern pattern : patterns)
			if (pattern.matches(path))
				return true;
		return false;
	}
343484
def check_next_match(self, match, new_relations, subject_graph, one_match):
        """"""
        if not CustomPattern.check_next_match(self, match, new_relations, subject_graph, one_match):
            return False
        if self.strong:
            # can this ever become a strong ring?
            vertex1_start = match.forward[self.pattern_graph.central_vertex]
            for vertex1 in new_relations.values():
                paths = list(subject_graph.iter_shortest_paths(vertex1, vertex1_start))
                if self.size % 2 == 0 and len(match) == self.size:
                    if len(paths) != 2:
                        #print "NRingPattern.check_next_match: not strong a.1"
                        return False
                    for path in paths:
                        if len(path) != len(match)//2+1:
                            #print "NRingPattern.check_next_match: not strong a.2"
                            return False
                else:
                    if len(paths) != 1:
                        #print "NRingPattern.check_next_match: not strong b.1"
                        return False
                    if len(paths[0]) != (len(match)+1)//2:
                        #print "NRingPattern.check_next_match: not strong b.2"
                        return False
            #print "RingPattern.check_next_match: no remarks"
        return True
1239213
public static boolean matches(String[] patterns, String value) {
        for (int i = 0; i < patterns.length; i++) {
            String pattern = patterns[i];
            if (pattern.equals(value)) {
                return true;
            }
            if (pattern.endsWith("*")) {
                if (value.startsWith(pattern.substring(0, pattern.length() - 1))) {
                    return true;
                }
            }
            if (pattern.startsWith("*")) {
                if (value.endsWith(pattern.substring(1))) {
                    return true;
                }
            }
        }
        return false;
    }
988889
private void lhsPattern( PatternDescrBuilder< ? > pattern,
                             String label,
                             boolean isUnification ) throws RecognitionException {
        boolean query = false;
        if ( input.LA( 1 ) == DRL5Lexer.QUESTION ) {
            match( input,
                   DRL5Lexer.QUESTION,
                   null,
                   null,
                   DroolsEditorType.SYMBOL );
            if ( state.failed ) return;
            query = true;
        }

        String type = this.qualifiedIdentifier();
        if ( state.failed ) return;

        if ( state.backtracking == 0 ) {
            pattern.type( type );
            pattern.isQuery( query );
            if ( label != null ) {
                pattern.id( label,
                            isUnification );
            }
        }

        match( input,
               DRL5Lexer.LEFT_PAREN,
               null,
               null,
               DroolsEditorType.SYMBOL );
        if ( state.failed ) return;

        if ( input.LA( 1 ) != DRL5Lexer.RIGHT_PAREN && speculatePositionalConstraints() ) {
            positionalConstraints( pattern );
        }

        if ( input.LA( 1 ) != DRL5Lexer.RIGHT_PAREN ) {
            constraints( pattern );
        }

        match( input,
               DRL5Lexer.RIGHT_PAREN,
               null,
               null,
               DroolsEditorType.SYMBOL );
        if ( state.failed ) return;

        while ( input.LA( 1 ) == DRL5Lexer.AT ) {
            // annotation*
            annotation( pattern );
            if ( state.failed ) return;
        }

        if ( helper.validateIdentifierKey( DroolsSoftKeywords.OVER ) ) {
            //           || input.LA( 1 ) == DRL5Lexer.PIPE ) {
            patternFilter( pattern );
        }

        if ( helper.validateIdentifierKey( DroolsSoftKeywords.FROM ) ) {
            patternSource( pattern );
        }

        if ( state.backtracking == 0 ) {
            helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
        }
    }
1334579
public boolean matches(Object left, Object right) {
    if (left == null && right == null) {
      // if both are null L == R
      return true;
    }
    if (left == null || right == null) {
      // we know both aren't null, therefore L != R
      return false;
    }
    final String arg = left.toString();
    if (right instanceof java.util.regex.Pattern) {
      return ((java.util.regex.Pattern) right).matcher(arg).matches();
    }
    else {
      return arg.matches(right.toString());
    }
  }
902131
public CharSequence matchesPattern(final CharSequence input, final String pattern, final String message) {
        if (!Pattern.matches(pattern, input)) {
            fail(message);
        }
        return input;
    }
1253812
public boolean matches(LinkedList<Node> nodePath) {
        if(simplePattern) {
            // simple pattern
            return items.get(0).matches(nodePath.getLast());
        }
        // match the full pattern
        if(items.size() != nodePath.size()) {
            // different size
            return false;
        }
        for(int i=0; i<items.size(); i++) {
            if (! items.get(i).matches(nodePath.get(i))) {
                // failed a comparison
                return false;
            }
        }
        // pass all comparisons
        return true;
    }
767865
public static boolean matches(String pattern, String value) {
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(value);
        return m.matches();
    }
683936
public static void validateNodeAndPatterns(final Node node, final Pattern... patterns)
            throws IllegalArgumentException
   {
      // Precondition checks
      if (node == null)
      {
         throw new IllegalArgumentException("node must be specified");
      }
      if (patterns == null || patterns.length == 0)
      {
         throw new IllegalArgumentException("At least one pattern must be specified");
      }

      // OK
   }
287456
private static boolean multiPointRelateMultiPoint_(MultiPoint multipoint_a,
			MultiPoint multipoint_b, double tolerance, int relation,
			ProgressTracker progress_tracker) {
		switch (relation) {
		case Relation.disjoint:
			return multiPointDisjointMultiPoint_(multipoint_a, multipoint_b,
					tolerance, progress_tracker);

		case Relation.within:
			return multiPointContainsMultiPoint_(multipoint_b, multipoint_a,
					tolerance, progress_tracker);

		case Relation.contains:
			return multiPointContainsMultiPoint_(multipoint_a, multipoint_b,
					tolerance, progress_tracker);

		case Relation.equals:
			return multiPointEqualsMultiPoint_(multipoint_a, multipoint_b,
					tolerance, progress_tracker);

		case Relation.overlaps:
			return multiPointOverlapsMultiPoint_(multipoint_a, multipoint_b,
					tolerance, progress_tracker);

		default:
			break; // warning fix
		}

		return false;
	}
1052434
public static boolean hasNamedAnnotation(AnnotatedConstruct ac, Pattern pattern) {
    for (AnnotationMirror annotation : ac.getAnnotationMirrors()) {
      if (pattern.matcher(getName(annotation.getAnnotationType().asElement())).matches()) {
        return true;
      }
    }
    return false;
  }