コード例 #1
0
void gt_line_breaker_bases_delete(GtLineBreaker *lb)
{
  GtLineBreakerBases *lbb;
  if (!lb) return;
  lbb = gt_line_breaker_bases_cast(lb);
  gt_hashmap_delete(lbb->itrees);
}
コード例 #2
0
GtLineBreaker* gt_line_breaker_bases_new()
{
  GtLineBreakerBases *lbb;
  GtLineBreaker *lb;
  lb = gt_line_breaker_create(gt_line_breaker_bases_class());
  lbb = gt_line_breaker_bases_cast(lb);
  lbb->itrees = gt_hashmap_new(HASH_DIRECT, NULL,
                               (GtFree) gt_interval_tree_delete);
  return lb;
}
コード例 #3
0
bool gt_line_breaker_bases_is_line_occupied(GtLineBreaker* lb, GtLine *line,
                                            GtBlock *block)
{
  GtLineBreakerBases *lbb;
  GtRange r;
  GtIntervalTree *t;
  gt_assert(lb && block && line);
  r = gt_block_get_range(block);
  lbb = gt_line_breaker_bases_cast(lb);
  if (!(t = gt_hashmap_get(lbb->itrees, line)))
    return false;
  else
    return (gt_interval_tree_find_first_overlapping(t, r.start, r.end));
}
コード例 #4
0
int gt_line_breaker_bases_is_line_occupied(GtLineBreaker* lb, bool *result,
                                           GtLine *line, GtBlock *block,
                                           GT_UNUSED GtError *err)
{
  GtLineBreakerBases *lbb;
  GtRange r;
  GtIntervalTree *t;
  gt_assert(lb && block && line);
  r = gt_block_get_range(block);
  lbb = gt_line_breaker_bases_cast(lb);
  if (!(t = gt_hashmap_get(lbb->itrees, line)))
    *result = false;
  else
    *result = (gt_interval_tree_find_first_overlapping(t, r.start, r.end));
  return 0; /* gt_line_breaker_bases_is_line_occupied() is sane */
}
コード例 #5
0
void gt_line_breaker_bases_register_block(GtLineBreaker *lb,
                                          GtLine *line,
                                          GtBlock *block)
{
  GtLineBreakerBases *lbb;
  GtIntervalTree *t;
  GtIntervalTreeNode *new_node;
  GtRange *rng;
  gt_assert(lb && block && line);
  lbb = gt_line_breaker_bases_cast(lb);
  rng = gt_block_get_range_ptr(block);
  new_node = gt_interval_tree_node_new(rng, rng->start, rng->end);
  if (!(t = gt_hashmap_get(lbb->itrees, line)))
  {
    t = gt_interval_tree_new(NULL);
    gt_hashmap_add(lbb->itrees, line, t);
  }
  gt_interval_tree_insert(t, new_node);
}