Package org.jruby

Examples of org.jruby.RubyRange.last()


        int length = (int)getJavaArray().length().getLongValue();
        JavaClass arrayClass = JavaClass.get(context.getRuntime(), getJavaArray().getComponentType());
       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
View Full Code Here


       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
                int newLength = last - first;
                if (range.exclude_end_p().isFalse()) newLength += 1;
View Full Code Here

        int length = (int)getJavaArray().length().getLongValue();
        JavaClass arrayClass = JavaClass.get(context.getRuntime(), getJavaArray().getComponentType());
       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
View Full Code Here

       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
                int newLength = last - first;
                if (range.exclude_end_p().isFalse()) newLength += 1;
View Full Code Here

                    // in the PreparedStatement: (? AND ?)

                    RubyRange range_value = (RubyRange) arg;

                    driver.setPreparedStatementParam(ps, range_value.first(), index++);
                    driver.setPreparedStatementParam(ps, range_value.last(), index++);

                } else {
                    // Otherwise, handle each argument
                    driver.setPreparedStatementParam(ps, arg, index++);
                }
View Full Code Here

    public IRubyObject getRange(ThreadContext context, IRubyObject arg0) {
        int length = Array.getLength(getObject());
       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
View Full Code Here

       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first() instanceof RubyFixnum && range.last() instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first()).getLongValue();
                int last = (int)((RubyFixnum)range.last()).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
                int newLength = last - first;
                if (range.exclude_end_p().isFalse()) newLength += 1;
View Full Code Here

            Long index = (Long)index_or_range.toJava(Long.class);
            return commonArefIndex(context, index);
        } else if (index_or_range instanceof RubyRange) {
            RubyRange range = (RubyRange)index_or_range;
            Long start = (Long)range.first(context).toJava(Long.class);
            Long last = (Long)range.last(context).toJava(Long.class);
            // subvec returns from 'start' to element (- end 1)
            if (range.exclude_end_p().isTrue()) {
                return commonAref(context, start, null, last);
            } else {
                return commonAref(context, start, null, last + 1);
View Full Code Here

    public IRubyObject getRange(ThreadContext context, IRubyObject arg0) {
        int length = Array.getLength(getObject());
       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first(context) instanceof RubyFixnum && range.last(context) instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first(context)).getLongValue();
                int last = (int)((RubyFixnum)range.last(context)).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
View Full Code Here

       
        if (arg0 instanceof RubyRange) {
            RubyRange range = (RubyRange)arg0;
            if (range.first(context) instanceof RubyFixnum && range.last(context) instanceof RubyFixnum) {
                int first = (int)((RubyFixnum)range.first(context)).getLongValue();
                int last = (int)((RubyFixnum)range.last(context)).getLongValue();
               
                first = first >= 0 ? first : length + first;
                last = last >= 0 ? last : length + last;
                int newLength = last - first;
                if (range.exclude_end_p().isFalse()) newLength += 1;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.