├── .github
├── ISSUE_TEMPLATE
│ └── bug_report.md
├── dependabot.yml
└── workflows
│ └── gradle.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── NOTICE
├── README.md
├── build.gradle
├── circle.yml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── publish.gradle
├── settings.gradle
└── src
├── main
├── java
│ └── cognitivej
│ │ ├── core
│ │ ├── ChainedBuilder.java
│ │ ├── ChainedRestAction.java
│ │ ├── CognitiveResult.java
│ │ ├── ExponentialBackOff.java
│ │ ├── ExponentialBackOffFunction.java
│ │ ├── RestAction.java
│ │ ├── ResultChain.java
│ │ ├── Utils.java
│ │ ├── Validation.java
│ │ ├── WorkingContext.java
│ │ └── error
│ │ │ ├── ConcurrentOperationConflictErrorHandler.java
│ │ │ ├── ErrorHandler.java
│ │ │ ├── ForbiddenErrorHandler.java
│ │ │ ├── RateLimitExceededErrorHandler.java
│ │ │ ├── UnAuthorizedErrorHandler.java
│ │ │ └── exceptions
│ │ │ ├── CognitiveException.java
│ │ │ ├── ConcurrentOperationConflictException.java
│ │ │ ├── ParameterValidationException.java
│ │ │ ├── QuotaExceededException.java
│ │ │ ├── RateLimitExceededException.java
│ │ │ └── SubscriptionKeyNotAuthorizedException.java
│ │ └── vision
│ │ ├── computervision
│ │ ├── ComputerVisionBuilder.java
│ │ ├── ComputerVisionScenario.java
│ │ ├── ComputerVisionString.java
│ │ ├── DomainSpecificContent.java
│ │ ├── DomainSpecificDetails.java
│ │ ├── ImageAnalysis.java
│ │ ├── ImageDescription.java
│ │ ├── ListDomainSpecificModelsResponse.java
│ │ ├── OCRResult.java
│ │ ├── OCRResultHelper.java
│ │ ├── VisualFeatures.java
│ │ └── action
│ │ │ ├── AnalyzeImageAction.java
│ │ │ ├── DescribeImageAction.java
│ │ │ ├── GetThumbnailAction.java
│ │ │ ├── ListDomainSpecificModelsAction.java
│ │ │ ├── OCROnImageAction.java
│ │ │ ├── RecognizeDomainSpecificContentInImageAction.java
│ │ │ ├── TagImageAction.java
│ │ │ ├── TagImageResponse.java
│ │ │ └── error
│ │ │ ├── FailedToProcessImageErrorHandler.java
│ │ │ ├── FailedToProcessImageException.java
│ │ │ ├── InvalidVisionImageErrorHandler.java
│ │ │ └── InvalidVisionImageException.java
│ │ ├── emotion
│ │ ├── Emotion.java
│ │ ├── EmotionBuilder.java
│ │ ├── EmotionStringBuilder.java
│ │ ├── action
│ │ │ └── EmotionRecognitionAction.java
│ │ └── scenario
│ │ │ └── EmotionScenario.java
│ │ ├── face
│ │ ├── CognitiveContext.java
│ │ ├── FaceStringBuilder.java
│ │ ├── facelist
│ │ │ ├── ChainedFaceListBuilder.java
│ │ │ ├── FaceList.java
│ │ │ ├── FaceListBuilder.java
│ │ │ ├── action
│ │ │ │ ├── AddFaceToFaceListAction.java
│ │ │ │ ├── CreateFaceListAction.java
│ │ │ │ ├── DeleteFaceListAction.java
│ │ │ │ ├── DeleteFaceListFaceAction.java
│ │ │ │ ├── GetFaceListAction.java
│ │ │ │ ├── ListFaceListsAction.java
│ │ │ │ └── UpdateFaceListAction.java
│ │ │ └── error
│ │ │ │ ├── FaceListAlreadyExistsError.java
│ │ │ │ ├── FaceListAlreadyExistsException.java
│ │ │ │ ├── FaceListNotFoundErrorHandler.java
│ │ │ │ └── FaceListNotFoundException.java
│ │ ├── person
│ │ │ ├── ChainedPersonBuilder.java
│ │ │ ├── Person.java
│ │ │ ├── PersonBuilder.java
│ │ │ ├── action
│ │ │ │ ├── AddFaceToPersonAction.java
│ │ │ │ ├── CreatePersonAction.java
│ │ │ │ ├── DeletePersonAction.java
│ │ │ │ ├── DeletePersonFaceAction.java
│ │ │ │ ├── GetPersonAction.java
│ │ │ │ ├── GetPersonFaceAction.java
│ │ │ │ ├── UpdateFaceToPersonAction.java
│ │ │ │ └── UpdatePersonAction.java
│ │ │ └── error
│ │ │ │ ├── InvalidImageErrorHandler.java
│ │ │ │ ├── InvalidImageException.java
│ │ │ │ ├── PersonFaceNotFoundErrorHandler.java
│ │ │ │ ├── PersonFaceNotFoundException.java
│ │ │ │ ├── PersonNotFoundErrorHandler.java
│ │ │ │ └── PersonNotFoundException.java
│ │ ├── persongroup
│ │ │ ├── ChainedPersistedFaceBuilder.java
│ │ │ ├── ChainedPersonGroupBuilder.java
│ │ │ ├── CurrentGroupTrainingStatus.java
│ │ │ ├── PersistedFace.java
│ │ │ ├── PersonGroup.java
│ │ │ ├── PersonGroupBuilder.java
│ │ │ ├── PersonGroupTrainingStatus.java
│ │ │ ├── action
│ │ │ │ ├── CreatePersonGroupAction.java
│ │ │ │ ├── DeletePersonGroupAction.java
│ │ │ │ ├── GetPersonGroupAction.java
│ │ │ │ ├── GetPersonGroupTrainingStatusAction.java
│ │ │ │ ├── ListPersonGroupsAction.java
│ │ │ │ ├── TrainPersonGroupAction.java
│ │ │ │ └── UpdatePersonGroupAction.java
│ │ │ └── error
│ │ │ │ ├── ListPersonsInPersonGroupAction.java
│ │ │ │ ├── PersonGroupAlreadyExistsError.java
│ │ │ │ ├── PersonGroupAlreadyExistsException.java
│ │ │ │ ├── PersonGroupNotFoundErrorHandler.java
│ │ │ │ └── PersonGroupNotFoundException.java
│ │ ├── scenario
│ │ │ ├── FaceGroupingSet.java
│ │ │ ├── FaceScenarios.java
│ │ │ ├── FindSimilarSet.java
│ │ │ ├── IdentificationSet.java
│ │ │ ├── ImageAndFace.java
│ │ │ ├── ImageHolder.java
│ │ │ ├── ImageNamingStrategy.java
│ │ │ ├── People.java
│ │ │ ├── ScenarioHelper.java
│ │ │ ├── VerificationSet.java
│ │ │ └── VisionImage.java
│ │ └── task
│ │ │ ├── Candidate.java
│ │ │ ├── Face.java
│ │ │ ├── FaceAttributes.java
│ │ │ ├── FaceGrouping.java
│ │ │ ├── FaceLandmarks.java
│ │ │ ├── FaceRectangle.java
│ │ │ ├── FaceTaskBuilder.java
│ │ │ ├── FindSimilar.java
│ │ │ ├── Identification.java
│ │ │ ├── Verification.java
│ │ │ ├── action
│ │ │ ├── DetectFaceAction.java
│ │ │ ├── FindSimilarFacesAction.java
│ │ │ ├── GroupFacesAction.java
│ │ │ ├── IdentifyFacesAction.java
│ │ │ └── VerifyFaceAction.java
│ │ │ └── error
│ │ │ ├── NoFacesNotFoundException.java
│ │ │ └── SingleFaceNotFoundException.java
│ │ └── overlay
│ │ ├── BorderWeight.java
│ │ ├── CognitiveJColourPalette.java
│ │ ├── CopyImagetoClipBoard.java
│ │ ├── ImageGrid.java
│ │ ├── Location.java
│ │ ├── OverlayUtils.java
│ │ ├── PointLocations.java
│ │ ├── RectangleTextPosition.java
│ │ ├── RectangleType.java
│ │ ├── builder
│ │ ├── ImageNotFoundException.java
│ │ └── ImageOverlayBuilder.java
│ │ └── filter
│ │ ├── ApplyCaptionOutsideImageFilter.java
│ │ ├── GrowImageFilter.java
│ │ ├── ImageCaptionFilter.java
│ │ ├── ImageFilter.java
│ │ ├── LineJoinRectangleFilter.java
│ │ ├── MergeImagesFilter.java
│ │ ├── OverlayPointsFilter.java
│ │ ├── OverlayRectangleFilter.java
│ │ ├── PixelatedImageSectionFilter.java
│ │ └── TextOnRectangleFilter.java
└── resources
│ ├── cognitivej-version.txt
│ └── font
│ └── notosans
│ ├── NotoSans-Bold.ttf
│ ├── NotoSans-BoldItalic.ttf
│ ├── NotoSans-Italic.ttf
│ └── NotoSans-Regular.ttf
└── test
├── groovy
└── cognitivej
│ ├── core
│ └── ChainedResultChainSpecification.groovy
│ ├── utils
│ └── TestUtil.groovy
│ └── vision
│ ├── computervision
│ └── action
│ │ ├── AnalyzeImageSpecification.groovy
│ │ ├── DescribeImageSpecification.groovy
│ │ ├── GetThumbnailSpecification.groovy
│ │ ├── ListDomainSpecificModelsSpecification.groovy
│ │ ├── OCROnImageSpecification.groovy
│ │ ├── RecognizeDomainSpecificContentInImageSpecification.groovy
│ │ └── TagImageSpecification.groovy
│ ├── emotion
│ └── action
│ │ └── EmotionRecognitionSpecification.groovy
│ └── face
│ ├── facelist
│ ├── AddFaceToFaceListSpecification.groovy
│ ├── CreateFaceListSpecification.groovy
│ ├── DeleteFaceListFaceSpecification.groovy
│ ├── DeleteFaceListSpecification.groovy
│ ├── GetFaceListSpecification.groovy
│ ├── ListFaceListsSpecification.groovy
│ └── UpdateFaceListSpecification.groovy
│ ├── person
│ ├── AddFaceToPersonSpecification.groovy
│ ├── CreatePersonSpecification.groovy
│ ├── DeletePersonFaceSpecification.groovy
│ ├── DeletePersonSpecification.groovy
│ ├── GetPersonFaceSpecification.groovy
│ ├── GetPersonSpecification.groovy
│ ├── ListPersonsInPersonGroupSpecification.groovy
│ ├── UpdateFaceToPersonSpecification.groovy
│ └── UpdatePersonSpecification.groovy
│ ├── persongroup
│ ├── CreatePersonGroupSpecification.groovy
│ ├── DeletePersonGroupSpecification.groovy
│ ├── GetPersonGroupSpecification.groovy
│ ├── GetPersonGroupTrainingStatusSpecification.groovy
│ ├── ListPersonGroupSpecification.groovy
│ ├── TrainPersonGroupSpecification.groovy
│ └── UpdatePersonGroupSpecification.groovy
│ └── task
│ ├── DetectFaceSpecification.groovy
│ └── VerifyFaceSpecification.groovy
├── java
└── blog
│ ├── BlogHelper.java
│ ├── ClassTypeAdapter.java
│ ├── ClassTypeAdapterFactory.java
│ ├── attributes
│ ├── DetectAllAttributesExample.java
│ ├── DetectFacialLandmarksExample.java
│ ├── DetectGenderAgeFromFileExample.java
│ └── DetectGenderAgeFromURLExample.java
│ ├── computervision
│ ├── DescribeImageExample.java
│ └── OCRImageExample.java
│ ├── detect
│ ├── DetectFacesFromImageUrlExample.java
│ └── DetectSingleFaceFromFileExample.java
│ ├── emotion
│ ├── DetectDominantEmotionFromImageUrlExample.java
│ └── DetectEmotionFromImageUrlExample.java
│ ├── identify
│ └── IdentifyMultipleFacesExample.java
│ ├── pixelate
│ └── PixlateFacesFromImageUrlExample.java
│ └── verify
│ └── VerifyFacesFromUrlExample.java
└── resources
└── blog
└── sets
└── love_hate_candidates.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the problem**
11 | A clear and concise description of what the bug is.
12 |
13 | **Please provide full details to reproduce the problem**
14 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: gradle
4 | directory: "/"
5 | schedule:
6 | interval: monthly
7 | open-pull-requests-limit: 6
--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
1 | name: gradle
2 |
3 | on:
4 | schedule:
5 | - cron: '30 2 2 * *'
6 | push:
7 | pull_request:
8 | branches: [ "master" ]
9 |
10 | jobs:
11 | build:
12 | runs-on: ubuntu-latest
13 | name: Test with Java ${{ matrix.jdk }}
14 | strategy:
15 | fail-fast: false
16 | matrix:
17 | jdk: [ '8', '11', '17', '18' ]
18 |
19 | steps:
20 | - uses: actions/checkout@v3
21 |
22 | - name: Set up JDK ${{ matrix.jdk }}
23 | uses: actions/setup-java@v3
24 | with:
25 | distribution: zulu
26 | java-version: ${{ matrix.jdk }}
27 | cache: 'gradle'
28 |
29 | - name: Gradle Build
30 | run: ./gradlew check
31 |
32 | - name: Gradle Check
33 | run: ./gradlew check
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/gradle,intellij,java
3 |
4 | ### Intellij ###
5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
7 |
8 | # User-specific stuff:
9 | .idea/*
10 |
11 | # Gradle:
12 | .idea/gradle.xml
13 | .idea/libraries
14 |
15 | # Mongo Explorer plugin:
16 | .idea/mongoSettings.xml
17 |
18 | ## File-based project format:
19 | *.iws
20 |
21 | ## Plugin-specific files:
22 |
23 | # IntelliJ
24 | /out/
25 |
26 | # Eclipse
27 | .settings
28 | .classpath
29 | .project
30 |
31 | # mpeltonen/sbt-idea plugin
32 | .idea_modules/
33 |
34 | # JIRA plugin
35 | atlassian-ide-plugin.xml
36 |
37 | # Crashlytics plugin (for Android Studio and IntelliJ)
38 | com_crashlytics_export_strings.xml
39 | crashlytics.properties
40 | crashlytics-build.properties
41 | fabric.properties
42 |
43 | ### Intellij Patch ###
44 | *.iml
45 |
46 |
47 | ### Java ###
48 | *.class
49 |
50 | # Mobile Tools for Java (J2ME)
51 | .mtj.tmp/
52 |
53 | # Package Files #
54 | *.jar
55 | *.war
56 | *.ear
57 |
58 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
59 | hs_err_pid*
60 |
61 |
62 | ### Gradle ###
63 | .gradle
64 | build/
65 |
66 | # Ignore Gradle GUI config
67 | gradle-app.setting
68 |
69 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
70 | !gradle-wrapper.jar
71 |
72 | # Cache of project
73 | .gradletasknamecache
74 |
75 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
76 | # gradle/wrapper/gradle-wrapper.properties
77 | /bin/
78 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 0.6.1 (21/05/2016)
2 | - Enriched overlay capabilities (still WIP)
3 |
4 | # 0.6.1 (19/05/2016)
5 | - Updated Blog Section
6 |
7 | # 0.6.0 (02/05/2016)
8 | - Updated Blog Section
9 | - Added Scenario API
10 | - Initial Release
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2016 Ian Kelly
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | CognitiveJ
2 | Copyright (c) 2016 Ian Kelly All Rights Reserved.
3 |
4 | This product is licensed to you under the Apache License, Version 2.0 (the "License").
5 | You may not use this product except in compliance with the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ***Looking for new collaborators for this repo - open an issue if you would like to be considered***
2 |
3 | # CognitiveJ - Image Analysis in Java
4 | [](http://www.apache.org/licenses/LICENSE-2.0.html)
5 | [](https://github.com/CognitiveJ/cognitivej/actions/workflows/gradle.yml)
6 | [](https://bintray.com/cognitivej/CognitiveJ/CognitiveJ/_latestVersion)
7 | [](https://circleci.com/gh/CognitiveJ/cognitivej)
8 |
9 | CognitiveJ is an open-source fluent Java (8) API that manages and orchestrates the interaction between Java applications and
10 | Microsofts’ Cognitive (Project Oxford) Machine Learning & Image Processing libraries and allows you to query and analyze images.
11 |
12 | 
13 |
14 | > Face service access is limited based on eligibility and usage criteria. You will need a valid subscription id to Azure Face service
15 |
16 | **Faces**
17 |
18 | * Facial Detection – Capture faces, gender, age and associated facial features and landmarks from an image
19 | * Emotion Detection – Derive emotional state from faces within an image
20 | * Verification – Verify, with a confidence scale on whether 2 different faces are of the same person
21 | * Identification – Identify a person from a set of known people.
22 | * Find Similar – detect, group and rank similar faces
23 | * Grouping – group people based on facial characteristics
24 | * Person Group/Person/Face Lists; Create, manage and train groups, face lists and persons to interact with the identification/grouping/find similar face features.
25 |
26 | **Vision**
27 |
28 | * Image Describe - Describe visual content of an image and return real world caption to what the Image is of.
29 | * Image Analysis – extract key details from an image and if the image is of an adult/racy nature.
30 | * OCR – detect and extract text from an image.
31 | * Thumbnail – Create thumbnail images based on key points of interest from the image.
32 |
33 | **Overlay _(Experimental)_**
34 |
35 | * Apply image layers onto images to visually represent found features.
36 | * Apply captions onto faces and images
37 | * Graphically illustrate the Faces/Vision feature sets.
38 | * Pixelate faces in an image.
39 |
40 | **Other Features**
41 |
42 | * Works with local or remote images
43 | * validation of parameters
44 |
45 | **Getting Started**
46 |
47 | * Java 8 or above
48 | * Subscription keys for the MS Cognitive libraries ([free registration here](https://www.microsoft.com/cognitive-services/))
49 | * Add the dependency from ~JCenter~ (Since JCenter is no longer available, build from source until artifacts are published elsewhere)
50 |
51 | ###### Gradle
52 |
53 | ```groovy
54 | dependencies {
55 | implementation 'cognitivej:cognitivej:0.6.2'
56 | ...
57 | }
58 | ```
59 | ###### Maven
60 | ```xml
61 |
62 | cognitivej
63 | cognitivej
64 | 0.6.2
65 | pom
66 |
67 | ```
68 |
69 | **Chained Builders** - The builders are simple lightweight wrappers over the MS Cognitive REST calls that manages the marshalling of parameters/responses, the HTTP communications and retry strategies. The builders are chained to allow for follow up manipulation on resources that have been created or retrieved & where applicable.
70 |
71 | **Scenarios** - Scenarios are real world use case classes that greatly simplifies the interaction between the builders and the wrapper classes. _While there is no reason you can’t interact directly with the builders, scenarios have much of the boilerplate logic in place to reduce burden._
72 |
73 | **Overlay** - Allows for creating and writing new images based on the results from the queries. Note: work is ongoing around collision detection and observing boundaries
74 |
75 | **Wrappers** Simple domain wrappers around request/response/parameter objects (e.g. Face, FaceAttributes,Person etc)
76 |
77 | **Face – Detect** can detect faces from within an image and return the results as a collection of ‘face’ results.
78 |
79 | 
80 |
81 |
82 | ###### Example
83 |
84 | ```java
85 | public static void main(String[] args) {
86 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
87 | getProperty("azure.cognitive.emotion.subscriptionKey"));
88 | ImageOverlayBuilder imageOverlayBuilder = ImageOverlayBuilder.builder(IMAGE_URL);
89 | imageOverlayBuilder.outlineFacesOnImage(faceScenarios.findFaces(IMAGE_URL), RectangleType.FULL,
90 | CognitiveJColourPalette.STRAWBERRY).launchViewer();
91 | }
92 | ```
93 |
94 |
95 | **Face – Landmarks** can detect faces from within an image and apply facial landmarks
96 |
97 | 
98 |
99 | ###### Example
100 | ```java
101 | public static void main(String[] args) throws IOException {
102 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
103 | getProperty("azure.cognitive.emotion.subscriptionKey"));
104 | Face faces = faceScenarios.findSingleFace(IMAGE_URL);
105 | ImageOverlayBuilder.builder(IMAGE_URL).outFaceLandmarksOnImage(faces).launchViewer();
106 | }
107 | ```
108 |
109 | **Face – Detect with Attributes** displays associated attributes for detected faces
110 |
111 | 
112 |
113 | ###### Example
114 | ```java
115 | public static void main(String[] args) {
116 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
117 | getProperty("azure.cognitive.emotion.subscriptionKey"));
118 | List faces = faceScenarios.findFaces(IMAGE_URL);
119 | ImageOverlayBuilder.builder(IMAGE_URL).outlineFacesOnImage(faces, RectangleType.CORNERED,
120 | CognitiveJColourPalette.MEADOW).writeFaceAttributesToTheSide(faces, CognitiveJColourPalette.MEADOW).launchViewer();
121 | }
122 | ```
123 |
124 | **Face – Verify** will validate (with a confidence ratio) if 2 different faces are of the same persons.
125 |
126 | 
127 | 
128 |
129 | ###### Example
130 | ```java
131 | public static void main(String[] args) {
132 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
133 | getProperty("azure.cognitive.emotion.subscriptionKey"));
134 | ImageOverlayBuilder imageOverlayBuilder = ImageOverlayBuilder.builder(CANDIDATE_1);
135 | imageOverlayBuilder.verify(CANDIDATE_2, faceScenarios.verifyFaces(CANDIDATE_1, CANDIDATE_2)).launchViewer();
136 | }
137 | ```
138 |
139 | **Face – Identify** will identify a person (or people) within an image. Before the library can identify, we need to provide the the Cognitive libraries with the samples set of candidates. Currently supports 1000 candidates.
140 |
141 | 
142 |
143 | ###### Example
144 | ```java
145 | public static void main(String[] args) {
146 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
147 | getProperty("azure.cognitive.emotion.subscriptionKey"));
148 | ImageOverlayBuilder imageOverlayBuilder = ImageOverlayBuilder.builder(IMAGE);
149 | List candidates = candidates();
150 | People people = ScenarioHelper.createPeopleFromHoldingImages(candidates, ImageNamingStrategy.DEFAULT);
151 | String groupId = faceScenarios.createGroupWithPeople(randomAlphabetic(6).toLowerCase(), people);
152 | }
153 | ```
154 |
155 | **Face – Pixelate** will identify all faces within an image and pixelate them.
156 |
157 | 
158 |
159 | ```java
160 | public static void main(String[] args) {
161 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
162 | getProperty("azure.cognitive.emotion.subscriptionKey"));
163 | ImageOverlayBuilder imageOverlayBuilder = ImageOverlayBuilder.builder(IMAGE);
164 | faceScenarios.findFaces(IMAGE).stream().forEach(imageOverlayBuilder:: pixelateFaceOnImage);
165 | imageOverlayBuilder.launchViewer();
166 | }
167 | ```
168 |
169 | **Emotion – Detect** will detect what emotion a face(s) is showing within an image.
170 | 
171 |
172 |
173 |
174 | ```java
175 | public static void main(String[] args) {
176 | FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.face.subscriptionKey"),
177 | getProperty("azure.cognitive.emotion.subscriptionKey"));
178 | ImageOverlayBuilder.builder(IMAGE_URL).outlineEmotionsOnImage(faceScenarios.findEmotionFaces(IMAGE_URL)).launchViewer();
179 | }
180 | ```
181 | **Vision – Describe** will analyse and describe the contents of an image in a human readable caption.
182 |
183 | 
184 |
185 | ```java
186 | public static void main(String[] args) {
187 | ComputerVisionScenario computerVisionScenario = new ComputerVisionScenario(getProperty("azure.cognitive.vision.subscriptionKey"));
188 | ImageDescription imageDescription = computerVisionScenario.describeImage(IMAGE_URL);
189 | ImageOverlayBuilder.builder(IMAGE_URL).describeImage(imageDescription).launchViewer();
190 |
191 | }
192 | ```
193 |
194 | **Vision – OCR** will analyse and extract text from within an image into a computer understandable stream.
195 |
196 | 
197 |
198 | ```java
199 | public static void main(String[] args) {
200 | ComputerVisionScenario computerVisionScenario = new ComputerVisionScenario(getProperty("azure.cognitive.vision.subscriptionKey"));
201 | OCRResult ocrResult = computerVisionScenario.ocrImage(IMAGE_URL);
202 | ImageOverlayBuilder.builder(IMAGE_URL).ocrImage(ocrResult).launchViewer();
203 | }
204 | ```
205 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'java-library'
3 | }
4 |
5 | repositories {
6 | mavenCentral()
7 | }
8 |
9 | apply plugin: 'maven-publish'
10 | apply plugin: 'groovy'
11 |
12 | apply from: file('publish.gradle')
13 |
14 | dependencies {
15 | implementation 'com.mashape.unirest:unirest-java:1.4.9'
16 | implementation 'org.apache.httpcomponents:httpclient:4.5.2'
17 | implementation 'org.apache.httpcomponents:httpasyncclient:4.1.1'
18 | implementation 'org.apache.httpcomponents:httpmime:4.5.2'
19 | implementation 'com.google.code.gson:gson:2.6.2'
20 | implementation 'org.apache.commons:commons-lang3:3.4'
21 | implementation 'commons-io:commons-io:2.5'
22 | implementation 'com.intellij:annotations:12.0'
23 |
24 | testImplementation 'net.coobird:thumbnailator:0.4.8'
25 | testImplementation 'org.codehaus.groovy:groovy-all:2.4.6'
26 | testImplementation 'org.spockframework:spock-core:1.0-groovy-2.4'
27 |
28 | }
29 |
30 | test.onlyIf {
31 | hasProperty('azure.cognitive.face.subscriptionKey') && hasProperty('azure.cognitive.emotion.subscriptionKey')
32 |
33 | // we don't run tests on builds due to subscription quota reasons
34 | //Boolean.getBoolean('run.tests')
35 | }
36 |
37 | //tasks.named('test') {
38 | // useJUnitPlatform()
39 | //}
40 |
41 | jar {
42 | from rootProject.file('LICENSE')
43 | from rootProject.file('NOTICE')
44 | }
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | java:
3 | version: oraclejdk8
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CognitiveJ/cognitivej/b8a06daa74809e069264445caf70c5311059bb8b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | #
3 | # Apache License
4 | # Version 2.0, January 2004
5 | # http://www.apache.org/licenses/
6 | #
7 | # TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | #
9 | # 1. Definitions.
10 | #
11 | # "License" shall mean the terms and conditions for use, reproduction,
12 | # and distribution as defined by Sections 1 through 9 of this document.
13 | #
14 | # "Licensor" shall mean the copyright owner or entity authorized by
15 | # the copyright owner that is granting the License.
16 | #
17 | # "Legal Entity" shall mean the union of the acting entity and all
18 | # other entities that control, are controlled by, or are under common
19 | # control with that entity. For the purposes of this definition,
20 | # "control" means (i) the power, direct or indirect, to cause the
21 | # direction or management of such entity, whether by contract or
22 | # otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | # outstanding shares, or (iii) beneficial ownership of such entity.
24 | #
25 | # "You" (or "Your") shall mean an individual or Legal Entity
26 | # exercising permissions granted by this License.
27 | #
28 | # "Source" form shall mean the preferred form for making modifications,
29 | # including but not limited to software source code, documentation
30 | # source, and configuration files.
31 | #
32 | # "Object" form shall mean any form resulting from mechanical
33 | # transformation or translation of a Source form, including but
34 | # not limited to compiled object code, generated documentation,
35 | # and conversions to other media types.
36 | #
37 | # "Work" shall mean the work of authorship, whether in Source or
38 | # Object form, made available under the License, as indicated by a
39 | # copyright notice that is included in or attached to the work
40 | # (an example is provided in the Appendix below).
41 | #
42 | # "Derivative Works" shall mean any work, whether in Source or Object
43 | # form, that is based on (or derived from) the Work and for which the
44 | # editorial revisions, annotations, elaborations, or other modifications
45 | # represent, as a whole, an original work of authorship. For the purposes
46 | # of this License, Derivative Works shall not include works that remain
47 | # separable from, or merely link (or bind by name) to the interfaces of,
48 | # the Work and Derivative Works thereof.
49 | #
50 | # "Contribution" shall mean any work of authorship, including
51 | # the original version of the Work and any modifications or additions
52 | # to that Work or Derivative Works thereof, that is intentionally
53 | # submitted to Licensor for inclusion in the Work by the copyright owner
54 | # or by an individual or Legal Entity authorized to submit on behalf of
55 | # the copyright owner. For the purposes of this definition, "submitted"
56 | # means any form of electronic, verbal, or written communication sent
57 | # to the Licensor or its representatives, including but not limited to
58 | # communication on electronic mailing lists, source code control systems,
59 | # and issue tracking systems that are managed by, or on behalf of, the
60 | # Licensor for the purpose of discussing and improving the Work, but
61 | # excluding communication that is conspicuously marked or otherwise
62 | # designated in writing by the copyright owner as "Not a Contribution."
63 | #
64 | # "Contributor" shall mean Licensor and any individual or Legal Entity
65 | # on behalf of whom a Contribution has been received by Licensor and
66 | # subsequently incorporated within the Work.
67 | #
68 | # 2. Grant of Copyright License. Subject to the terms and conditions of
69 | # this License, each Contributor hereby grants to You a perpetual,
70 | # worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | # copyright license to reproduce, prepare Derivative Works of,
72 | # publicly display, publicly perform, sublicense, and distribute the
73 | # Work and such Derivative Works in Source or Object form.
74 | #
75 | # 3. Grant of Patent License. Subject to the terms and conditions of
76 | # this License, each Contributor hereby grants to You a perpetual,
77 | # worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | # (except as stated in this section) patent license to make, have made,
79 | # use, offer to sell, sell, import, and otherwise transfer the Work,
80 | # where such license applies only to those patent claims licensable
81 | # by such Contributor that are necessarily infringed by their
82 | # Contribution(s) alone or by combination of their Contribution(s)
83 | # with the Work to which such Contribution(s) was submitted. If You
84 | # institute patent litigation against any entity (including a
85 | # cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | # or a Contribution incorporated within the Work constitutes direct
87 | # or contributory patent infringement, then any patent licenses
88 | # granted to You under this License for that Work shall terminate
89 | # as of the date such litigation is filed.
90 | #
91 | # 4. Redistribution. You may reproduce and distribute copies of the
92 | # Work or Derivative Works thereof in any medium, with or without
93 | # modifications, and in Source or Object form, provided that You
94 | # meet the following conditions:
95 | #
96 | # (a) You must give any other recipients of the Work or
97 | # Derivative Works a copy of this License; and
98 | #
99 | # (b) You must cause any modified files to carry prominent notices
100 | # stating that You changed the files; and
101 | #
102 | # (c) You must retain, in the Source form of any Derivative Works
103 | # that You distribute, all copyright, patent, trademark, and
104 | # attribution notices from the Source form of the Work,
105 | # excluding those notices that do not pertain to any part of
106 | # the Derivative Works; and
107 | #
108 | # (d) If the Work includes a "NOTICE" text file as part of its
109 | # distribution, then any Derivative Works that You distribute must
110 | # include a readable copy of the attribution notices contained
111 | # within such NOTICE file, excluding those notices that do not
112 | # pertain to any part of the Derivative Works, in at least one
113 | # of the following places: within a NOTICE text file distributed
114 | # as part of the Derivative Works; within the Source form or
115 | # documentation, if provided along with the Derivative Works; or,
116 | # within a display generated by the Derivative Works, if and
117 | # wherever such third-party notices normally appear. The contents
118 | # of the NOTICE file are for informational purposes only and
119 | # do not modify the License. You may add Your own attribution
120 | # notices within Derivative Works that You distribute, alongside
121 | # or as an addendum to the NOTICE text from the Work, provided
122 | # that such additional attribution notices cannot be construed
123 | # as modifying the License.
124 | #
125 | # You may add Your own copyright statement to Your modifications and
126 | # may provide additional or different license terms and conditions
127 | # for use, reproduction, or distribution of Your modifications, or
128 | # for any such Derivative Works as a whole, provided Your use,
129 | # reproduction, and distribution of the Work otherwise complies with
130 | # the conditions stated in this License.
131 | #
132 | # 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | # any Contribution intentionally submitted for inclusion in the Work
134 | # by You to the Licensor shall be under the terms and conditions of
135 | # this License, without any additional terms or conditions.
136 | # Notwithstanding the above, nothing herein shall supersede or modify
137 | # the terms of any separate license agreement you may have executed
138 | # with Licensor regarding such Contributions.
139 | #
140 | # 6. Trademarks. This License does not grant permission to use the trade
141 | # names, trademarks, service marks, or product names of the Licensor,
142 | # except as required for reasonable and customary use in describing the
143 | # origin of the Work and reproducing the content of the NOTICE file.
144 | #
145 | # 7. Disclaimer of Warranty. Unless required by applicable law or
146 | # agreed to in writing, Licensor provides the Work (and each
147 | # Contributor provides its Contributions) on an "AS IS" BASIS,
148 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | # implied, including, without limitation, any warranties or conditions
150 | # of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | # PARTICULAR PURPOSE. You are solely responsible for determining the
152 | # appropriateness of using or redistributing the Work and assume any
153 | # risks associated with Your exercise of permissions under this License.
154 | #
155 | # 8. Limitation of Liability. In no event and under no legal theory,
156 | # whether in tort (including negligence), contract, or otherwise,
157 | # unless required by applicable law (such as deliberate and grossly
158 | # negligent acts) or agreed to in writing, shall any Contributor be
159 | # liable to You for damages, including any direct, indirect, special,
160 | # incidental, or consequential damages of any character arising as a
161 | # result of this License or out of the use or inability to use the
162 | # Work (including but not limited to damages for loss of goodwill,
163 | # work stoppage, computer failure or malfunction, or any and all
164 | # other commercial damages or losses), even if such Contributor
165 | # has been advised of the possibility of such damages.
166 | #
167 | # 9. Accepting Warranty or Additional Liability. While redistributing
168 | # the Work or Derivative Works thereof, You may choose to offer,
169 | # and charge a fee for, acceptance of support, warranty, indemnity,
170 | # or other liability obligations and/or rights consistent with this
171 | # License. However, in accepting such obligations, You may act only
172 | # on Your own behalf and on Your sole responsibility, not on behalf
173 | # of any other Contributor, and only if You agree to indemnify,
174 | # defend, and hold each Contributor harmless for any liability
175 | # incurred by, or claims asserted against, such Contributor by reason
176 | # of your accepting any such warranty or additional liability.
177 | #
178 | # END OF TERMS AND CONDITIONS
179 | #
180 | # APPENDIX: How to apply the Apache License to your work.
181 | #
182 | # To apply the Apache License to your work, attach the following
183 | # boilerplate notice, with the fields enclosed by brackets "[]"
184 | # replaced with your own identifying information. (Don't include
185 | # the brackets!) The text should be enclosed in the appropriate
186 | # comment syntax for the file format. We also recommend that a
187 | # file or class name and description of purpose be included on the
188 | # same "printed page" as the copyright notice for easier
189 | # identification within third-party archives.
190 | #
191 | # Copyright 2016 Ian Kelly
192 | #
193 | # Licensed under the Apache License, Version 2.0 (the "License");
194 | # you may not use this file except in compliance with the License.
195 | # You may obtain a copy of the License at
196 | #
197 | # http://www.apache.org/licenses/LICENSE-2.0
198 | #
199 | # Unless required by applicable law or agreed to in writing, software
200 | # distributed under the License is distributed on an "AS IS" BASIS,
201 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | # See the License for the specific language governing permissions and
203 | # limitations under the License.
204 | #
205 |
206 | #Thu Jan 19 18:46:57 GMT 2023
207 | distributionBase=GRADLE_USER_HOME
208 | distributionPath=wrapper/dists
209 | zipStoreBase=GRADLE_USER_HOME
210 | zipStorePath=wrapper/dists
211 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
212 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
162 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
92 |
--------------------------------------------------------------------------------
/publish.gradle:
--------------------------------------------------------------------------------
1 | def versionString = file('src/main/resources/cognitivej-version.txt').text.trim()
2 | group = 'cognitivej'
3 | version = versionString
4 |
5 | // custom tasks for creating source/javadoc jars
6 | task sourcesJar(type: Jar, dependsOn: classes) {
7 | classifier = 'sources'
8 | from sourceSets.main.allSource
9 | }
10 |
11 | task javadocJar(type: Jar, dependsOn: javadoc) {
12 | classifier = 'javadoc'
13 | from javadoc.destinationDir
14 | javadoc.failOnError = false
15 | }
16 |
17 | // add javadoc/source jar tasks as artifacts
18 | artifacts {
19 | archives sourcesJar, javadocJar
20 | }
21 |
22 | task release() {
23 | dependsOn 'assemble'
24 | }
25 |
26 | publishing {
27 | publications {
28 | mavenJava(MavenPublication) {
29 | from components.java
30 | artifact sourcesJar
31 | artifact javadocJar
32 | }
33 | }
34 | }
35 |
36 | // todo: setup release to maven central
37 | //bintray {
38 | // user = project.hasProperty('bintray_user') ? bintray_user : ''
39 | // key = project.hasProperty('bintray_api_key') ? bintray_api_key : ''
40 | // publications = ['mavenJava']
41 | // dryRun = false
42 | // publish = true
43 | // pkg {
44 | // repo = 'CognitiveJ'
45 | // name = 'CognitiveJ'
46 | // desc = 'Image Analysis in Java Made Easy'
47 | // websiteUrl = 'https://github.com/CognitiveJ/cognitivej'
48 | // issueTrackerUrl = 'https://github.com/CognitiveJ/cognitivej/issues'
49 | // vcsUrl = 'https://github.com/CognitiveJ/cognitivej.git'
50 | // licenses = ['Apache-2.0']
51 | // labels = ['cognitivej', 'java', 'Image Analysis', 'microsoft cognitive']
52 | // publicDownloadNumbers = true
53 | // //Optional version descriptor
54 | // version {
55 | // name = project.version
56 | // released = new Date()
57 | // mavenCentralSync {
58 | // sync = false //Optional (true by default). Determines whether to sync the version to Maven Central.
59 | // user = 'userToken' //OSS user token
60 | // password = 'paasword' //OSS user password
61 | // close = '1'
62 | // }
63 | // }
64 | // }
65 | //}
66 |
67 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | rootProject.name = 'cognitivej'
207 |
208 |
209 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/core/ChainedBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.core;
207 |
208 |
209 |
210 | public abstract class ChainedBuilder {
211 |
212 |
213 | }
214 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/core/CognitiveResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.core;
207 |
208 |
209 | import org.jetbrains.annotations.NotNull;
210 |
211 | public abstract class CognitiveResult {
212 |
213 | @NotNull
214 | public final Class resultType() {
215 | return getClass();
216 | }
217 | }
218 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/core/ExponentialBackOffFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.core;
207 |
208 | import org.jetbrains.annotations.NotNull;
209 |
210 | @FunctionalInterface
211 | public interface ExponentialBackOffFunction {
212 | @NotNull
213 | T execute();
214 | }
--------------------------------------------------------------------------------
/src/main/java/cognitivej/core/error/exceptions/QuotaExceededException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.core.error.exceptions;
207 |
208 | import org.jetbrains.annotations.NotNull;
209 |
210 | public class QuotaExceededException extends RuntimeException {
211 | public QuotaExceededException(@NotNull String message) {
212 | super(message);
213 | }
214 | }
215 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/core/error/exceptions/RateLimitExceededException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.core.error.exceptions;
207 |
208 |
209 | import org.jetbrains.annotations.NotNull;
210 |
211 | public class RateLimitExceededException extends RuntimeException {
212 | public RateLimitExceededException(@NotNull String message) {
213 | super(message);
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/computervision/DomainSpecificDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.computervision;
207 |
208 |
209 | import java.util.Arrays;
210 | import java.util.List;
211 |
212 | public enum DomainSpecificDetails {
213 | celebrities;
214 |
215 | public static final List ALL = Arrays.asList(values());
216 | }
217 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/face/persongroup/CurrentGroupTrainingStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.face.persongroup;
207 |
208 | /**
209 | * Created by Ian on 29/04/2016.
210 | */
211 | enum CurrentGroupTrainingStatus {
212 | notstarted, running, succeeded, failed;
213 | }
214 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/face/task/error/NoFacesNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.face.task.error;
207 |
208 | public class NoFacesNotFoundException extends RuntimeException {
209 |
210 | public NoFacesNotFoundException(String message) {
211 | super(String.format("no found faces", message));
212 | }
213 |
214 |
215 | }
216 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/overlay/RectangleTextPosition.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.overlay;
207 |
208 |
209 | public enum RectangleTextPosition {
210 | LEFT_OF, RIGHT_OF, TOP_OF, BOTTOM_OF
211 | }
212 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/overlay/RectangleType.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.overlay;
207 |
208 |
209 | public enum RectangleType {
210 | FULL, CORNERED;
211 | }
212 |
--------------------------------------------------------------------------------
/src/main/java/cognitivej/vision/overlay/filter/ImageFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.vision.overlay.filter;
207 |
208 |
209 | import org.jetbrains.annotations.NotNull;
210 |
211 | import java.awt.image.BufferedImage;
212 |
213 | public interface ImageFilter {
214 |
215 |
216 | @NotNull
217 | BufferedImage applyFilter(@NotNull BufferedImage bufferedImage);
218 | }
219 |
--------------------------------------------------------------------------------
/src/main/resources/cognitivej-version.txt:
--------------------------------------------------------------------------------
1 | 0.6.2
--------------------------------------------------------------------------------
/src/main/resources/font/notosans/NotoSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CognitiveJ/cognitivej/b8a06daa74809e069264445caf70c5311059bb8b/src/main/resources/font/notosans/NotoSans-Bold.ttf
--------------------------------------------------------------------------------
/src/main/resources/font/notosans/NotoSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CognitiveJ/cognitivej/b8a06daa74809e069264445caf70c5311059bb8b/src/main/resources/font/notosans/NotoSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/src/main/resources/font/notosans/NotoSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CognitiveJ/cognitivej/b8a06daa74809e069264445caf70c5311059bb8b/src/main/resources/font/notosans/NotoSans-Italic.ttf
--------------------------------------------------------------------------------
/src/main/resources/font/notosans/NotoSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CognitiveJ/cognitivej/b8a06daa74809e069264445caf70c5311059bb8b/src/main/resources/font/notosans/NotoSans-Regular.ttf
--------------------------------------------------------------------------------
/src/test/groovy/cognitivej/utils/TestUtil.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Apache License
4 | * Version 2.0, January 2004
5 | * http://www.apache.org/licenses/
6 | *
7 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | *
9 | * 1. Definitions.
10 | *
11 | * "License" shall mean the terms and conditions for use, reproduction,
12 | * and distribution as defined by Sections 1 through 9 of this document.
13 | *
14 | * "Licensor" shall mean the copyright owner or entity authorized by
15 | * the copyright owner that is granting the License.
16 | *
17 | * "Legal Entity" shall mean the union of the acting entity and all
18 | * other entities that control, are controlled by, or are under common
19 | * control with that entity. For the purposes of this definition,
20 | * "control" means (i) the power, direct or indirect, to cause the
21 | * direction or management of such entity, whether by contract or
22 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | * outstanding shares, or (iii) beneficial ownership of such entity.
24 | *
25 | * "You" (or "Your") shall mean an individual or Legal Entity
26 | * exercising permissions granted by this License.
27 | *
28 | * "Source" form shall mean the preferred form for making modifications,
29 | * including but not limited to software source code, documentation
30 | * source, and configuration files.
31 | *
32 | * "Object" form shall mean any form resulting from mechanical
33 | * transformation or translation of a Source form, including but
34 | * not limited to compiled object code, generated documentation,
35 | * and conversions to other media types.
36 | *
37 | * "Work" shall mean the work of authorship, whether in Source or
38 | * Object form, made available under the License, as indicated by a
39 | * copyright notice that is included in or attached to the work
40 | * (an example is provided in the Appendix below).
41 | *
42 | * "Derivative Works" shall mean any work, whether in Source or Object
43 | * form, that is based on (or derived from) the Work and for which the
44 | * editorial revisions, annotations, elaborations, or other modifications
45 | * represent, as a whole, an original work of authorship. For the purposes
46 | * of this License, Derivative Works shall not include works that remain
47 | * separable from, or merely link (or bind by name) to the interfaces of,
48 | * the Work and Derivative Works thereof.
49 | *
50 | * "Contribution" shall mean any work of authorship, including
51 | * the original version of the Work and any modifications or additions
52 | * to that Work or Derivative Works thereof, that is intentionally
53 | * submitted to Licensor for inclusion in the Work by the copyright owner
54 | * or by an individual or Legal Entity authorized to submit on behalf of
55 | * the copyright owner. For the purposes of this definition, "submitted"
56 | * means any form of electronic, verbal, or written communication sent
57 | * to the Licensor or its representatives, including but not limited to
58 | * communication on electronic mailing lists, source code control systems,
59 | * and issue tracking systems that are managed by, or on behalf of, the
60 | * Licensor for the purpose of discussing and improving the Work, but
61 | * excluding communication that is conspicuously marked or otherwise
62 | * designated in writing by the copyright owner as "Not a Contribution."
63 | *
64 | * "Contributor" shall mean Licensor and any individual or Legal Entity
65 | * on behalf of whom a Contribution has been received by Licensor and
66 | * subsequently incorporated within the Work.
67 | *
68 | * 2. Grant of Copyright License. Subject to the terms and conditions of
69 | * this License, each Contributor hereby grants to You a perpetual,
70 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | * copyright license to reproduce, prepare Derivative Works of,
72 | * publicly display, publicly perform, sublicense, and distribute the
73 | * Work and such Derivative Works in Source or Object form.
74 | *
75 | * 3. Grant of Patent License. Subject to the terms and conditions of
76 | * this License, each Contributor hereby grants to You a perpetual,
77 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | * (except as stated in this section) patent license to make, have made,
79 | * use, offer to sell, sell, import, and otherwise transfer the Work,
80 | * where such license applies only to those patent claims licensable
81 | * by such Contributor that are necessarily infringed by their
82 | * Contribution(s) alone or by combination of their Contribution(s)
83 | * with the Work to which such Contribution(s) was submitted. If You
84 | * institute patent litigation against any entity (including a
85 | * cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | * or a Contribution incorporated within the Work constitutes direct
87 | * or contributory patent infringement, then any patent licenses
88 | * granted to You under this License for that Work shall terminate
89 | * as of the date such litigation is filed.
90 | *
91 | * 4. Redistribution. You may reproduce and distribute copies of the
92 | * Work or Derivative Works thereof in any medium, with or without
93 | * modifications, and in Source or Object form, provided that You
94 | * meet the following conditions:
95 | *
96 | * (a) You must give any other recipients of the Work or
97 | * Derivative Works a copy of this License; and
98 | *
99 | * (b) You must cause any modified files to carry prominent notices
100 | * stating that You changed the files; and
101 | *
102 | * (c) You must retain, in the Source form of any Derivative Works
103 | * that You distribute, all copyright, patent, trademark, and
104 | * attribution notices from the Source form of the Work,
105 | * excluding those notices that do not pertain to any part of
106 | * the Derivative Works; and
107 | *
108 | * (d) If the Work includes a "NOTICE" text file as part of its
109 | * distribution, then any Derivative Works that You distribute must
110 | * include a readable copy of the attribution notices contained
111 | * within such NOTICE file, excluding those notices that do not
112 | * pertain to any part of the Derivative Works, in at least one
113 | * of the following places: within a NOTICE text file distributed
114 | * as part of the Derivative Works; within the Source form or
115 | * documentation, if provided along with the Derivative Works; or,
116 | * within a display generated by the Derivative Works, if and
117 | * wherever such third-party notices normally appear. The contents
118 | * of the NOTICE file are for informational purposes only and
119 | * do not modify the License. You may add Your own attribution
120 | * notices within Derivative Works that You distribute, alongside
121 | * or as an addendum to the NOTICE text from the Work, provided
122 | * that such additional attribution notices cannot be construed
123 | * as modifying the License.
124 | *
125 | * You may add Your own copyright statement to Your modifications and
126 | * may provide additional or different license terms and conditions
127 | * for use, reproduction, or distribution of Your modifications, or
128 | * for any such Derivative Works as a whole, provided Your use,
129 | * reproduction, and distribution of the Work otherwise complies with
130 | * the conditions stated in this License.
131 | *
132 | * 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | * any Contribution intentionally submitted for inclusion in the Work
134 | * by You to the Licensor shall be under the terms and conditions of
135 | * this License, without any additional terms or conditions.
136 | * Notwithstanding the above, nothing herein shall supersede or modify
137 | * the terms of any separate license agreement you may have executed
138 | * with Licensor regarding such Contributions.
139 | *
140 | * 6. Trademarks. This License does not grant permission to use the trade
141 | * names, trademarks, service marks, or product names of the Licensor,
142 | * except as required for reasonable and customary use in describing the
143 | * origin of the Work and reproducing the content of the NOTICE file.
144 | *
145 | * 7. Disclaimer of Warranty. Unless required by applicable law or
146 | * agreed to in writing, Licensor provides the Work (and each
147 | * Contributor provides its Contributions) on an "AS IS" BASIS,
148 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | * implied, including, without limitation, any warranties or conditions
150 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | * PARTICULAR PURPOSE. You are solely responsible for determining the
152 | * appropriateness of using or redistributing the Work and assume any
153 | * risks associated with Your exercise of permissions under this License.
154 | *
155 | * 8. Limitation of Liability. In no event and under no legal theory,
156 | * whether in tort (including negligence), contract, or otherwise,
157 | * unless required by applicable law (such as deliberate and grossly
158 | * negligent acts) or agreed to in writing, shall any Contributor be
159 | * liable to You for damages, including any direct, indirect, special,
160 | * incidental, or consequential damages of any character arising as a
161 | * result of this License or out of the use or inability to use the
162 | * Work (including but not limited to damages for loss of goodwill,
163 | * work stoppage, computer failure or malfunction, or any and all
164 | * other commercial damages or losses), even if such Contributor
165 | * has been advised of the possibility of such damages.
166 | *
167 | * 9. Accepting Warranty or Additional Liability. While redistributing
168 | * the Work or Derivative Works thereof, You may choose to offer,
169 | * and charge a fee for, acceptance of support, warranty, indemnity,
170 | * or other liability obligations and/or rights consistent with this
171 | * License. However, in accepting such obligations, You may act only
172 | * on Your own behalf and on Your sole responsibility, not on behalf
173 | * of any other Contributor, and only if You agree to indemnify,
174 | * defend, and hold each Contributor harmless for any liability
175 | * incurred by, or claims asserted against, such Contributor by reason
176 | * of your accepting any such warranty or additional liability.
177 | *
178 | * END OF TERMS AND CONDITIONS
179 | *
180 | * APPENDIX: How to apply the Apache License to your work.
181 | *
182 | * To apply the Apache License to your work, attach the following
183 | * boilerplate notice, with the fields enclosed by brackets "[]"
184 | * replaced with your own identifying information. (Don't include
185 | * the brackets!) The text should be enclosed in the appropriate
186 | * comment syntax for the file format. We also recommend that a
187 | * file or class name and description of purpose be included on the
188 | * same "printed page" as the copyright notice for easier
189 | * identification within third-party archives.
190 | *
191 | * Copyright 2016 Ian Kelly
192 | *
193 | * Licensed under the Apache License, Version 2.0 (the "License");
194 | * you may not use this file except in compliance with the License.
195 | * You may obtain a copy of the License at
196 | *
197 | * http://www.apache.org/licenses/LICENSE-2.0
198 | *
199 | * Unless required by applicable law or agreed to in writing, software
200 | * distributed under the License is distributed on an "AS IS" BASIS,
201 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | * See the License for the specific language governing permissions and
203 | * limitations under the License.
204 | */
205 |
206 | package cognitivej.utils
207 |
208 |
209 | class TestUtil {
210 |
211 | public static InputStream fromUrl(String url) {
212 | new URL(url).openStream();
213 | }
214 | }
215 |
--------------------------------------------------------------------------------
/src/test/resources/blog/sets/love_hate_candidates.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Nidge",
4 | "userData": "",
5 | "images": [
6 | {
7 | "name": "",
8 | "userData": "",
9 | "image": "http://i1.irishmirror.ie/whats-on/arts-culture-news/article4291331.ece/alternates/s1227b/Nidge.jpg",
10 | "dataSetType": "java.lang.String"
11 | }
12 | ]
13 | },
14 | {
15 | "name": "Trish",
16 | "userData": "",
17 | "images": [
18 | {
19 | "name": "",
20 | "userData": "",
21 | "image": "http://i4.irishmirror.ie/whats-on/arts-culture-news/article4291340.ece/ALTERNATES/s1227b/Trish.jpg",
22 | "dataSetType": "java.lang.String"
23 | }
24 | ]
25 | },
26 | {
27 | "name": "Ado",
28 | "userData": "",
29 | "images": [
30 | {
31 | "name": "",
32 | "userData": "",
33 | "image": "http://i3.irishmirror.ie/whats-on/arts-culture-news/article4291327.ece/ALTERNATES/s1227b/Ado.jpg",
34 | "dataSetType": "java.lang.String"
35 | }
36 | ]
37 | },
38 | {
39 | "name": "Fran",
40 | "userData": "",
41 | "images": [
42 | {
43 | "name": "",
44 | "userData": "",
45 | "image": "http://i2.irishmirror.ie/whats-on/arts-culture-news/article4291341.ece/ALTERNATES/s1227b/Fran.jpg",
46 | "dataSetType": "java.lang.String"
47 | }
48 | ]
49 | },
50 | {
51 | "name": "Siobhan",
52 | "userData": "",
53 | "images": [
54 | {
55 | "name": "",
56 | "userData": "",
57 | "image": "http://i1.irishmirror.ie/whats-on/arts-culture-news/article4291343.ece/ALTERNATES/s1227b/Siobhan.jpg",
58 | "dataSetType": "java.lang.String"
59 | }
60 | ]
61 | },
62 | {
63 | "name": "Janet",
64 | "userData": "",
65 | "images": [
66 | {
67 | "name": "",
68 | "userData": "",
69 | "image": "http://i1.irishmirror.ie/whats-on/arts-culture-news/article4291332.ece/ALTERNATES/s1227b/Janet.jpg",
70 | "dataSetType": "java.lang.String"
71 | }
72 | ]
73 | },
74 | {
75 | "name": "Nadine",
76 | "userData": "",
77 | "images": [
78 | {
79 | "name": "",
80 | "userData": "",
81 | "image": "http://i1.irishmirror.ie/whats-on/arts-culture-news/article4291344.ece/ALTERNATES/s1227b/Nadine.jpg",
82 | "dataSetType": "java.lang.String"
83 | }
84 | ]
85 | },
86 | {
87 | "name": "Darren",
88 | "userData": "",
89 | "images": [
90 | {
91 | "name": "",
92 | "userData": "",
93 | "image": "http://images.dailystar.co.uk/dynamic/117/photos/70000/620x/12070.jpg",
94 | "dataSetType": "java.lang.String"
95 | }
96 | ]
97 | },
98 | {
99 | "name": "Dano",
100 | "userData": "",
101 | "images": [
102 | {
103 | "name": "",
104 | "userData": "",
105 | "image": "http://thecircular.org/wp-content/uploads/2013/10/Love-Hate-Series-3-Jason-Barry-as-Dano-1.jpg",
106 | "dataSetType": "java.lang.String"
107 | }
108 | ]
109 | },
110 | {
111 | "name": "Lizzie",
112 | "userData": "",
113 | "images": [
114 | {
115 | "name": "",
116 | "userData": "",
117 | "image": "http://www.independent.ie/migration_catalog/article28929807.ece/ALTERNATES/h342/caoilfhionn",
118 | "dataSetType": "java.lang.String"
119 | }
120 | ]
121 | },
122 | {
123 | "name": "John Boy",
124 | "userData": "",
125 | "images": [
126 | {
127 | "name": "",
128 | "userData": "",
129 | "image": "http://images.entertainment.ie/images_content/rectangle/620x372/aidangillen.jpg",
130 | "dataSetType": "java.lang.String"
131 | }
132 | ]
133 | }/*,
134 | {
135 | "name": "Tommy",
136 | "userData": "",
137 | "images": [
138 | {
139 | "name": "",
140 | "userData": "",
141 | "image": "http://rsvpmagazine.ie/wp-content/uploads/2013/04/600full-killian-scott.jpg",
142 | "dataSetType": "java.lang.String"
143 | }
144 | ]
145 | }*/,
146 | {
147 | "name": "Wayne",
148 | "userData": "",
149 | "images": [
150 | {
151 | "name": "",
152 | "userData": "",
153 | "image": "https://pbs.twimg.com/profile_images/378800000576501919/625fb5afe3acdc7835589b7168b53908_400x400.jpeg",
154 | "dataSetType": "java.lang.String"
155 | }
156 | ]
157 | },
158 | {
159 | "name": "Ruth",
160 | "userData": "",
161 | "images": [
162 | {
163 | "name": "",
164 | "userData": "",
165 | "image": "http://s3-eu-west-1.amazonaws.com/evokeuploads/2016/03/16175428/ruth-bradley-160316-640x457.jpg",
166 | "dataSetType": "java.lang.String"
167 | }
168 | ]
169 | },
170 | {
171 | "name": "Hughie",
172 | "userData": "",
173 | "images": [
174 | {
175 | "name": "",
176 | "userData": "",
177 | "image": "http://images.wikia.com/rts-lovehate/images/archive/6/69/20121229223605!Hughie.jpg",
178 | "dataSetType": "java.lang.String"
179 | }
180 | ]
181 | }
182 | ]
--------------------------------------------------------------------------------