Skip to content

Commit

Permalink
style: reformat code
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Reichel <[email protected]>
  • Loading branch information
manticore-projects committed Jul 24, 2024
1 parent eb7e1b8 commit 45c7ef0
Show file tree
Hide file tree
Showing 8 changed files with 1,449 additions and 1,449 deletions.
12 changes: 4 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,17 @@ test {
// set heap size for the test JVM(s)
minHeapSize = "128m"
maxHeapSize = "1G"

jacoco {
excludes = ['net/sf/jsqlparser/parser/CCJSqlParserTokenManager']
}
}

coveralls {
jacocoReportPath 'build/reports/jacoco/test/jacocoTestReport.xml'
}

jacocoTestReport {
// Jacoco can't handle the TokenManager class
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**CCJSqlParserTokenManager**"
])
}))
}
dependsOn test // tests are required to run before generating the report
reports {
xml.required = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,126 +1,126 @@
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression.operators.relational;

import net.sf.jsqlparser.expression.BinaryExpression;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.ExpressionVisitor;

public class LikeExpression extends BinaryExpression {
private boolean not = false;
private boolean useBinary = false;
private Expression escapeExpression = null;
private KeyWord likeKeyWord = KeyWord.LIKE;

public boolean isNot() {
return not;
}

public void setNot(boolean b) {
not = b;
}

public boolean isUseBinary() {
return useBinary;
}

public LikeExpression setUseBinary(boolean useBinary) {
this.useBinary = useBinary;
return this;
}

@Override
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) {
return expressionVisitor.visit(this, context);
}

@Deprecated
@Override
public String getStringExpression() {
return likeKeyWord.toString();
}

@Override
public String toString() {
String retval = getLeftExpression() + " " + (not ? "NOT " : "")
+ (likeKeyWord == KeyWord.SIMILAR_TO ? "SIMILAR TO" : likeKeyWord) + " "
+ (useBinary ? "BINARY " : "") + getRightExpression();
if (escapeExpression != null) {
retval += " ESCAPE " + escapeExpression;
}
return retval;
}

public Expression getEscape() {
return escapeExpression;
}

public void setEscape(Expression escapeExpression) {
this.escapeExpression = escapeExpression;
}

@Deprecated
public boolean isCaseInsensitive() {
return likeKeyWord == KeyWord.ILIKE;
}

@Deprecated
public void setCaseInsensitive(boolean caseInsensitive) {
this.likeKeyWord = KeyWord.ILIKE;
}

public KeyWord getLikeKeyWord() {
return likeKeyWord;
}

public LikeExpression setLikeKeyWord(KeyWord likeKeyWord) {
this.likeKeyWord = likeKeyWord;
return this;
}

public LikeExpression setLikeKeyWord(String likeKeyWord) {
this.likeKeyWord = KeyWord.from(likeKeyWord);
return this;
}

public LikeExpression withEscape(Expression escape) {
this.setEscape(escape);
return this;
}

@Deprecated
public LikeExpression withCaseInsensitive(boolean caseInsensitive) {
this.setCaseInsensitive(caseInsensitive);
return this;
}

public LikeExpression withNot(boolean not) {
this.setNot(not);
return this;
}

@Override
public LikeExpression withLeftExpression(Expression arg0) {
return (LikeExpression) super.withLeftExpression(arg0);
}

@Override
public LikeExpression withRightExpression(Expression arg0) {
return (LikeExpression) super.withRightExpression(arg0);
}

public enum KeyWord {
LIKE, ILIKE, RLIKE, REGEXP_LIKE, REGEXP, SIMILAR_TO;

public static KeyWord from(String keyword) {
return Enum.valueOf(KeyWord.class, keyword.toUpperCase().replaceAll("\\s+", "_"));
}
}
}
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression.operators.relational;

import net.sf.jsqlparser.expression.BinaryExpression;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.ExpressionVisitor;

public class LikeExpression extends BinaryExpression {
private boolean not = false;
private boolean useBinary = false;
private Expression escapeExpression = null;
private KeyWord likeKeyWord = KeyWord.LIKE;

public boolean isNot() {
return not;
}

public void setNot(boolean b) {
not = b;
}

public boolean isUseBinary() {
return useBinary;
}

public LikeExpression setUseBinary(boolean useBinary) {
this.useBinary = useBinary;
return this;
}

@Override
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) {
return expressionVisitor.visit(this, context);
}

@Deprecated
@Override
public String getStringExpression() {
return likeKeyWord.toString();
}

@Override
public String toString() {
String retval = getLeftExpression() + " " + (not ? "NOT " : "")
+ (likeKeyWord == KeyWord.SIMILAR_TO ? "SIMILAR TO" : likeKeyWord) + " "
+ (useBinary ? "BINARY " : "") + getRightExpression();
if (escapeExpression != null) {
retval += " ESCAPE " + escapeExpression;
}
return retval;
}

public Expression getEscape() {
return escapeExpression;
}

public void setEscape(Expression escapeExpression) {
this.escapeExpression = escapeExpression;
}

@Deprecated
public boolean isCaseInsensitive() {
return likeKeyWord == KeyWord.ILIKE;
}

@Deprecated
public void setCaseInsensitive(boolean caseInsensitive) {
this.likeKeyWord = KeyWord.ILIKE;
}

public KeyWord getLikeKeyWord() {
return likeKeyWord;
}

public LikeExpression setLikeKeyWord(KeyWord likeKeyWord) {
this.likeKeyWord = likeKeyWord;
return this;
}

public LikeExpression setLikeKeyWord(String likeKeyWord) {
this.likeKeyWord = KeyWord.from(likeKeyWord);
return this;
}

public LikeExpression withEscape(Expression escape) {
this.setEscape(escape);
return this;
}

@Deprecated
public LikeExpression withCaseInsensitive(boolean caseInsensitive) {
this.setCaseInsensitive(caseInsensitive);
return this;
}

public LikeExpression withNot(boolean not) {
this.setNot(not);
return this;
}

@Override
public LikeExpression withLeftExpression(Expression arg0) {
return (LikeExpression) super.withLeftExpression(arg0);
}

@Override
public LikeExpression withRightExpression(Expression arg0) {
return (LikeExpression) super.withRightExpression(arg0);
}

public enum KeyWord {
LIKE, ILIKE, RLIKE, REGEXP_LIKE, REGEXP, SIMILAR_TO;

public static KeyWord from(String keyword) {
return Enum.valueOf(KeyWord.class, keyword.toUpperCase().replaceAll("\\s+", "_"));
}
}
}
Loading

0 comments on commit 45c7ef0

Please sign in to comment.