Many amenities can be mapped as areas.
[potlatch2.git] / it / sephiroth / expr / SymbolTable.as
1 package it.sephiroth.expr
2 {
3         import flash.utils.Dictionary;
4         
5         public class SymbolTable
6         {
7                 private var _symbols: Array;
8                 
9                 public function SymbolTable()
10                 {
11                         _symbols = new Array();
12                 }
13                 
14                 public function get symbolNames(): Array
15                 {
16                         var names: Array = new Array();
17                         
18                         for each( var ident: Ident in _symbols )
19                         {
20                                 names.push( ident.id );
21                         }
22                         
23                         return names;
24                 }
25                 
26                 public function find( s: String ): Ident
27                 {
28                         for each( var ident: Ident in _symbols )
29                         {
30                                 if( ident.id == s )
31                                 {
32                                         return ident;
33                                 }
34                         }
35                         
36                         return null;
37                 }
38                 
39                 public function add( ident: Ident ): void
40                 {
41                         _symbols.push( ident );
42                 }
43                 
44                 public function findAndAdd( s: String ): Ident
45                 {
46                         var ident: Ident = find( s );
47                         if( ident == null )
48                         {
49                                 ident = new Ident( s );
50                                 add( ident );
51                         }
52                         
53                         return ident;
54                 }
55
56         }
57 }