/**
 * Retrieve the index of the current position.
 *
 * @return The position index.
 */
RexxInternalObject *SupplierClass::index()
{
    // past the end if an error
    if (position > items->size())
    {
        reportException(Error_Incorrect_method_supplier);
    }
    // the index array is optional...if we don't have it, just give
    // the numeric position
    if (indexes == OREF_NULL)
    {
        return new_integer(position);
    }

    // already gone past the end of the index array?
    if (position > indexes->size())
    {
        return TheNilObject;
    }
    else
    {
        // get the current value and return .nil if nothing is there.
        return resultOrNil(indexes->get(position));
    }
}
/**
 * Retrieve the value portion of the pair.
 *
 * @return The associated value.
 */
RexxInternalObject *SupplierClass::item()
{
    // already gone past the end the end is an error
    if (position > items->size())
    {
        reportException(Error_Incorrect_method_supplier);
    }

    // get the value, but make sure we at least return .nil
    return resultOrNil(items->get(position));
}
Beispiel #3
0
/**
 * Returns the defining class scope for a method.  Returns .nil
 * for any method not defined by a class scope.
 *
 * @return The scope class or .nil.
 */
RexxObject *MethodClass::getScopeRexx()
{
    return resultOrNil(getScope());
}
/**
 * Pull an item off of the stack, returning .nil if no items
 * are available
 *
 * @return The popped item, or .nil if the queue is empty.
 */
RexxObject *QueueClass::pullRexx()
{
    return resultOrNil(pop());
}