本文整理匯總了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;
}