Skip to content

IPattern Interface

sequenze edited this page Jun 9, 2017 · 6 revisions

Represents a finite list of elements, that used in conjunction with a tuple space, can retrieve tuples that match the values defined.

Syntax

    public interface IPattern : IFields

Properties

                Name                   Description
Size Gets the cardinality of the ITuple.
Item[Int32] Gets or sets the field at the specified index.
IFields.Fields Gets or sets the array of fields contained within the tuple.

Remarks

IPattern is the base interface of all patterns.


Examples

The following example demonstrates the usage of IPattern for fetching data from a tuple space.

    static void Main(string[] args)
    {
        Space fridge = new Space();
        fridge.Put("Milk", 3);
        IPattern pattern = new Pattern("Milk", typeof(int));
        ITuple result = fridge.Query(pattern);
        Console.WriteLine("The fridge has {0} bottles of {1}", result[1], result[0]);
        Console.Read();
    }
    /*
    The following is printed to the console:
    The fridge has 3 bottles of Milk
    */

See Also

IFields, Pattern

Clone this wiki locally