Bag.create()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
1
from pyalgs.data_structures.commons.stack import Stack
2
3
4
class Bag(object):
5
    def __init__(self):
6
        self.stack = Stack.create()
7
8
    def add(self, item):
9
        self.stack.push(item)
10
11
    def size(self):
12
        return self.stack.size()
13
14
    def is_empty(self):
15
        return self.stack.is_empty()
16
17
    def iterate(self):
18
        return self.stack.iterate()
19
20
    @staticmethod
21
    def create():
22
        return Bag()
23