Ignore:
Timestamp:
11/13/15 15:18:03 (9 years ago)
Author:
Eric.Larour
Message:

CHG: finished routines related to setmask in javascript, and startted classes and routines related to parameterization,
in partcular, geometry and constants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/array/ArrayOperations.js

    r19711 r19719  
    5555        return list;
    5656} //}}}
     57function IsArray(object) { //{{{
     58
     59        if( Object.prototype.toString.call( object ) === '[object Array]' ) {
     60                return 1;
     61        }
     62        else return 0;
     63
     64} //}}}
     65function ArrayNot(array) { //{{{
     66
     67        var notarray=array;
     68        for (i=0;i<array.length;i++)notarray[i]=-array[i];
     69        return notarray;
     70} //}}}
     71function ArrayAnd(array1,array2) { //{{{
     72
     73        var array=array1;
     74        for (i=0;i<array1.length;i++)array[i]=array1[i] & array2[i];
     75        return array;
     76} //}}}
     77function NewArrayFill(size,value) { //{{{
     78
     79        return new Array(size).fill(value);
     80} //}}}
     81function ArrayFind(array,value) { //{{{
     82       
     83        //find number of indices
     84        var count=0;
     85        for (i=0;i<array.length;i++)if(array[i]==value)count++;
     86
     87        //allocate:
     88        var indices= NewArrayFill(count,0);
     89
     90        //fill in:
     91        count=0;
     92        for (i=0;i<array.length;i++){
     93                if(array[i]==value){
     94                        indices[count]=i;
     95                        count++;
     96                }
     97        }
     98        return indices;
     99} //}}}
Note: See TracChangeset for help on using the changeset viewer.