Class: WirisPlugin::Queue

Inherits:
Object
  • Object
show all
Includes:
Wiris
Defined in:
lib/com/wiris/util/type/Queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQueue

Returns a new instance of Queue.



8
9
10
11
12
# File 'lib/com/wiris/util/type/Queue.rb', line 8

def initialize()
    super()
    self.array = Array.new()
    self.size = 0
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



6
7
8
# File 'lib/com/wiris/util/type/Queue.rb', line 6

def array
  @array
end

#sizeObject

Returns the value of attribute size.



7
8
9
# File 'lib/com/wiris/util/type/Queue.rb', line 7

def size
  @size
end

Instance Method Details

#emptyObject



26
27
28
# File 'lib/com/wiris/util/type/Queue.rb', line 26

def empty()
    return @size == 0
end

#frontObject



13
14
15
# File 'lib/com/wiris/util/type/Queue.rb', line 13

def front()
    return @array::_(0)
end

#popObject



16
17
18
19
20
21
# File 'lib/com/wiris/util/type/Queue.rb', line 16

def pop()
    if @size > 0
        @size-=1
        @array::splice(0,1)
    end
end

#push(e) ⇒ Object



22
23
24
25
# File 'lib/com/wiris/util/type/Queue.rb', line 22

def push(e)
    @array::push(e)
    @size+=1
end