示例#1
0
        public static ICarrier CreateCarrier(ReceptorsContainer rsys, string protocol, Action<dynamic> initializeSignal)
        {
            ISemanticTypeStruct outprotocol = rsys.SemanticTypeSystem.GetSemanticTypeStruct(protocol);
            dynamic outsignal = rsys.SemanticTypeSystem.Create(protocol);
            initializeSignal(outsignal);
            ICarrier carrier = new Carrier(outprotocol, "", outsignal, null);

            return carrier;
        }
示例#2
0
        public Membrane(ISemanticTypeSystem sts)
        {
            receptorSystem     = new ReceptorsContainer(sts);
            SemanticTypeSystem = sts;

            receptorSystem.NewReceptor     += OnNewReceptor;
            receptorSystem.NewCarrier      += OnNewCarrier;
            receptorSystem.ReceptorRemoved += OnReceptorRemoved;

            Membranes            = new List <IMembrane>();
            ProtocolPermeability = new Dictionary <PermeabilityKey, PermeabilityConfiguration>();
        }
示例#3
0
		public Membrane(ISemanticTypeSystem sts, IApplicationController appController)
		{
			receptorSystem = new ReceptorsContainer(sts, this);
			SemanticTypeSystem = sts;
			ApplicationController = appController;

			receptorSystem.NewReceptor += OnNewReceptor;
			receptorSystem.NewCarrier += OnNewCarrier;
			receptorSystem.ReceptorRemoved += OnReceptorRemoved;

			Membranes = new List<IMembrane>();
			ProtocolPermeability = new Dictionary<PermeabilityKey, PermeabilityConfiguration>();
		}
示例#4
0
		public void MoveReceptorTo(IReceptor receptor, ReceptorsContainer target)
		{
			InternalRemove(receptor);
			target.InternalAdd(receptor);
		}
示例#5
0
文件: Receptors.cs 项目: babann/HOPE
 public void MoveReceptorTo(IReceptor receptor, ReceptorsContainer target)
 {
     InternalRemove(receptor);
     target.InternalAdd(receptor);
 }
示例#6
0
        protected void InitializeSDRTests(Action initStructs)
        {
            // Initialize the Semantic Type System.
            ssys = new STS();

            // Initialize the Receptor System
            rsys = new ReceptorsContainer(ssys);

            // Initialize declaration and structure lists.
            decls = new List<SemanticTypeDecl>();
            structs = new List<SemanticTypeStruct>();

            // We must have a noun definition for now.
            Helpers.InitializeNoun(ssys, decls, structs);

            // We need this ST for query tests.
            SemanticTypeStruct sts = Helpers.CreateSemanticType("Query", false, decls, structs);
            Helpers.CreateNativeType(sts, "QueryText", "string", false);
            Helpers.CreateNativeType(sts, "Param0", "Object", false);

            // Initialize the Semantic Database Receptor
            sdr = new SemanticDatabase(rsys);
            sdr.DatabaseName = "test_semantic_database";
            sdr.Connect();

            // Create our semantic structure.
            initStructs();

            // Instantiate the runtime code-behind.
            ssys.Parse(decls, structs);
            string code = ssys.GenerateCode();
            System.Reflection.Assembly assy = Compiler.Compile(code);
            ssys.CompiledAssembly = assy;
        }