Pattern for an entity is producing a small molecule, and the small molecule controls state
change of another molecule.

@param blacklist a skip-list of ubiquitous molecules
@return the pattern
320637
public static Pattern controlsStateChangeThroughControllerSmallMolecule(Blacklist blacklist)
	{
		Pattern p = new Pattern(SequenceEntityReference.class, "upper controller ER");
		p.add(linkedER(true), "upper controller ER", "upper controller generic ER");
		p.add(erToPE(), "upper controller generic ER", "upper controller simple PE");
		p.add(linkToComplex(), "upper controller simple PE", "upper controller PE");
		p.add(peToControl(), "upper controller PE", "upper Control");
		p.add(controlToConv(), "upper Control", "upper Conversion");
		p.add(new NOT(participantER()), "upper Conversion", "upper controller ER");
		p.add(new Participant(RelType.OUTPUT, blacklist), "upper Conversion", "controller PE");
		p.add(type(SmallMolecule.class), "controller PE");
		if (blacklist != null) p.add(new NonUbique(blacklist), "controller PE");

		// the linker small mol is at also an input
		p.add(new NOT(new ConstraintChain(
			new ConversionSide(ConversionSide.Type.OTHER_SIDE), linkToSpecific())),
			"controller PE", "upper Conversion", "controller PE");

		p.add(peToControl(), "controller PE", "Control");
		p.add(controlToConv(), "Control", "Conversion");
		p.add(equal(false), "upper Conversion", "Conversion");

//		p.add(nextInteraction(), "upper Conversion", "Conversion");

		stateChange(p, "Control");

		p.add(type(SequenceEntityReference.class), "changed ER");
		p.add(equal(false), "upper controller ER", "changed ER");
		p.add(new NOT(participantER()), "Conversion", "upper controller ER");

		return p;
	}
1202890
public static List<String> getRepeat(List<String> list) {
        List<String> rtn = new ArrayList<>();
        Set<String> idSet = new HashSet<>();

        for (String id : list) {
            if (idSet.contains(id)) {
                rtn.add(id);
            } else {
                idSet.add(id);
            }
        }

        return rtn;
    }
950005
public static Pattern molecularInteraction()
	{
		Pattern p = new Pattern(SequenceEntityReference.class, "Protein 1");
		p.add(linkedER(true), "Protein 1", "generic Protein 1");
		p.add(erToPE(), "generic Protein 1", "SPE1");
		p.add(linkToComplex(), "SPE1", "PE1");
		p.add(new PathConstraint("PhysicalEntity/participantOf:MolecularInteraction"), "PE1", "MI");
		p.add(participant(), "MI", "PE2");
		p.add(equal(false), "PE1", "PE2");

		// participants are not both baits or preys
		p.add(new NOT(new AND(new MappedConst(isPrey(), 0), new MappedConst(isPrey(), 1))), "PE1", "PE2");
		p.add(new NOT(new AND(new MappedConst(isBait(), 0), new MappedConst(isBait(), 1))), "PE1", "PE2");

		p.add(linkToSpecific(), "PE2", "SPE2");
		p.add(type(SequenceEntity.class), "SPE2");
		p.add(new PEChainsIntersect(false), "SPE1", "PE1", "SPE2", "PE2");
		p.add(peToER(), "SPE2", "generic Protein 2");
		p.add(linkedER(false), "generic Protein 2", "Protein 2");
		p.add(equal(false), "Protein 1", "Protein 2");
		return p;
	}
895168
public List<String> getBlacklistedNodes() {
    List<String> ret = new ArrayList<String>();
    for (String nodeName : blacklistedNodes.keySet()) {
      ret.add(nodeName);
    }
    return ret;
  }
945177
public static Pattern hasNonSelfEffect()
	{
		Pattern p = new Pattern(PhysicalEntity.class, "SPE");
		p.add(peToER(), "SPE", "ER");
		p.add(linkToComplex(), "SPE", "PE");
		p.add(peToControl(), "PE", "Control");
		p.add(controlToInter(), "Control", "Inter");
		p.add(new NOT(participantER()), "Inter", "ER");
		return p;
	}
1094481
protected String convertSchemaPattern(final String pattern) {
    if ((pattern == null) || pattern.isEmpty()) {
      return convertPattern("%", true);
    } else {
      return convertPattern(pattern, true);
    }
  }
1199403
public static <T> T objectDeepCopyWithBlackList(Object from, Class<T> toClass, String... blockFields) {
        Object to = getNewInstance(toClass);
        return objectDeepCopyWithBlackList(from, to, blockFields);
    }
415688
protected XmlSchemaPatternFacet createPatternFacet(final String pattern) {
        XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet();
        xmlSchemaPatternFacet.setValue(pattern);
        return xmlSchemaPatternFacet;
    }
104194
@Nonnull
	public DataBuilder appendDevicePattern(@Nonnull final DevicePattern pattern) {
		Check.notNull(pattern, "pattern");
		if (!devicePatterns.containsKey(pattern.getId())) {
			devicePatterns.put(pattern.getId(), new TreeSet<DevicePattern>(DEVICE_PATTERN_COMPARATOR));
		}

		devicePatterns.get(pattern.getId()).add(pattern);
		return this;
	}
324151
public static Pattern selection(Pattern pattern1, Pattern pattern2)
   {
      if (pattern1 == null || pattern2 == null)
      {
         throw new IllegalArgumentException("Neither pattern can be null");
      }
      return new SelectPattern(pattern1, pattern2);
   }
789249
def pattern_filter(items, whitelist=None, blacklist=None, key=None):
    
    key = key or __return_self
    if whitelist:
        whitelisted = _filter(items, whitelist, key)

        if blacklist:
            blacklisted = _filter(items, blacklist, key)
            # Remove any blacklisted items from the whitelisted ones.
            whitelisted.difference_update(blacklisted)

        return [item for item in items if key(item) in whitelisted]

    elif blacklist:
        blacklisted = _filter(items, blacklist, key)
        return [item for item in items if key(item) not in blacklisted]

    else:
        return items
53475
protected function inBlacklist($filename, array $blacklist)
    {
        foreach ($blacklist as $pattern) {
            if (fnmatch($pattern, $filename, FNM_PATHNAME | FNM_CASEFOLD)) {
                return true;
            }
        }

        return false;
    }
781198
@SuppressWarnings("unchecked")
    public <T> Predicate byPattern(Root<T> root, CriteriaBuilder builder, SearchParameters sp, Class<T> type) {
        if (!sp.hasSearchPattern()) {
            return null;
        }

        List<Predicate> predicates = newArrayList();
        EntityType<T> entity = em.getMetamodel().entity(type);
        String pattern = sp.getSearchPattern();

        for (SingularAttribute<? super T, ?> attr : entity.getSingularAttributes()) {
            if (attr.getPersistentAttributeType() == MANY_TO_ONE || attr.getPersistentAttributeType() == ONE_TO_ONE) {
                continue;
            }

            if (attr.getJavaType() == String.class) {
                predicates.add(jpaUtil.stringPredicate((Expression<String>) root.get(jpaUtil.attribute(entity, attr)), pattern, sp, builder));
            }
        }

        return jpaUtil.orPredicate(builder, predicates);
    }
836030
public Pattern getPattern()
	{
		if(pattern == null) {
			pattern = constructPattern();
			if (this instanceof SIFMiner && idFetcher != null && idMap != null) {
				pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getSourceLabel());
				pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getTargetLabel());
			}
			pattern.optimizeConstraintOrder();
		}
		return pattern;
	}
692584
public static Pattern controlsTransportOfChemical(Blacklist blacklist)
	{
		Pattern p = new Pattern(SequenceEntityReference.class, "controller ER");
		p.add(linkedER(true), "controller ER", "controller generic ER");
		p.add(erToPE(), "controller generic ER", "controller simple PE");
		p.add(linkToComplex(), "controller simple PE", "controller PE");
		p.add(peToControl(), "controller PE", "Control");
		p.add(controlToConv(), "Control", "Conversion");
		p.add(new Participant(RelType.INPUT, blacklist, true), "Control", "Conversion", "input PE");
		p.add(linkToSimple(blacklist), "input PE", "input simple PE");
		p.add(new Type(SmallMolecule.class), "input simple PE");
		p.add(notGeneric(), "input simple PE");
		p.add(peToER(), "input simple PE", "changed generic SMR");
		p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE, blacklist, RelType.OUTPUT), "input PE", "Conversion", "output PE");
		p.add(equal(false), "input PE", "output PE");
		p.add(linkToSimple(blacklist), "output PE", "output simple PE");
		p.add(new Type(SmallMolecule.class), "output simple PE");
		p.add(notGeneric(), "output simple PE");
		p.add(peToER(), "output simple PE", "changed generic SMR");
		p.add(linkedER(false), "changed generic SMR", "changed SMR");
		p.add(new OR(
			new MappedConst(hasDifferentCompartments(), 0, 1),
			new MappedConst(hasDifferentCompartments(), 2, 3)),
			"input simple PE", "output simple PE", "input PE", "output PE");

		return p;
	}
339910
public PTable makeNewPTable(FieldList record, Object lookupKey)
    {
        InputStream istream = null;
        try
        {
            if (lookupKey instanceof String)
                istream = this.openSerialStream(record, (String)lookupKey);
            if (istream != null)
            {
                ObjectInputStream q = new ObjectInputStream(istream);
                
                MTable sTable = (MTable)q.readObject();
                q.close();      // Is this necessary?
                sTable.init(this, record, lookupKey);
                return sTable;
            }
             
        } catch (Exception ex) {
        	System.out.println("Error " + ex.getMessage() + " on read serial file: " + lookupKey);
        	//+Util.getLogger().warning("Error " + ex.getMessage() + " on read serial file: " + lookupKey);
        } finally {
            try {
                if (istream != null)
                    istream.close();
            } catch (IOException e) {
            }            
        }
        return new MTable(this, record, lookupKey);   // New empty table
    }
84229
public <K2 extends K, E2 extends E> BlockingList<K2, E2> make() {
        @SuppressWarnings("unchecked")
        BlockingListMaker<K2, E2> stricterThis = (BlockingListMaker<K2, E2>) this;
        return stricterThis.internalCreateBlockingList();
    }