Compare two actions

This is used by {@link Action_sort()} to compare actions
545787
static function actioncmp(PHP_ParserGenerator_Action $ap1, PHP_ParserGenerator_Action $ap2)
    {
        $rc = $ap1->sp->index - $ap2->sp->index;
        if ($rc === 0) {
            $rc = $ap1->type - $ap2->type;
        }
        if ($rc === 0) {
            if ($ap1->type == self::SHIFT) {
                if ($ap1->x->statenum != $ap2->x->statenum) {
                    throw new Exception('Shift conflict: ' . $ap1->sp->name .
                        ' shifts both to state ' . $ap1->x->statenum . ' (rule ' .
                        $ap1->x->cfp->rp->lhs->name . ' on line ' .
                        $ap1->x->cfp->rp->ruleline . ') and to state ' .
                        $ap2->x->statenum . ' (rule ' .
                        $ap2->x->cfp->rp->lhs->name . ' on line ' .
                        $ap2->x->cfp->rp->ruleline . ')');
                }
            }
            if ($ap1->type != self::REDUCE
                && $ap1->type != self::RD_RESOLVED
                && $ap1->type != self::CONFLICT
            ) {
                throw new Exception('action has not been processed: ' .
                $ap1->sp->name . ' on line ' . $ap1->x->cfp->rp->ruleline .
                ', rule ' . $ap1->x->cfp->rp->lhs->name);
            }
            if ($ap2->type != self::REDUCE
                && $ap2->type != self::RD_RESOLVED
                && $ap2->type != self::CONFLICT
            ) {
                throw new Exception('action has not been processed: ' .
                $ap2->sp->name . ' on line ' . $ap2->x->cfp->rp->ruleline .
                ', rule ' . $ap2->x->cfp->rp->lhs->name);
            }
            $rc = $ap1->x->index - $ap2->x->index;
        }
        return $rc;
    }
1262628
function dispatch($action_name) {
        if (method_exists($this, '_init')) {
            $this->_init();
        }
        $action = self::getActionMethodName($action_name);
        if (method_exists($this, $action)) {
            return $this->$action();
        } else {
            throw new NoActionException;
        }
    }
827912
@Override
    protected void doPerform() {
        if (isSourceDocumentRoot()) {
            getActions().doubleClick().perform();
        } else {
            getActions().doubleClick(getFirstElement()).perform();
        }
    }
1249790
public Action0 getEndAction() {
    return new Action0() {
      @Override
      public void call() {
        if (endTime == null) {
          endTime = new Date().getTime();
          PerformanceLogger.log(PerformanceMetrics.this);
        }
      }
    };
  }
534349
function seqActions(actions, seed, onCompleted) {
  var index = 0;

  function invokeNext(v) {
    var action = actions[index];
    action(v, function (res) {
      index = index + 1;
      if (index < actions.length) {
        invokeNext(res);
      } else {
        onCompleted(res);
      }
    });
  }

  invokeNext(seed);
}
800519
@SuppressWarnings({ "unchecked" })
	protected int compare(E k1, E k2) {
		if (comparator == null) {
			return ((Comparable) k1).compareTo(k2);
		}
		return comparator.compare(k1, k2);
	}
296659
@Override
    public int compareTo(Object obj) throws ClassCastException {

        URI another = (URI) obj;
        if (!equals(_authority, another.getRawAuthority())) { 
            return -1;
        }
        return toString().compareTo(another.toString());
    }
1026482
public int compareTo (final ITrigger other)
  {

    if (other.getKey () == null && getKey () == null)
      return 0;
    if (other.getKey () == null)
      return -1;
    if (getKey () == null)
      return 1;

    return getKey ().compareTo (other.getKey ());
  }
1171512
static function isCurrentAction( $action ) {

		if ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) {
			$compare = $_REQUEST['action'];
		} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) {
			$compare = $_REQUEST['action2'];
		} else {
			return false;
		}

		return ( $action === $compare );
	}
701172
protected function calculateActionCount()
    {
        $counter = 0;
        foreach ($this->actions as $actions) {
            $counter += count($actions);
        }

        return $counter;
    }
373239
def if_else( action1, action2 )
      @function << "#{@function.indent}if ( #{self} ) {\n"
      @function.indent_offset +1
      action1.call
      @function.indent_offset -1
      @function << "#{@function.indent}} else {\n"
      @function.indent_offset +1
      action2.call
      @function.indent_offset -1
      @function << "#{@function.indent}};\n"
      self
    end
385517
@Override
    public int compareTo(MapElementContainer other) {
        if (this.priority < other.priority) {
            return -1;
        }
        if (this.priority > other.priority) {
            return 1;
        }
        return 0;
    }
1366426
private function action($action_name) {
    	// if no principal action is set yet or is the same
		if(!$this->Action || $action_name == $this->Action) {
			// set the main action
			$this->Action = $action_name;
		}
		// an action has already been set, this is impossible
		else { Throw new Exception("Query->action({$action_name}) : An incompatible action already exists : {$this->Action}"); }
    }
289787
@Override
    public int compareTo(final Outcome other) {
        return Data.getTotalComparator().compare(this.invocationID, other.invocationID);
    }
829464
public void rsort ()
    {
        sort(new Comparator<T>() {
            public int compare (T o1, T o2) {
                return _comp.compare(o2, o1);
            }
        });
    }
752042
@Override
    public int compareTo(Request<T> other) {
        Priority left = this.getPriority();
        Priority right = other.getPriority();

        // High-priority requests are "lesser" so they are sorted to the front.
        // Equal priorities are sorted by sequence number to provide FIFO ordering.
        return left == right ?
                this.sequence - other.sequence :
                right.ordinal() - left.ordinal();
    }
8059
private int compare(Object k1, Object k2) {
        return (mComparator==null ? ((Comparable)k1).compareTo(k2)
                : mComparator.compare(k1, k2));
    }