00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 00006 namespace GEP.Core.Common 00007 { 00011 [Serializable] 00012 public class Alphabet 00013 { 00017 internal Symbol[] _symbols; 00023 public Symbol this[int index] 00024 { 00025 get 00026 { 00027 return _symbols[index]; 00028 } 00029 set 00030 { 00031 _symbols[index] = value; 00032 if (_maxN_Parameters < value.N_Parameters) 00033 _maxN_Parameters = value.N_Parameters; 00034 } 00035 } 00036 00044 public int this[Symbol symbol] 00045 { 00046 get 00047 { 00048 for (int i = _symbols.Length - 1; 0 <= i; i--) 00049 { 00050 if (object.ReferenceEquals(_symbols[i], symbol)) 00051 return i; 00052 } 00053 return -1; 00054 } 00055 } 00056 00060 public int Length 00061 { 00062 get 00063 { 00064 return _symbols.Length; 00065 } 00066 } 00067 00068 protected int _maxN_Parameters = 0; 00072 public int MaxN_Parameters 00073 { 00074 get 00075 { 00076 return _maxN_Parameters; 00077 } 00078 } 00079 00085 public Alphabet(int size) 00086 { 00087 _symbols = new Symbol[size]; 00088 } 00089 } 00090 }