Skip to content

Commit

Permalink
Apply spotless and Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
VincenzoArceri committed Jul 24, 2023
1 parent cbd3a37 commit b9e66c9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,35 @@ public RegexAutomaton repeat(long n) {
return toRegex().simplify().repeat(n).toAutomaton(this).minimize();
}

/**
* Yields a new automaton where leading whitespaces have been removed from
* {@code this}.
*
* @return a new automaton where leading whitespaces have been removed from
* {@code this}
*/
public RegexAutomaton trimLeft() {
return this.toRegex().trimLeft().simplify().toAutomaton(this);
}

/**
* Yields a new automaton where trailing whitespaces have been removed from
* {@code this}.
*
* @return a new automaton where trailing whitespaces have been removed from
* {@code this}
*/
public RegexAutomaton trimRight() {
return this.toRegex().trimRight().simplify().toAutomaton(this);
}

/**
* Yields a new automaton where trailing and leading whitespaces have been
* removed from {@code this}.
*
* @return a new automaton where trailing and leading whitespaces have been
* removed from {@code this}
*/
public RegexAutomaton trim() {
return this.toRegex().trimRight().simplify().trimLeft().simplify().toAutomaton(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,18 @@ public Satisfiability containsChar(char c) throws SemanticException {
new Tarsis(RegexAutomaton.string(String.valueOf(c))), null);
}

/**
* Yields a new Tarsis's instance recognizing each string of {@code this}
* automaton repeated k-times, with k belonging to {@code intv}.
*
* @param intv the interval
*
* @return a new Tarsis's instance recognizing each string of {@code this}
* automaton repeated k-times, with k belonging to {@code intv}
*
* @throws MathNumberConversionException if {@code intv} is iterated but is
* not finite
*/
public Tarsis repeat(Interval intv) throws MathNumberConversionException {
if (intv.isTop() || a.hasCycle())
return new Tarsis(a.star());
Expand All @@ -424,6 +436,13 @@ else if (intv.interval.isFinite()) {
return new Tarsis(a.repeat(intv.interval.getLow().toLong()).concat(a.star()));
}

/**
* Yields a new Tarsis's instance where trailing and leading whitespaces
* have been removed from {@code this}.
*
* @return a new Tarsis's instance where trailing and leading whitespaces
* have been removed from {@code this}
*/
public Tarsis trim() {
return new Tarsis(this.a.trim());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,33 @@ public String toString() {
*/
protected abstract Set<PartialSubstring> substringAux(int charsToSkip, int missingChars);

/**
* Yields a new regular expression corresponding to the {@code n}-repetition
* of {@code this}.
*
* @param n number of repetitions
*
* @return a new regular expression corresponding to the
* {@code n}-repetition of {@code this}
*/
public abstract RegularExpression repeat(long n);

/**
* Yields a new regular expression where leading whitespaces have been
* removed from {@code this}.
*
* @return a new regular expression where leading whitespaces have been
* removed from {@code this}
*/
public abstract RegularExpression trimLeft();

/**
* Yields a new regular expression where trailing whitespaces have been
* removed from {@code this}.
*
* @return a new regular expression where trailing whitespaces have been
* removed from {@code this}
*/
public abstract RegularExpression trimRight();

/**
Expand Down

0 comments on commit b9e66c9

Please sign in to comment.