User Tools

Site Tools


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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
01_user_documentation:07_rgg_xl:02_xl:08_object:02_pattern [2025/08/29 10:49] gaetan01_user_documentation:07_rgg_xl:02_xl:08_object:02_pattern [2025/09/02 18:26] (current) gaetan
Line 1: Line 1:
 ====== Pattern ====== ====== Pattern ======
  
-Patterns are declared from a class that extends [[https://javadoc.grogra.de/xl/de/grogra/xl/query/UserDefinedPattern.html|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.+Patterns are declared from a class that extends [[https://javadoc.grogra.de/xl/de/grogra/xl/query/UserDefinedPattern.html|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 [[https://javadoc.grogra.de/xl/de/grogra/xl/query/UserDefinedPattern.In.html|@In]] and [[https://javadoc.grogra.de/xl/de/grogra/xl/query/UserDefinedPattern.Out.html|@Out]] annotations in the signature are needed when textually neighboring patterns are connected.
  
 =====  ===== =====  =====
  
-The minimal format to declare a pattern as java object is:  
  
-<code java> +{{namespace>:01_user_documentation:07_rgg_xl:02_xl:08_object:02_pattern}}
-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) {...} +
-    } +
-+
-</code> +
- +
-Additionally, the in RGG, a pattern can be declared and used as: +
-<code java> +
-// declaration +
-class xyzPath(@In Node a, @Out Node b) ( +
-    a -x-> -y-> -z-> b +
-    ) +
- +
-//usage +
-void rule() [ Node -xyzPath-> Node ==>; ] +
-</code>+
  
01_user_documentation/07_rgg_xl/02_xl/08_object/02_pattern.1756457363.txt.gz · Last modified: 2025/08/29 10:49 by gaetan