Examples of Pattern

• jxl.format.Pattern
Enumeration class which contains the various patterns available within the standard Excel pattern palette
• net.algart.math.patterns.Pattern
kipedia.org/wiki/Dilation_%28morphology%29">"Dilation" article in Wikipedia) with a very large pattern, created by {@link Patterns#newMinkowskiSum(java.util.Collection)}and consisting of millions or milliards points, via sequential dilations with the Minkowski summands of such a pattern, extracted by {@link #minkowskiDecomposition(int)} call.

Coordinate restrictions

There are the following guarantees for coordinates of the points of any pattern:

1. if p=(x0,x1,...,xn−1) is some point of the pattern, then − {@link #MAX_COORDINATE}≤xj≤ {@link #MAX_COORDINATE}for all j; here this inequality means absolutely precise mathematical inequality;
2. if p=(x01,x11,...,xn−11) and q=(x02,x12,...,xn−12) are some two points of the pattern, then |xj1xj2|≤ {@link #MAX_COORDINATE} for all j, where|xj1xj2| means the absolute value of mathematically precise difference (not the result of Java operators Math.abs(xj1xj2)). (This condition can be checked with help of {@link Patterns#isAllowedDifference(double,double)} method.)

Each implementation of this interface must fulfil both restriction. The point sets, satisfying these requirements, are called allowed points sets for patterns. Any attempt to create a pattern, the set of points of which is not allowed, leads to {@link TooLargePatternCoordinatesException}.

Note: though patterns are sets of real points, their coordinates are restricted by long-type constant {@link #MAX_COORDINATE}.

Also note: uniform-grid patterns must fulfil, in addition, two similar restrictions for their grid indexes. See more details in the comments to {@link UniformGridPattern} interface,the section "Grid index restrictions".

Below are two important theorems, following from these two restrictions.

Theorem I. If you round the coordinates of all points of a pattern, i.e. replace each pattern's point (x0, x1, ..., xn−1) with a new point (round(x0), round(x1), ..., round(xn−1)), where "round(a)" means the result of (double)StrictMath.round(a) call, then the resulting point set will also be allowed. The same statement is true for the point set, consisting of precise integer points, without type cast to double, i.e. for points (StrictMath.round(x0), StrictMath.round(x1), ..., StrictMath.round(xn−1)) — such mathematical point set also fulfils both restrictions 1 and 2.

The proof of this is complex enough. The paper http://algart.net/ru/numeric_algorithms/rounding_theorem.html (in Russian) contains such proof: see the theorem of rounding and the theorem of subtraction in this paper.

It means that you can freely use {@link #round()} method for any pattern:it always constructs another allowed pattern, both in terms of this interface and in terms in {@link UniformGridPattern}, and cannot throw {@link TooLargePatternCoordinatesException}.

Theorem II. If all points of a pattern are integer, i.e. for all pattern's points (x0, x1, ..., xn−1) we have xj==(double)(long)xj for any index j, and (X0,X1,...,Xn−1) is some point of this pattern, then you can subtract (using Java “−” operator) the coordinate Xj (j is any index) from the corresponding coordinate of all points of this pattern, i.e. replace each pattern's point (x0, ..., xj−1, xj, xj+1, ..., xn−1) with (x0, ..., xj−1, xjXj, xj+1, ..., xn−1), and the resulting point set will also be allowed. Here and below ab (a and b are real values of double Java type) means the computer difference (not strict mathematical), i.e. the result of execution of Java operator “ab”.

Proof.

First of all, let's remind that the computer difference ab, according IEEE 754 standard and Java language specification, is the nearest double value to the precise mathematical difference ab. Because all pattern's points are integer, the restriction 2 allows to state that any difference xjXj can be represented precisely by double type (see the comments to {@link #MAX_COORDINATE} constant).So, we have xjXj = xjXj: the computer difference is just a mathematical difference.

Now the proof is simple. If is enough to show that the restrictions will be satisfied for the coordinate index j. The restriction 2 is obvious: (mathematical) subtracting Xj does not change the (mathematical!) differences |xj1xj2|. The new value of this coordinate for each point will be xjXj, where both (x0,x1,...,xn−1) and (X0,X1,...,Xn−1) are some points of the pattern; according the condition 2, this difference lies in range − {@link #MAX_COORDINATE}≤xjXj≤ {@link #MAX_COORDINATE}. In other words, the restriction 1 is also satisfied. This completes the proof.

Note: this proof is really correct only for patterns, consisting of integer points only. The reason is that all integer coordinates, fulfilling the restriction 1, and all their differences xjXj are represented precisely by double Java type. If a pattern contains non-integer points, the statement of this theorem is not true. For example, for 1-dimensional pattern, consisting of three points x1=2251799813685248.00 (= {@link #MAX_COORDINATE}/2), x2=−2251799813685248.00 (=− {@link #MAX_COORDINATE}/2) and x3=−2251799813685247.75 (=− {@link #MAX_COORDINATE}/2+0.25), subtracting the point x3 by Java “−” operator leads to the pattern x'1=4503599627370496.00 (= {@link #MAX_COORDINATE}) (computer subtraction of double values leads to rounding here), x'2=−0.25 and x'3=0.0, which obviously violates the mathematically precise restriction 2: |x'1x'2|> {@link #MAX_COORDINATE}.

As a result, there is an obvious conclusion. If p is one of the {@link #points() points} ofsome integer pattern (see above), then the method pattern. {@link #shift(Point) shift}(p. {@link Point#symmetric() symmetric()}) always works successfully and never throw {@link TooLargePatternCoordinatesException}.

The equals() method in the classes, implementing this interface, may return false for two patterns, consisting of the same point sets, for example, if these patterns belong to different pattern types. For example, a rectangular pattern may be considered to be non-equal to a geometrically identical {@link Patterns#newMinkowskiSum(Pattern) Minkowski sum} of several segments,because the thorough comparison of these patterns can require too long time and large memory. (Please consider 10000x10000x10000 3-dimensional parallelepiped, consisting of 1012 points with integer coordinates in range 0..9999. It is geometrically equal to Minkowski sum of 3 orthogonal segments with 10000 integer points in every segment, but we have no resources to check this fact via direct comparison of the point sets.) However, the patterns of the same kind (for example, two rectangular patterns, two {@link Patterns#newMinkowskiSum(Pattern) Minkowski sums} ortwo {@link Patterns#newUnion(Pattern) unions}) are usually compared precisely. In particular, there are the following guarantees:

• if both patterns are direct point-set (see above), then equals() method always returns true for geometrically identical patterns;
• if both patterns are rectangular (see above), then, also, equals() method always returns true for geometrically identical patterns;
• and, of course, there is the reverse guarantee, that if the equals() method returns true, then two patterns consists of the identical point sets.

The classes, implementing this interface, are immutable and thread-safe: there are no ways to modify settings of the created instance.

AlgART Laboratory 2007–2014

@author Daniel Alievsky @version 1.2 @since JDK 1.5
• net.sf.saxon.pattern.Pattern
A Pattern represents the result of parsing an XSLT pattern string.
Patterns are created by calling the static method Pattern.make(string).
The pattern is used to test a particular node by calling match().
• net.sourceforge.chaperon.model.extended.Pattern
This class describes an abstract pattern element. @author Stephan Michels @version CVS \$Id: Pattern.java,v 1.10 2004/01/08 11:30:52 benedikta Exp \$
• org.apache.camel.Pattern
• org.apache.geronimo.jee.deployment.Pattern
3.org/2001/XMLSchema}anyType"> <sequence> <sequence> <element name="groupId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="artifactId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="module" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> </sequence> </sequence> </restriction> </complexContent> </complexType> @version \$Rev: 688452 \$ \$Date: 2008-08-24 13:56:20 +0800 (Sun, 24 Aug 2008) \$
• org.apache.geronimo.jee.naming.Pattern
3.org/2001/XMLSchema}anyType"> <sequence> <element name="groupId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="artifactId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="module" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/> </sequence> </restriction> </complexContent> </complexType> @version \$Rev: 704567 \$ \$Date: 2008-10-14 23:45:57 +0800 (Tue, 14 Oct 2008) \$
• org.apache.geronimo.naming.deployment.jsr88.Pattern
Holds the elements that make up an ObjectName. This class exists so that the bundle of elements can be get, set, and edited together separate from any other elements that may be on the parent. @version \$Rev: 409817 \$ \$Date: 2006-05-27 09:56:38 +0200 (Sat, 27 May 2006) \$
• org.apache.joran.Pattern
• org.apache.log4j.joran.spi.Pattern
• org.apache.mahout.fpm.pfpgrowth.fpgrowth.Pattern
A in FPGrowth is a list of items (here int) and the support(the number of times the pattern is seen in the dataset)
• org.apache.marmotta.kiwi.reasoner.model.program.Pattern
Representation of a graph pattern. A graph pattern has a subject, predicate, and object, and optionally a context. Subject, predicate and object may be either RDF nodes or variables or null. Context is either null or a RDF resource. User: sschaffe
• org.apache.maven.plugins.enforcer.utils.ArtifactMatcher.Pattern
• org.apache.myfaces.extensions.validator.baseval.annotation.Pattern
• org.apache.oro.text.regex.Pattern
The Pattern interface allows multiple representations of a regular expression to be defined. In general, different regular expression compilers will produce different types of pattern representations. Some will produce state transition tables derived from syntax trees, others will produce byte code representations of an NFA, etc. The Pattern interface does not impose any specific internal pattern representation, and consequently, Pattern implementations are not meant to be interchangeable among differing PatternCompiler and PatternMatcher implementations. The documentation accompanying a specific implementation will define what other classes a Pattern can interact with. @version @version@ @since 1.0 @see PatternCompiler @see PatternMatcher
• org.apache.servicemix.nmr.api.Pattern
• org.codehaus.jparsec.pattern.Pattern
Encapsulates algorithm to recognize certain string pattern. When fed with a character range, a {@link Pattern} object either fails to match, or matches with the match length returned.There is no error reported on where and what exactly failed. @author Ben Yu
• org.dom4j.rule.Pattern

`Pattern` defines the behaviour for pattern in the XSLT processing model.

@author James Strachan @version \$Revision: 1.6 \$
• org.drools.analytics.components.Pattern
@author Toni Rikkola
• org.drools.core.rule.Pattern
• org.drools.planner.examples.nurserostering.domain.Pattern
• org.drools.rule.Pattern
• org.drools.verifier.components.Pattern
@author Toni Rikkola
• org.eclipse.swt.graphics.Pattern
ipse.org/swt/snippets/#path">Path, Pattern snippets @see SWT Example: GraphicsExample @see Sample code and further information @since 3.1
• org.emftrace.metamodel.QUARCModel.GSS.Pattern
• org.gocha.text.regex.Pattern
Шаблон (образец текста) производящий сравнение с текстом. Для создания щаблона см. класс Regex @see Regex @author gocha
• org.gwtwidgets.client.util.regex.Pattern
oper.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions">RegExp object. As most of the methods delegate to the JavaScript RegExp object, certain differences in the declaration and behaviour of regular expressions must be expected.

@author George Georgovassilis
• org.hibernate.validator.Pattern
• org.jaxen.pattern.Pattern

`Pattern` defines the behaviour for pattern in the XSLT processing model.

@author James Strachan @version \$Revision: 1.4 \$
• org.jboss.bpm.console.client.model.util.regex.Pattern
oper.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions">RegExp object. As most of the methods delegate to the JavaScript RegExp object, certain differences in the declaration and behaviour of regular expressions must be expected.

@author George Georgovassilis
• org.jboss.bpm.console.client.util.regex.Pattern
oper.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions">RegExp object. As most of the methods delegate to the JavaScript RegExp object, certain differences in the declaration and behaviour of regular expressions must be expected.

@author George Georgovassilis
• org.jboss.forge.parser.xml.query.Pattern
A pattern that may be executed as part of a {@link Query} upon a {@link Node} in a search, or used to define a target{@link Node} to be created. Value object analogous to XPath patterns; it describes something in the tree structure of{@link Node}. @author Aslak Knutsen @author Lincoln Baxter, III @author ALR
• org.jboss.seam.web.Pattern
• org.jfrog.build.api.dependency.Pattern
@author jbaruch @since 16/02/12
• org.jfugue.Pattern
This class represents a segment of music. By representing segments of music as patterns, JFugue gives users the opportunity to play around with pieces of music in new and interesting ways. Patterns may be added together, transformed, or otherwise manipulated to expand the possibilities of creative music. @author David Koelle @version 2.0 @version 4.0 - Added Pattern Properties @version 4.0.3 - Now implements Serializable
• org.jregex.Pattern
A handle for a precompiled regular expression.
To match a regular expression `myExpr` against a text `myString` one should first create a Pattern object:
` Pattern p=new Pattern(myExpr); `
then obtain a Matcher object:
` Matcher matcher=p.matcher(myText); `
The latter is an automaton that actually performs a search. It provides the following methods:
• search for matching substrings : matcher.find() or matcher.findAll();
• test whether the text matches the whole pattern : matcher.matches();
• test whether the text matches the beginning of the pattern : matcher.matchesPrefix();
• search with custom options : matcher.find(int options)

Flags
Flags (see REFlags interface) change the meaning of some regular expression elements at compiletime. These flags may be passed both as string(see Pattern(String,String)) and as bitwise OR of:

• REFlags.IGNORE_CASE - enables case insensitivity
• REFlags.MULTILINE - forces "^" and "\$" to match both at the start and the end of line;
• REFlags.DOTALL - forces "." to match eols('\r' and '\n' in ASCII);
• REFlags.IGNORE_SPACES - literal spaces in expression are ignored for better readability;
• REFlags.UNICODE - the predefined classes('\w','\d',etc) are referenced to Unicode;
• REFlags.XML_SCHEMA - permits XML Schema regular expressions syntax extentions.

Pattern instances are thread-safe, i.e. the same Pattern object may be used by any number of threads simultaniously. On the other hand, the Matcher objects are NOT thread safe, so, given a Pattern instance, each thread must obtain and use its own Matcher. @see REFlags @see Matcher @see Matcher#setTarget(java.lang.String) @see Matcher#setTarget(java.lang.String,int,int) @see Matcher#setTarget(char[],int,int) @see Matcher#setTarget(java.io.Reader,int) @see MatchResult @see MatchResult#group(int) @see MatchResult#start(int) @see MatchResult#end(int) @see MatchResult#length(int) @see MatchResult#charAt(int,int) @see MatchResult#prefix() @see MatchResult#suffix()

• org.jvnet.glassfish.comms.deployment.backend.Pattern
A compiled representation of a regular expression. This is a wrapper for the java.util.regex.Pattern with support for named capturing groups. The named groups are specified with "(?<name>exp)", which is identical to Java 7 named groups. @since 0.1.9
• org.openquark.cal.compiler.SourceModel.Pattern
• org.optaplanner.examples.nurserostering.domain.pattern.Pattern
• org.pdf4j.saxon.pattern.Pattern
A Pattern represents the result of parsing an XSLT pattern string.
Patterns are created by calling the static method Pattern.make(string).
The pattern is used to test a particular node by calling match().
• org.rstudio.core.client.regex.Pattern
• org.sikuli.script.Pattern
• org.worldbank.transport.tamt.client.util.Pattern
oper.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions">RegExp object. As most of the methods delegate to the JavaScript RegExp object, certain differences in the declaration and behaviour of regular expressions must be expected.

@author George Georgovassilis
• ptolemy.actor.gt.Pattern
@author Thomas Huining Feng @version \$Id: Pattern.java,v 1.4.4.1 2008/03/25 22:12:10 cxh Exp \$ @since Ptolemy II 6.1 @Pt.ProposedRating Red (tfeng) @Pt.AcceptedRating Red (tfeng)
• wolf.city.buildings.style.Pattern
• wyrl.core.Pattern

• Examples of ch.qos.logback.core.joran.spi.Pattern

 `100101102103104105106` ```  protected void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {       }     protected Pattern initialPattern() {     return new Pattern();   } ```
View Full Code Here

Examples of client.net.sf.saxon.ce.pattern.Pattern

 `196197198199200201202203204205206207208209210211212213214215216217` ```                                    BuiltInAtomicType soughtItemType,                                     Set foundItemTypes,                                     XPathContext context,                                     boolean isFirst) throws XPathException {         //System.err.println("build index for doc " + doc.getDocumentNumber());         Pattern match = keydef.getMatch();         //NodeInfo curr;         XPathContextMajor xc = context.newContext();         // The use expression (or sequence constructor) may contain local variables.         SlotManager map = keydef.getStackFrameMap();         if (map != null) {             xc.openStackFrame(map);         }         SequenceIterator iter = match.selectNodes(doc, xc);         while (true) {             Item item = iter.next();             if (item == null) {                 break;             } ```
View Full Code Here

 `108410851086108710881089109010911092109310941095` ```  }     @Test   public void testGrokSeparatedValues() throws Exception {     String msg = "hello\tworld\tfoo";     Pattern pattern = Pattern.compile("(?.+?)(\\t|\\z)");     Matcher matcher = pattern.matcher(msg);     List results = new ArrayList();     while (matcher.find()) {       //System.out.println("match:'" + matcher.group(1) + "'");       results.add(matcher.group(1));     } ```
View Full Code Here

Examples of com.digiburo.backprop1b.network.Pattern

 `6061626364656667686970717273747576777879808182838485` ```    // write above answers     BufferedWriter bw = new BufferedWriter(new FileWriter(POS_FILENAME));     for (int ii = 0; ii < limit; ii++) {       Pattern pp = pl.get(ii);       double[] output = pp.getOutput();       if (output[0] > 0.5) {         writeData(bw, pp);       }     }     bw.close();     // write below answers     bw = new BufferedWriter(new FileWriter(NEG_FILENAME));     for (int ii = 0; ii < limit; ii++) {       Pattern pp = pl.get(ii);       double[] output = pp.getOutput();       if (output[0] < 0.5) {         writeData(bw, pp);       }     } ```
View Full Code Here

Examples of com.dotcms.repackage.org.apache.oro.text.regex.Pattern

 `959960961962963964965966967968969` ```        for (int i = 0; i < length; i++) {           String regex = filesMasksArray[i];           regex = regex.replace(".", "\\.");           regex = regex.replace("*", ".*");           regex = "^" + regex.trim() + "\$";           Pattern pattern = p5c.compile(regex, Perl5Compiler.CASE_INSENSITIVE_MASK);           match = match || p5m.matches(fileName, pattern);           if (match) {             break;           }         } ```
View Full Code Here

Examples of com.ericsson.ssa.dd.Pattern

 `666768697071727374757677` ```        Object child = digester.peek(0);         Object parent = digester.peek(1);         Operand operand = (Operand) child;         if (parent instanceof Pattern) {             Pattern pattern = (Pattern) parent;             pattern.addCondition(operand);         } else {             Operator operator = (Operator) parent;             operator.addCondition(operand);         }     } ```
View Full Code Here

Examples of com.firefly.utils.pattern.Pattern

 `910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879` ```import com.firefly.utils.pattern.Pattern; public class TestPattern {   @Test   public void testPattern() {     Pattern p = Pattern.compile("?ddaaad?", "?");     Assert.assertThat(p.match("ddaaad")[1], is(""));     Assert.assertThat(p.match("ddaaadxwww")[1], is("xwww"));     Assert.assertThat(p.match("addaaadxwww")[1], is("xwww"));     Assert.assertThat(p.match("addaaadxwww")[0], is("a"));     Assert.assertThat(p.match("addaaad")[0], is("a"));     Assert.assertThat(p.match("orange"), nullValue());         p = Pattern.compile("?", "?");     Assert.assertThat(p.match("orange")[0], is("orange"));         p = Pattern.compile("??????", "?");     Assert.assertThat(p.match("orange")[0], is("orange"));     Assert.assertThat(p.match("orange").length, is(1));         p = Pattern.compile("org", "?");     Assert.assertThat(p.match("orange"), nullValue());     Assert.assertThat(p.match("org").length, is(0));         p = Pattern.compile("?org", "?");     Assert.assertThat(p.match("org")[0], is(""));     Assert.assertThat(p.match("aassorg")[0], is("aass"));     Assert.assertThat(p.match("ssorg").length, is(1));         p = Pattern.compile("org?", "?");     Assert.assertThat(p.match("org")[0], is(""));     Assert.assertThat(p.match("orgaaa")[0], is("aaa"));     Assert.assertThat(p.match("orgaaa").length, is(1));         p = Pattern.compile("www.?.com?", "?");     Assert.assertThat(p.match("www.fireflysource.com")[0], is("fireflysource"));     Assert.assertThat(p.match("www.fireflysource.com")[1], is(""));     Assert.assertThat(p.match("www.fireflysource.com/cn/")[1], is("/cn/"));     Assert.assertThat(p.match("www.fireflysource.com/cn/").length, is(2));     Assert.assertThat(p.match("orange"), nullValue());         p = Pattern.compile("www.?.com/?/app", "?");     Assert.assertThat(p.match("orange"), nullValue());     Assert.assertThat(p.match("www.fireflysource.com/cn/app").length, is(2));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[0], is("fireflysource"));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[1], is("cn"));         p = Pattern.compile("?www.?.com/?/app", "?");     Assert.assertThat(p.match("orange"), nullValue());     Assert.assertThat(p.match("www.fireflysource.com/cn/app").length, is(3));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[0], is(""));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[1], is("fireflysource"));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[2], is("cn"));     Assert.assertThat(p.match("http://www.fireflysource.com/cn/app")[0], is("http://"));         p = Pattern.compile("?www.?.com/?/app?", "?");     Assert.assertThat(p.match("orange"), nullValue());     Assert.assertThat(p.match("www.fireflysource.com/cn/app").length, is(4));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[0], is(""));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[1], is("fireflysource"));     Assert.assertThat(p.match("www.fireflysource.com/cn/app")[2], is("cn"));     Assert.assertThat(p.match("http://www.fireflysource.com/cn/app")[0], is("http://"));     Assert.assertThat(p.match("http://www.fireflysource.com/cn/app")[3], is(""));     Assert.assertThat(p.match("http://www.fireflysource.com/cn/app/1334")[3], is("/1334"));         p = Pattern.compile("abc*abc", "*");     Assert.assertThat(p.match("abcabcabc")[0], is(""));         p = Pattern.compile("aa*aa", "*");     Assert.assertThat(p.match("aaaaa")[0], is(""));   } ```
View Full Code Here

 `666768697071727374757677787980818283848586878889` ```        return text;     }         private static int processClass(List lines, String indent, int startIndex, String qualifiedName, String simpleName)     {         Pattern classPattern = Pattern.compile(indent + CLASS_REGEX);                 for (int i = startIndex; i < lines.size(); i++)         {             String line = lines.get(i);                         // who knows.....             if (Strings.isNullOrEmpty(line))                 continue;             // ignore packages and imports             else if (line.startsWith("package") || line.startsWith("import"))                 continue;                         Matcher matcher = classPattern.matcher(line);                         // found a class!             if (matcher.find())             {                 String newIndent; ```
View Full Code Here

 `105106107108109110111112113114115116117118119120121` ```        if (returnType != dateTimeFormat) {           logger.log(TreeLogger.ERROR, typeName + "." + method.getName()               + " must return DateTimeFormat");           throw new UnableToCompleteException();         }         Pattern annotation = method.getAnnotation(Pattern.class);         if (annotation == null) {           logger.log(TreeLogger.ERROR, typeName + "." + method.getName()               + " must have an @Pattern annotation");           throw new UnableToCompleteException();         }         String pattern = annotation.value();         pattern = dtpg.getBestPattern(pattern);         writer.println();         writer.println("public "             + method.getReturnType().getQualifiedSourceName() + " "             + method.getName() + "() {"); ```
 `114115116117118119120121122123124125126127128129130131132133134135` ```          logger.log(TreeLogger.ERROR, typeName + "." + method.getName()               + " must return DateTimeFormat");           throw new UnableToCompleteException();         }         String pattern;         Pattern annotation = method.getAnnotation(Pattern.class);         if (annotation == null) {           com.google.gwt.i18n.client.CustomDateTimeFormat.Pattern oldAnnotation               = method.getAnnotation(com.google.gwt.i18n.client.CustomDateTimeFormat.Pattern.class);           if (oldAnnotation == null) {             logger.log(TreeLogger.ERROR, typeName + "." + method.getName()                 + " must have an @Pattern annotation");             throw new UnableToCompleteException();           }           pattern = oldAnnotation.value();         } else {           pattern = annotation.value();         }         pattern = dtpg.getBestPattern(pattern);         writer.println();         String retTypeName = method.getReturnType().getQualifiedSourceName();         writer.println("public " + retTypeName + " " + method.getName() + "() {"); ```