public class RubySet extends RubyObject implements java.util.Set
Modifier and Type | Class and Description |
---|---|
static class |
RubySet.DivideTSortHash |
RubyObject.Data
RubyBasicObject.Finalizer
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
ALL_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, varTableStamp
NULL_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) |
static RubySet |
newSet(Ruby runtime)
Construct a new Set.
|
static RubySet |
newSet(Ruby runtime,
RubyClass metaclass)
Construct a new Set.
|
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, dig1, dig2, eqlInternal, equalInternal, equals, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toString
addFinalizer, 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, yieldUnder
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
array
public static RubySet newSet(Ruby runtime)
runtime
- the current runtimepublic static RubySet newSet(Ruby runtime, RubyClass metaclass)
runtime
- the current runtimemetaclass
- the class to assign to the new setpublic 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)
RubyBasicObject
instance_variable_set
in class RubyBasicObject
public IRubyObject initialize_dup(ThreadContext context, IRubyObject orig)
public IRubyObject initialize_clone(ThreadContext context, IRubyObject orig)
public IRubyObject freeze(ThreadContext context)
RubyBasicObject
TypeError
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 RubyBasicObject
public 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 RubyBasicObject
public IRubyObject untaint(ThreadContext context)
RubyBasicObject
untaint
in class RubyBasicObject
public 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)
to_a
in class RubyBasicObject
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)
RubyBasicObject
op_equal
in interface IRubyObject
op_equal
in class RubyBasicObject
public IRubyObject reset(ThreadContext context)
public IRubyObject op_eql(ThreadContext context, IRubyObject other)
public boolean eql(IRubyObject other)
RubyBasicObject
eql
in interface IRubyObject
eql
in class RubyBasicObject
public RubyFixnum hash()
RubyBasicObject
hash
in class RubyBasicObject
public IRubyObject classify(ThreadContext context, Block block)
public IRubyObject divide(ThreadContext context, Block block)
public final IRubyObject inspect()
RubyBasicObject
to_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 IRubyObject
inspect
in class RubyBasicObject
public 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.Collection
size
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.Set
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.Set
public java.util.Iterator<IRubyObject> rawIterator()
public java.util.Iterator<java.lang.Object> iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] ary)
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public boolean add(java.lang.Object element)
add
in interface java.util.Collection
add
in interface java.util.Set
public boolean remove(java.lang.Object element)
remove
in interface java.util.Collection
remove
in interface java.util.Set
public boolean containsAll(java.util.Collection coll)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
public boolean addAll(java.util.Collection coll)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
public boolean retainAll(java.util.Collection coll)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
public boolean removeAll(java.util.Collection coll)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
Copyright © 2001-2021 JRuby. All Rights Reserved.