Skip to content

Commit

Permalink
Using the new 'type' of struct. Class instead variable
Browse files Browse the repository at this point in the history
  • Loading branch information
marciovicente committed May 13, 2014
1 parent 2e57270 commit 99b7968
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
# TODO - Change another name to Appliocation class
# because this must be a node of list, and not an application

class Application(object):
""" Application Class """
class Node(object):
"""docstring for Node"""

def __init__(self):
self.method = None
self.value = None
self.sequence = None
self.age = None
super(Node, self).__init__()


class Application(object):
""" Application Class """

def __init__(self):
self.method = None
self.file = None
self.filename = 'binary'
self.SIZE_OF_FILE = 11
Expand All @@ -35,12 +42,6 @@ def main(self):
elif operation != 'e':
return

# UNUSED
def get_entries(self):
self.value = raw_input()
self.sequence = raw_input()
self.age = raw_input()

def mod(self, n):
return n % self.SIZE_OF_FILE

Expand All @@ -54,17 +55,21 @@ def point_to_value(self, value):
self.file.seek(index)

def insert_record(self):
self.value = raw_input()
self.sequence = raw_input()
self.age = raw_input()
value = raw_input()
sequence = raw_input()
age = raw_input()
n = Node()
n.value = value
n.sequence = sequence
n.age = age

if self.file:
self.point_to_value(self.value)
self.point_to_value(n.value)
if self.file.read(): # ie, if has colision
print 'chave ja existente: %s' % self.value
print 'chave ja existente: %s' % n.value
self.solve_colision()
else:
self.file.write(str(self.value))
self.file.write(str(n.value))

def query(self):
value = raw_input()
Expand All @@ -81,8 +86,6 @@ def close_file(self):
if self.file:
self.file.close()



app = Application()
app.main()

0 comments on commit 99b7968

Please sign in to comment.