1.1 --- a/micropython/table.py Sun Jan 13 02:14:46 2008 +0100
1.2 +++ b/micropython/table.py Sun Jan 13 02:50:21 2008 +0100
1.3 @@ -138,6 +138,7 @@
1.4 def __init__(self):
1.5 self.attributes = set()
1.6 self.table = {}
1.7 + self.objnames = []
1.8 self.names = []
1.9 self.displaced_list = None
1.10
1.11 @@ -152,6 +153,13 @@
1.12 if self.displaced_list is not None:
1.13 self.displaced_list.add(objname, self.matrix_row(attributes))
1.14
1.15 + def object_names(self):
1.16 +
1.17 + "Return the object names used in the table."
1.18 +
1.19 + self.objnames = self.objnames or list(self.table.keys())
1.20 + return self.objnames
1.21 +
1.22 def attribute_names(self):
1.23
1.24 "Return the attribute names used in the table."
1.25 @@ -159,6 +167,12 @@
1.26 self.names = self.names or list(self.attributes)
1.27 return self.names
1.28
1.29 + def get_code(self, name):
1.30 +
1.31 + "Return the code of the given 'name'."
1.32 +
1.33 + return self.object_names().index(name)
1.34 +
1.35 def get_index(self, name):
1.36
1.37 "Return the index of the given 'name'."