本文整理汇总了C++中OrderedTaskPoint::predecessor_allowed方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTaskPoint::predecessor_allowed方法的具体用法?C++ OrderedTaskPoint::predecessor_allowed怎么用?C++ OrderedTaskPoint::predecessor_allowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTaskPoint
的用法示例。
在下文中一共展示了OrderedTaskPoint::predecessor_allowed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Append
bool
OrderedTask::Insert(const OrderedTaskPoint &new_tp, const unsigned position)
{
if (position >= task_points.size())
return Append(new_tp);
if (/* is the new_tp allowed in this context? */
(position > 0 && !new_tp.predecessor_allowed()) ||
!new_tp.successor_allowed() ||
/* can a tp be inserted at this position? */
(position > 0 && !task_points[position - 1]->successor_allowed()) ||
!task_points[position]->predecessor_allowed())
return false;
if (active_task_point >= position)
active_task_point++;
task_points.insert(task_points.begin() + position,
new_tp.clone(task_behaviour, m_ordered_behaviour));
if (position)
set_neighbours(position - 1);
set_neighbours(position);
set_neighbours(position + 1);
update_geometry();
return true;
}
示例2:
bool
OrderedTask::Replace(const OrderedTaskPoint &new_tp, const unsigned position)
{
if (position >= task_points.size())
return false;
if (task_points[position]->equals(&new_tp))
// nothing to do
return true;
/* is the new_tp allowed in this context? */
if ((position > 0 && !new_tp.predecessor_allowed()) ||
(position + 1 < task_points.size() && !new_tp.successor_allowed()))
return false;
delete task_points[position];
task_points[position] = new_tp.clone(task_behaviour, m_ordered_behaviour);
if (position)
set_neighbours(position - 1);
set_neighbours(position);
if (position + 1 < task_points.size())
set_neighbours(position + 1);
update_geometry();
return true;
}