Merge pull request #7456 from staabm/simpler-equals
Specialize Rule2Literal->equals(Rule2Literal) for speeduppull/7432/merge
commit
1e9136f086
|
@ -65,6 +65,19 @@ class Rule2Literals extends Rule
|
||||||
*/
|
*/
|
||||||
public function equals(Rule $rule)
|
public function equals(Rule $rule)
|
||||||
{
|
{
|
||||||
|
// specialized fast-case
|
||||||
|
if ($rule instanceof self) {
|
||||||
|
if ($this->literal1 !== $rule->literal1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->literal2 !== $rule->literal2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$literals = $rule->getLiterals();
|
$literals = $rule->getLiterals();
|
||||||
if (2 != count($literals)) {
|
if (2 != count($literals)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue