Diff of /MatchKeys.c [7cd0b1] .. [ba04a1] Maximize Restore

  Switch to unified view

a/MatchKeys.c b/MatchKeys.c
...
...
66
ArrayList* MatchKeys_FilterJoins (ArrayList* matches)
66
ArrayList* MatchKeys_FilterJoins (ArrayList* matches)
67
{
67
{
68
    HashTable* ht = HashTable_new0 (NULL, NULL);
68
    HashTable* ht = HashTable_new0 (NULL, NULL);
69
    
69
    
70
    // Count the references to each keypoint
70
    // Count the references to each keypoint
71
    // ARG 13 May 2010: made 64 bit OS safe
71
    int i;
72
    int i;
72
    for(i=0; i<ArrayList_Count(matches); i++) {
73
    for(i=0; i<ArrayList_Count(matches); i++) {
73
        Match* m = (Match*) ArrayList_GetItem(matches, i);
74
        Match* m = (Match*) ArrayList_GetItem(matches, i);
74
      int lI = (HashTable_GetItem(ht, m->kp1) == NULL) ? 0 : (int) HashTable_GetItem(ht, m->kp1);
75
               void *lI = (HashTable_GetItem(ht, m->kp1) == NULL) ? NULL : HashTable_GetItem(ht, m->kp1);
75
      HashTable_SetItem(ht, m->kp1, (void*)(lI + 1));
76
               HashTable_SetItem(ht, m->kp1, (void*)((char *) lI + 1));
76
      int rI = (HashTable_GetItem(ht, m->kp2) == NULL) ? 0 : (int) HashTable_GetItem(ht, m->kp2);
77
               void *rI = (HashTable_GetItem(ht, m->kp2) == NULL) ? NULL : HashTable_GetItem(ht, m->kp2);
77
      HashTable_SetItem(ht, m->kp2, (void*)(rI + 1));
78
               HashTable_SetItem(ht, m->kp2, (void*)((char *) rI + 1));
78
    }
79
    }
79
80
80
    ArrayList* survivors = ArrayList_new0(NULL);
81
    ArrayList* survivors = ArrayList_new0(NULL);
81
    int removed = 0;
82
    int removed = 0;
82
    int j;
83
    int j;
83
    for(j=0; j<ArrayList_Count(matches); j++) {
84
    for(j=0; j<ArrayList_Count(matches); j++) {
84
        Match* m = (Match*) ArrayList_GetItem(matches, j);
85
        Match* m = (Match*) ArrayList_GetItem(matches, j);
85
        //WriteLine ("match: %d, %d", (int) HashTable_GetItem(ht, m->kp1), (int) HashTable_GetItem(ht, m->kp2));
86
        //WriteLine ("match: %d, %d", (int) HashTable_GetItem(ht, m->kp1), (int) HashTable_GetItem(ht, m->kp2));
86
        
87
        
87
      if (((int) HashTable_GetItem(ht, m->kp1)) <= 1 && ((int) HashTable_GetItem(ht, m->kp2)) <= 1)
88
               if (( HashTable_GetItem(ht, m->kp1)) <= (void *)1 && (HashTable_GetItem(ht, m->kp2)) <= (void *)1)
88
            ArrayList_AddItem(survivors, m);
89
            ArrayList_AddItem(survivors, m);
89
        else
90
        else
90
            removed += 1;
91
            removed += 1;
91
    }
92
    }
92
    
93