Return the isotope pattern normalized to the highest abundance.

@param isotopeP  The IsotopePattern object to normalize
@return          The IsotopePattern normalized
10612
public static IsotopePattern normalize(IsotopePattern isotopeP) {
        IsotopeContainer isoHighest = null;

        double biggestAbundance = 0;
        /* Extraction of the isoContainer with the highest abundance */
        for (IsotopeContainer isoContainer : isotopeP.getIsotopes()) {
            double abundance = isoContainer.getIntensity();
            if (biggestAbundance < abundance) {
                biggestAbundance = abundance;
                isoHighest = isoContainer;
            }
        }
        /* Normalize */
        IsotopePattern isoNormalized = new IsotopePattern();
        for (IsotopeContainer isoContainer : isotopeP.getIsotopes()) {
            double inten = isoContainer.getIntensity() / isoHighest.getIntensity();
            IsotopeContainer icClone;
            try {
                icClone = (IsotopeContainer) isoContainer.clone();
                icClone.setIntensity(inten);
                if (isoHighest.equals(isoContainer))
                    isoNormalized.setMonoIsotope(icClone);
                else
                    isoNormalized.addIsotope(icClone);

            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }

        }
        isoNormalized.setCharge(isotopeP.getCharge());
        return isoNormalized;
    }
234643
@Deprecated
    public Pattern getPattern() {
        if (patterns != null && !patterns.isEmpty()) {
            return patterns.get(0);
        } else {
            return null;
        }
    }
436652
public static Pattern bindsTo()
	{
		Pattern p = new Pattern(ProteinReference.class, "first PR");
		p.add(erToPE(), "first PR", "first simple PE");
		p.add(linkToComplex(), "first simple PE", "Complex");
		p.add(new Type(Complex.class), "Complex");
		p.add(linkToSpecific(), "Complex", "second simple PE");
		p.add(peToER(), "second simple PE", "second PR");
		p.add(equal(false), "first PR", "second PR");
		return p;
	}
673545
public static Pattern computeJavaPattern(String sqlPattern)
    {
        StringBuffer pattern_buff = new StringBuffer();
        // Replace "_" with "." (match exactly 1 character)
        // Replace "%" with ".*" (match 0 or more characters)
        for (int i=0; i<sqlPattern.length(); i++)
        {
            char c = sqlPattern.charAt(i);
            if (c == '_')
            {
                pattern_buff.append('.');
            }
            else
            if (c == '%')
            {
                pattern_buff.append(".*");
            }
            else
                pattern_buff.append(c);
        }
        return Pattern.compile(pattern_buff.toString());
    }
984678
private static DateTimeFormatter createFormatterForPattern(String pattern) {
        if (pattern == null || pattern.length() == 0) {
            throw new IllegalArgumentException("Invalid pattern specification");
        }
        DateTimeFormatter formatter = cPatternCache.get(pattern);
        if (formatter == null) {
            DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
            parsePatternTo(builder, pattern);
            formatter = builder.toFormatter();
            if (cPatternCache.size() < PATTERN_CACHE_SIZE) {
                // the size check is not locked against concurrent access,
                // but is accepted to be slightly off in contention scenarios.
                DateTimeFormatter oldFormatter = cPatternCache.putIfAbsent(pattern, formatter);
                if (oldFormatter != null) {
                    formatter = oldFormatter;
                }
            }
        }
        return formatter;
    }
368149
@SuppressWarnings("checkstyle:innerassignment")
    private static IPath[] decodePatterns(NamedNodeMap nodeMap, String tag) {
        final String sequence = removeAttribute(tag, nodeMap);
        if (!"".equals(sequence)) { //$NON-NLS-1$
            final char[][] patterns = CharOperation.splitOn('|', sequence.toCharArray());
            final int patternCount;
            if ((patternCount = patterns.length) > 0) {
                IPath[] paths = new IPath[patternCount];
                int index = 0;
                for (int j = 0; j < patternCount; j++) {
                    final char[] pattern = patterns[j];
                    if (pattern.length == 0) {
                        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=105581
                        continue;
                    }
                    paths[index++] = new Path(new String(pattern));
                }
                if (index < patternCount) {
                    System.arraycopy(paths, 0, paths = new IPath[index], 0, index);
                }
                return paths;
            }
        }
        return null;
    }
1000879
public IAtom configure(IAtom atom, IIsotope isotope) {
        atom.setMassNumber(isotope.getMassNumber());
        atom.setSymbol(isotope.getSymbol());
        atom.setExactMass(isotope.getExactMass());
        atom.setAtomicNumber(isotope.getAtomicNumber());
        atom.setNaturalAbundance(isotope.getNaturalAbundance());
        return atom;
    }
956662
@Override
    public boolean compare(Object object) {
        if (!(object instanceof Isotope)) {
            return false;
        }
        if (!super.compare(object)) {
            return false;
        }
        Isotope isotope = (Isotope) object;
        if (isotope.getMassNumber() != null && massNumber != null
                && isotope.getMassNumber().intValue() != this.getMassNumber().intValue()) return false;
        if (isotope.getMassNumber() == null && massNumber != null) return false;
        if (isotope.getExactMass() != null && exactMass != null) {
            double diff = Math.abs(isotope.getExactMass().doubleValue() - this.getExactMass().doubleValue());
            if (diff > 0.0000001) return false;
        }
        if (isotope.getExactMass() == null && exactMass != null) return false;
        if (isotope.getNaturalAbundance() != null && naturalAbundance != null) {
            double diff = Math.abs(isotope.getNaturalAbundance().doubleValue()
                    - this.getNaturalAbundance().doubleValue());
            if (diff > 0.0000001) return false;
        }
        if (isotope.getNaturalAbundance() == null && naturalAbundance != null) return false;

        return true;
    }
991329
private List<IIsotope> orderList(List<IIsotope> isotopes_TO) {
        List<IIsotope> newOrderList = new ArrayList<IIsotope>();
        for (int i = 0; i < orderElements.length; i++) {
            String symbol = orderElements[i];
            Iterator<IIsotope> itIso = isotopes_TO.iterator();
            while (itIso.hasNext()) {
                IIsotope isotopeToCo = itIso.next();
                if (isotopeToCo.getSymbol().equals(symbol)) {
                    newOrderList.add(isotopeToCo);
                }
            }
        }
        return newOrderList;
    }
371994
public void removeIsotope(IIsotope isotope) {
        isotopesMax.remove(getIsotope(isotope));
        isotopesMin.remove(getIsotope(isotope));
    }
507805
public Iterable<IIsotope> isotopes() {
        return new Iterable<IIsotope>() {

            @Override
            public Iterator<IIsotope> iterator() {
                return isotopesMax.keySet().iterator();
            }
        };
    }
770601
private Pattern getPattern(String expr)
    {
        Pattern pattern = patterns.get(expr);
        if(pattern == null)
        {
            pattern = Pattern.compile(expr);
            patterns.put(expr, pattern);
        }
        return pattern;
    }
1143918
function(patternDef, latLngs) {
        return {
            symbolFactory: patternDef.symbol,
            // Parse offset and repeat values, managing the two cases:
            // absolute (in pixels) or relative (in percentage of the polyline length)
            offset: parseRelativeOrAbsoluteValue(patternDef.offset),
            endOffset: parseRelativeOrAbsoluteValue(patternDef.endOffset),
            repeat: parseRelativeOrAbsoluteValue(patternDef.repeat),
        };
    }
43533
long applyMappingToRepo(
      EntityMapping sourceMapping, Repository<Entity> targetRepo, Progress progress, int depth) {
    progress.status(format("Mapping source [%s]...", sourceMapping.getLabel()));
    AtomicLong counter = new AtomicLong();

    boolean canAdd = targetRepo.count() == 0;
    dataService
        .getRepository(sourceMapping.getName())
        .forEachBatched(
            entities ->
                processBatch(sourceMapping, targetRepo, progress, counter, canAdd, entities, depth),
            MAPPING_BATCH_SIZE);

    progress.status(format("Mapped %s [%s] entities.", counter, sourceMapping.getLabel()));
    return counter.get();
  }
1306877
private void normalizeMapping(ImmutableSet<CQIE> unfoldingProgram) {

        // Normalizing language tags. Making all LOWER CASE

        for (CQIE mapping : unfoldingProgram) {
            Function head = mapping.getHead();
            for (Term term : head.getTerms()) {
                if (!(term instanceof Function))
                    continue;

                Function typedTerm = (Function) term;
                if (typedTerm.getTerms().size() == 2 && typedTerm.getFunctionSymbol().getName().equals(RDF.LANGSTRING.getIRIString())) {
                    // changing the language, its always the second inner term (literal,lang)
                    Term originalLangTag = typedTerm.getTerm(1);
                    if (originalLangTag instanceof ValueConstant) {
                        ValueConstant originalLangConstant = (ValueConstant) originalLangTag;
                        Term normalizedLangTag = termFactory.getConstantLiteral(originalLangConstant.getValue().toLowerCase(),
                                originalLangConstant.getType());
                        typedTerm.setTerm(1, normalizedLangTag);
                    }
                }
            }
        }

        // Normalizing equalities
        for (CQIE cq: unfoldingProgram)
            eqNormalizer.enforceEqualities(cq);
    }
1273620
def _getcycle(self, cycle, decayed=False):
        ''' '''
        yps=self.get('ABUNDANCE_MF', cycle)
        z=self.get('Z', cycle) #charge
        a=self.get('A', cycle) #mass
        isomers=self.get('ISOM', cycle)

        a_iso_to_plot,z_iso_to_plot,abunds,isotope_to_plot,el_iso_to_plot,isom=\
            self._process_abundance_vector(a,z,isomers,yps)
        self.a_iso_to_plot=a_iso_to_plot
        self.isotope_to_plot=isotope_to_plot
        self.z_iso_to_plot=z_iso_to_plot
        self.el_iso_to_plot=el_iso_to_plot
        self.abunds=array(abunds)
        self.isom=isom

        if decayed:
            try:
                self.decay_idp
            except AttributeError:
                print("WARNING: decayed in _getcycle ignores isomers " \
                    "and will decay alpha-unstable p-rich nuclei as if they were beta+ stable.")
                print("Initialising decay index pointers ....")
                self.decay_indexpointer() # provides self.decay_idp and
            ind_tmp=self.idp_to_stables_in_isostoplot

            isotope_decay=array(isotope_to_plot)[ind_tmp]
            z_iso_decay=array(z_iso_to_plot)[ind_tmp]
            a_iso_decay=array(a_iso_to_plot)[ind_tmp]
            el_iso_decay=array(el_iso_to_plot)[ind_tmp]
            abunds_decay=zeros(len(ind_tmp), dtype='float64')
            for i in range(len(isotope_to_plot)):
                idp=where(isotope_decay==isotope_to_plot[self.decay_idp[i]])[0] # points from
                # i on isotope_to_plot scale to decay target_on_decayed array scale
                abunds_decay[idp] += abunds[i]

            if self.debug:
                print("Decayed array:")
                for i in range(len(ind_tmp)):
                    print(isotope_decay[i], z_iso_decay[i], a_iso_decay[i], el_iso_decay[i], abunds_decay[i])

            self.a_iso_to_plot=a_iso_decay
            self.isotope_to_plot=isotope_decay
            self.z_iso_to_plot=z_iso_decay
            self.el_iso_to_plot=el_iso_decay
            self.abunds=abunds_decay
1034733
private static Matcher<AnnotationTree> hasAnyParameter(String... parameters) {
    return anyOf(
        transform(
            asList(parameters),
            new Function<String, Matcher<AnnotationTree>>() {
              @Override
              public Matcher<AnnotationTree> apply(String parameter) {
                return hasArgumentWithValue(parameter, Matchers.<ExpressionTree>anything());
              }
            }));
  }