本文整理汇总了PHP中Set::unionInPlace方法的典型用法代码示例。如果您正苦于以下问题:PHP Set::unionInPlace方法的具体用法?PHP Set::unionInPlace怎么用?PHP Set::unionInPlace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Set
的用法示例。
在下文中一共展示了Set::unionInPlace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUnionInPlace
public function testUnionInPlace()
{
$set1 = new Set(array(1, 2, 3));
$set2 = new Set(array(2, 3, 4));
$set1->unionInPlace($set2);
$arr = array(1, 2, 3, 4);
foreach ($arr as $n) {
self::assertTrue($set1->member($n));
}
}
示例2: combineFollows
protected function combineFollows($exact)
{
$top = $this->state->_fsp;
$followSet = new Set(array());
for ($i = $top; $i >= 0; $i--) {
$localFollowSet = $this->state->following[$i];
/*
System.out.println("local follow depth "+i+"="+
localFollowSet.toString(getTokenNames())+")");
*/
$followSet->unionInPlace($localFollowSet);
if ($exact) {
// can we see end of rule?
if ($localFollowSet->member(TokenConst::$EOR_TOKEN_TYPE)) {
// Only leave EOR in set if at top (start rule); this lets
// us know if have to include follow(start rule); i.e., EOF
if ($i > 0) {
$followSet->remove(TokenConst::$EOR_TOKEN_TYPE);
}
} else {
// can't see end of rule, quit
break;
}
}
}
return $followSet;
}