--------------------- Interface BioPAXElement ---------------------
779930
protected boolean semanticallyEquivalent(BioPAXElement element)
	{
		if (!(element instanceof sequenceInterval))
		{
			return false;
		}

		final sequenceInterval that = (sequenceInterval) element;
		return
			(SEQUENCE_INTERVAL_BEGIN != null ?
				SEQUENCE_INTERVAL_BEGIN.isEquivalent(
					that.getSEQUENCE_INTERVAL_BEGIN()) :
				that.getSEQUENCE_INTERVAL_BEGIN() == null)
				&&
				(SEQUENCE_INTERVAL_END != null ?
					SEQUENCE_INTERVAL_END.isEquivalent(
						that.getSEQUENCE_INTERVAL_END()) :
					that.getSEQUENCE_INTERVAL_END() != null);
	}
1258631
@Override
  public void endVisit(MethodDeclaration node) {
    ExecutableElement element = node.getExecutableElement();
    if (!ElementUtil.getName(element).equals("compareTo") || node.getBody() == null) {
      return;
    }
    DeclaredType comparableType = typeUtil.findSupertype(
        ElementUtil.getDeclaringClass(element).asType(), "java.lang.Comparable");
    if (comparableType == null) {
      return;
    }
    List<? extends TypeMirror> typeArguments = comparableType.getTypeArguments();
    List<? extends VariableElement> parameters = element.getParameters();
    if (typeArguments.size() != 1 || parameters.size() != 1
        || !typeArguments.get(0).equals(parameters.get(0).asType())) {
      return;
    }

    VariableElement param = node.getParameter(0).getVariableElement();

    FunctionInvocation castCheck = createCastCheck(typeArguments.get(0), new SimpleName(param));
    if (castCheck != null) {
      node.getBody().addStatement(0, new ExpressionStatement(castCheck));
    }
  }
937410
protected boolean semanticallyEquivalent(BioPAXElement element)
	{
		final kPrime aKPrime = (kPrime) element;
		return
			(Float.compare(aKPrime.getIONIC_STRENGTH(), IONIC_STRENGTH) == 0) &&
				(Float.compare(aKPrime.getK_PRIME(), K_PRIME) == 0) &&
				(Float.compare(aKPrime.getPH(), PH) == 0) &&
				(Float.compare(aKPrime.getPMG(), PMG) == 0) &&
				(Float.compare(aKPrime.getTEMPERATURE(), TEMPERATURE) == 0);
	}
1270013
protected static void replaceXrefsWithRelatedER(
		Collection<BioPAXElement> elements)
	{
		Set<EntityReference> ers = new HashSet<EntityReference>();
		Set<Xref> xrefs = new HashSet<Xref>();
		for (BioPAXElement element : elements)
		{
			if (element instanceof Xref)
			{
				xrefs.add((Xref) element);
				for (XReferrable able : ((Xref) element).getXrefOf())
				{
					if (able instanceof EntityReference)
					{
						ers.add((EntityReference) able);
					}
				}
			}
		}

		elements.removeAll(xrefs);
		for (EntityReference er : ers)
		{
			if (!elements.contains(er)) elements.add(er);
		}
	}
683560
protected void writeResultDetailed(Map<BioPAXElement, List<Match>> matches, OutputStream out,
		int columns) throws IOException
	{
		OutputStreamWriter writer = new OutputStreamWriter(out);

		// write the header

		String header = getHeader();
		if (header != null)
		{
			writer.write(header);
		}
		else
		{
			for (int i = 0; i < columns; i++)
			{
				writer.write("col-" + (i+1));
				if (i < columns - 1) writer.write("\t");
			}
		}

		// memory for already written lines
		Set<String> mem = new HashSet<String>();

		// write values

		for (BioPAXElement ele : matches.keySet())
		{
			for (Match m : matches.get(ele))
			{
				String line = "";
				boolean aborted = false;

				for (int i = 0; i < columns; i++)
				{
					String s = getValue(m, i);

					if (s == null)
					{
						aborted = true;
						break;
					}
					else
					{
						line += s + "\t";
					}
				}

				if (aborted) continue;

				line = line.trim();

				if (!mem.contains(line))
				{
					writer.write("\n" + line);
					mem.add(line);
				}
			}
		}
		writer.flush();
	}
335106
@Override
    public boolean accept(final Node aNode) {

        // Only deal with Element nodes.
        if (aNode.getNodeType() != Node.ELEMENT_NODE) {
            return false;
        }

        // We should accept:
        //
        // 1) A simpleType Element
        // 2) An enumeration Element
        final Element theElement = (Element) aNode;

        final String localName = theElement.getLocalName();
        if (localName != null) {

            final String trimmed = localName.trim();
            return trimmed.equalsIgnoreCase("enumeration")
                    || trimmed.equalsIgnoreCase("simpleType");
        }

        /*
        <xs:simpleType name="foodPreference">
            <!-- ClassLocation JavaDocData insertion point -->

            <xs:restriction base="xs:string">

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="NONE"/>

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="LACTO_VEGETARIAN"/>

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="VEGAN"/>

            </xs:restriction>
        </xs:simpleType>
         */

        /*
  <xs:simpleType name="foodPreference">
    <xs:restriction base="xs:string">
      <xs:enumeration value="NONE"/>
      <xs:enumeration value="LACTO_VEGETARIAN"/>
      <xs:enumeration value="VEGAN"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="americanCoin">
    <xs:restriction base="xs:int">
      <xs:enumeration value="25"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="5"/>
      <xs:enumeration value="10"/>
    </xs:restriction>
  </xs:simpleType>
        */

        // All done.
        return false;
    }
1218366
public synchronized void replace(final BioPAXElement existing, final BioPAXElement replacement) 
	{
		 ModelUtils.replace(this, Collections.singletonMap(existing, replacement));
		 remove(existing);
		 if(replacement != null)
			 add(replacement);
	}
167810
@Override
    public void processElement(Wrapper<Element> element) {
        activeElement = element.getContent();
        
        if (parentElement != null) {
            parentElement.addContent(activeElement);
        }
    }
606374
public List<BioPAXElement> get(String[] label, Pattern p)
	{
		if (label == null) return Collections.emptyList();

		List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length);
		for (String lab : label)
		{
			list.add(variables[p.indexOf(lab)]);
		}
		return list;
	}
442722
protected boolean semanticallyEquivalent(BioPAXElement element)
	{
		final physicalEntityParticipant that =
			(physicalEntityParticipant) element;
		return isInEquivalentState(that) &&
			isInEquivalentContext(that);
	}
322040
protected boolean semanticallyEquivalent(BioPAXElement o)
	{
		if (o!= null && o instanceof openControlledVocabulary)
		{
			openControlledVocabulary that =
				(openControlledVocabulary) o;

			return
				this.equals(that) ||
				hasCommonTerm(that) ||
				!this.findCommonUnifications(that).isEmpty();
		}
		return false;
	}
1111564
private static void registerCommonProteinModifications(InputStream inStream) {
		try {

			ProteinModificationXmlReader.registerProteinModificationFromXml(inStream);
		} catch (Exception e) {
			logger.error("Exception: ", e);
		}
	}
743586
private void addIntoEquivalanceMap(BioPAXElement bpe)
	{
		int key = bpe.hashCode();
		List<BioPAXElement> list = equivalenceMap.get(key);
		if (list == null)
		{
			list = new ArrayList<BioPAXElement>();
			equivalenceMap.put(key, list);
		}
		list.add(bpe);
	}
647979
@Override
	public Collection<BioPAXElement> generate(Match match, int... ind)
	{
		Collection<BioPAXElement> result = new HashSet<BioPAXElement>();

		PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]);

		for (Interaction inter : pe.getParticipantOf())
		{
			if (inter instanceof Conversion)
			{
				Conversion cnv = (Conversion) inter;
				ConversionDirectionType dir = getDirection(cnv);

				// do not get blacklisted small molecules
				if (blacklist != null && blacklist.isUbique(pe, cnv, dir, type)) continue;

				if (dir == ConversionDirectionType.REVERSIBLE)
				{
					result.add(cnv);
				}
				else if (dir == ConversionDirectionType.RIGHT_TO_LEFT &&
					(type == RelType.INPUT ? cnv.getRight().contains(pe) : cnv.getLeft().contains(pe)))
				{
					result.add(cnv);
				}
				// Note that null direction is treated as if LEFT_TO_RIGHT. This is not a best
				// practice, but it is a good approximation.
				else if ((dir == ConversionDirectionType.LEFT_TO_RIGHT || dir == null) &&
					(type == RelType.INPUT ? cnv.getLeft().contains(pe) : cnv.getRight().contains(pe)))
				{
					result.add(cnv);
				}
			}
		}

		return result;
	}
307705
@Override
	public Collection<BioPAXElement> generate(Match match, int... outer)
	{
		return constr.generate(match, translate(outer));
	}
580884
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
		throws IOException
	{
		writeResultDetailed(matches, out, 5);
	}
1139601
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
		throws IOException
	{
		OutputStreamWriter writer = new OutputStreamWriter(out);

		for (BioPAXElement ele : matches.keySet())
		{
			Set<String> syms = new HashSet<String>();

			for (Match m : matches.get(ele))
			{
				ProteinReference pr = (ProteinReference) m.get("PR", getPattern());

				String sym = getGeneSymbol(pr);
				if (sym != null) syms.add(sym);
			}

			if (syms.size() > 1)
			{
				writer.write("\n" + ele.getUri());

				for (Object o : controlAcc.getValueFromBean(ele))
				{
					Control ctrl = (Control) o;
					writer.write(" " + ctrl.getUri());
				}

				for (String sym : syms)
				{
					writer.write("\t" + sym);
				}
			}
		}
		writer.flush();
	}