コード例 #1
0
ファイル: Main.cs プロジェクト: pepipe/ISEL
        public static void Main(string[] args)
        {
            TupleSpace ts = new TupleSpace("localhost", 2525, new String[] {"TestSpace"});

            Tuple t;

            Console.WriteLine("Connected to TS " + ts);
            t = new Tuple(new Field[] { new Field("Hallo"), new Field("Welt") });
            ts.Write(t);
            Console.WriteLine("Written tuple " + t);

            //t = new Tuple(new Field[] {new Field("Hello"), new Field("World")});
            //ts.Write(t);
            //Console.WriteLine ("Written tuple " + t);

            //t = new Tuple(new Field[] {new Field("Czesc"), new Field("Swiat")});
            //ts.Write(t);
            //Console.WriteLine ("Written tuple " + t);

            Tuple template = new Tuple(new Field[] {new Field(typeof(String)), new Field(typeof(String))});

            //Take
            //t = ts.Take(template);
            //Console.WriteLine("Tuple Read: " + t);

            //Ler tudo
            //Tuple[] tups = ts.ReadAll(template);
            //foreach (Tuple tu in tups)
            //{
            //    Console.WriteLine("---> Tuple Read: " + tu);
            //}

            //Read
            t = ts.Read(template);
            Console.WriteLine("Tuple Read: " + t);

            int num = ts.Count(template);
            Console.WriteLine (num + " tuples found!");

            //bool deleted = ts.Delete(template);
            //Console.WriteLine ("Deleted one tuple? " + deleted);

            //num = ts.Count(template);
            //Console.WriteLine (num + " tuples found!");

            //int deletedSomething = ts.DeleteAll(template);
            //Console.WriteLine ("Deleted something? " + deletedSomething);

            Console.WriteLine ("BYE");
        }
コード例 #2
0
ファイル: Transaction.cs プロジェクト: pepipe/ISEL
 public void addTupleSpace(TupleSpace space)
 {
     spaces.Add(space);
 }