Top Description Fields Constructors Methods
org.jruby.specialized

public abstract Class RubyArraySpecialized

extends RubyArray
Class Inheritance
Known Direct Subclasses
org.jruby.specialized.RubyArrayTwoObject, org.jruby.specialized.RubyArrayOneObject
Imports
org.jruby.Ruby, .RubyArray, .RubyClass, org.jruby.runtime.Helpers, .ThreadContext, org.jruby.runtime.builtin.IRubyObject

This is the base class for all specialized RubyArray.

Specialized RubyArray use fields rather than an IRubyObject[] to hold their values. When they need to grow or shrink, they unpack those values to a proper IRubyObject[] and fall back on RubyArray logic.

Subclasses should override all methods that would access the array directly to use the fields, with guards for the packed flag and access outside packed range. This includes the following methods (at the time of this writing...this list will evolve):

RubyArrayeltInternal(int) RubyArrayeltInternalSet(int index, IRubyObject value) RubyArraySpecializedfinishUnpack(IRubyObject nil) RubyArrayaryDup() RubyArrayrb_clear(org.jruby.runtime.ThreadContext) RubyArraycollect(org.jruby.runtime.ThreadContext, org.jruby.runtime.Block) RubyArraycopyInto(org.jruby.runtime.ThreadContext, IRubyObject[], int) RubyArraycopyInto(org.jruby.runtime.ThreadContext, IRubyObject[], int, int) RubyArraydupImpl(Ruby, RubyClass) RubyArrayincludes(org.jruby.runtime.ThreadContext, IRubyObject) RubyArrayindexOf(Object) RubyArrayinspectAry(org.jruby.runtime.ThreadContext) RubyArrayinternalRotate(org.jruby.runtime.ThreadContext, int) RubyArrayinternalRotateBang(org.jruby.runtime.ThreadContext, int) RubyArrayop_plus(org.jruby.runtime.ThreadContext, IRubyObject) RubyArrayreverse_bang(org.jruby.runtime.ThreadContext) RubyArraysafeReverse() RubyArraysortInternal(org.jruby.runtime.ThreadContext, org.jruby.runtime.Block) RubyArraysortInternal(org.jruby.runtime.ThreadContext, boolean) RubyArraystoreInternal(org.jruby.runtime.ThreadContext, int, IRubyObject) RubyArraysubseq(RubyClass, long, long, boolean) RubyArraytoJavaArray(ThreadContext) RubyArrayuniq(org.jruby.runtime.ThreadContext)

Field Summary

Modifier and TypeField and Description
public static final int
Inherited from org.jruby.RubyArray:
ARRAY_DEFAULT_SIZEbeginDEFAULT_INSPECT_STR_SIZErealLengthvalues

Constructor Summary

AccessConstructor and Description
public
RubyArraySpecialized(Ruby runtime, boolean light)

public
RubyArraySpecialized(RubyClass otherClass, boolean light)

public

Method Summary

Modifier and TypeMethod and Description
protected abstract void
protected boolean
protected final void
unpack(ThreadContext context)

Overrides org.jruby.RubyArray.unpack.

Overridden by specialized arrays to fall back to IRubyObject[].

Inherited from org.jruby.RubyArray:
addaddaddaddAlladdAllall_pall_pall_pCommonany_pany_pany_pCommonappendappendarefarefarefarefarefaryAppendaryAppendaryDuparyToAryaryToAryasetasetasetasetasetassocatatbsearchbsearch_indexcheckArrayTypecheckLengthcheckLengthclearcollectcollect_bangcollectArraycollectBangcollectEnumcombinationcompactcompactcompact_bangcompact_bangcomparecompareFixnumscompareOthersconcatconcatconcatconcurrentModificationcontainscontainsAllconvertToArraycopyIntocopyIntocopyIntocopyIntocountcountcreatecreatecreateArrayClasscyclecycledeconstructdeletedelete_atdelete_atdelete_atdelete_atdelete_ifdeleteIfdetectCommondifferencedigdigdigdigdropdrop_whiledupdupImpleacheach_indexeach_sliceeachIndexeachSliceeltInternaleltInternalSeteltOkeltSetOkeltSetOkempty_pempty_pensureCapacityentryentryeqlequalsfetchfetchfetchfetch_valuesfillfillfillfillfillCommonfillCommonfindfind_indexfind_indexfirstfirstfirstfirstfirstflattenflattenflattenflatten_bangflatten_bangfrozen_pgetgetJavaClassgetLengthgetListgetNativeClassIndexhashinclude_pincludesincludesByEqlindexindexindexindexesindexesindexOfinitializeinitializeinitializeinitializeinitialize_copyinitializeCommoninsertinsertinsertinsertinsertinsertinsertinspectinspectAryinternalRotateinternalRotateBangintersect_pintersectionisEmptyisSharedJavaArrayiteratorjoinjoinjoin19join19joinStringskeep_iflastlastlastlastlastlastIndexOflengthlengthlistIteratorlistIteratormakeSharedmapmap_bangmarshalTomarshalTomarshalTomaxmaxminminminmaxmodifymodifymodifyCheckmodifyChecknewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArraynewArrayLightnewArrayLightnewArrayLightnewArrayLightnewArrayLightnewArrayLightnewArrayLightnewArrayLightnewArrayMayCopynewArrayMayCopynewArrayMayCopynewArrayNoCopynewArrayNoCopynewArrayNoCopynewArrayNoCopyLightnewBlankArraynewBlankArraynewEmptyArraynewEmptyArraynewSharedArraynitemsnitemsnone_pnone_pnone_pCommonone_pone_pone_pCommonop_andop_andop_cmpop_diffop_diffop_equalop_orop_orop_plusop_plusop_timespackpackpermutationpermutationpoppopproductproductpushpushpushpushpush_mrassocrb_clearrb_clearrbCollectrejectreject_bangrejectBangrejectCommonremoveremoveremoveAllrepeated_permutationrepeatedCombinationreplacereplaceretainAllreversereversereverse_bangreverse_bangreverse_eachreverseEachrindexrindexrindexrotaterotaterotate_bangrotate_bangrubyStreamsafeArraySetsafeReversesamplesamplesamplesampleselectselect_bangselectCommonsetshiftshiftshuffleshuffleshuffleshuffle_bangshuffle_bangshuffle_bangsizesizeslice_bangslice_bangslice_bangslice_bangslice_bangsortsort_bangsort_by_bangsortInternalsortInternalstorestorestoreInternalsubListsubseqsubseqsubseq_stepsubseqLightsumsumsumCommontaketake_whileto_ato_ato_aryto_aryto_hto_hto_stoArraytoArraytoJavatoJavaArraytoJavaArraytoJavaArrayMaybeUnsafetoJavaArrayUnsafetransposetransposetry_convertunionuniquniquniq_banguniq_bangunmarshalFromunmarshalFromunshiftunshiftunshiftunshiftunshiftunshiftvalues_atvalues_atzip

Field Detail

MAX_PACKED_SIZEback to summary
public static final int MAX_PACKED_SIZE

Constructor Detail

RubyArraySpecializedback to summary
public RubyArraySpecialized(Ruby runtime, boolean light)
RubyArraySpecializedback to summary
public RubyArraySpecialized(RubyClass otherClass, boolean light)
RubyArraySpecializedback to summary
public RubyArraySpecialized(RubyClass otherClass)

Method Detail

finishUnpackback to summary
protected abstract void finishUnpack(IRubyObject nil)
packedback to summary
protected boolean packed()
unpackback to summary
protected final void unpack(ThreadContext context)

Overrides org.jruby.RubyArray.unpack.

Doc from org.jruby.RubyArray.unpack.

Overridden by specialized arrays to fall back to IRubyObject[].