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.
Custom patterns can be created in XL with the simple syntax:
class patternName(@In Node a, @Out Node b) ( // some patterns )
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) {...} } }