Checks which side is the first PhysicalEntity, and gathers participants on either the other
side or the same side.
@param match current pattern match
@param ind mapped indices
@return participants at the desired side
558149
@Override
	public Collection<BioPAXElement> generate(Match match, int... ind)
	{
		assertIndLength(ind);

		PhysicalEntity pe1 = (PhysicalEntity) match.get(ind[0]);
		Conversion conv = (Conversion) match.get(ind[1]);

		Set<PhysicalEntity> parts;

		if (conv.getLeft().contains(pe1))
		{
			parts = sideType == Type.OTHER_SIDE ? conv.getRight() : conv.getLeft();
		}
		else if (conv.getRight().contains(pe1))
		{
			parts = sideType == Type.SAME_SIDE ? conv.getRight() : conv.getLeft();
		}
		else throw new IllegalArgumentException(
				"The PhysicalEntity has to be a participant of the Conversion.");

		if (blacklist == null) return new HashSet<BioPAXElement>(parts);
		else
		{
			ConversionDirectionType dir = getDirection(conv);

			if ((dir == ConversionDirectionType.LEFT_TO_RIGHT && ((relType == RelType.INPUT && parts != conv.getLeft()) || (relType == RelType.OUTPUT && parts != conv.getRight()))) ||
				(dir == ConversionDirectionType.RIGHT_TO_LEFT && ((relType == RelType.INPUT && parts != conv.getRight()) || (relType == RelType.OUTPUT && parts != conv.getLeft()))))
				return Collections.emptySet();

			return new HashSet<BioPAXElement>(blacklist.getNonUbiques(parts, relType));
		}
	}
439859
@Override
    public boolean matches(IAtom atom) {
        // h counts should be set before match throw runtime exception?
        if (atom.getImplicitHydrogenCount() == null)
            return false;
        return atom.getImplicitHydrogenCount() == hcount;
    }
689111
public List<Object> match() {
        final IntMatchResults result = new IntMatchResults();
        if (matches(result)) {
            return result.getIntResultList();
        } else {
            return null;
        }
    }
1356401
@Override
    public boolean matches(IAtom atom) {

        if (!((IQueryAtom) query.getAtom(0)).matches(atom)) return false;

        if (query.getAtomCount() == 1) return true;

        IAtomContainer target = invariants(atom).target();

        return cache.getUnchecked(target).get(target.indexOf(atom));
    }
1332178
private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
		return (matchers.size() > index) ? matchers.get(index).match(value) : true;
	}
305265
public T match(I item)
    {
        Set<T> set = mapSet.get(item);
        if (set.size() == 1)
        {
            T match = set.iterator().next();
            unmap(match);
            return match;
        }
        return null;
    }
1208932
private static boolean isCollectionMatching(Joinable mainSideJoinable, OgmCollectionPersister inverseSidePersister) {
		boolean isSameTable = mainSideJoinable.getTableName().equals( inverseSidePersister.getTableName() );

		if ( !isSameTable ) {
			return false;
		}

		return Arrays.equals( mainSideJoinable.getKeyColumnNames(), inverseSidePersister.getElementColumnNames() );
	}
769957
public char match(ISense source, ISense target) throws MatcherLibraryException {
        List<ISense> sourceList = getAncestors(source, depth);
        List<ISense> targetList = getAncestors(target, depth);
        targetList.retainAll(sourceList);
        if (targetList.size() > 0)
            return IMappingElement.EQUIVALENCE;
        else
            return IMappingElement.IDK;
    }
807108
public boolean isOuterJoin(int index) throws IndexOutOfBoundsException {
        if (index < 0) {
            throw new IndexOutOfBoundsException();
        }
        if (mOuterJoin == null) {
            if (index > getChainCount()) {
                throw new IndexOutOfBoundsException();
            }
            return false;
        }
        return mOuterJoin[index];
    }
839304
@Override
	public Collection<BioPAXElement> generate(Match match, int... ind)
	{
		Interaction inter = (Interaction) match.get(ind[0]);

		Set<Entity> taboo = new HashSet<Entity>();

		for (int i = 1; i < getVariableSize() - 1; i++)
		{
			taboo.add((Entity) match.get(ind[i]));
		}

		if (direction == null) return generate(inter, taboo);
		else return generate((Conversion) inter, direction, taboo);
	}
316744
public boolean matches(String target, Match match) {
		return this.matches(target, 0, target.length(), match);
	}
1259227
@Override
	public Collection<BioPAXElement> generate(Match match, int... ind)
	{

		Collection<BioPAXElement> gen = new HashSet<BioPAXElement> (
			con[0].generate(match, ind));

		Set<BioPAXElement> input = new HashSet<BioPAXElement>();
		Set<BioPAXElement> output = new HashSet<BioPAXElement>(gen);
		int[] tempInd = {0, 1};

		for (int i = 1; i < con.length; i++)
		{
			if (output.isEmpty()) break;
			input.clear();
			input.addAll(output);
			output.clear();

			for (BioPAXElement ele : input)
			{
				Match m = new Match(2);
				m.set(ele, 0);
				output.addAll(con[i].generate(m, tempInd));
			}
		}

		return output;
	}
819591
public NamedPatternMatch<E> match(final String string) {
        final Matcher matcher = pattern.matcher(string);
        while (matcher.find()) {

            final int start = matcher.start();
            final int end = matcher.end();

            if (start == 0 && end == string.length()) {
                final Map<E, String> resultMap = new EnumMap<>(groupEnum);
                final Set<Entry<E, Integer>> entries = groupIndexes.entrySet();
                for (final Entry<E, Integer> entry : entries) {
                    final E group = entry.getKey();
                    final Integer groupIndex = entry.getValue();
                    final String result = matcher.group(groupIndex);
                    resultMap.put(group, result);
                }
                return new NamedPatternMatch<>(resultMap);
            }
        }

        return null;
    }
245084
@Override
    public boolean matchesIndexValue(int v) {
        if (pattern.length() == 0) {
            return true;
        }
        int c = UTF16.charAt(pattern, 0);
        UnicodeMatcher m = data.lookupMatcher(c);
        return (m == null) ? ((c & 0xFF) == v) : m.matchesIndexValue(v);
    }
410825
@Override
    public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> seed,
                                                                     final IPersonAttributeDaoFilter filter) {
        Validate.notNull(seed, "Argument 'seed' cannot be null.");

        if (patterns == null || patterns.size() < 1) {
            throw new IllegalStateException("patterns Map may not be null and must contain at least 1 mapping.");
        }
        if (targetPersonAttributeDao == null) {
            throw new IllegalStateException("targetPersonAttributeDao may not be null");
        }

        //Flag for patterns that match
        boolean matchedPatterns = false;

        //Iterate through all attributeName/pattern pairs
        for (final Map.Entry<String, Pattern> patternEntry : this.patterns.entrySet()) {
            final String attributeName = patternEntry.getKey();
            final List<Object> attributeValues = seed.get(attributeName);

            //Check if the value exists
            if (attributeValues == null) {
                if (this.matchAllPatterns) {
                    //Need to match ALL patters, if the attribute isn't in the seed it can't be matched, return null
                    if (this.logger.isInfoEnabled()) {
                        this.logger.info("All patterns must match and attribute='" + attributeName + "' does not exist in the seed, returning null.");
                    }

                    return null;
                }

                //Don't need to match all, just go to the next attribute and see if it exists
                continue;
            }

            //The pattern to test the attribute's value(s) with
            final Pattern compiledPattern = patternEntry.getValue();
            if (compiledPattern == null) {
                throw new IllegalStateException("Attribute '" + attributeName + "' has a null pattern");
            }

            //Flag for matching the pattern on the values
            boolean matchedValues = false;

            //Iterate over the values for the attribute, testing each against the pattern
            for (final Object valueObj : attributeValues) {
                final String value;
                try {
                    value = (String) valueObj;
                } catch (final ClassCastException cce) {
                    final IllegalArgumentException iae = new IllegalArgumentException("RegexGatewayPersonAttributeDao can only accept seeds who's values are String or List of String. Attribute '" + attributeName + "' has a non-String value.");
                    iae.initCause(cce);
                    throw iae;
                }

                //Check if the value matches the pattern
                final Matcher valueMatcher = compiledPattern.matcher(value);
                matchedValues = valueMatcher.matches();

                //Only one value needs to be matched, this one matched so no need to test the rest, break out of the loop
                if (matchedValues && !this.matchAllValues) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("value='" + value + "' matched pattern='" + compiledPattern + "' and only one value match is needed, leaving value matching loop.");
                    }

                    break;
                }
                //Need to match all values, this one failed so no need to test the rest, break out of the loop
                else if (!matchedValues && this.matchAllValues) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("value='" + value + "' did not match pattern='" + compiledPattern + "' and all values need to match, leaving value matching loop.");
                    }

                    break;
                }
                //Extra logging
                else if (this.logger.isDebugEnabled()) {
                    if (matchedValues) {
                        this.logger.debug("value='" + value + "' matched pattern='" + compiledPattern + "' and all values need to match, continuing value matching loop.");
                    } else {
                        this.logger.debug("value='" + value + "' did not match pattern='" + compiledPattern + "' and only one value match is needed, continuing value matching loop.");
                    }
                }
            }

            matchedPatterns = matchedValues;

            //Only one pattern needs to be matched, this one matched so no need to test the rest, break out of the loop
            if (matchedPatterns && !this.matchAllPatterns) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("pattern='" + compiledPattern + "' found a match and only one pattern match is needed, leaving pattern matching loop.");
                }

                break;
            }
            //Need to match all patterns, this one failed so no need to test the rest, break out of the loop
            else if (!matchedPatterns && this.matchAllPatterns) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("pattern='" + compiledPattern + "' did not find a match and all patterns need to match, leaving pattern matching loop.");
                }

                break;
            }
            //Extra logging
            else if (this.logger.isDebugEnabled()) {
                if (matchedPatterns) {
                    this.logger.debug("pattern='" + compiledPattern + "' found a match and all patterns need to match, continuing pattern matching loop.");
                } else {
                    this.logger.debug("pattern='" + compiledPattern + "' did not find a match and only one pattern match is needed, continuing pattern matching loop.");
                }
            }
        }

        //Execute the wrapped DAO if the match criteria was met
        if (matchedPatterns) {
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Matching criteria '" + this.patterns + "' was met for query '" + seed + "', delegating call to the targetPersonAttributeDao='" + this.targetPersonAttributeDao + "'");
            }

            return this.targetPersonAttributeDao.getPeopleWithMultivaluedAttributes(seed, filter);
        }

        if (this.logger.isInfoEnabled()) {
            this.logger.info("Matching criteria '" + this.patterns + "' was not met for query '" + seed + "', return null");
        }

        return null;
    }
1035672
public <U extends T, A> InitialMatching1<T, U, A> when(
      DecomposableMatchBuilder1<U, A> decomposableMatchBuilder) {
    return new InitialMatching1<>(decomposableMatchBuilder.build(), value);
  }
148952
@Override
	public Collection<BioPAXElement> generate(Match match, int... ind)
	{
		PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]);
		Conversion conv = (Conversion) match.get(ind[1]);

		if (!((peType == RelType.INPUT && getConvParticipants(conv, RelType.INPUT).contains(pe)) ||
			(peType == RelType.OUTPUT && getConvParticipants(conv, RelType.OUTPUT).contains(pe))))
			throw new IllegalArgumentException("peType = " + peType +
				", and related participant set does not contain this PE. Conv dir = " +
				getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri());

		boolean rightContains = conv.getRight().contains(pe);
		boolean leftContains = conv.getLeft().contains(pe);
		
		assert rightContains || leftContains : "PE is not a participant.";

		Set<BioPAXElement> result = new HashSet<BioPAXElement>();

		ConversionDirectionType avoidDir = (leftContains && rightContains) ? null : peType == RelType.OUTPUT ?
			(leftContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT) :
			(rightContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT);

		for (Object o : controlledOf.getValueFromBean(conv))
		{
			Control ctrl = (Control) o;
			ConversionDirectionType dir = getDirection(conv, ctrl);

			if (avoidDir != null && dir == avoidDir) continue;

			// don't collect this if the pe is ubique in the context of this control
			if (blacklist != null && blacklist.isUbique(pe, conv, dir, peType)) continue;

			result.add(ctrl);
		}
		return result;
	}