User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:08_object:02_pattern

This is an old revision of the document!


Pattern

Patterns are declared from a class that extends UserDefinedPattern. Each concrete subclass of UserDefinedPattern declares a user-defined pattern, where the term “user-defined” distinguishes such a pattern from built-in patterns of the XL programming language. The signature (number and types of parameters) of a user-defined pattern is given by a special method named signature which has no further purpose. The @In and @Out annotations in the signature are needed when textually neighboring patterns are connected.

The minimal format to declare a pattern as java object is:

class X extends Node {
    static class Pattern extends UserDefinedPattern {
        private static void signature(@In @Out X node) {}
        public Matcher createMatcher(Graph graph, XBitSet bound,
             IntList requiredAsBound) {...}
    }
}

Additionally, the in RGG, a pattern can be declared and used as:

// declaration
class xyzPath(@In Node a, @Out Node b) (
    a -x-> -y-> -z-> b
    )
 
//usage
void rule() [ Node -xyzPath-> Node ==>; ]
01_user_documentation/07_rgg_xl/02_xl/08_object/02_pattern.1756117961.txt.gz · Last modified: 2025/08/25 12:32 by gaetan