public class RubySet extends RubyObject implements java.util.Set
| Modifier and Type | Class and Description |
|---|---|
static class |
RubySet.DivideTSortHash |
RubyObject.DataRubyBasicObject.FinalizerIVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampNULL_ARRAY| Modifier | Constructor and Description |
|---|---|
protected |
RubySet(Ruby runtime,
RubyClass klass) |
| Modifier and Type | Method and Description |
|---|---|
IRubyObject |
add_p(ThreadContext context,
IRubyObject obj)
Adds the given object to the set and returns self.
|
boolean |
add(java.lang.Object element) |
RubySet |
add(ThreadContext context,
IRubyObject obj)
Adds the given object to the set and returns self.
|
boolean |
addAll(java.util.Collection coll) |
protected void |
addImpl(Ruby runtime,
IRubyObject obj) |
protected void |
addImplSet(ThreadContext context,
RubySet set) |
IRubyObject |
classify(ThreadContext context,
Block block) |
void |
clear() |
protected void |
clearImpl() |
IRubyObject |
collect_bang(ThreadContext context,
Block block) |
IRubyObject |
compare_by_identity_p(ThreadContext context) |
IRubyObject |
compare_by_identity(ThreadContext context) |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection coll) |
static RubySet |
create(ThreadContext context,
IRubyObject self,
IRubyObject... ary)
Creates a new set containing the given objects.
|
IRubyObject |
delete_if(ThreadContext context,
Block block) |
IRubyObject |
delete_p(ThreadContext context,
IRubyObject obj)
Deletes the given object from the set and returns self.
|
IRubyObject |
delete(ThreadContext context,
IRubyObject obj) |
protected boolean |
deleteImpl(IRubyObject obj) |
protected void |
deleteImplIterator(IRubyObject obj,
java.util.Iterator it) |
IRubyObject |
disjoint_p(ThreadContext context,
IRubyObject set)
Returns true if the set and the given set have no element in common.
|
IRubyObject |
divide(ThreadContext context,
Block block)
Divides the set into a set of subsets according to the commonality
defined by the given block.
|
IRubyObject |
each(ThreadContext context,
Block block) |
protected java.util.Set<IRubyObject> |
elements() |
protected java.util.Set<IRubyObject> |
elementsOrdered() |
IRubyObject |
empty_p(ThreadContext context) |
boolean |
eql(IRubyObject other)
method used for Hash key comparison (specialized for String, Symbol and Fixnum)
Will by default just call the Ruby method "eql?"
|
IRubyObject |
flatten_bang(ThreadContext context) |
RubySet |
flatten_merge(ThreadContext context,
IRubyObject set) |
RubySet |
flatten(ThreadContext context) |
IRubyObject |
freeze(ThreadContext context)
rb_obj_freeze
call-seq:
obj.freeze => obj
Prevents further modifications to obj.
|
RubyFixnum |
hash()
rb_obj_id
Will return the hash code of this object.
|
RubyBoolean |
include_p(ThreadContext context,
IRubyObject obj)
Returns true if the set contains the given object.
|
IRubyObject |
initialize_clone(ThreadContext context,
IRubyObject orig) |
IRubyObject |
initialize_dup(ThreadContext context,
IRubyObject orig) |
IRubyObject |
initialize(ThreadContext context,
Block block)
initialize(enum = nil, &block)
|
protected IRubyObject |
initialize(ThreadContext context,
IRubyObject[] args,
Block block) |
IRubyObject |
initialize(ThreadContext context,
IRubyObject enume,
Block block)
initialize(enum = nil, &block)
|
IRubyObject |
inspect()
rb_obj_inspect
call-seq:
obj.inspect => string
Returns a string containing a human-readable representation of
obj.
|
RubyString |
inspect(ThreadContext context) |
IRubyObject |
instance_variable_set(IRubyObject name,
IRubyObject value)
rb_obj_ivar_set
call-seq:
obj.instance_variable_set(symbol, obj) => obj
Sets the instance variable names by symbol to
object, thereby frustrating the efforts of the class's
author to attempt to provide proper encapsulation.
|
IRubyObject |
intersect_p(ThreadContext context,
IRubyObject set)
Returns true if the set and the given set have at least one element in common.
|
boolean |
intersect(RubySet set) |
boolean |
isEmpty() |
java.util.Iterator<java.lang.Object> |
iterator() |
IRubyObject |
keep_if(ThreadContext context,
Block block) |
IRubyObject |
length(ThreadContext context) |
protected void |
modifyCheck(Ruby runtime) |
IRubyObject |
op_and(ThreadContext context,
IRubyObject enume)
Returns a new set built by merging the set and the elements of the given enumerable object.
|
IRubyObject |
op_diff(ThreadContext context,
IRubyObject enume)
Returns a new set built by duplicating the set, removing every element that appears in the given enumerable object.
|
IRubyObject |
op_eql(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
rb_obj_equal
Will by default use identity equality to compare objects.
|
IRubyObject |
op_or(ThreadContext context,
IRubyObject enume)
Returns a new set built by merging the set and the elements of the given enumerable object.
|
IRubyObject |
op_xor(ThreadContext context,
IRubyObject enume)
Returns a new set containing elements exclusive between the set and the given enumerable object.
|
IRubyObject |
proper_subset_p(ThreadContext context,
IRubyObject set) |
IRubyObject |
proper_superset_p(ThreadContext context,
IRubyObject set) |
java.util.Iterator<IRubyObject> |
rawIterator() |
IRubyObject |
rb_clear(ThreadContext context) |
RubySet |
rb_merge(ThreadContext context,
IRubyObject enume)
Merges the elements of the given enumerable object to the set and returns self.
|
IRubyObject |
reject_bang(ThreadContext context,
Block block) |
boolean |
remove(java.lang.Object element) |
boolean |
removeAll(java.util.Collection coll) |
RubySet |
replace(ThreadContext context,
IRubyObject enume)
Replaces the contents of the set with the contents of the given enumerable object and returns self.
|
IRubyObject |
reset(ThreadContext context) |
boolean |
retainAll(java.util.Collection coll) |
IRubyObject |
select_bang(ThreadContext context,
Block block) |
int |
size() |
IRubyObject |
subset_p(ThreadContext context,
IRubyObject set) |
IRubyObject |
subtract(ThreadContext context,
IRubyObject enume)
Deletes every element that appears in the given enumerable object and returns self.
|
IRubyObject |
superset_p(ThreadContext context,
IRubyObject set) |
IRubyObject |
taint(ThreadContext context)
rb_obj_taint
call-seq:
obj.taint -> obj
Marks obj as tainted---if the
$SAFE level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings. |
RubyArray |
to_a(ThreadContext context)
Converts the set to an array.
|
RubySet |
to_set(ThreadContext context,
Block block) |
RubySet |
to_set(ThreadContext context,
IRubyObject[] args,
Block block) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] ary) |
IRubyObject |
untaint(ThreadContext context)
rb_obj_untaint
call-seq:
obj.untaint => obj
Removes the taint from obj.
|
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, equals, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toStringaddFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, ensureInstanceVariablesSettable, eql_p, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id, infectBy, initialize_copy, initialize, initialize19, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing, method_missing19, method, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_method, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, tainted_p, testFrozen, testFrozen, to_a, to_s, toJava, trust, type_deprecated, type, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderclone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitarraypublic static RubySet create(ThreadContext context, IRubyObject self, IRubyObject... ary)
public IRubyObject initialize(ThreadContext context, Block block)
public IRubyObject initialize(ThreadContext context, IRubyObject enume, Block block)
protected IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject instance_variable_set(IRubyObject name, IRubyObject value)
RubyBasicObjectinstance_variable_set in class RubyBasicObjectpublic IRubyObject initialize_dup(ThreadContext context, IRubyObject orig)
public IRubyObject initialize_clone(ThreadContext context, IRubyObject orig)
public IRubyObject freeze(ThreadContext context)
RubyBasicObjectTypeError will be raised if modification is attempted.
There is no way to unfreeze a frozen object. See also
Object#frozen?.
a = [ "a", "b", "c" ]
a.freeze
a << "z"
produces:
prog.rb:3:in `<<': can't modify frozen array (TypeError)
from prog.rb:3freeze in class RubyBasicObjectpublic IRubyObject taint(ThreadContext context)
RubyBasicObject$SAFE level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.taint in class RubyBasicObjectpublic IRubyObject untaint(ThreadContext context)
RubyBasicObjectuntaint in class RubyBasicObjectpublic IRubyObject length(ThreadContext context)
public IRubyObject empty_p(ThreadContext context)
public IRubyObject rb_clear(ThreadContext context)
protected void clearImpl()
public RubySet replace(ThreadContext context, IRubyObject enume)
public RubyArray to_a(ThreadContext context)
public RubySet to_set(ThreadContext context, Block block)
public RubySet to_set(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject compare_by_identity(ThreadContext context)
public IRubyObject compare_by_identity_p(ThreadContext context)
public RubySet flatten_merge(ThreadContext context, IRubyObject set)
public RubySet flatten(ThreadContext context)
public IRubyObject flatten_bang(ThreadContext context)
public RubyBoolean include_p(ThreadContext context, IRubyObject obj)
public IRubyObject superset_p(ThreadContext context, IRubyObject set)
public IRubyObject proper_superset_p(ThreadContext context, IRubyObject set)
public IRubyObject subset_p(ThreadContext context, IRubyObject set)
public IRubyObject proper_subset_p(ThreadContext context, IRubyObject set)
public IRubyObject intersect_p(ThreadContext context, IRubyObject set)
public boolean intersect(RubySet set)
public IRubyObject disjoint_p(ThreadContext context, IRubyObject set)
public IRubyObject each(ThreadContext context, Block block)
public RubySet add(ThreadContext context, IRubyObject obj)
protected void addImpl(Ruby runtime, IRubyObject obj)
protected void addImplSet(ThreadContext context, RubySet set)
public IRubyObject add_p(ThreadContext context, IRubyObject obj)
public IRubyObject delete(ThreadContext context, IRubyObject obj)
protected boolean deleteImpl(IRubyObject obj)
protected void deleteImplIterator(IRubyObject obj, java.util.Iterator it)
public IRubyObject delete_p(ThreadContext context, IRubyObject obj)
public IRubyObject delete_if(ThreadContext context, Block block)
public IRubyObject keep_if(ThreadContext context, Block block)
public IRubyObject collect_bang(ThreadContext context, Block block)
public IRubyObject reject_bang(ThreadContext context, Block block)
public IRubyObject select_bang(ThreadContext context, Block block)
public RubySet rb_merge(ThreadContext context, IRubyObject enume)
public IRubyObject subtract(ThreadContext context, IRubyObject enume)
public IRubyObject op_or(ThreadContext context, IRubyObject enume)
public IRubyObject op_diff(ThreadContext context, IRubyObject enume)
public IRubyObject op_and(ThreadContext context, IRubyObject enume)
public IRubyObject op_xor(ThreadContext context, IRubyObject enume)
public IRubyObject op_equal(ThreadContext context, IRubyObject other)
RubyBasicObjectop_equal in interface IRubyObjectop_equal in class RubyBasicObjectpublic IRubyObject reset(ThreadContext context)
public IRubyObject op_eql(ThreadContext context, IRubyObject other)
public boolean eql(IRubyObject other)
RubyBasicObjecteql in interface IRubyObjecteql in class RubyBasicObjectpublic RubyFixnum hash()
RubyBasicObjecthash in class RubyBasicObjectpublic IRubyObject classify(ThreadContext context, Block block)
public IRubyObject divide(ThreadContext context, Block block)
public final IRubyObject inspect()
RubyBasicObjectto_s method to
generate the string.
[ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]"
Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"inspect in interface IRubyObjectinspect in class RubyBasicObjectpublic RubyString inspect(ThreadContext context)
protected final java.util.Set<IRubyObject> elements()
protected java.util.Set<IRubyObject> elementsOrdered()
protected final void modifyCheck(Ruby runtime)
public int size()
size in interface java.util.Collectionsize in interface java.util.Setpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Setpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Setpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Setpublic java.util.Iterator<IRubyObject> rawIterator()
public java.util.Iterator<java.lang.Object> iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Setpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] ary)
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic boolean add(java.lang.Object element)
add in interface java.util.Collectionadd in interface java.util.Setpublic boolean remove(java.lang.Object element)
remove in interface java.util.Collectionremove in interface java.util.Setpublic boolean containsAll(java.util.Collection coll)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Setpublic boolean addAll(java.util.Collection coll)
addAll in interface java.util.CollectionaddAll in interface java.util.Setpublic boolean retainAll(java.util.Collection coll)
retainAll in interface java.util.CollectionretainAll in interface java.util.Setpublic boolean removeAll(java.util.Collection coll)
removeAll in interface java.util.CollectionremoveAll in interface java.util.SetCopyright © 2001-2019 JRuby. All Rights Reserved.