class Vertx::SharedData::SharedSet

@private

Public Class Methods

new(j_set) click to toggle source

@private

# File lib/vertx/shared_data.rb, line 121
def initialize(j_set)
  @j_set = j_set
end

Public Instance Methods

==(other) click to toggle source
# File lib/vertx/shared_data.rb, line 125
def ==(other)
  if other.is_a?(SharedSet)
    @j_set.equal?(other._to_java_set)
  else
    false
  end
end
_to_java_set() click to toggle source

@private

# File lib/vertx/shared_data.rb, line 208
def _to_java_set
  @j_set
end
add(obj) click to toggle source

Add an object to the set @param [Object] obj. The object to add @return [SharedSet} self

# File lib/vertx/shared_data.rb, line 136
def add(obj)
  obj = SharedData.check_obj(obj)
  @j_set.add(obj)
  self
end
add?(obj) click to toggle source

Add an object to the set @param [Object] obj. The object to add @return [SharedSet] self if the object is not already in the set, otherwise nil

# File lib/vertx/shared_data.rb, line 145
def add?(obj)
  obj = SharedData.check_obj(obj)
  if !@j_set.contains(obj)
    @j_set.add(obj)
    self
  else
    nil
  end
end
clear() click to toggle source

Clear the set

# File lib/vertx/shared_data.rb, line 156
def clear
  @j_set.clear
end
delete(obj) click to toggle source

Delete an object from the set @param [Object] obj. The object to delete

# File lib/vertx/shared_data.rb, line 162
def delete(obj)
  @j_set.remove(obj)
end
delete?(obj) click to toggle source

Delete an object from the set @param [Object] obj. The object to delete @return [SharedSet] self if the object was in the set before the remove, nil otherwise.

# File lib/vertx/shared_data.rb, line 169
def delete?(obj)
  if @j_set.contains(obj)
    @j_set.remove(obj)
    self
  else
    nil
  end
end
each(&block) click to toggle source

Call the block for every element of the set @param [Blovk] block. The block to call.

# File lib/vertx/shared_data.rb, line 180
def each(&block)
  iter = @j_set.iterator
  while iter.hasNext do
    obj = iter.next
    obj = Buffer.new(obj) if obj.is_a? org.vertx.java.core.buffer.Buffer
    block.call(obj)
  end
end
empty?() click to toggle source

@return [Boolean] true if the set is empty

# File lib/vertx/shared_data.rb, line 190
def empty?
  @j_set.isEmpty
end
include?(obj) click to toggle source

Does the set contain an element? @param [Object] obj, the object to check if the set contains @return [Boolean] true if the object is contained in the set

# File lib/vertx/shared_data.rb, line 197
def include?(obj)
  obj = obj._to_java_buffer if obj.is_a? Buffer
  @j_set.contains(obj)
end
size() click to toggle source

@return [FixNum] The number of elements in the set

# File lib/vertx/shared_data.rb, line 203
def size
  @j_set.size
end