| 2 |  |  | 
| 3 |  | #include "Exclude.hpp" | 
| 4 |  |  | 
| 5 | – | double* Exclude::exPair; | 
| 5 |  |  | 
| 6 | < | Exclude::Exclude( int theIndex ){ | 
| 7 | < |  | 
| 8 | < | exI = index*2; | 
| 9 | < | exJ = index*2 + 1; | 
| 6 | > |  | 
| 7 | > | Exclude::Exclude( int theIndex ){ | 
| 8 | > | exI = theIndex*2; | 
| 9 | > | exJ = theIndex*2 + 1; | 
| 10 |  | } | 
| 11 |  |  | 
| 12 |  | void Exclude::createArray( int nExcludes ){ | 
| 13 |  |  | 
| 14 | < | exPair = new int[nExcludes*2]; | 
| 14 | > | exPairs = new int[nExcludes*2]; | 
| 15 |  | } | 
| 16 |  |  | 
| 17 | < | void destroyArray( void ){ | 
| 18 | < | delete[] exPair; | 
| 17 | > | void Exclude::destroyArray( void ){ | 
| 18 | > | delete[] exPairs; | 
| 19 |  | } | 
| 20 |  |  | 
| 21 |  | void Exclude::setPair( int i, int j ){ | 
| 22 | + | exPairs[exI] = i; | 
| 23 | + | exPairs[exJ] = j; | 
| 24 | + | } | 
| 25 |  |  | 
| 26 | < | exPair[exI] = i; | 
| 27 | < | exPair[exJ] = j; | 
| 26 | > | void Exclude::addExcludePairs(int nAdded, int* AexPairs) { | 
| 27 | > | int nNew = nExcludes + nAdded; | 
| 28 | > |  | 
| 29 | > | int* new_exPairs = new int[nNew*2]; | 
| 30 | > | int i, j; | 
| 31 | > |  | 
| 32 | > | for (i = 0; i < 2*nExcludes; i++) { | 
| 33 | > | new_exPairs[i] = exPairs[i]; | 
| 34 | > | } | 
| 35 | > |  | 
| 36 | > | for (i=0; i < 2*nAdded; i++) { | 
| 37 | > | j = i + 2*nExcludes; | 
| 38 | > | new_exPairs[j] = AexPairs[i]; | 
| 39 | > | } | 
| 40 | > |  | 
| 41 | > | delete[] exPairs; | 
| 42 | > |  | 
| 43 | > | exPairs = new_exPairs; | 
| 44 | > |  | 
| 45 | > | nExcludes = nNew; | 
| 46 |  | } | 
| 47 | + |  | 
| 48 | + | void Exclude::deleteExcludePair(int theIndex) { | 
| 49 | + | deleteRange(theIndex, theIndex); | 
| 50 | + | } | 
| 51 | + |  | 
| 52 | + | void Exclude::deleteRange(int startIndex, int stopIndex) { | 
| 53 | + |  | 
| 54 | + | int nNew = nExcludes - (stopIndex - startIndex + 1); | 
| 55 | + | int* new_exPairs = new int[nNew*2]; | 
| 56 | + | int i, j; | 
| 57 | + |  | 
| 58 | + | for (i=0; i < 2*startIndex; i++) { | 
| 59 | + | new_exPairs[i] = exPairs[i]; | 
| 60 | + | } | 
| 61 | + | for(i=2*(stopIndex+1); i < 2*nExcludes; i++) { | 
| 62 | + | j = i-2*startIndex + 1; | 
| 63 | + | new_exPairs[j] = exPairs[i]; | 
| 64 | + | } | 
| 65 | + |  | 
| 66 | + | delete[] exPairs; | 
| 67 | + |  | 
| 68 | + | exPairs = new_exPairs; | 
| 69 | + | nExcludes = nNew; | 
| 70 | + | } |