BitVector *SGraphBit::new_node_successors(SGraphNode node) const { if (!has_bv(node)) { return new BitVector; } else { return(new BitVector(*get_bv(node))); } }
SNodeIter SGraphBit:: get_node_successor_iterator(SGraphNode node) const { if (!node_has_successors(node)) return new SGraphEmptyIter; if (has_bv(node)) { return(SNodeIter( new SGraphBitIter(get_bv(node), false) )); } else { return(SNodeIter( new SGraphEmptyIter()) ); } }
static inline int *get_bit_vector(struct tobj* tobj) { struct tobj *t = tobj; int s_bit, e_bit; int cur = t->cur_doc; int len, i; int *output; //printf("get_bit_vector %d, %d, %d\n", t->cur_chunk, t->chunk_s, t->chunk_e); if(!cur){ s_bit = 0; }else{ s_bit = t->chunk.bvoff[cur - 1]; } e_bit = t->chunk.bvoff[cur]; //printf("-- %d, %d, %d\n", cur, s_bit, e_bit); /* huffman decode */ len = hfman_decode(s_bit, e_bit, t->hcode_addr, hcode_buff); /* printf("%d \n", len); for(i = 0; i < len; i++){ printf("%d ", hcode_buff[i]); } printf("\n"); */ /* bit vector decode */ output = get_bv(len, hcode_buff, &len); // output is the pointer to the bit vector array /* printf("%d \n", len); for(i = 0; i < len; i++){ printf("%d ", output[i]); } printf("\n"); */ return output; }
bool SGraphBit::node_has_successors(SGraphNode node) const { BitVector *bv = get_bv(node); if (!bv) return false; return(bv->num_significant_bits() != 0); }