void draw_ball(void) { //if(ball1.moving == true) if(ball1.player_has_ball == 0) { ball1.x += ball1.speed_x; ball1.y += ball1.speed_y; check_border(); } else { if(ball1.player_has_ball == 1) { ball1.y = player1.paddle_pos + PADDLE_HEIGHT/2 - BALL_SIZE/2; ball1.x = OFFSET_L + 3; } else { ball1.y = player2.paddle_pos + PADDLE_HEIGHT/2 - BALL_SIZE/2; ball1.x = OFFSET_R - 3 - BALL_SIZE; if(ball1.speed_x > 0) { ball1.speed_x = -ball1.speed_x; } } } }
bool VolumeBox::check_border (const Border& border, const Volume& default_volume, Treelog& msg) const { if (const VolumeBox* box_volume = dynamic_cast<const VolumeBox*> (&default_volume)) { bool ok = true; for (size_t i = 0; i < bounds_size; i++) { const Bound& bound = *(this->*(bounds[i].bound)); if (bound.type () != Bound::finite) continue; const Bound& other = *(box_volume->*(bounds[i].bound)); if (other.type () != Bound::finite) continue; if (approximate (bound.value (), other.value ())) continue; if (!((border.*(bounds[i].check_border)) (bound.value (), msg))) ok = false; } return ok; } return check_border (border, msg); }
void parsing(char *argv, t_map *map, t_param *param) { int fd; map->nb_line = 0; map->nb_col = 0; if ((fd = open(argv, O_RDONLY)) < 0) ft_exit(); map = count_line_col(fd, map); map->tab = (int **)malloc(sizeof(int *) * (map->nb_line)); map->tab[map->nb_line] = NULL; close(fd); fd = open(argv, O_RDONLY); map = split_tab(map, fd); define_start(param, map); check_border(map); close(fd); }
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default_val) { xlsx_border border; border.left = xlsx_border_edge(); border.right = xlsx_border_edge(); border.top = xlsx_border_edge(); border.bottom = xlsx_border_edge(); if (cellProp) { const common_border_attlist & odfBordersAttr = cellProp->common_border_attlist_; process_border(*border.left, odfBordersAttr.fo_border_); process_border(*border.right, odfBordersAttr.fo_border_); process_border(*border.top, odfBordersAttr.fo_border_); process_border(*border.bottom, odfBordersAttr.fo_border_); process_border(*border.left, odfBordersAttr.fo_border_left_); process_border(*border.right, odfBordersAttr.fo_border_right_); process_border(*border.top, odfBordersAttr.fo_border_top_); process_border(*border.bottom, odfBordersAttr.fo_border_bottom_); if (check_border(cellProp->style_diagonal_bl_tr_)) { border.diagonal = xlsx_border_edge(); _CP_OPT(border_style) borderStyle(*cellProp->style_diagonal_bl_tr_); process_border(*border.diagonal, borderStyle); border.diagonalUp = true; } if (check_border(cellProp->style_diagonal_tl_br_)) { if (!border.diagonal) border.diagonal = xlsx_border_edge(); _CP_OPT(border_style) borderStyle (*cellProp->style_diagonal_tl_br_); process_border(*border.diagonal, borderStyle); border.diagonalDown = true; } } if (is_default(border)) { is_default_val = true; return 0; } else { is_default_val = false; xlsx_borders_array::const_iterator i = borders_.find(border); if (i != borders_.end()) { return i->index; } else { border.index = borders_.size(); borders_.insert(border); //borders_.push_back(border); return border.index; } } }
int ObSSTableBlockIndexMgr::find_by_key( const ObRowkey& key, const SearchMode mode, const Bound& bound, const_iterator& find) const { int ret = OB_SUCCESS; if (OB_SEARCH_MODE_MIN_VALUE == mode) { find = bound.begin_; } else if (OB_SEARCH_MODE_MAX_VALUE == mode) { find = bound.end_; find --; } else { find = std::lower_bound(bound.begin_, bound.end_, key, Compare(*this)); if (OB_SUCCESS != (ret = check_border(find, bound, mode))) { //TBSYS_LOG(WARN, "check border error"); } else { ObRowkey compare_key; if (OB_SUCCESS != (ret = get_row_key(*find, compare_key))) { TBSYS_LOG(WARN, "get row key error:ret=%d", ret); } else { switch (mode) { case OB_SEARCH_MODE_EQUAL: case OB_SEARCH_MODE_GREATER_EQUAL: break; case OB_SEARCH_MODE_GREATER_THAN: if (key == compare_key) { find ++; } if (find >= bound.end_) { ret = OB_BEYOND_THE_RANGE; } break; case OB_SEARCH_MODE_LESS_THAN: case OB_SEARCH_MODE_LESS_EQUAL: break; default: ret = OB_SEARCH_MODE_NOT_IMPLEMENT; break; } } } } return ret; }
int ObSSTableBlockIndexMgr::search_batch_blocks_by_offset( const int64_t offset, const SearchMode mode, ObBlockPositionInfos& pos_info) const { int ret = OB_SUCCESS; Bound bound; ObRowkey key; if (0 > offset) { ret = OB_INVALID_ARGUMENT; TBSYS_LOG(WARN, "invalid argument"); } else if (OB_SUCCESS != (ret = get_bound(bound))) { TBSYS_LOG(WARN, "get bound error:ret=%d", ret); } else { ObSSTableBlockIndex item; item.block_data_offset_ = offset; item.block_endkey_offset_ = 0; const_iterator find_it = std::lower_bound(bound.begin_, bound.end_, item); if (OB_SUCCESS != (ret = check_border(find_it, bound, mode))) {//check right border //TBSYS_LOG(WARN, "check border error"); } else { switch (mode) { case OB_SEARCH_MODE_GREATER_THAN: if (*find_it == item) { ++ find_it; } if (find_it >= bound.end_) { ret = OB_BEYOND_THE_RANGE; } break; case OB_SEARCH_MODE_EQUAL: if (*find_it == item) { pos_info.block_count_ = 1; } else { ret = OB_BEYOND_THE_RANGE; } break; case OB_SEARCH_MODE_GREATER_EQUAL: break; case OB_SEARCH_MODE_LESS_THAN: find_it --; case OB_SEARCH_MODE_LESS_EQUAL: if (*find_it != item) { find_it --; } if (find_it < bound.begin_) { ret = OB_BEYOND_THE_RANGE; } break; default: ret = OB_SEARCH_MODE_NOT_IMPLEMENT; break; }//end switch } if (OB_SUCCESS == ret) { ret = store_block_position_info(find_it, bound, mode, key, pos_info); } } return ret; }