Source code for MSQuant: PILcommon.cs, MSQlib1/src/utility/PILcommon.cs.

Table of contents page.

Home page for MSQuant.

//****************************************************************************
//* Copyright (C) 2008 Peter Mortensen and Matthias Mann                     *
//* This file is part of MSQuant.                                            *
//*                                                                          *
//* MSQuant is distributed under the terms of                                *
//* the GNU General Public License. See src/COPYING.TXT or                   *
//* <http://www.gnu.org/licenses/gpl.txt> for details.                       *
//*                                                                          *
//* MSQuant is free software; you can redistribute it                        *
//* and/or modify it under the terms of the GNU                              *
//* General Public License as published by the Free                          *
//* Software Foundation; either version 2 of the                             *
//* License, or (at your option) any later version.                          *
//*                                                                          *
//* MSQuant is distributed in the hope that it will be                       *
//* useful, but WITHOUT ANY WARRANTY; without even the                       *
//* implied warranty of MERCHANTABILITY or FITNESS FOR                       *
//* A PARTICULAR PURPOSE.  See the GNU General Public                        *
//* License for more details.                                                *
//*                                                                          *
//* You should have received a copy of the GNU General                       *
//* Public License along with MSQuant; if not, write to                      *
//* the Free Software Foundation, Inc., 59 Temple                            *
//* Place, Suite 330, Boston, MA  02111-1307  USA                            *
//*                                                                          *
//* Purpose: some static general utility function.                           *
//*                                                                          *
//****************************************************************************

//****************************************************************************
//*                               CEBI                                       *
//*                    Software Development Group                            *
//*                         Peter Mortensen                                  *
//*                E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk          *
//*                 WWW: http://www.cebi.sdu.dk/                             *
//*                                                                          *
//*  Program for post-processing of result from search in mass               *
//*    spectrometric data.                                                   *
//*                                                                          *
//*    FILENAME:   PILpeptides.vb                                            *
//*    TYPE:  VISUAL_BASIC                                                   *
//*                                                                          *
//* CREATED: PM 2008-10-30   Vrs 1.0. First content from somewhere else;     *
//*                          translated from VB.NET.                         *
//* UPDATED: PM 2008-xx-xx                                                   *
//*                                                                          *
//****************************************************************************

using System.Diagnostics; //For Trace. And its Assert.


//Changed PM_REFACTOR 2006-03-17
//****************************************************************************
//*    <placeholder for header>                                              *
//****************************************************************************
public class utilityStatic
{


    //****************************************************************************
    //*    <placeholder for header>                                              *
    //****************************************************************************
    public static bool numbersClose(
        double aNumber1, double aNumber2, double aTolerance)
    {
        bool toReturn = false;
        double diff = aNumber2 - aNumber1;
        double absDiff = System.Math.Abs(diff);
        if (absDiff <= aTolerance)
        {
            toReturn = true;
        }
        return toReturn;
    } //numbersClose()


    //Changed PM_AVERAGEERROR_BYMCR 2007-10-04
    //****************************************************************************
    //*    Needed with C# clients? (use of default)                                              *
    //****************************************************************************
    public static void zeroDoubleArr(ref double[] anInOutArr)
    {
        Trace.Assert(
            anInOutArr != null, "PIL ASSERT. anInOutArr is Nothing...");

        int len = anInOutArr.Length;
        int lastIndex = len - 1;

        int j = 0;
        for (j = 0; j <= lastIndex; j += 1)
        {
            anInOutArr[j] = 0.0;
        }
    } //zeroDoubleArr()


    //Changed PM_AVERAGEERROR_BYMCR 2007-10-04
    //****************************************************************************
    //*    Needed with C# clients? (use of default)                                              *
    //****************************************************************************
    public static void zeroIntegerArr(ref int[] anInOutArr)
    {
        Trace.Assert(
            anInOutArr != null, 
            "PIL ASSERT. anInOutArr is Nothing...");

        int len = anInOutArr.Length;
        int lastIndex = len - 1;

        int j = 0;
        for (j = 0; j <= lastIndex; j += 1)
        {
            anInOutArr[j] = 0;
        }
    } //zeroIntegerArr()


} //utilityStatic


    

    

Generated by script codePublish.pl at 2009-01-05T15:20:59.