-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c426681
commit 6b5e547
Showing
8 changed files
with
184 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.github.smallcreep.jb.hub.api; | ||
|
||
/** | ||
* JetBrains Hub Query Syntax. | ||
* | ||
* @author Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* @version $Id$ | ||
* @see <a href="https://www.jetbrains.com/help/hub/Query-Syntax.html">Query Syntax</a> | ||
* @since 0.2.0 | ||
*/ | ||
public interface Query extends Field { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/github/smallcreep/jb/hub/api/Searchable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.github.smallcreep.jb.hub.api; | ||
|
||
/** | ||
* Searchable interface use for search elements. | ||
* | ||
* @author Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* @version $Id$ | ||
* @param <T> Type of self searchable request | ||
* @see <a href="https://www.jetbrains.com/help/hub/Query-Syntax.html">Query Syntax</a> | ||
* @since 0.2.0 | ||
*/ | ||
public interface Searchable<T extends Searchable> { | ||
|
||
/** | ||
* Search. | ||
* @param query Query | ||
* @return Self | ||
* @throws Exception If fails | ||
*/ | ||
T search(Query query) throws Exception; | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/github/smallcreep/jb/hub/api/query/Field.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.github.smallcreep.jb.hub.api.query; | ||
|
||
import com.github.smallcreep.jb.hub.api.Query; | ||
import org.cactoos.text.FormattedText; | ||
|
||
/** | ||
* Simple query field. | ||
* | ||
* @author Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* @version $Id$ | ||
* @since 0.2.0 | ||
*/ | ||
public final class Field implements Query { | ||
|
||
/** | ||
* Field name. | ||
*/ | ||
private final String name; | ||
|
||
/** | ||
* Field value. | ||
*/ | ||
private final String value; | ||
|
||
/** | ||
* Ctor. | ||
* @param name Field name | ||
* @param value Field value | ||
*/ | ||
public Field(final String name, final String value) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String value() throws Exception { | ||
return new FormattedText("%s:%s", this.name, this.value).asString(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/github/smallcreep/jb/hub/api/query/Or.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.github.smallcreep.jb.hub.api.query; | ||
|
||
import com.github.smallcreep.jb.hub.api.Query; | ||
import org.cactoos.iterable.IterableOf; | ||
import org.cactoos.iterable.Mapped; | ||
import org.cactoos.iterable.StickyIterable; | ||
import org.cactoos.text.JoinedText; | ||
|
||
/** | ||
* Or expression for search. | ||
* @author Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* @version $Id$ | ||
* @since 0.2.0 | ||
*/ | ||
public final class Or implements Query { | ||
|
||
/** | ||
* Queries. | ||
*/ | ||
private final Iterable<Query> queries; | ||
|
||
/** | ||
* Ctor. | ||
* @param queries Queries | ||
*/ | ||
public Or(final Query... queries) { | ||
this(new IterableOf<>(queries)); | ||
} | ||
|
||
/** | ||
* Ctor. | ||
* @param queries Queries | ||
*/ | ||
public Or(final Iterable<Query> queries) { | ||
this.queries = new StickyIterable<>(queries); | ||
} | ||
|
||
@Override | ||
public String value() throws Exception { | ||
return new JoinedText( | ||
" or ", | ||
new Mapped<>( | ||
Query::value, | ||
this.queries | ||
) | ||
).asString(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/github/smallcreep/jb/hub/api/query/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017 Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* Different query syntax from JetBrains Hub. | ||
* | ||
* <p><a href="https://www.jetbrains.com/help/hub/Query-Syntax.html">Query Syntax</a></p> | ||
* @author Ilia Rogozhin (ilia.rogozhin@gmail.com) | ||
* @version $Id$ | ||
* @since 0.2.0 | ||
*/ | ||
package com.github.smallcreep.jb.hub.api.query; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6b5e547
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: