Class: WirisPlugin::Stack
- Inherits:
-
Object
- Object
- WirisPlugin::Stack
- Includes:
- Wiris
- Defined in:
- lib/com/wiris/util/type/Stack.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
Returns the value of attribute array.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #empty ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #pop ⇒ Object
- #push(e) ⇒ Object
- #top ⇒ Object
Constructor Details
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
6 7 8 |
# File 'lib/com/wiris/util/type/Stack.rb', line 6 def array @array end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/com/wiris/util/type/Stack.rb', line 7 def size @size end |
Instance Method Details
#empty ⇒ Object
26 27 28 |
# File 'lib/com/wiris/util/type/Stack.rb', line 26 def empty() return @size == 0 end |
#pop ⇒ Object
16 17 18 19 20 21 |
# File 'lib/com/wiris/util/type/Stack.rb', line 16 def pop() if @size > 0 @size-=1 @array::pop() end end |
#push(e) ⇒ Object
22 23 24 25 |
# File 'lib/com/wiris/util/type/Stack.rb', line 22 def push(e) @array::push(e) @size+=1 end |
#top ⇒ Object
13 14 15 |
# File 'lib/com/wiris/util/type/Stack.rb', line 13 def top() return @array::_(@size - 1) end |