Example #1
0
        // bytearray.c (540, 1)
        // l_byteaFindEachSequence(ba, sequence, seqlen, pda) as int
        // l_byteaFindEachSequence(L_BYTEA *, const l_uint8 *, size_t, L_DNA **) as l_ok
        ///  <summary>
        /// l_byteaFindEachSequence()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_byteaFindEachSequence/*"/>
        ///  <param name="ba">[in] - </param>
        ///  <param name="sequence">[in] - subarray of bytes to find in data</param>
        ///  <param name="seqlen">[in] - length of sequence, in bytes</param>
        ///  <param name="pda">[out] - byte positions of each occurrence of %sequence</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_byteaFindEachSequence(
            L_Bytea ba,
            Byte[] sequence,
            uint seqlen,
            out L_Dna pda)
        {
            if (ba == null)
            {
                throw new ArgumentNullException("ba cannot be Nothing");
            }

            if (sequence == null)
            {
                throw new ArgumentNullException("sequence cannot be Nothing");
            }

            IntPtr pdaPtr  = IntPtr.Zero;
            int    _Result = Natives.l_byteaFindEachSequence(ba.Pointer, sequence, seqlen, out pdaPtr);

            if (pdaPtr == IntPtr.Zero)
            {
                pda = null;
            }
            else
            {
                pda = new L_Dna(pdaPtr);
            };

            return(_Result);
        }
Example #2
0
        // dnahash.c (350, 1)
        // l_dnaRemoveDupsByHash(das, pdad, pdahash) as int
        // l_dnaRemoveDupsByHash(L_DNA *, L_DNA **, L_DNAHASH **) as l_ok
        ///  <summary>
        /// (1) Generates a dna with unique values.<para/>
        ///
        /// (2) The dnahash is built up with dad to assure uniqueness.
        /// It can be used to find if an element is in the set:
        /// l_dnaFindValByHash(dad, dahash, val, [and]index)
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaRemoveDupsByHash/*"/>
        ///  <param name="das">[in] - </param>
        ///  <param name="pdad">[out] - hash set</param>
        ///  <param name="pdahash">[out][optional] - dnahash used for lookup</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int l_dnaRemoveDupsByHash(
            L_Dna das,
            out L_Dna pdad,
            out L_DnaHash pdahash)
        {
            if (das == null)
            {
                throw new ArgumentNullException("das cannot be Nothing");
            }

            IntPtr pdadPtr    = IntPtr.Zero;
            IntPtr pdahashPtr = IntPtr.Zero;
            int    _Result    = Natives.l_dnaRemoveDupsByHash(das.Pointer, out pdadPtr, out pdahashPtr);

            if (pdadPtr == IntPtr.Zero)
            {
                pdad = null;
            }
            else
            {
                pdad = new L_Dna(pdadPtr);
            };
            if (pdahashPtr == IntPtr.Zero)
            {
                pdahash = null;
            }
            else
            {
                pdahash = new L_DnaHash(pdahashPtr);
            };

            return(_Result);
        }
Example #3
0
        // Rearrangements
        public static int l_dnaJoin(this L_Dna dad, L_Dna das, int istart, int iend)
        {
            if (null == dad ||
                null == das)
            {
                throw new ArgumentNullException("dad, das cannot be null");
            }

            return(Native.DllImports.l_dnaJoin((HandleRef)dad, (HandleRef)das, istart, iend));
        }
Example #4
0
        // dnabasic.c (786, 1)
        // l_dnaGetIArray(da) as int[]
        // l_dnaGetIArray(L_DNA *) as l_int32 *
        ///  <summary>
        /// (1) A copy of the array is made, because we need to
        /// generate an integer array from the bare double array.
        /// The caller is responsible for freeing the array.<para/>
        ///
        /// (2) The array size is determined by the number of stored numbers,
        /// not by the size of the allocated array in the l_dna.<para/>
        ///
        /// (3) This function is provided to simplify calculations
        /// using the bare internal array, rather than continually
        /// calling accessors on the l_dna.  It is typically used
        /// on an array of size 256.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaGetIArray/*"/>
        ///  <param name="da">[in] - </param>
        ///   <returns>a copy of the bare internal array, integerized by rounding, or NULL on error</returns>
        public static int[] l_dnaGetIArray(
            L_Dna da)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int[] _Result = Natives.l_dnaGetIArray(da.Pointer);
            return(_Result);
        }
Example #5
0
        // dnafunc1.c (159, 1)
        // l_dnaConvertToNuma(da) as Numa
        // l_dnaConvertToNuma(L_DNA *) as NUMA *
        ///  <summary>
        /// l_dnaConvertToNuma()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaConvertToNuma/*"/>
        ///  <param name="da">[in] - </param>
        ///   <returns>na, or NULL on error</returns>
        public static Numa l_dnaConvertToNuma(
            L_Dna da)
        {
            if (da == null) {throw new ArgumentNullException  ("da cannot be Nothing");}

            IntPtr _Result = Natives.l_dnaConvertToNuma(da.Pointer);

            if (_Result == IntPtr.Zero) {return null;}

            return  new Numa(_Result);
        }
Example #6
0
        // dnafunc1.c (350, 1)
        // l_asetCreateFromDna(da) as L_Rbtree
        // l_asetCreateFromDna(L_DNA *) as L_ASET *
        ///  <summary>
        /// l_asetCreateFromDna()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_asetCreateFromDna/*"/>
        ///  <param name="da">[in] - source dna</param>
        ///   <returns>set using the doubles in %da as keys</returns>
        public static L_Rbtree l_asetCreateFromDna(
            L_Dna da)
        {
            if (da == null) {throw new ArgumentNullException  ("da cannot be Nothing");}

            IntPtr _Result = Natives.l_asetCreateFromDna(da.Pointer);

            if (_Result == IntPtr.Zero) {return null;}

            return  new L_Rbtree(_Result);
        }
Example #7
0
        // dnafunc1.c (385, 1)
        // l_dnaDiffAdjValues(das) as L_Dna
        // l_dnaDiffAdjValues(L_DNA *) as L_DNA *
        ///  <summary>
        /// l_dnaDiffAdjValues()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaDiffAdjValues/*"/>
        ///  <param name="das">[in] - input l_dna</param>
        ///   <returns>dad of difference values val[i+1] - val[i], or NULL on error</returns>
        public static L_Dna l_dnaDiffAdjValues(
            L_Dna das)
        {
            if (das == null) {throw new ArgumentNullException  ("das cannot be Nothing");}

            IntPtr _Result = Natives.l_dnaDiffAdjValues(das.Pointer);

            if (_Result == IntPtr.Zero) {return null;}

            return  new L_Dna(_Result);
        }
Example #8
0
        // dnafunc1.c (79, 1)
        // l_dnaJoin(dad, das, istart, iend) as int
        // l_dnaJoin(L_DNA *, L_DNA *, l_int32, l_int32) as l_ok
        ///  <summary>
        /// (1) istart  is smaller 0 is taken to mean 'read from the start' (istart = 0)<para/>
        ///
        /// (2) iend  is smaller 0 means 'read to the end'<para/>
        ///
        /// (3) if das == NULL, this is a no-op
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaJoin/*"/>
        ///  <param name="dad">[in] - dest dna add to this one</param>
        ///  <param name="das">[in][optional] - source dna add from this one</param>
        ///  <param name="istart">[in] - starting index in das</param>
        ///  <param name="iend">[in] - ending index in das use -1 to cat all</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaJoin(
            L_Dna dad,
            L_Dna das,
            int istart,
            int iend)
        {
            if (dad == null) {throw new ArgumentNullException  ("dad cannot be Nothing");}

            IntPtr dasPtr = IntPtr.Zero; 	if (das != null) {dasPtr = das.Pointer;}
            int _Result = Natives.l_dnaJoin(dad.Pointer, dasPtr,   istart,   iend);
            return _Result;
        }
Example #9
0
        // dnabasic.c (831, 1)
        // l_dnaGetDArray(da, copyflag) as Double[]
        // l_dnaGetDArray(L_DNA *, l_int32) as l_float64 *
        ///  <summary>
        /// (1) If copyflag == L_COPY, it makes a copy which the caller
        /// is responsible for freeing.  Otherwise, it operates
        /// directly on the bare array of the l_dna.<para/>
        ///
        /// (2) Very important: for L_NOCOPY, any writes to the array
        /// will be in the l_dna.  Do not write beyond the size of
        /// the count field, because it will not be accessible
        /// from the l_dna!  If necessary, be sure to set the count
        /// field to a larger number (such as the alloc size)
        /// BEFORE calling this function.  Creating with l_dnaMakeConstant()
        /// is another way to insure full initialization.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaGetDArray/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="copyflag">[in] - L_NOCOPY or L_COPY</param>
        ///   <returns>either the bare internal array or a copy of it, or NULL on error</returns>
        public static Double[] l_dnaGetDArray(
            L_Dna da,
            int copyflag)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            Double[] _Result = Natives.l_dnaGetDArray(da.Pointer, copyflag);
            return(_Result);
        }
Example #10
0
        // dnabasic.c (881, 1)
        // l_dnaChangeRefcount(da, delta) as int
        // l_dnaChangeRefcount(L_DNA *, l_int32) as l_ok
        ///  <summary>
        /// l_dnaChangeRefCount()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaChangeRefcount/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="delta">[in] - change to be applied</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaChangeRefcount(
            L_Dna da,
            int delta)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaChangeRefcount(da.Pointer, delta);

            return(_Result);
        }
Example #11
0
        // dnabasic.c (624, 1)
        // l_dnaSetCount(da, newcount) as int
        // l_dnaSetCount(L_DNA *, l_int32) as l_ok
        ///  <summary>
        /// (1) If newcount smaller or equal datonalloc, this resets daton.
        /// Using newcount = 0 is equivalent to l_dnaEmpty().<para/>
        ///
        /// (2) If newcount  is greater  datonalloc, this causes a realloc
        /// to a size datonalloc = newcount.<para/>
        ///
        /// (3) All the previously unused values in da are set to 0.0.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaSetCount/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="newcount">[in] - </param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaSetCount(
            L_Dna da,
            int newcount)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaSetCount(da.Pointer, newcount);

            return(_Result);
        }
Example #12
0
        // dnabasic.c (539, 1)
        // l_dnaRemoveNumber(da, index) as int
        // l_dnaRemoveNumber(L_DNA *, l_int32) as l_ok
        ///  <summary>
        /// (1) This shifts da[i] to da[i - 1] for all i  is greater  index.<para/>
        ///
        /// (2) It should not be used repeatedly on large arrays,
        /// because the function is O(n).
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaRemoveNumber/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="index">[in] - element to be removed</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaRemoveNumber(
            L_Dna da,
            int index)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaRemoveNumber(da.Pointer, index);

            return(_Result);
        }
Example #13
0
        // dnabasic.c (439, 1)
        // l_dnaAddNumber(da, val) as int
        // l_dnaAddNumber(L_DNA *, l_float64) as l_ok
        ///  <summary>
        /// l_dnaAddNumber()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaAddNumber/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="val">[in] - float or int to be added stored as a float</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaAddNumber(
            L_Dna da,
            double val)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaAddNumber(da.Pointer, val);

            return(_Result);
        }
Example #14
0
        // dnafunc1.c (226, 1)
        // l_dnaUnionByAset(da1, da2) as L_Dna
        // l_dnaUnionByAset(L_DNA *, L_DNA *) as L_DNA *
        ///  <summary>
        /// (1) See sarrayUnionByAset() for the approach.<para/>
        ///
        /// (2) Here, the key in building the sorted tree is the number itself.<para/>
        ///
        /// (3) Operations using an underlying tree are O(nlogn), which is
        /// typically less efficient than hashing, which is O(n).
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaUnionByAset/*"/>
        ///  <param name="da1">[in] - </param>
        ///  <param name="da2">[in] - </param>
        ///   <returns>dad with the union of the set of numbers, or NULL on error</returns>
        public static L_Dna l_dnaUnionByAset(
            L_Dna da1,
            L_Dna da2)
        {
            if (da1 == null) {throw new ArgumentNullException  ("da1 cannot be Nothing");}

            if (da2 == null) {throw new ArgumentNullException  ("da2 cannot be Nothing");}

            IntPtr _Result = Natives.l_dnaUnionByAset(da1.Pointer, da2.Pointer);

            if (_Result == IntPtr.Zero) {return null;}

            return  new L_Dna(_Result);
        }
Example #15
0
        // dnabasic.c (932, 1)
        // l_dnaSetParameters(da, startx, delx) as int
        // l_dnaSetParameters(L_DNA *, l_float64, l_float64) as l_ok
        ///  <summary>
        /// l_dnaSetParameters()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaSetParameters/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="startx">[in] - x value corresponding to da[0]</param>
        ///  <param name="delx">[in] - difference in x values for the situation where the elements of da correspond to the evaulation of a function at equal intervals of size %delx</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaSetParameters(
            L_Dna da,
            double startx,
            double delx)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaSetParameters(da.Pointer, startx, delx);

            return(_Result);
        }
Example #16
0
        // dnabasic.c (750, 1)
        // l_dnaShiftValue(da, index, diff) as int
        // l_dnaShiftValue(L_DNA *, l_int32, l_float64) as l_ok
        ///  <summary>
        /// l_dnaShiftValue()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaShiftValue/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="index">[in] - to element to change relative to the current value</param>
        ///  <param name="diff">[in] - increment if diff  is greater  0 or decrement if diff  is smaller 0</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int l_dnaShiftValue(
            L_Dna da,
            int index,
            double diff)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaShiftValue(da.Pointer, index, diff);

            return(_Result);
        }
Example #17
0
        // dnabasic.c (693, 1)
        // l_dnaGetIValue(da, index, pival) as int
        // l_dnaGetIValue(L_DNA *, l_int32, l_int32 *) as l_ok
        ///  <summary>
        /// (1) Caller may need to check the function return value to
        /// decide if a 0 in the returned ival is valid.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaGetIValue/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="index">[in] - into l_dna</param>
        ///  <param name="pival">[out] - integer value 0 on error</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int l_dnaGetIValue(
            L_Dna da,
            int index,
            out int pival)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaGetIValue(da.Pointer, index, out pival);

            return(_Result);
        }
Example #18
0
        // dnabasic.c (389, 1)
        // l_dnaClone(da) as L_Dna
        // l_dnaClone(L_DNA *) as L_DNA *
        ///  <summary>
        /// l_dnaClone()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaClone/*"/>
        ///  <param name="da">[in] - </param>
        ///   <returns>ptr to same da, or NULL on error</returns>
        public static L_Dna l_dnaClone(
            L_Dna da)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            IntPtr _Result = Natives.l_dnaClone(da.Pointer);

            if (_Result == IntPtr.Zero)
            {
                return(null);
            }

            return(new L_Dna(_Result));
        }
Example #19
0
        // dnabasic.c (1087, 1)
        // l_dnaWriteStream(fp, da) as int
        // l_dnaWriteStream(FILE *, L_DNA *) as l_ok
        ///  <summary>
        /// l_dnaWriteStream()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaWriteStream/*"/>
        ///  <param name="fp">[in] - file stream</param>
        ///  <param name="da">[in] - </param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaWriteStream(
            FILE fp,
            L_Dna da)
        {
            if (fp == null)
            {
                throw new ArgumentNullException("fp cannot be Nothing");
            }

            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaWriteStream(fp.Pointer, da.Pointer);

            return(_Result);
        }
Example #20
0
        // dnabasic.c (1056, 1)
        // l_dnaWrite(filename, da) as int
        // l_dnaWrite(const char *, L_DNA *) as l_ok
        ///  <summary>
        /// l_dnaWrite()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaWrite/*"/>
        ///  <param name="filename">[in] - </param>
        ///  <param name="da">[in] - </param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaWrite(
            String filename,
            L_Dna da)
        {
            if (filename == null)
            {
                throw new ArgumentNullException("filename cannot be Nothing");
            }

            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaWrite(filename, da.Pointer);

            return(_Result);
        }
Example #21
0
        public static L_Dna l_dnaRemoveDupsByAset(this L_Dna das)
        {
            if (null == das)
            {
                throw new ArgumentNullException("das cannot be null");
            }

            var pointer = Native.DllImports.l_dnaRemoveDupsByAset((HandleRef)das);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new L_Dna(pointer));
            }
        }
Example #22
0
        // dnabasic.c (955, 1)
        // l_dnaCopyParameters(dad, das) as int
        // l_dnaCopyParameters(L_DNA *, L_DNA *) as l_ok
        ///  <summary>
        /// l_dnaCopyParameters()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaCopyParameters/*"/>
        ///  <param name="dad">[in] - destination DNuma</param>
        ///  <param name="das">[in] - source DNuma</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaCopyParameters(
            L_Dna dad,
            L_Dna das)
        {
            if (dad == null)
            {
                throw new ArgumentNullException("dad cannot be Nothing");
            }

            if (das == null)
            {
                throw new ArgumentNullException("das cannot be Nothing");
            }

            int _Result = Natives.l_dnaCopyParameters(dad.Pointer, das.Pointer);

            return(_Result);
        }
Example #23
0
        // Conversion between numa and dna
        public static Numa l_dnaConvertToNuma(this L_Dna da)
        {
            if (null == da)
            {
                throw new ArgumentNullException("da cannot be null");
            }

            var pointer = Native.DllImports.l_dnaConvertToNuma((HandleRef)da);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Numa(pointer));
            }
        }
Example #24
0
        public static L_ASet l_asetCreateFromDna(this L_Dna da)
        {
            if (null == da)
            {
                throw new ArgumentNullException("da cannot be null");
            }

            var pointer = Native.DllImports.l_asetCreateFromDna((HandleRef)da);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new L_ASet(pointer));
            }
        }
Example #25
0
        // dnabasic.c (1438, 1)
        // l_dnaaReplaceDna(daa, index, da) as int
        // l_dnaaReplaceDna(L_DNAA *, l_int32, L_DNA *) as l_ok
        ///  <summary>
        /// (1) Any existing l_dna is destroyed, and the input one
        /// is inserted in its place.<para/>
        ///
        /// (2) If the index is invalid, return 1 (error)
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaaReplaceDna/*"/>
        ///  <param name="daa">[in] - </param>
        ///  <param name="index">[in] - to the index-th l_dna</param>
        ///  <param name="da">[in] - insert and replace any existing one</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaaReplaceDna(
            L_Dnaa daa,
            int index,
            L_Dna da)
        {
            if (daa == null)
            {
                throw new ArgumentNullException("daa cannot be Nothing");
            }

            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaaReplaceDna(daa.Pointer, index, da.Pointer);

            return(_Result);
        }
Example #26
0
        public static L_Dna l_dnaIntersectionByAset(this L_Dna da1, L_Dna da2)
        {
            if (null == da1 ||
                null == da2)
            {
                throw new ArgumentNullException("da1, da2 cannot be null");
            }

            var pointer = Native.DllImports.l_dnaIntersectionByAset((HandleRef)da1, (HandleRef)da2);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new L_Dna(pointer));
            }
        }
Example #27
0
        // dnabasic.c (321, 1)
        // l_dnaDestroy(pda) as Object
        // l_dnaDestroy(L_DNA **) as void
        ///  <summary>
        /// (1) Decrements the ref count and, if 0, destroys the l_dna.<para/>
        ///
        /// (2) Always nulls the input ptr.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaDestroy/*"/>
        ///  <param name="pda">[in,out] - to be nulled if it exists</param>
        public static void l_dnaDestroy(
            ref L_Dna pda)
        {
            IntPtr pdaPtr = IntPtr.Zero;    if (pda != null)

            {
                pdaPtr = pda.Pointer;
            }

            Natives.l_dnaDestroy(ref pdaPtr);
            if (pdaPtr == IntPtr.Zero)
            {
                pda = null;
            }
            else
            {
                pda = new L_Dna(pdaPtr);
            };
        }
Example #28
0
        // dnabasic.c (1265, 1)
        // l_dnaaAddDna(daa, da, copyflag) as int
        // l_dnaaAddDna(L_DNAA *, L_DNA *, l_int32) as l_ok
        ///  <summary>
        /// l_dnaaAddDna()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaaAddDna/*"/>
        ///  <param name="daa">[in] - </param>
        ///  <param name="da">[in] - to be added</param>
        ///  <param name="copyflag">[in] - L_INSERT, L_COPY, L_CLONE</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int l_dnaaAddDna(
            L_Dnaa daa,
            L_Dna da,
            int copyflag)
        {
            if (daa == null)
            {
                throw new ArgumentNullException("daa cannot be Nothing");
            }

            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            int _Result = Natives.l_dnaaAddDna(daa.Pointer, da.Pointer, copyflag);

            return(_Result);
        }
Example #29
0
        // dnahash.c (553, 1)
        // l_dnaFindValByHash(da, dahash, val, pindex) as int
        // l_dnaFindValByHash(L_DNA *, L_DNAHASH *, l_float64, l_int32 *) as l_ok
        ///  <summary>
        /// (1) Algo: hash %val into a key hash the key to get the dna
        /// in %dahash (that holds indices into %da) traverse
        /// the dna of indices looking for %val in %da.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/l_dnaFindValByHash/*"/>
        ///  <param name="da">[in] - </param>
        ///  <param name="dahash">[in] - containing indices into %da</param>
        ///  <param name="val">[in] - searching for this number in %da</param>
        ///  <param name="pindex">[out] - index into da if found -1 otherwise</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int l_dnaFindValByHash(
            L_Dna da,
            L_DnaHash dahash,
            double val,
            out int pindex)
        {
            if (da == null)
            {
                throw new ArgumentNullException("da cannot be Nothing");
            }

            if (dahash == null)
            {
                throw new ArgumentNullException("dahash cannot be Nothing");
            }

            int _Result = Natives.l_dnaFindValByHash(da.Pointer, dahash.Pointer, val, out pindex);

            return(_Result);
        }