View Javadoc

1   package io.github.reggert.reb4j;
2   
3   import io.github.reggert.reb4j.Quantified.Mode;
4   
5   /**
6    * Extension to {@link AbstractSequenceableAlternative} providing
7    * the canonical implementation of {@link Quantifiable}. 
8    * 
9    * Note that it delegates to static methods of {@link Quantified}.
10   */
11  public abstract class AbstractQuantifiableSequenceableAlternative 
12  	extends AbstractSequenceableAlternative implements Quantifiable
13  {
14  	private static final long serialVersionUID = 1L;
15  
16  	@Override
17  	public final Quantified.AnyTimes anyTimes(final Mode mode)
18  	{return new Quantified.AnyTimes(this, mode);}
19  	
20  	@Override
21  	public final Quantified.AnyTimes anyTimes()
22  	{return anyTimes(Mode.GREEDY);}
23  
24  	@Override
25  	@Deprecated
26  	public final Quantified.AnyTimes anyTimesReluctantly()
27  	{return anyTimes(Mode.RELUCTANT);}
28  
29  	@Override
30  	@Deprecated
31  	public final Quantified.AnyTimes anyTimesPossessively()
32  	{return anyTimes(Mode.POSSESSIVE);}
33  
34  	@Override
35  	public final Quantified.AtLeastOnce atLeastOnce(final Mode mode)
36  	{return new Quantified.AtLeastOnce(this, mode);}
37  	
38  	@Override
39  	public final Quantified.AtLeastOnce atLeastOnce()
40  	{return atLeastOnce(Mode.GREEDY);}
41  
42  	@Override
43  	@Deprecated
44  	public final Quantified.AtLeastOnce atLeastOnceReluctantly()
45  	{return atLeastOnce(Mode.RELUCTANT);}
46  
47  	@Override
48  	@Deprecated
49  	public final Quantified.AtLeastOnce atLeastOncePossessively()
50  	{return atLeastOnce(Mode.POSSESSIVE);}
51  
52  	@Override
53  	public final Quantified.Optional optional(final Mode mode)
54  	{return new Quantified.Optional(this, mode);}
55  	
56  	@Override
57  	public final Quantified.Optional optional()
58  	{return optional(Mode.GREEDY);}
59  
60  	@Override
61  	@Deprecated
62  	public final Quantified.Optional optionalReluctantly()
63  	{return optional(Mode.RELUCTANT);}
64  
65  	@Override
66  	@Deprecated
67  	public final Quantified.Optional optionalPossessively()
68  	{return optional(Mode.POSSESSIVE);}
69  
70  	@Override
71  	public final Quantified.RepeatExactly repeat(final int n, final Mode mode)
72  	{return new Quantified.RepeatExactly(this, n, mode);}
73  	
74  	@Override
75  	public final Quantified.RepeatExactly repeat(final int n)
76  	{return repeat(n, Mode.GREEDY);}
77  
78  	@Override
79  	@Deprecated
80  	public final Quantified.RepeatExactly repeatReluctantly(final int n)
81  	{return repeat(n, Mode.RELUCTANT);}
82  
83  	@Override
84  	@Deprecated
85  	public final Quantified.RepeatExactly repeatPossessively(final int n)
86  	{return repeat(n, Mode.POSSESSIVE);}
87  
88  	@Override
89  	public final Quantified.RepeatRange repeat(final int min, final int max, final Mode mode)
90  	{return new Quantified.RepeatRange(this, min, max, mode);}
91  	
92  	@Override
93  	public final Quantified.RepeatRange repeat(final int min, final int max)
94  	{return repeat(min, max, Mode.GREEDY);}
95  
96  	@Override
97  	@Deprecated
98  	public final Quantified.RepeatRange repeatReluctantly(final int min, final int max)
99  	{return repeat(min, max, Mode.RELUCTANT);}
100 
101 	@Override
102 	@Deprecated
103 	public final Quantified.RepeatRange repeatPossessively(final int min, final int max)
104 	{return repeat(min, max, Mode.POSSESSIVE);}
105 
106 	@Override
107 	public final Quantified.RepeatRange atLeast(final int n, final Mode mode)
108 	{return new Quantified.RepeatRange(this, n, null, mode);}
109 	
110 	@Override
111 	public final Quantified.RepeatRange atLeast(final int n)
112 	{return atLeast(n, Mode.GREEDY);}
113 
114 	@Override
115 	@Deprecated
116 	public final Quantified.RepeatRange atLeastReluctantly(final int n)
117 	{return atLeast(n, Mode.RELUCTANT);}
118 
119 	@Override
120 	@Deprecated
121 	public final Quantified.RepeatRange atLeastPossessively(final int n)
122 	{return atLeast(n, Mode.POSSESSIVE);}
123 
124 }