hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e162f2b3a6f4b0f4e8c1e3eb1d8aa628738603c
1,102
java
Java
Projects/VoiceShoppingList/VoiceShoppingList/app/src/main/java/com/telerik/academy/voiceshoppinglist/utilities/Constants.java
todorm85/TelerikAcademy
78b34dd829a4fa45bd873596efea4a48673185c9
[ "MIT" ]
null
null
null
Projects/VoiceShoppingList/VoiceShoppingList/app/src/main/java/com/telerik/academy/voiceshoppinglist/utilities/Constants.java
todorm85/TelerikAcademy
78b34dd829a4fa45bd873596efea4a48673185c9
[ "MIT" ]
null
null
null
Projects/VoiceShoppingList/VoiceShoppingList/app/src/main/java/com/telerik/academy/voiceshoppinglist/utilities/Constants.java
todorm85/TelerikAcademy
78b34dd829a4fa45bd873596efea4a48673185c9
[ "MIT" ]
5
2015-07-10T14:28:54.000Z
2017-01-09T18:15:32.000Z
52.47619
85
0.786751
9,438
package com.telerik.academy.voiceshoppinglist.utilities; public final class Constants { public static final int ACCEPTABLE_SIMILARITY_COEFFICIENT = 65; public static final String ADD_SHOPPING_LIST_COMMAND = "add new shopping list"; public static final String STOP_LISTENING_COMMAND = "stop listening"; public static final String EXIT_APPLICATION_COMMAND = "exit"; public static final String SET_PRODUCT_NAME_COMMAND = "product"; public static final String ADD_PRODUCT_COMMAND = "add product"; public static final String CHECK_PRODUCT_COMMAND = "check"; public static final String UNCHECK_PRODUCT_COMMAND = "uncheck"; public static final String DELETE_PRODUCT_COMMAND = "delete"; public static final String FINISH_SHOPPING_LIST_COMMAND = "finish"; public static final String PRODUCTS_LIST_BUNDLE_KEY = "products_list"; public static final String SHOPPING_LIST_BUNDLE_KEY = "shopping list bundle key"; public static final String SHARED_PREFERENCES_KEY = "shared_preferences"; public static final String TOKEN_SHARED_PREFERENCE_KEY = "token"; }
3e163057384178316baacc9c9e28145bed59ccc7
3,594
java
Java
server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesWithNonCompatibleElasticSearchServerTest.java
cketti/james-project
b8b635479d571862df7be4fa489f4a230ed10756
[ "Apache-2.0" ]
null
null
null
server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesWithNonCompatibleElasticSearchServerTest.java
cketti/james-project
b8b635479d571862df7be4fa489f4a230ed10756
[ "Apache-2.0" ]
null
null
null
server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesWithNonCompatibleElasticSearchServerTest.java
cketti/james-project
b8b635479d571862df7be4fa489f4a230ed10756
[ "Apache-2.0" ]
null
null
null
47.289474
117
0.658598
9,439
/**************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * * regarding copyright ownership. The ASF licenses this file * * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * ****************************************************************/ package org.apache.james; import static org.apache.james.CassandraJamesServerMain.ALL_BUT_JMX_CASSANDRA_MODULE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import org.apache.james.backends.es.DockerElasticSearch; import org.apache.james.lifecycle.api.StartUpCheck; import org.apache.james.lifecycle.api.StartUpCheck.CheckResult; import org.apache.james.mailbox.extractor.TextExtractor; import org.apache.james.mailbox.store.search.PDFTextExtractor; import org.apache.james.modules.TestJMAPServerModule; import org.apache.james.modules.mailbox.ElasticSearchStartUpCheck; import org.apache.james.util.docker.Images; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; class JamesWithNonCompatibleElasticSearchServerTest { private static final int LIMIT_MAX_MESSAGES = 10; static DockerElasticSearch dockerES2 = new DockerElasticSearch(Images.ELASTICSEARCH_2); @RegisterExtension static JamesServerExtension testExtension = new JamesServerBuilder() .extension(new DockerElasticSearchExtension(dockerES2)) .extension(new CassandraExtension()) .server(configuration -> GuiceJamesServer.forConfiguration(configuration) .combineWith(ALL_BUT_JMX_CASSANDRA_MODULE) .overrideWith(binder -> binder.bind(TextExtractor.class).to(PDFTextExtractor.class)) .overrideWith(new TestJMAPServerModule(LIMIT_MAX_MESSAGES))) .disableAutoStart() .build(); @AfterAll static void afterAll() { dockerES2.stop(); } @Test void jamesShouldStopWhenStartingWithANonCompatibleElasticSearchServer(GuiceJamesServer server) throws Exception { assertThatThrownBy(server::start) .isInstanceOfSatisfying( StartUpChecksPerformer.StartUpChecksException.class, ex -> assertThat(ex.getBadChecks()) .containsOnly(CheckResult.builder() .checkName(ElasticSearchStartUpCheck.CHECK_NAME) .resultType(StartUpCheck.ResultType.BAD) .description("ES version(2.4.6) is not compatible with the recommendation(6.3.2)") .build())); assertThat(server.isStarted()) .isFalse(); } }
3e16315a3d2d9e2b82bdf89ea759026ac0c44298
8,189
java
Java
app/src/main/java/com/example/aad2020_vvz_app_graldij_moimfeld/Activities/Vvz.java
moimfeld/AAD2020_Vvz_App_graldij_moimfeld
5c9f1cadd1f89ecc2fef40281cca4ab29f304c9c
[ "Apache-2.0" ]
2
2020-11-21T13:37:44.000Z
2020-12-03T16:29:31.000Z
app/src/main/java/com/example/aad2020_vvz_app_graldij_moimfeld/Activities/Vvz.java
moimfeld/AAD2020_Vvz_App_graldij_moimfeld
5c9f1cadd1f89ecc2fef40281cca4ab29f304c9c
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/aad2020_vvz_app_graldij_moimfeld/Activities/Vvz.java
moimfeld/AAD2020_Vvz_App_graldij_moimfeld
5c9f1cadd1f89ecc2fef40281cca4ab29f304c9c
[ "Apache-2.0" ]
null
null
null
43.1
166
0.627427
9,440
package com.example.aad2020_vvz_app_graldij_moimfeld.Activities; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; import android.view.KeyEvent; import android.view.MenuItem; import android.view.View; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.Toast; import com.example.aad2020_vvz_app_graldij_moimfeld.R; import com.example.aad2020_vvz_app_graldij_moimfeld.Utils.Course; import com.example.aad2020_vvz_app_graldij_moimfeld.Utils.Parse; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Objects; /** * The Course Catalogue Activity is a WebView of the ETH course catalogue (www.vvz.ethz.ch). * We used this approach, since we do not have direct access to the course information. * We are aware that the the current solution is not optimal in terms of user-experience and design, * and having granted the access to the official course data of ETH, we would definitely opt for * another modern in-app custom design aligning it with the rest of the app (see Outlook-section). * When the user navigates to a course, it can be saved using a button. * The button will trigger a parse function (implemented with the JSoup open-source library). * This function goes through the HTML code of the current page recognizing and saving the course information. * After a parsing attempt, the user gets a feedback (with Toast Messages) indicating success or * fail of the parse function. */ public class Vvz extends AppCompatActivity { //Variables needed throughout the whole activity public ArrayList<Course> saved_courses; private WebView myWebView; @SuppressLint("StaticFieldLeak") static Context context; @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vvz); context = this; //here the saved_courses ArrayList gets rebuilt from the MainActivity Intent.putExtra Type type = new TypeToken<ArrayList<Course>>(){}.getType(); Gson gson = new Gson(); saved_courses = gson.fromJson(getIntent().getStringExtra("saved_courses"), type); if(saved_courses == null){ saved_courses = new ArrayList<>(); } //Set the status bar color to the ETH color getWindow().setStatusBarColor(Color.parseColor("#1F407A")); //Webview for VVZ myWebView = findViewById(R.id.webview); myWebView.setWebViewClient(new MyWebViewClient()); //the following lines are needed to initially zoom out the Webview such that it is accessible myWebView.getSettings().setUseWideViewPort(true); myWebView.setInitialScale(1); //enable zoom in webview myWebView.getSettings().setBuiltInZoomControls(true); myWebView.getSettings().setDisplayZoomControls(false); myWebView.loadUrl("http://www.vorlesungsverzeichnis.ethz.ch/Vorlesungsverzeichnis/sucheLehrangebotPre.view?lang=en"); //Button final Button button = findViewById(R.id.saved_lecture); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //parse the currently displayed lecture in the webview Parse parse = new Parse(); Course new_parse = parse.parse(Objects.requireNonNull(myWebView.getUrl()), getApplicationContext()); //check whether the Lecture fully parsed if(!new_parse.isEmpty()) { //check if the saved_lecture ArrayList is empty if (saved_courses.size() > 0) { //check if the Lecture is already in the ArrayList for (int i = 0; i <= saved_courses.size(); i++) { if (saved_courses.get(i).isEqual(new_parse)) { Toast.makeText(Vvz.this, "course has already been saved", Toast.LENGTH_SHORT).show(); break; } if (i == saved_courses.size() - 1) { saved_courses.add(new_parse); Toast.makeText(Vvz.this, "course saved", Toast.LENGTH_SHORT).show(); saveCourses(); break; } } //handling the empty saved_lecture ArrayList } else { saved_courses.size(); saved_courses.add(new_parse); Toast.makeText(Vvz.this, "course saved", Toast.LENGTH_SHORT).show(); saveCourses(); } } } }); //Bottom navigation bar which can be used to switch from activity to activity. Here the data to be sent to other activities gets built and put into the intent BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation); bottomNavigationView.setSelectedItemId(R.id.action_Vvz); bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.action_Timetable: Intent Timetable = new Intent(Vvz.this, Timetable.class); Gson gson = new Gson(); Timetable.putExtra("saved_courses", gson.toJson(saved_courses)); startActivity(Timetable); overridePendingTransition(0, 0); break; case R.id.action_MainActivity: Intent MainActivity = new Intent(Vvz.this, MainActivity.class); startActivity(MainActivity); overridePendingTransition(0, 0); break; case R.id.action_Vvz: break; } return true; } }); } //this class hinders the webview from jumping out of the app into a browser app and prevents the user from getting out of the VVZ web pages private static class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { if(!StringUtils.contains(request.getUrl().toString(), "Vorlesungsverzeichnis")){ Toast.makeText(context, "you cannot leave the course catalogue", Toast.LENGTH_SHORT).show(); return true; } return false; } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (myWebView.canGoBack()) { myWebView.goBack(); } else { finish(); } return true; } } return super.onKeyDown(keyCode, event); } private void saveCourses() { SharedPreferences sharedPreferences = getSharedPreferences("shared_preferences", MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); Gson gson = new Gson(); String json = gson.toJson(saved_courses); editor.putString("saved_courses", json); editor.apply(); } }
3e1631c2f24a258133eca4ea14468125ed348fc0
5,262
java
Java
src/main/java/com/ruoyi/project/ums/account/controller/AccountController.java
Beignet95/yangfan-project
dbde156198cc81ef12da5ed85fe11369ef69ac9a
[ "MIT" ]
null
null
null
src/main/java/com/ruoyi/project/ums/account/controller/AccountController.java
Beignet95/yangfan-project
dbde156198cc81ef12da5ed85fe11369ef69ac9a
[ "MIT" ]
null
null
null
src/main/java/com/ruoyi/project/ums/account/controller/AccountController.java
Beignet95/yangfan-project
dbde156198cc81ef12da5ed85fe11369ef69ac9a
[ "MIT" ]
1
2021-03-29T09:01:20.000Z
2021-03-29T09:01:20.000Z
28.139037
94
0.685671
9,441
package com.ruoyi.project.ums.account.controller; import java.util.List; import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.project.ums.account.domain.Account; import com.ruoyi.project.ums.account.service.IAccountService; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.page.TableDataInfo; /** * 账号Controller * * @author Beignet * @date 2021-03-20 */ @Controller @RequestMapping("/ums/account") public class AccountController extends BaseController { private String prefix = "ums/account"; @Autowired private IAccountService accountService; @RequiresPermissions("ums:account:view") @GetMapping() public String account() { return prefix + "/account"; } @RequiresPermissions("ums:account:view") @GetMapping("/site") public String site(String accountId,ModelMap mmap) { mmap.addAttribute("accountId",accountId); return prefix + "/site"; } /** * 查询账号列表 */ @RequiresPermissions("ums:account:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(Account account) { startPage(); List<Account> list = accountService.selectAccountList(account); return getDataTable(list); } /** * 导出账号列表 */ @RequiresPermissions("ums:account:export") @Log(title = "账号", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(Account account) { List<Account> list = accountService.selectAccountList(account); ExcelUtil<Account> util = new ExcelUtil<Account>(Account.class); return util.exportExcel(list, "account"); } /** * 新增账号 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存账号 */ @RequiresPermissions("ums:account:add") @Log(title = "账号", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(Account account) { return toAjax(accountService.insertAccount(account)); } /** * 修改账号 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { Account account = accountService.selectAccountById(id); mmap.put("account", account); return prefix + "/edit"; } /** * 修改保存账号 */ @RequiresPermissions("ums:account:edit") @Log(title = "账号", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(Account account) { return toAjax(accountService.updateAccount(account)); } /** * 删除账号 */ @RequiresPermissions("ums:account:remove") @Log(title = "账号", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(accountService.deleteAccountByIds(ids)); } @Log(title = "账号导入", businessType = BusinessType.IMPORT) @RequiresPermissions("ums:account:import") @PostMapping("/importData") @ResponseBody public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil<Account> util = new ExcelUtil<Account>(Account.class); List<Account> accountList = util.importExcel(StringUtils.EMPTY,file.getInputStream()); String message = accountService.importAccount(accountList, updateSupport); return AjaxResult.success(message); } //导出 导入模板 @RequiresPermissions("ums:account:import") @GetMapping("/importTemplate") @ResponseBody public AjaxResult importTemplate() { ExcelUtil<Account> util = new ExcelUtil<Account>(Account.class); return util.importTemplateExcel("账号"); } /** * 查询账号列表 */ @RequiresPermissions("ums:account:list") @GetMapping("/getJson4AccountSite") @ResponseBody public String getJson4AccountSite(Account account) { String jsonString = accountService.getJson4AccountSite(); return jsonString; } /** * 查询账号列表 */ @RequiresPermissions("ums:account:list") @GetMapping("/getJson4AllAccountSite") @ResponseBody public String getJson4AllAccountSite(Account account) { String jsonString = accountService.getJson4AllAccountSite(); return jsonString; } }
3e1631c788cd0cb905674e02b2a3920a7f98b366
650
java
Java
src/org/opensha/gem/GEM1/calc/gemModelParsers/gshap/africa/SsAfricaSourceGeometry.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
src/org/opensha/gem/GEM1/calc/gemModelParsers/gshap/africa/SsAfricaSourceGeometry.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
src/org/opensha/gem/GEM1/calc/gemModelParsers/gshap/africa/SsAfricaSourceGeometry.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
17.105263
63
0.735385
9,442
package org.opensha.gem.GEM1.calc.gemModelParsers.gshap.africa; import java.util.ArrayList; import org.opensha.commons.geo.Location; import org.opensha.commons.geo.LocationList; public class SsAfricaSourceGeometry { LocationList vertexes; int id; public SsAfricaSourceGeometry (){ } public SsAfricaSourceGeometry (LocationList vertexes, int id){ this.vertexes = vertexes; this.id = id; } public void setId(int id){ this.id = id; } public void setVertexes(LocationList vertexes){ this.vertexes = vertexes; } public LocationList getVertexes(){ return this.vertexes; } public int getId(){ return this.id; } }
3e1631e3145e1603d907f20d7460d65e46cd5473
2,080
java
Java
Chess Lab/Player.java
utk003/AP-CS-DS
c88f22e1643cb9b310110c3a738fee2608251fb9
[ "MIT" ]
1
2020-12-01T19:00:48.000Z
2020-12-01T19:00:48.000Z
Chess Lab/Player.java
utk003/APCS-DS
c88f22e1643cb9b310110c3a738fee2608251fb9
[ "MIT" ]
null
null
null
Chess Lab/Player.java
utk003/APCS-DS
c88f22e1643cb9b310110c3a738fee2608251fb9
[ "MIT" ]
null
null
null
23.111111
87
0.536058
9,443
import java.awt.*; import java.util.*; /** * The abstract class Player is a player that can play Chess. * * @author Utkarsh Priyam * @version v1 */ public abstract class Player { private Board board; private String name; private Color color; /** * A constructor for a Player * * @param b the player's board * @param n the player's name * @param c the player's color */ public Player( Board b, String n, Color c ) { board = b; name = n; color = c; } /** * Returns the player's board * @return the player's board */ public Board getBoard() { return board; } /** * Returns the player's name * @return the player's name */ public String getName() { return name; } /** * Returns the player's color * @return the player's color */ public Color getColor() { return color; } /** * Returns the next move this player will make * @return this player's next move */ public abstract Move nextMove(); /** * Checks whether each of the moves in the given * arraylist is valid in a normal game of chess. * Removes the move from the arraylist if the move puts the king in check. * Returns the size of the arraylist after all the moves are checked. * @param moves all the moves to check * @return the size of the arraylist of moves after all the moves are checked. */ public int checkMoves( ArrayList<Move> moves ) { int ind = 0; if ( color.equals(Color.BLACK) ) ind = 1; for ( int i = moves.size() - 1; i >= 0; i-- ) { Move m = moves.get(i); board.executeMove( m ); int[] safety = board.evaluateGameStatus(); board.undoMove( m ); if ( safety[ind] != 0 ) moves.remove(i); } board.evaluateGameStatus(); return moves.size(); } }
3e16320b4702a76e7c615dcebfc86d3167edafe0
587
java
Java
src/main/java/com/xiaobai/springbootdemo/controller/LogoutController.java
3ylh3/SpringBootDemo
9a044398f977cfd6c37675848d2309315e0aa5fc
[ "MIT" ]
null
null
null
src/main/java/com/xiaobai/springbootdemo/controller/LogoutController.java
3ylh3/SpringBootDemo
9a044398f977cfd6c37675848d2309315e0aa5fc
[ "MIT" ]
null
null
null
src/main/java/com/xiaobai/springbootdemo/controller/LogoutController.java
3ylh3/SpringBootDemo
9a044398f977cfd6c37675848d2309315e0aa5fc
[ "MIT" ]
null
null
null
27.952381
62
0.746167
9,444
package com.xiaobai.springbootdemo.controller; import com.xiaobai.springbootdemo.bean.Message; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpSession; @RestController @RequestMapping("/SpringBootDemo") public class LogoutController { @RequestMapping("/logout") public Message logout(HttpSession session){ Message message = new Message(); //销毁session session.invalidate(); message.setMessage("success"); return message; } }
3e16327db67744004ea1d48466c765e43e16065c
133,504
java
Java
3-data-analysis/data/raw/evosuite_fuzzer_60/tests/s18/fastjson/evosuite-tests/com/alibaba/fastjson/JSONPath_ESTest.java
mitchellolsthoorn/ASE-NIER-2020-Replication
d921c324d95346b2d962d913c21b993fa5a51d18
[ "MIT" ]
null
null
null
3-data-analysis/data/raw/evosuite_fuzzer_60/tests/s18/fastjson/evosuite-tests/com/alibaba/fastjson/JSONPath_ESTest.java
mitchellolsthoorn/ASE-NIER-2020-Replication
d921c324d95346b2d962d913c21b993fa5a51d18
[ "MIT" ]
3
2020-11-16T20:45:46.000Z
2021-03-23T00:28:18.000Z
3-data-analysis/data/raw/evosuite_fuzzer_60/tests/s18/fastjson/evosuite-tests/com/alibaba/fastjson/JSONPath_ESTest.java
mitchellolsthoorn/ASE-NIER-2020-Replication
d921c324d95346b2d962d913c21b993fa5a51d18
[ "MIT" ]
null
null
null
42.776033
268
0.692871
9,445
/* * This file was automatically generated by EvoSuite * Fri May 22 11:40:47 GMT 2020 */ package com.alibaba.fastjson; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONPath; import com.alibaba.fastjson.PropertyNamingStrategy; import com.alibaba.fastjson.parser.DefaultJSONParser; import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.parser.ParserConfig; import com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory; import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; import com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer; import com.alibaba.fastjson.serializer.JavaBeanSerializer; import com.alibaba.fastjson.serializer.SerializeConfig; import com.alibaba.fastjson.util.FieldInfo; import java.lang.reflect.Field; import java.math.BigDecimal; import java.math.BigInteger; import java.sql.BatchUpdateException; import java.sql.ClientInfoStatus; import java.sql.DataTruncation; import java.sql.SQLClientInfoException; import java.sql.SQLDataException; import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLInvalidAuthorizationSpecException; import java.sql.SQLNonTransientConnectionException; import java.sql.SQLNonTransientException; import java.sql.SQLRecoverableException; import java.sql.SQLSyntaxErrorException; import java.sql.SQLTimeoutException; import java.sql.SQLTransactionRollbackException; import java.sql.SQLTransientConnectionException; import java.sql.SQLTransientException; import java.sql.SQLWarning; import java.time.Period; import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.Vector; import java.util.regex.Pattern; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.mock.java.util.MockCalendar; import org.evosuite.runtime.mock.java.util.MockGregorianCalendar; import org.evosuite.runtime.testdata.EvoSuiteFile; import org.evosuite.runtime.testdata.FileSystemHandling; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class JSONPath_ESTest extends JSONPath_ESTest_scaffolding { @Test(timeout = 4000) public void test000() throws Throwable { Long long0 = new Long((-4270347329889690746L)); Long long1 = new Long(2188); boolean boolean0 = JSONPath.eqNotNull(long0, long1); assertFalse(boolean0); } @Test(timeout = 4000) public void test001() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(2287, false); ParserConfig parserConfig0 = ParserConfig.global; JSONPath jSONPath0 = new JSONPath("illegal state. ", serializeConfig0, parserConfig0); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(827, 2287, (-1346)); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance_deep; ArrayList arrayList0 = (ArrayList)jSONPath_RangeSegment0.eval(jSONPath0, (Object) null, jSONPath_WildCardSegment0); assertEquals(0, arrayList0.size()); } @Test(timeout = 4000) public void test002() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("r>'Kor=K,5?o", serializeConfig0, parserConfig0); SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException((String) null); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(1261, 91, 63); Byte byte0 = new Byte((byte) (-112)); // Undeclared exception! try { jSONPath_RangeSegment0.eval(jSONPath0, byte0, sQLTransientConnectionException0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Illegal Capacity: -17 // verifyException("java.util.ArrayList", e); } } @Test(timeout = 4000) public void test003() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("trim"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("trim", "x!x3:Q", 1536); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(36, 0, (-9)); ArrayList arrayList0 = (ArrayList)jSONPath_RangeSegment0.eval(jSONPath0, "+ZL.3U;fG$TRC", sQLIntegrityConstraintViolationException0); assertEquals(0, arrayList0.size()); } @Test(timeout = 4000) public void test004() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("'N`{6"); JSONPath.Segment jSONPath_Segment0 = jSONPath_JSONPathParser0.buildArraySegement("&m7*[SB[&^YMg({etb"); assertNotNull(jSONPath_Segment0); } @Test(timeout = 4000) public void test005() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("false"); // Undeclared exception! try { jSONPath_JSONPathParser0.accept('?'); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // expect '?, but 'f' // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test006() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("scanLong"); // Undeclared exception! try { jSONPath_JSONPathParser0.readValue(); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test007() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("0"); // Undeclared exception! try { jSONPath_JSONPathParser0.readLongValue(); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test008() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("([CLjava/lang/Class;)"); // Undeclared exception! try { jSONPath_JSONPathParser0.readLongValue(); fail("Expecting exception: NumberFormatException"); } catch(NumberFormatException e) { // // For input string: \"\" // verifyException("java.lang.NumberFormatException", e); } } @Test(timeout = 4000) public void test009() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("trim"); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("\"\"", jSONPath0, true); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("\"\""); JSONPath.Filter jSONPath_Filter0 = jSONPath_JSONPathParser0.filterRest(jSONPath_ValueSegment0); assertSame(jSONPath_Filter0, jSONPath_ValueSegment0); } @Test(timeout = 4000) public void test010() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("$VALUES"); // Undeclared exception! try { jSONPath_JSONPathParser0.parseArrayAccessFilter(false); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test011() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(2287); ParserConfig parserConfig0 = new ParserConfig(false); JSONPath jSONPath0 = new JSONPath("Tf!-e_A}N|fVLZ", serializeConfig0, parserConfig0); Double double0 = new Double(2287); // Undeclared exception! try { jSONPath0.eval((Object) double0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : Tf!-e_A}N|fVLZ // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test012() throws Throwable { Feature[] featureArray0 = new Feature[9]; // Undeclared exception! try { JSONPath.extract("com", "pik+sY{", (ParserConfig) null, (-457), featureArray0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.parser.DefaultJSONParser", e); } } @Test(timeout = 4000) public void test013() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("2/O(O4x<D<9|B"); Object object0 = jSONPath_JSONPathParser0.readValue(); assertEquals(2L, object0); } @Test(timeout = 4000) public void test014() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("m;knl^J]mEq"); jSONPath_JSONPathParser0.readSegement(); // Undeclared exception! try { jSONPath_JSONPathParser0.readDoubleValue(3004L); fail("Expecting exception: NumberFormatException"); } catch(NumberFormatException e) { } } @Test(timeout = 4000) public void test015() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("false"); String string0 = jSONPath_JSONPathParser0.readName(); assertEquals("false", string0); } @Test(timeout = 4000) public void test016() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("{\"y\":7,\"a\":[],\"x\":\"hello\",\"value is null\":{},\"z\":true,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}"); jSONPath_JSONPathParser0.next(); } @Test(timeout = 4000) public void test017() throws Throwable { boolean boolean0 = JSONPath.JSONPathParser.isDigitFirst('/'); assertFalse(boolean0); } @Test(timeout = 4000) public void test018() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("\u0006:XkD-n42{o_#6G<+l"); // Undeclared exception! try { jSONPath_JSONPathParser0.accept(';'); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // expect ';, but '\u0006' // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test019() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("expect '"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.RLIKE; JSONPath.IntOpSegement jSONPath_IntOpSegement0 = new JSONPath.IntOpSegement("com.alibaba.fastjson.JSONPath$StringInSegement", 0, jSONPath_Operator0); int[] intArray0 = new int[6]; JSONPath.MultiIndexSegment jSONPath_MultiIndexSegment0 = new JSONPath.MultiIndexSegment(intArray0); SQLWarning sQLWarning0 = new SQLWarning(); boolean boolean0 = jSONPath_IntOpSegement0.apply(jSONPath0, jSONPath_MultiIndexSegment0, (Object) null, sQLWarning0); assertFalse(boolean0); } @Test(timeout = 4000) public void test020() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("r>'Kor=K,5?o", serializeConfig0, parserConfig0); JSONPath.PropertySegment jSONPath_PropertySegment0 = new JSONPath.PropertySegment("y~KBH#A'zNK:", true); ArrayList arrayList0 = (ArrayList)jSONPath_PropertySegment0.eval(jSONPath0, " is not a primitive type", jSONPath0); assertTrue(arrayList0.isEmpty()); } @Test(timeout = 4000) public void test021() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("4~&v}G`JEvY-sHO:i"); double double0 = jSONPath_JSONPathParser0.readDoubleValue(901); assertEquals(905.0, double0, 0.01); } @Test(timeout = 4000) public void test022() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("-"); Object object0 = jSONPath_JSONPathParser0.parseArrayAccessFilter(false); assertNotNull(object0); } @Test(timeout = 4000) public void test023() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(true); JSONPath jSONPath0 = JSONPath.compile("LE"); // Undeclared exception! try { jSONPath0.toJSONString(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class byte // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test024() throws Throwable { int int0 = JSONPath.size((Object) null, "com.alibaba.fastjson.JSONValidator$ReaderValidator"); assertEquals((-1), int0); } @Test(timeout = 4000) public void test025() throws Throwable { JSONPath jSONPath0 = new JSONPath("/stackTrace/5"); int[] intArray0 = new int[6]; BatchUpdateException batchUpdateException0 = new BatchUpdateException("3YzbIq~/j", "3YzbIq~/j", intArray0); int int0 = jSONPath0.size((Object) batchUpdateException0); assertEquals(5, int0); } @Test(timeout = 4000) public void test026() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser(", end "); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = JSONPath.compile("fastjson.parser.deny"); boolean boolean0 = jSONPath0.setPropertyValue(jSONPath_JSONPathParser0, "<V`T/n", 47, parserConfig0); assertFalse(boolean0); } @Test(timeout = 4000) public void test027() throws Throwable { Short short0 = new Short((short)0); boolean boolean0 = JSONPath.set((Object) "{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[],\"b\":{\"x\":false}}", "k", (Object) short0); assertTrue(boolean0); } @Test(timeout = 4000) public void test028() throws Throwable { Class<Byte> class0 = Byte.TYPE; Class<JSONPath.WildCardSegment> class1 = JSONPath.WildCardSegment.class; FieldInfo fieldInfo0 = new FieldInfo("%dx<u", class0, class1, class0, (Field) null, 3, 39, (-1982378825)); Object object0 = JSONPath.reserveToObject((Object) null, fieldInfo0.alternateNames); assertNull(object0); } @Test(timeout = 4000) public void test029() throws Throwable { JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.GE; SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; Map<String, Object> map0 = JSONPath.paths((Object) jSONPath_Operator0, serializeConfig0); assertEquals(1, map0.size()); } @Test(timeout = 4000) public void test030() throws Throwable { Map<String, Object> map0 = JSONPath.paths((Object) null); assertTrue(map0.isEmpty()); } @Test(timeout = 4000) public void test031() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(20); Set<?> set0 = JSONPath.keySet((Object) serializeConfig0, "pos "); assertNull(set0); } @Test(timeout = 4000) public void test032() throws Throwable { SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException("/stackTrace/9"); JSONPath jSONPath0 = JSONPath.compile("/stackTrace/9"); Set<?> set0 = jSONPath0.keySet((Object) sQLTransientConnectionException0); assertEquals(5, set0.size()); assertNotNull(set0); } @Test(timeout = 4000) public void test033() throws Throwable { Class<Integer> class0 = Integer.class; boolean boolean0 = JSONPath.isInt(class0); assertTrue(boolean0); } @Test(timeout = 4000) public void test034() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; boolean boolean0 = JSONPath.isInt(class0); assertFalse(boolean0); } @Test(timeout = 4000) public void test035() throws Throwable { Class<Double> class0 = Double.class; boolean boolean0 = JSONPath.isDouble(class0); assertTrue(boolean0); } @Test(timeout = 4000) public void test036() throws Throwable { Class<SQLInvalidAuthorizationSpecException> class0 = SQLInvalidAuthorizationSpecException.class; boolean boolean0 = JSONPath.isDouble(class0); assertFalse(boolean0); } @Test(timeout = 4000) public void test037() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("{\"fastjson.parser.autoTypeSupport\":99,\"toJSON error\":-99,\"x\":\"hello\",\"value is null\":99,\"/uRLs/0\":false,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.Or; Object object0 = jSONPath0.getPropertyValue(jSONPath_Operator0, "{\"fastjson.parser.autoTypeSupport\":99,\"toJSON error\":-99,\"x\":\"hello\",\"value is null\":99,\"/uRLs/0\":false,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}", (-1589194880214235129L)); assertNull(object0); } @Test(timeout = 4000) public void test038() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(false); ASMDeserializerFactory aSMDeserializerFactory0 = new ASMDeserializerFactory((ClassLoader) null); ParserConfig parserConfig0 = new ParserConfig(aSMDeserializerFactory0); JSONPath jSONPath0 = new JSONPath("LE", serializeConfig0, parserConfig0); Object object0 = JSONPath.reserveToArray("LE", (String[]) null); Object object1 = jSONPath0.getPropertyValue(object0, "fastjson.parser.autoTypeAccept", 1983L); assertNotNull(object1); } @Test(timeout = 4000) public void test039() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("b)ANXW-j"); Class<MockCalendar> class0 = MockCalendar.class; JavaBeanSerializer javaBeanSerializer0 = jSONPath0.getJavaBeanSerializer(class0); assertNull(javaBeanSerializer0); } @Test(timeout = 4000) public void test040() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); ClassLoader classLoader0 = ClassLoader.getSystemClassLoader(); ASMDeserializerFactory aSMDeserializerFactory0 = new ASMDeserializerFactory(classLoader0); ParserConfig parserConfig0 = new ParserConfig(aSMDeserializerFactory0); JSONPath jSONPath0 = new JSONPath("\"a string\"", serializeConfig0, parserConfig0); Class<JSONPath> class0 = JSONPath.class; JavaBeanDeserializer javaBeanDeserializer0 = jSONPath0.getJavaBeanDeserializer(class0); assertNull(javaBeanDeserializer0); } @Test(timeout = 4000) public void test041() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("trim"); Class<Float> class0 = Float.class; JavaBeanDeserializer javaBeanDeserializer0 = jSONPath0.getJavaBeanDeserializer(class0); assertEquals(12, javaBeanDeserializer0.getFastMatchToken()); } @Test(timeout = 4000) public void test042() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[],\"b\":{\"x\":false}}"); SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException("{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[],\"b\":{\"x\":false}}", "k"); int int0 = jSONPath0.evalSize(sQLSyntaxErrorException0); assertEquals(5, int0); } @Test(timeout = 4000) public void test043() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); JSONPath jSONPath0 = new JSONPath("8mjimBsyNeN0", serializeConfig0, (ParserConfig) null); int int0 = jSONPath0.evalSize(jSONPath0); assertEquals((-1), int0); } @Test(timeout = 4000) public void test044() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(107); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("u*\"qO2;\u0005M7O4Vq1&", serializeConfig0, parserConfig0); BigInteger bigInteger0 = BigInteger.TEN; Set<?> set0 = jSONPath0.evalKeySet(bigInteger0); assertNull(set0); } @Test(timeout = 4000) public void test045() throws Throwable { JSONPath jSONPath0 = new JSONPath("C"); BigDecimal bigDecimal0 = BigDecimal.TEN; Set<?> set0 = jSONPath0.evalKeySet(bigDecimal0); assertFalse(set0.contains("C")); } @Test(timeout = 4000) public void test046() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("illegal state. ", serializeConfig0, parserConfig0); SQLWarning sQLWarning0 = new SQLWarning("fastjson.parser.deny"); SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException(sQLWarning0); Set<?> set0 = jSONPath0.evalKeySet(sQLInvalidAuthorizationSpecException0); assertFalse(set0.isEmpty()); } @Test(timeout = 4000) public void test047() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); JSONPath jSONPath1 = new JSONPath("Ni/O|y"); SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("com.alibaba.fastjson.JSONPath$Operator", "com.alibaba.fastjson.JSONPath$KeySetSegment", (-1)); // Undeclared exception! jSONPath1.setPropertyValue(jSONPath0, "true", (-26639035867733124L), sQLInvalidAuthorizationSpecException0); } @Test(timeout = 4000) public void test048() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ClassLoader classLoader0 = ClassLoader.getSystemClassLoader(); ParserConfig parserConfig0 = new ParserConfig(classLoader0); JSONPath jSONPath0 = new JSONPath("d2Pi", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.setPropertyValue((Object) null, "TR< ;#cJR*L", 1420L, classLoader0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test049() throws Throwable { JSONPath jSONPath0 = new JSONPath("2+Aah4,*<bgcX"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("ryp>:4leM.|pS%"); SQLDataException sQLDataException0 = new SQLDataException("ryp>:4leM.|pS%", "]%f,!|,I%", 63, sQLIntegrityConstraintViolationException0); // Undeclared exception! try { jSONPath0.set((Object) sQLDataException0, (Object) sQLDataException0, true); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. 2+Aah4,*<bgcX // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test050() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(false); SerializeConfig serializeConfig0 = new SerializeConfig(57); JSONPath jSONPath0 = new JSONPath("5", serializeConfig0, parserConfig0); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException(); JSONPath.SizeSegment jSONPath_SizeSegment0 = new JSONPath.SizeSegment(); // Undeclared exception! try { jSONPath0.set((Object) sQLTransactionRollbackException0, (Object) jSONPath_SizeSegment0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test051() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(true); ParserConfig parserConfig0 = new ParserConfig(true); JSONPath jSONPath0 = new JSONPath("2u}}D]T[,|t+Jl6D-+", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.set((Object) "|rgKxnuwAh]?$", (Object) serializeConfig0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. 2u}}D]T[,|t+Jl6D-+ // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test052() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; String[] stringArray0 = new String[5]; stringArray0[0] = "emode"; // Undeclared exception! try { JSONPath.reserveToObject(class0, stringArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test053() throws Throwable { SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException(")=0C+8[:}/A8f", ","); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException(")=0C+8[:}/A8f", sQLSyntaxErrorException0); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(sQLTransactionRollbackException0); String[] stringArray0 = new String[7]; stringArray0[0] = ","; // Undeclared exception! try { JSONPath.reserveToObject(sQLIntegrityConstraintViolationException0, stringArray0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1 // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test054() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; String[] stringArray0 = new String[2]; stringArray0[0] = "CaP"; // Undeclared exception! try { JSONPath.reserveToArray(class0, stringArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test055() throws Throwable { SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("98rJ6+1\"]U&y*_r", "98rJ6+1\"]U&y*_r", 7); SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException(sQLInvalidAuthorizationSpecException0); String[] stringArray0 = new String[1]; // Undeclared exception! try { JSONPath.reserveToArray(sQLNonTransientConnectionException0, stringArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // jsonpath can not be null // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test056() throws Throwable { JSONPath jSONPath0 = new JSONPath("{\"/stackTrace/11\":{},\"+ZL.3U;fG$TRC\":7,\"z\":true,\"a\":99,\"b\":\"a string\"}"); // Undeclared exception! jSONPath0.removePropertyValue(jSONPath0, "H6e8SMN<Ed(30n", false); } @Test(timeout = 4000) public void test057() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); JSONPath jSONPath0 = new JSONPath("`MP2q4:nrx4fv%4d"); boolean boolean0 = jSONPath0.removePropertyValue("C", "checkValue", true); assertFalse(boolean0); } @Test(timeout = 4000) public void test058() throws Throwable { JSONPath jSONPath0 = JSONPath.compile(" }dB:3wO{Gf{a=xOh$"); // Undeclared exception! try { jSONPath0.removePropertyValue((Object) null, "jsonpath error, path ", true); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test059() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("{\"x\":\"/stackTrace/5\",\"y\":{\"x\":\"a string\",\"end must greater than or equals start. start \":99},\"z\":99,\"java.sql.Timestamp\":[],\"b\":{\"x\":null}}", serializeConfig0, parserConfig0); Float float0 = new Float((double) 1261); // Undeclared exception! try { jSONPath0.removeArrayItem(jSONPath0, float0, 1261); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported set operation.class java.lang.Float // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test060() throws Throwable { HashMap<String, ClientInfoStatus> hashMap0 = new HashMap<String, ClientInfoStatus>((byte)10); // Undeclared exception! try { JSONPath.remove((Object) hashMap0, "<"); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1 // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test061() throws Throwable { Integer integer0 = new Integer((-480)); JSONPath.remove((Object) integer0, "k1;=]pcS<-c"); } @Test(timeout = 4000) public void test062() throws Throwable { Class<Long> class0 = Long.class; JSONPath jSONPath0 = new JSONPath("/stackTrace/5"); // Undeclared exception! try { jSONPath0.remove((Object) class0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test063() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("o"); BigDecimal bigDecimal0 = new BigDecimal(598L); // Undeclared exception! jSONPath0.remove((Object) bigDecimal0); } @Test(timeout = 4000) public void test064() throws Throwable { JSONPath jSONPath0 = JSONPath.compile(">"); SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException("java.lang.AutoCloseable"); SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException(sQLRecoverableException0); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(sQLNonTransientConnectionException0); // Undeclared exception! try { jSONPath0.remove((Object) sQLIntegrityConstraintViolationException0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1 // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test065() throws Throwable { // Undeclared exception! try { JSONPath.read("{\"fruit\":\"Apple\",\"size\":false,\"color\":\"Red\",\"value\":true,\"value2\":false,\"number\":\"1\"}", "{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[[]],\"b\":{}}"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. {\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[[]],\"b\":{}} // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test066() throws Throwable { Class<Calendar> class0 = Calendar.class; // Undeclared exception! try { JSONPath.keySet((Object) class0, "p_|"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test067() throws Throwable { JSONPath jSONPath0 = new JSONPath("/stackTrace/7", (SerializeConfig) null, (ParserConfig) null); int[] intArray0 = new int[4]; JSONPath.MultiIndexSegment jSONPath_MultiIndexSegment0 = new JSONPath.MultiIndexSegment(intArray0); // Undeclared exception! try { jSONPath0.keySet((Object) jSONPath_MultiIndexSegment0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test068() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(924, true); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("end must greater than or equals start. start ", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.keySet((Object) jSONPath0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : end must greater than or equals start. start // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test069() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("{\"fruit\":{},\"size\":\"Large\",\"color\":\"Red\",\"value\":true,\"value2\":false,\"number\":\"1\"}", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.isRef(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. {\"fruit\":{},\"size\":\"Large\",\"color\":\"Red\",\"value\":true,\"value2\":false,\"number\":\"1\"} // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test070() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); jSONPath0.init(); assertEquals("-99", jSONPath0.getPath()); } @Test(timeout = 4000) public void test071() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; JSONPath jSONPath0 = JSONPath.compile("K"); // Undeclared exception! try { jSONPath0.getPropertyValues(class0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test072() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("ljava", (SerializeConfig) null, parserConfig0); Class<DataTruncation> class0 = DataTruncation.class; // Undeclared exception! try { jSONPath0.getJavaBeanSerializer(class0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test073() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); Class<JSONPath.WildCardSegment> class0 = JSONPath.WildCardSegment.class; // Undeclared exception! try { jSONPath0.getJavaBeanDeserializer(class0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // default constructor not found. class com.alibaba.fastjson.JSONPath$WildCardSegment // verifyException("com.alibaba.fastjson.util.JavaBeanInfo", e); } } @Test(timeout = 4000) public void test074() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("\"a string\"", serializeConfig0, parserConfig0); Class<JSONPath> class0 = JSONPath.class; // Undeclared exception! jSONPath0.getJavaBeanDeserializer(class0); } @Test(timeout = 4000) public void test075() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; JSONPath jSONPath0 = new JSONPath("W{v?lJtSE_WSqS", serializeConfig0, (ParserConfig) null); Class<JavaBeanDeserializer> class0 = JavaBeanDeserializer.class; // Undeclared exception! try { jSONPath0.getJavaBeanDeserializer(class0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test076() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(); Feature[] featureArray0 = new Feature[8]; // Undeclared exception! try { JSONPath.extract("fastjson.parser.safeMode", "1", parserConfig0, 95, featureArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // error parse false // verifyException("com.alibaba.fastjson.parser.JSONLexerBase", e); } } @Test(timeout = 4000) public void test077() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(); Feature[] featureArray0 = new Feature[5]; // Undeclared exception! try { JSONPath.extract("true", "true", parserConfig0, 0, featureArray0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // true // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test078() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(); Feature[] featureArray0 = new Feature[5]; // Undeclared exception! try { JSONPath.extract("{\"x\":\"hello\",\"z\":true,\"a\":[],\"b\":{}}", "{\"x\":\"hello\",\"z\":true,\"a\":[],\"b\":{}}", parserConfig0, 0, featureArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. {\"x\":\"hello\",\"z\":true,\"a\":[],\"b\":{}} // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test079() throws Throwable { // Undeclared exception! try { JSONPath.extract((String) null, "jA`>~>}EN_ ^7"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test080() throws Throwable { // Undeclared exception! try { JSONPath.extract("N", "Rh27~J"); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // ident // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test081() throws Throwable { JSONPath jSONPath0 = new JSONPath("com.alibaba.fastjson.JSONPath$Str<ngOpSegement"); ParserConfig parserConfig0 = ParserConfig.global; DefaultJSONParser defaultJSONParser0 = new DefaultJSONParser("com.alibaba.fastjson.JSONPath$Str<ngOpSegement", parserConfig0); // Undeclared exception! try { jSONPath0.extract(defaultJSONParser0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : com.alibaba.fastjson.JSONPath$Str<ngOpSegement // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test082() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; JSONPath jSONPath0 = new JSONPath("d", serializeConfig0, (ParserConfig) null); // Undeclared exception! try { jSONPath0.evalSize(class0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test083() throws Throwable { JSONPath.eval((Object) "{\"fruit\":\"Apple\",\"size\":\"Large\",\"color\":\"Red\",\"value2\":false,\"number\":\"1\"}", "geSFieldValu2 error."); } @Test(timeout = 4000) public void test084() throws Throwable { Long long0 = new Long(1217L); // Undeclared exception! try { JSONPath.eqNotNull(long0, (Number) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test085() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("trim"); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance_deep; // Undeclared exception! try { jSONPath0.deepSet(jSONPath_WildCardSegment0, "X2'[f", 1314L, "trim"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // default constructor not found. class com.alibaba.fastjson.JSONPath$WildCardSegment // verifyException("com.alibaba.fastjson.util.JavaBeanInfo", e); } } @Test(timeout = 4000) public void test086() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("\"^0v.2bL_", serializeConfig0, parserConfig0); Vector<Object> vector0 = new Vector<Object>(); // Undeclared exception! try { jSONPath0.deepGetPropertyValues("\"^0v.2bL_", vector0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class byte // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test087() throws Throwable { JSONPath jSONPath0 = new JSONPath("java.time.Duration"); Stack<Object> stack0 = new Stack<Object>(); // Undeclared exception! try { jSONPath0.deepGetPropertyValues((Object) null, stack0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test088() throws Throwable { Class<Float> class0 = Float.class; // Undeclared exception! try { JSONPath.containsValue((Object) class0, "trim", (Object) "{\"x\":\"scanFieldIntArray\",\"y\":{\"x\":[]},\"z\":true,\"a\":[],\"b\":{\"x\":{}}}"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class class java.lang.Class // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test089() throws Throwable { Class<DataTruncation> class0 = DataTruncation.class; SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(); JSONPath.containsValue((Object) class0, "zL%jfGM>II0w", (Object) sQLIntegrityConstraintViolationException0); } @Test(timeout = 4000) public void test090() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); int[] intArray0 = new int[3]; BatchUpdateException batchUpdateException0 = new BatchUpdateException("-99", intArray0); jSONPath0.containsValue((Object) "-99", (Object) batchUpdateException0); } @Test(timeout = 4000) public void test091() throws Throwable { SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException(); JSONPath.contains((Object) sQLRecoverableException0, "<Z8C"); } @Test(timeout = 4000) public void test092() throws Throwable { SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException(); // Undeclared exception! try { JSONPath.compare((Object) null, sQLNonTransientConnectionException0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test093() throws Throwable { String[] stringArray0 = new String[7]; SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException("/stackTrace/9"); // Undeclared exception! try { JSONPath.arrayAdd((Object) sQLNonTransientConnectionException0, "4", (Object[]) stringArray0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test094() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = null; try { jSONPath0 = new JSONPath((String) null, serializeConfig0, parserConfig0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // json-path can not be null or empty // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test095() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("9F", serializeConfig0, parserConfig0); boolean boolean0 = jSONPath0.removePropertyValue(serializeConfig0, "v~ Th3G-J>8wsI|", true); assertFalse(boolean0); } @Test(timeout = 4000) public void test096() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.LE; jSONPath0.deepSet(jSONPath_Operator0, "-99", (-2044L), jSONPath_Operator0); assertEquals("-99", jSONPath0.getPath()); } @Test(timeout = 4000) public void test097() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("j'AxY{[qE z"); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("fastjson.parser.deny", "j'AxY{[qE z", 0); jSONPath0.deepSet((Object) null, "\\-", 0, sQLTransactionRollbackException0); assertEquals("j'AxY{[qE z", sQLTransactionRollbackException0.getSQLState()); } @Test(timeout = 4000) public void test098() throws Throwable { LinkedList<Object> linkedList0 = new LinkedList<Object>(); JSONPath jSONPath0 = JSONPath.compile("not support jsonpath : "); SQLTransientException sQLTransientException0 = new SQLTransientException("g._&"); SQLNonTransientException sQLNonTransientException0 = new SQLNonTransientException(sQLTransientException0); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(sQLNonTransientException0); // Undeclared exception! try { jSONPath0.deepScan(sQLIntegrityConstraintViolationException0, "g._&", linkedList0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // jsonpath error, path not support jsonpath : , segement g._& // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test099() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); // Undeclared exception! try { jSONPath0.removeArrayItem(jSONPath0, (Object) null, 116); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test100() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("z'_$_I.<D!E3r", serializeConfig0, parserConfig0); PropertyNamingStrategy propertyNamingStrategy0 = PropertyNamingStrategy.PascalCase; // Undeclared exception! try { jSONPath0.setArrayItem(jSONPath0, propertyNamingStrategy0, 109, jSONPath0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported set operation.class com.alibaba.fastjson.PropertyNamingStrategy // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test101() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("fastjson.parser.deny.internal"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("JSONSerializer", "etAiB}c1WE5YhjvEtv"); JSONPath.PropertySegment jSONPath_PropertySegment0 = new JSONPath.PropertySegment("E{t", false); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("_?RL\"EK.O.ZDR.", "etAiB}c1WE5YhjvEtv", 12, sQLTimeoutException0); jSONPath_PropertySegment0.setValue(jSONPath0, sQLTransactionRollbackException0, sQLTransactionRollbackException0); assertEquals(12, sQLTransactionRollbackException0.getErrorCode()); } @Test(timeout = 4000) public void test102() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("/stackTrace/5"); JSONPath.Segment[] jSONPath_SegmentArray0 = jSONPath_JSONPathParser0.explain(); assertEquals(2, jSONPath_SegmentArray0.length); } @Test(timeout = 4000) public void test103() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser(" _FH+IIWLB0#=4C{V'K"); jSONPath_JSONPathParser0.skipWhitespace(); } @Test(timeout = 4000) public void test104() throws Throwable { JSONPath jSONPath0 = new JSONPath("-"); jSONPath0.init(); assertEquals("-", jSONPath0.getPath()); } @Test(timeout = 4000) public void test105() throws Throwable { BigInteger bigInteger0 = BigInteger.TEN; SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("z'_$_I.<]!E3r", serializeConfig0, parserConfig0); parserConfig0.addDeny("z'_$_I.<]!E3r"); JSONPath.SizeSegment jSONPath_SizeSegment0 = JSONPath.SizeSegment.instance; Long long0 = new Long((-5808549176572512143L)); SQLDataException sQLDataException0 = new SQLDataException("fastjson.parser.deny.internal", "hzzka3Yd OhJtQjZ[\""); JSONPath.eqNotNull(bigInteger0, long0); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("parseInt error : "); JSONPath.compile("`/sg%#&eobaf5<x8q)"); Period period0 = Period.ZERO; Object object0 = JSONPath.reserveToObject(serializeConfig0, (String[]) null); assertSame(object0, serializeConfig0); } @Test(timeout = 4000) public void test106() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(20); ParserConfig parserConfig0 = new ParserConfig(false); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser(";Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;"); JSONPath jSONPath0 = new JSONPath("fastjson.parser.autoTypeAccept", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.set((Object) jSONPath_JSONPathParser0, (Object) null, false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test107() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("not support type :"); ParserConfig parserConfig0 = new ParserConfig(true); JSONPath jSONPath0 = new JSONPath("T", serializeConfig0, parserConfig0); SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException("fastjson.parser.autoTypeSupport", "T"); boolean boolean0 = jSONPath0.set((Object) jSONPath_JSONPathParser0, (Object) sQLNonTransientConnectionException0, true); assertTrue(boolean0); } @Test(timeout = 4000) public void test108() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); JSONPath.SizeSegment jSONPath_SizeSegment0 = JSONPath.SizeSegment.instance; boolean boolean0 = jSONPath0.remove((Object) jSONPath_SizeSegment0); assertFalse(boolean0); } @Test(timeout = 4000) public void test109() throws Throwable { JSONPath jSONPath0 = new JSONPath("2+Aah4,*<bgcX"); boolean boolean0 = jSONPath0.remove((Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test110() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("z'_$_I.<D!E3r", serializeConfig0, parserConfig0); jSONPath0.arrayAdd((Object) null, (Object[]) null); assertEquals("z'_$_I.<D!E3r", jSONPath0.getPath()); } @Test(timeout = 4000) public void test111() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = new ParserConfig(true); JSONPath jSONPath0 = new JSONPath("true", serializeConfig0, parserConfig0); Byte byte0 = new Byte((byte) (-65)); boolean boolean0 = jSONPath0.containsValue((Object) byte0, (Object) "(UHRt2q@y3g#tF"); assertFalse(boolean0); } @Test(timeout = 4000) public void test112() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(true); ParserConfig parserConfig0 = new ParserConfig(true); JSONPath jSONPath0 = new JSONPath("/stackTrace/8", serializeConfig0, parserConfig0); Double double0 = new Double(1452.68088); boolean boolean0 = jSONPath0.contains((Object) double0); assertFalse(boolean0); } @Test(timeout = 4000) public void test113() throws Throwable { JSONPath jSONPath0 = new JSONPath("b)ANXW-j"); JSONPath.PropertySegment jSONPath_PropertySegment0 = new JSONPath.PropertySegment("W{LE=|", false); // Undeclared exception! try { jSONPath0.contains((Object) jSONPath_PropertySegment0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : b)ANXW-j // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test114() throws Throwable { MockGregorianCalendar mockGregorianCalendar0 = new MockGregorianCalendar(); JSONPath jSONPath0 = JSONPath.compile("between"); Object object0 = jSONPath0.eval((Object) mockGregorianCalendar0); assertNull(object0); } @Test(timeout = 4000) public void test115() throws Throwable { JSONPath jSONPath0 = null; try { jSONPath0 = new JSONPath(""); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // json-path can not be null or empty // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test116() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); JSONPath.PropertySegment jSONPath_PropertySegment0 = (JSONPath.PropertySegment)jSONPath_JSONPathParser0.buildArraySegement("Ni/O|y"); JSONPath jSONPath0 = new JSONPath("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); int[] intArray0 = new int[7]; JSONPath.MultiIndexSegment jSONPath_MultiIndexSegment0 = new JSONPath.MultiIndexSegment(intArray0); boolean boolean0 = jSONPath_PropertySegment0.remove(jSONPath0, jSONPath_MultiIndexSegment0); assertFalse(boolean0); } @Test(timeout = 4000) public void test117() throws Throwable { SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("|-(G*GYw"); // Undeclared exception! try { JSONPath.paths((Object) sQLTransactionRollbackException0, (SerializeConfig) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test118() throws Throwable { ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); String[] stringArray0 = new String[3]; stringArray0[0] = "fastjson.parser.safeMode"; // Undeclared exception! try { JSONPath.reserveToObject(parserConfig0, stringArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // jsonpath can not be null // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test119() throws Throwable { SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("/stackTrace/5", "9F"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException((String) null, ".Sv@Ki;W", 110, sQLInvalidAuthorizationSpecException0); String[] stringArray0 = new String[1]; stringArray0[0] = "/stackTrace/5"; JSONObject jSONObject0 = (JSONObject)JSONPath.reserveToObject(sQLTimeoutException0, stringArray0); assertTrue(jSONObject0.isEmpty()); } @Test(timeout = 4000) public void test120() throws Throwable { SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException("/stackTrace/9"); DataTruncation dataTruncation0 = new DataTruncation(1225, false, false, 192, (-1777), sQLTransientConnectionException0); String[] stringArray0 = new String[7]; stringArray0[0] = "/stackTrace/9"; stringArray0[1] = "FastjsonASMDeserializer_"; stringArray0[2] = "/stackTrace/9"; stringArray0[3] = "/stackTrace/9"; stringArray0[4] = "FastjsonASMDeserializer_"; stringArray0[5] = "/stackTrace/9"; stringArray0[6] = "FastjsonASMDeserializer_"; JSONArray jSONArray0 = (JSONArray)JSONPath.reserveToArray(dataTruncation0, stringArray0); assertFalse(jSONArray0.isEmpty()); } @Test(timeout = 4000) public void test121() throws Throwable { Byte byte0 = new Byte((byte) (-25)); String[] stringArray0 = new String[0]; JSONArray jSONArray0 = (JSONArray)JSONPath.reserveToArray(byte0, stringArray0); assertEquals(3089, JSON.DEFAULT_GENERATE_FEATURE); } @Test(timeout = 4000) public void test122() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("fastjson.parser.deny.internal", serializeConfig0, parserConfig0); // Undeclared exception! try { jSONPath0.setPropertyValue(".}a?>z", "%%", (-2171L), parserConfig0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test123() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(false); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("m}RX^3CypYIBEVHhwC", serializeConfig0, parserConfig0); SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException("3hOinmnRwo2je", "IgnoreErrorGetter"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("fastjson.parser.deny", "PN[4MU!9bt_", 724, sQLRecoverableException0); jSONPath0.deepSet(sQLIntegrityConstraintViolationException0, "IgnoreErrorGetter", 724, sQLRecoverableException0); assertEquals("3hOinmnRwo2je", sQLRecoverableException0.getMessage()); } @Test(timeout = 4000) public void test124() throws Throwable { JSONPath jSONPath0 = new JSONPath("parser"); Vector<BigInteger> vector0 = new Vector<BigInteger>(); Vector<Object> vector1 = new Vector<Object>(vector0); jSONPath0.deepScan(jSONPath0, "parser", vector1); assertEquals(0, vector1.size()); } @Test(timeout = 4000) public void test125() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("YB"); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(90, 37, 46); LinkedList<Object> linkedList0 = new LinkedList<Object>(); linkedList0.add((Object) jSONPath_RangeSegment0); jSONPath0.deepScan(linkedList0, "com.alibaba.fastjson.util.ServiceLoader", linkedList0); assertEquals("YB", jSONPath0.getPath()); } @Test(timeout = 4000) public void test126() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("YB"); LinkedList<Object> linkedList0 = new LinkedList<Object>(); jSONPath0.deepScan(linkedList0, "com.alibaba.fastjson.util.ServiceLoader", linkedList0); assertFalse(linkedList0.contains("YB")); } @Test(timeout = 4000) public void test127() throws Throwable { Byte byte0 = Byte.valueOf((byte)30); boolean boolean0 = JSONPath.eqNotNull(byte0, byte0); assertTrue(boolean0); } @Test(timeout = 4000) public void test128() throws Throwable { Float float0 = new Float(278.0); Long long0 = new Long(3460L); boolean boolean0 = JSONPath.eqNotNull(long0, float0); assertFalse(boolean0); } @Test(timeout = 4000) public void test129() throws Throwable { Double double0 = new Double(192); boolean boolean0 = JSONPath.eqNotNull(double0, double0); assertTrue(boolean0); } @Test(timeout = 4000) public void test130() throws Throwable { Long long0 = new Long((-5764804792063216819L)); Double double0 = new Double((-5764804792063216819L)); boolean boolean0 = JSONPath.eqNotNull(double0, long0); assertTrue(boolean0); } @Test(timeout = 4000) public void test131() throws Throwable { Long long0 = new Long((-2930L)); Long long1 = new Long((-1597L)); boolean boolean0 = JSONPath.eqNotNull(long1, long0); assertFalse(boolean0); } @Test(timeout = 4000) public void test132() throws Throwable { BigInteger bigInteger0 = BigInteger.TEN; Long long0 = new Long((-5808549176572512143L)); // Undeclared exception! try { JSONPath.eqNotNull(long0, bigInteger0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.Long cannot be cast to java.math.BigInteger // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test133() throws Throwable { Long long0 = new Long((-4270347329889690746L)); BigDecimal bigDecimal0 = new BigDecimal(0); boolean boolean0 = JSONPath.eqNotNull(bigDecimal0, long0); assertFalse(boolean0); } @Test(timeout = 4000) public void test134() throws Throwable { BigDecimal bigDecimal0 = BigDecimal.ONE; boolean boolean0 = JSONPath.eqNotNull(bigDecimal0, bigDecimal0); assertFalse(boolean0); } @Test(timeout = 4000) public void test135() throws Throwable { boolean boolean0 = JSONPath.eq("h-&&4.f7\"?xv^W", "illegal state.v"); assertFalse(boolean0); } @Test(timeout = 4000) public void test136() throws Throwable { boolean boolean0 = JSONPath.eq("mp+>", (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test137() throws Throwable { SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException((Throwable) null); boolean boolean0 = JSONPath.eq((Object) null, sQLIntegrityConstraintViolationException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test138() throws Throwable { SQLDataException sQLDataException0 = new SQLDataException("end", "g._&"); SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("end", "end", sQLDataException0); boolean boolean0 = JSONPath.eq(sQLInvalidAuthorizationSpecException0, "end"); assertFalse(boolean0); } @Test(timeout = 4000) public void test139() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("$VALUES"); Stack<Object> stack0 = new Stack<Object>(); HashMap<String, ClientInfoStatus> hashMap0 = new HashMap<String, ClientInfoStatus>(); SQLClientInfoException sQLClientInfoException0 = new SQLClientInfoException("", hashMap0); // Undeclared exception! try { jSONPath0.deepGetPropertyValues(sQLClientInfoException0, stack0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // [Ljava.lang.StackTraceElement; // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test140() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("illegal state. ", serializeConfig0, parserConfig0); BigDecimal bigDecimal0 = BigDecimal.TEN; // Undeclared exception! try { jSONPath0.getPropertyValues(bigDecimal0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test141() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); Collection<Object> collection0 = jSONPath0.getPropertyValues((Object) null); assertNull(collection0); } @Test(timeout = 4000) public void test142() throws Throwable { JSONPath.ArrayAccessSegment jSONPath_ArrayAccessSegment0 = new JSONPath.ArrayAccessSegment(0); JSONPath jSONPath0 = JSONPath.compile("trim"); int[] intArray0 = new int[9]; JSONPath.MultiIndexSegment jSONPath_MultiIndexSegment0 = new JSONPath.MultiIndexSegment(intArray0); JSONArray jSONArray0 = (JSONArray)jSONPath_MultiIndexSegment0.eval(jSONPath0, jSONPath_ArrayAccessSegment0, jSONPath_ArrayAccessSegment0); assertEquals(9, jSONArray0.size()); } @Test(timeout = 4000) public void test143() throws Throwable { JSONPath jSONPath0 = new JSONPath("."); Integer integer0 = new Integer((-2121)); // Undeclared exception! try { jSONPath0.getArrayItem(integer0, (-2121)); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test144() throws Throwable { JSONPath jSONPath0 = new JSONPath("$#k0PZAzw_l'1}(/i"); Collection<Object> collection0 = jSONPath0.getPropertyValues("$#k0PZAzw_l'1}(/i"); Object object0 = jSONPath0.getArrayItem(collection0, 1098); assertNull(object0); } @Test(timeout = 4000) public void test145() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.LE; JSONPath.IntOpSegement jSONPath_IntOpSegement0 = new JSONPath.IntOpSegement("-99", 3010L, jSONPath_Operator0); JSONPath.FilterGroup jSONPath_FilterGroup0 = new JSONPath.FilterGroup(jSONPath_IntOpSegement0, jSONPath_IntOpSegement0, false); SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException(); BatchUpdateException batchUpdateException0 = new BatchUpdateException((int[]) null, sQLNonTransientConnectionException0); boolean boolean0 = jSONPath_FilterGroup0.apply(jSONPath0, jSONPath0, sQLNonTransientConnectionException0, batchUpdateException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test146() throws Throwable { JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("t[Oz4Kl0%U)Lm(^hwP", "expect string", false); JSONPath.FilterGroup jSONPath_FilterGroup0 = new JSONPath.FilterGroup(jSONPath_ValueSegment0, jSONPath_ValueSegment0, true); JSONPath jSONPath0 = new JSONPath("Mc5Z.u>Kh..wuu%>&yf"); ParserConfig parserConfig0 = new ParserConfig((ClassLoader) null); Class<SQLWarning> class0 = SQLWarning.class; ThrowableDeserializer throwableDeserializer0 = new ThrowableDeserializer(parserConfig0, class0); boolean boolean0 = jSONPath_FilterGroup0.apply(jSONPath0, throwableDeserializer0, "t[Oz4Kl0%U)Lm(^hwP", "t[Oz4Kl0%U)Lm(^hwP"); assertTrue(boolean0); } @Test(timeout = 4000) public void test147() throws Throwable { JSONPath jSONPath0 = new JSONPath("SortField"); JSONPath.NotNullSegement jSONPath_NotNullSegement0 = new JSONPath.NotNullSegement("SortField"); JSONPath.FilterGroup jSONPath_FilterGroup0 = new JSONPath.FilterGroup(jSONPath_NotNullSegement0, jSONPath_NotNullSegement0, true); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_FilterGroup0); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("GJz~tHQ.M&Qtuf1MS", "toJSON error"); Double double0 = new Double((-121.077524)); SQLFeatureNotSupportedException sQLFeatureNotSupportedException0 = new SQLFeatureNotSupportedException(sQLTimeoutException0); boolean boolean0 = jSONPath_FilterSegment0.remove(jSONPath0, double0, sQLFeatureNotSupportedException0); assertTrue(boolean0); } @Test(timeout = 4000) public void test148() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("1.2.68", serializeConfig0, parserConfig0); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("fastjson.parser.deny", jSONPath0, false); SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("fastjson.parser.deny"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException(sQLInvalidAuthorizationSpecException0); SQLFeatureNotSupportedException sQLFeatureNotSupportedException0 = new SQLFeatureNotSupportedException((String) null, "fastjson.parser.autoTypeSupport", sQLTimeoutException0); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_ValueSegment0); // Undeclared exception! try { jSONPath_FilterSegment0.remove(jSONPath0, (Object) null, sQLFeatureNotSupportedException0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("java.sql.SQLException$1", e); } } @Test(timeout = 4000) public void test149() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("1.2.68", serializeConfig0, parserConfig0); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("fastjson.parser.deny", jSONPath0, false); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_ValueSegment0); boolean boolean0 = jSONPath_FilterSegment0.remove(jSONPath0, parserConfig0, (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test150() throws Throwable { JSONPath jSONPath0 = new JSONPath("W9wv-53(7^<3RP"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.GE; JSONPath.DoubleOpSegement jSONPath_DoubleOpSegement0 = new JSONPath.DoubleOpSegement("end must greater than or equals start. start ", 1707L, jSONPath_Operator0); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_DoubleOpSegement0); boolean boolean0 = jSONPath_FilterSegment0.remove(jSONPath0, "W9wv-53(7^<3RP", jSONPath_DoubleOpSegement0); assertFalse(boolean0); } @Test(timeout = 4000) public void test151() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("1.2.68", serializeConfig0, parserConfig0); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("fastjson.parser.deny", jSONPath0, false); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance_deep; JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_ValueSegment0); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(390, 102, (-674)); Object object0 = jSONPath_FilterSegment0.eval(jSONPath0, jSONPath_WildCardSegment0, jSONPath_RangeSegment0); assertSame(object0, jSONPath_RangeSegment0); } @Test(timeout = 4000) public void test152() throws Throwable { JSONPath jSONPath0 = new JSONPath("fastjson.parser.autoTypeSupport", (SerializeConfig) null, (ParserConfig) null); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.RLIKE; JSONPath.IntOpSegement jSONPath_IntOpSegement0 = new JSONPath.IntOpSegement("fastjson.parser.autoTypeSupport", 0, jSONPath_Operator0); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_IntOpSegement0); Object object0 = jSONPath_FilterSegment0.eval(jSONPath0, jSONPath_Operator0, (Object) null); assertNull(object0); } @Test(timeout = 4000) public void test153() throws Throwable { SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("sk", "qZ"); JSONPath jSONPath0 = JSONPath.compile("LIuTKE"); Pattern pattern0 = Pattern.compile("qZ"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.NOT_RLIKE; JSONPath.RegMatchSegement jSONPath_RegMatchSegement0 = new JSONPath.RegMatchSegement("fastjson.parser.safeMode", pattern0, jSONPath_Operator0); SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException(sQLTimeoutException0); boolean boolean0 = jSONPath_RegMatchSegement0.apply(jSONPath0, "sk", "sk", sQLRecoverableException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test154() throws Throwable { JSONPath jSONPath0 = new JSONPath("W9wv-53(7^<3RP"); BatchUpdateException batchUpdateException0 = new BatchUpdateException((int[]) null); SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException("W9wv-53(7^<3RP", batchUpdateException0); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.GE; JSONPath.DoubleOpSegement jSONPath_DoubleOpSegement0 = new JSONPath.DoubleOpSegement("end must greater than or equals start. start ", 1707L, jSONPath_Operator0); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_DoubleOpSegement0); JSONArray jSONArray0 = (JSONArray)jSONPath_FilterSegment0.eval(jSONPath0, sQLSyntaxErrorException0, sQLSyntaxErrorException0); JSONPath.StringOpSegement jSONPath_StringOpSegement0 = new JSONPath.StringOpSegement("Y;$|&OyTR:6", "O^Zj?", jSONPath_Operator0); JSONPath.ArrayAccessSegment jSONPath_ArrayAccessSegment0 = new JSONPath.ArrayAccessSegment(123); boolean boolean0 = jSONPath_StringOpSegement0.apply(jSONPath0, "O^Zj?", jSONPath_ArrayAccessSegment0, jSONArray0); assertTrue(boolean0); assertTrue(jSONArray0.isEmpty()); } @Test(timeout = 4000) public void test155() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("com.alibaba.fastjson.JSONPath$StringInSegement"); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.EQ; JSONPath.StringOpSegement jSONPath_StringOpSegement0 = new JSONPath.StringOpSegement("fastjson.parser.deny", "CWCk|J!r-s2", jSONPath_Operator0); boolean boolean0 = jSONPath_StringOpSegement0.apply(jSONPath0, (Object) null, (Object) null, (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test156() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("CWCk|J!r-s2"); JSONPath.RlikeSegement jSONPath_RlikeSegement0 = new JSONPath.RlikeSegement("8^k00e!9Qrp<", "`L}m_|^Z", false); MockGregorianCalendar mockGregorianCalendar0 = new MockGregorianCalendar(); BigInteger bigInteger0 = BigInteger.TEN; SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException(); boolean boolean0 = jSONPath_RlikeSegement0.apply(jSONPath0, mockGregorianCalendar0, bigInteger0, sQLSyntaxErrorException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test157() throws Throwable { JSONPath.PropertySegment jSONPath_PropertySegment0 = new JSONPath.PropertySegment("{\"geSFieldValu2\":true,\"size\":[],\"color\":\"country\",\"value\":true,\"value2\":false,\"ull\":false,\"x\":\"a string\"}", false); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath.MatchSegement jSONPath_MatchSegement0 = new JSONPath.MatchSegement("zL%jfGM>II0w", "fastjson.parser.safeMode", "yc/M5C8ZzY=qX|", (String[]) null, false); JSONPath jSONPath0 = new JSONPath("GWDr7X &fq4%>"); boolean boolean0 = jSONPath_MatchSegement0.apply(jSONPath0, parserConfig0, jSONPath0, jSONPath_PropertySegment0); assertFalse(boolean0); } @Test(timeout = 4000) public void test158() throws Throwable { String[] stringArray0 = new String[7]; stringArray0[0] = "/uRLs"; stringArray0[1] = ""; stringArray0[2] = "/uRLs"; stringArray0[3] = "/uRLs"; stringArray0[4] = ""; stringArray0[5] = "/uRLs"; stringArray0[6] = ""; JSONPath.MatchSegement jSONPath_MatchSegement0 = new JSONPath.MatchSegement("/uRLs", "", "/uRLs", stringArray0, true); } @Test(timeout = 4000) public void test159() throws Throwable { String[] stringArray0 = new String[7]; JSONPath.MatchSegement jSONPath_MatchSegement0 = null; try { jSONPath_MatchSegement0 = new JSONPath.MatchSegement("{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[],\"b\":{}}", "{\"x\":\"hello\",\"y\":7,\"z\":true,\"a\":[],\"b\":{}}", (String) null, stringArray0, false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$MatchSegement", e); } } @Test(timeout = 4000) public void test160() throws Throwable { String[] stringArray0 = new String[1]; JSONPath.MatchSegement jSONPath_MatchSegement0 = null; try { jSONPath_MatchSegement0 = new JSONPath.MatchSegement("jsonpath error, path ", (String) null, "com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory$Context", stringArray0, true); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$MatchSegement", e); } } @Test(timeout = 4000) public void test161() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("j'AxY{[qE z"); JSONPath.MaxSegment jSONPath_MaxSegment0 = JSONPath.MaxSegment.instance; JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.And; JSONPath.RefOpSegement jSONPath_RefOpSegement0 = new JSONPath.RefOpSegement("fastjson.parser.autoTypeAccept", jSONPath_MaxSegment0, jSONPath_Operator0); Double double0 = new Double(0); boolean boolean0 = jSONPath_RefOpSegement0.apply(jSONPath0, jSONPath_MaxSegment0, double0, (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test162() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("qHPV!>)Jn}MM;{ r", serializeConfig0, parserConfig0); JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.REG_MATCH; JSONPath.DoubleOpSegement jSONPath_DoubleOpSegement0 = new JSONPath.DoubleOpSegement("com.alibaba..astjson.JSONPath$NullSegement", (-99.08407920125987), jSONPath_Operator0); JSONPath.SizeSegment jSONPath_SizeSegment0 = new JSONPath.SizeSegment(); boolean boolean0 = jSONPath_DoubleOpSegement0.apply(jSONPath0, jSONPath_SizeSegment0, jSONPath0, "com.alibaba..astjson.JSONPath$NullSegement"); assertFalse(boolean0); } @Test(timeout = 4000) public void test163() throws Throwable { JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.RLIKE; JSONPath.IntOpSegement jSONPath_IntOpSegement0 = new JSONPath.IntOpSegement("n", 0L, jSONPath_Operator0); JSONPath.FilterSegment jSONPath_FilterSegment0 = new JSONPath.FilterSegment(jSONPath_IntOpSegement0); SerializeConfig serializeConfig0 = new SerializeConfig(false); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("{\"fruit\":true,\"size\":\"Large\",\"color\":\"Red\",\"value\":true,\"value2\":false,\"number\":\"1\"}", serializeConfig0, parserConfig0); SQLFeatureNotSupportedException sQLFeatureNotSupportedException0 = new SQLFeatureNotSupportedException("G\"np6W<hJ+-", "", 0); Object object0 = jSONPath_FilterSegment0.eval(jSONPath0, sQLFeatureNotSupportedException0, jSONPath_Operator0); assertNull(object0); } @Test(timeout = 4000) public void test164() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("&5"); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("com.alibaba.fastjson.JSONPath$RefOpSegement"); String[] stringArray0 = new String[7]; JSONPath.StringInSegement jSONPath_StringInSegement0 = new JSONPath.StringInSegement("4~&v}G`JEvY-sHO:i", stringArray0, false); boolean boolean0 = jSONPath_StringInSegement0.apply(jSONPath0, "4~&v}G`JEvY-sHO:i", jSONPath_JSONPathParser0, "4~&v}G`JEvY-sHO:i"); assertTrue(boolean0); } @Test(timeout = 4000) public void test165() throws Throwable { String[] stringArray0 = new String[8]; stringArray0[0] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[1] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[2] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[3] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[4] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[5] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[6] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; stringArray0[7] = "com.alibaba.fastjson.JSONPath$IntOpSegement"; JSONPath.StringInSegement jSONPath_StringInSegement0 = new JSONPath.StringInSegement("com.alibaba.fastjson.JSONPath$IntOpSegement", stringArray0, false); JSONPath jSONPath0 = new JSONPath("com.alibaba.fastjson.JSONPath$IntOpSegement"); SQLDataException sQLDataException0 = new SQLDataException("getMethodType", "com.alibaba.fastjson.JSONPath$IntOpSegement"); SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException("/cause/stackTrace/5", "com.alibaba.fastjson.JSONPath$IntOpSegement", sQLDataException0); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException(); boolean boolean0 = jSONPath_StringInSegement0.apply(jSONPath0, sQLRecoverableException0, "com.alibaba.fastjson.JSONPath$IntOpSegement", sQLTimeoutException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test166() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("CharacterCodec", serializeConfig0, parserConfig0); SQLNonTransientException sQLNonTransientException0 = new SQLNonTransientException(); SQLFeatureNotSupportedException sQLFeatureNotSupportedException0 = new SQLFeatureNotSupportedException("json-path can not be null or empty", sQLNonTransientException0); SQLWarning sQLWarning0 = new SQLWarning(sQLFeatureNotSupportedException0); Long[] longArray0 = new Long[5]; JSONPath.IntObjInSegement jSONPath_IntObjInSegement0 = new JSONPath.IntObjInSegement("fastjson.parser.safeMode", longArray0, false); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException((String) null, sQLWarning0); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException((String) null, "fastjson.parser.autoTypeSupport", (-1076), sQLNonTransientException0); boolean boolean0 = jSONPath_IntObjInSegement0.apply(jSONPath0, longArray0[1], sQLTransactionRollbackException0, sQLIntegrityConstraintViolationException0); assertTrue(boolean0); } @Test(timeout = 4000) public void test167() throws Throwable { Long[] longArray0 = new Long[1]; Long long0 = new Long(2403L); longArray0[0] = long0; JSONPath.IntObjInSegement jSONPath_IntObjInSegement0 = new JSONPath.IntObjInSegement("2+Aah4,*<bgcX", longArray0, true); JSONPath jSONPath0 = new JSONPath("2+Aah4,*<bgcX"); Object object0 = new Object(); SQLTransientException sQLTransientException0 = new SQLTransientException(); boolean boolean0 = jSONPath_IntObjInSegement0.apply(jSONPath0, object0, longArray0[0], sQLTransientException0); assertTrue(boolean0); } @Test(timeout = 4000) public void test168() throws Throwable { SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException(); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment(":", sQLSyntaxErrorException0, false); JSONPath.FilterGroup jSONPath_FilterGroup0 = new JSONPath.FilterGroup(jSONPath_ValueSegment0, jSONPath_ValueSegment0, false); JSONPath jSONPath0 = new JSONPath(":"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(sQLSyntaxErrorException0); boolean boolean0 = jSONPath_FilterGroup0.apply(jSONPath0, "{\"x\":\"hello\",\"y\":{},\"z\":true,\"a\":[],\"b\":{}}", sQLIntegrityConstraintViolationException0, "Mc5Z.u>Kh..wuu%>&yf"); assertTrue(boolean0); } @Test(timeout = 4000) public void test169() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(2287, false); ParserConfig parserConfig0 = ParserConfig.global; SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("fastjson.parser.deny"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException(sQLInvalidAuthorizationSpecException0); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException(sQLTimeoutException0); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("fastjson.parser.autoTypeSupport", sQLIntegrityConstraintViolationException0, true); JSONPath jSONPath0 = new JSONPath("java.sql.SQLInvalidAuthorizationSpecException: fastjson.parser.deny", serializeConfig0, parserConfig0); JSONPath.MultiIndexSegment jSONPath_MultiIndexSegment0 = new JSONPath.MultiIndexSegment((int[]) null); boolean boolean0 = jSONPath_ValueSegment0.apply(jSONPath0, (Object) null, jSONPath_MultiIndexSegment0, jSONPath_MultiIndexSegment0); assertFalse(boolean0); } @Test(timeout = 4000) public void test170() throws Throwable { JSONPath.NotNullSegement jSONPath_NotNullSegement0 = new JSONPath.NotNullSegement("Ao6X9.;9G+xY+g L7"); JSONPath jSONPath0 = new JSONPath("Ao6X9.;9G+xY+g L7"); boolean boolean0 = jSONPath_NotNullSegement0.apply(jSONPath0, jSONPath0, jSONPath0, "Ao6X9.;9G+xY+g L7"); assertFalse(boolean0); } @Test(timeout = 4000) public void test171() throws Throwable { JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(2287, 2287, (-2762)); SerializeConfig serializeConfig0 = new SerializeConfig(2711); ParserConfig parserConfig0 = new ParserConfig(false); JSONPath jSONPath0 = new JSONPath("{\"fruit\":true,\"size\":true,\"color\":\"country\",\"value\":true,\"value2\":false,\"ull\":false}", serializeConfig0, parserConfig0); ArrayList arrayList0 = (ArrayList)jSONPath_RangeSegment0.eval(jSONPath0, jSONPath0, "{\"fruit\":\"nin\",\"size\":\"Large\",\"color\":\"Red\",\"value\":{},\"value2\":\"a string\",\"number\":\"1\"}"); assertEquals(0, arrayList0.size()); } @Test(timeout = 4000) public void test172() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); ParserConfig parserConfig0 = new ParserConfig(false); JSONPath jSONPath0 = new JSONPath("illegal", serializeConfig0, parserConfig0); JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment((-1385), (-1385), 42); SQLClientInfoException sQLClientInfoException0 = new SQLClientInfoException(); SQLWarning sQLWarning0 = new SQLWarning("illegal", "fastjson.parser.autoTypeSupport", sQLClientInfoException0); SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException("fastjson.parser.safeMode", "not_in", sQLWarning0); ArrayList arrayList0 = (ArrayList)jSONPath_RangeSegment0.eval(jSONPath0, sQLSyntaxErrorException0, serializeConfig0.propertyNamingStrategy); assertNotNull(arrayList0); assertEquals(1, arrayList0.size()); } @Test(timeout = 4000) public void test173() throws Throwable { JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance; ParserConfig parserConfig0 = new ParserConfig(true); JSONPath jSONPath0 = new JSONPath("size", (SerializeConfig) null, parserConfig0); // Undeclared exception! try { jSONPath_WildCardSegment0.eval(jSONPath0, (Object) null, jSONPath0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test174() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("o"); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance_deep; JSONPath.RangeSegment jSONPath_RangeSegment0 = new JSONPath.RangeSegment(32, 32, 32); Double double0 = new Double(32); ArrayList arrayList0 = (ArrayList)jSONPath_WildCardSegment0.eval(jSONPath0, jSONPath_RangeSegment0, double0); assertFalse(arrayList0.isEmpty()); } @Test(timeout = 4000) public void test175() throws Throwable { String[] stringArray0 = new String[5]; stringArray0[0] = "[F"; stringArray0[1] = "%0'"; stringArray0[2] = "null"; stringArray0[3] = "/stackTrace/12"; stringArray0[4] = "like"; JSONPath.MultiPropertySegment jSONPath_MultiPropertySegment0 = new JSONPath.MultiPropertySegment(stringArray0); JSONPath jSONPath0 = new JSONPath("null"); MockGregorianCalendar mockGregorianCalendar0 = new MockGregorianCalendar(114, 114, 623, 213, 1066); ArrayList arrayList0 = (ArrayList)jSONPath_MultiPropertySegment0.eval(jSONPath0, "/stackTrace/12", mockGregorianCalendar0); assertEquals(5, arrayList0.size()); } @Test(timeout = 4000) public void test176() throws Throwable { JSONPath.PropertySegment jSONPath_PropertySegment0 = new JSONPath.PropertySegment("*|#EKm<E6@(:", true); SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; ParserConfig parserConfig0 = new ParserConfig(false); JSONPath jSONPath0 = new JSONPath("R/N6L3", serializeConfig0, parserConfig0); jSONPath_PropertySegment0.setValue(jSONPath0, serializeConfig0, "*|#EKm<E6@(:"); assertEquals("@type", serializeConfig0.getTypeKey()); } @Test(timeout = 4000) public void test177() throws Throwable { int int0 = JSONPath.compare(":`gvQ|f5Qf_n", "z'_$_I<D!E3r"); assertEquals((-64), int0); } @Test(timeout = 4000) public void test178() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser(";Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;"); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance; // Undeclared exception! try { JSONPath.compare(jSONPath_WildCardSegment0, jSONPath_JSONPathParser0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // com.alibaba.fastjson.JSONPath$WildCardSegment cannot be cast to java.lang.Comparable // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test179() throws Throwable { JSONPath.MinSegment jSONPath_MinSegment0 = JSONPath.MinSegment.instance; // Undeclared exception! try { jSONPath_MinSegment0.eval((JSONPath) null, (Object) null, (Object) null); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$MinSegment", e); } } @Test(timeout = 4000) public void test180() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("j'AxY{[qE z"); JSONPath.MaxSegment jSONPath_MaxSegment0 = JSONPath.MaxSegment.instance; byte[] byteArray0 = new byte[1]; BigInteger bigInteger0 = new BigInteger(byteArray0); BigDecimal bigDecimal0 = new BigDecimal(bigInteger0); // Undeclared exception! try { jSONPath_MaxSegment0.eval(jSONPath0, bigDecimal0, "java.nio.ByteBuffer"); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$MaxSegment", e); } } @Test(timeout = 4000) public void test181() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("/stackTrace/8"); // Undeclared exception! try { jSONPath_JSONPathParser0.buildArraySegement("\""); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test182() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("{\"y\":7,\"a\":[],\"x\":\"hello\",\"value is null\":{},\"z\":true,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}"); jSONPath_JSONPathParser0.readString(); jSONPath_JSONPathParser0.readString(); JSONPath.Segment jSONPath_Segment0 = jSONPath_JSONPathParser0.parseArrayAccess(false); assertNotNull(jSONPath_Segment0); } @Test(timeout = 4000) public void test183() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("=7:"); // Undeclared exception! try { jSONPath_JSONPathParser0.readString(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // expect '=, but ':' // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test184() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("/stackTrace/5"); jSONPath_JSONPathParser0.readString(); // Undeclared exception! try { jSONPath_JSONPathParser0.readLongValue(); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test185() throws Throwable { JSONPath jSONPath0 = new JSONPath("xk06F.$0&"); Set<?> set0 = jSONPath0.keySet((Object) "xk06F.$0&"); assertNull(set0); } @Test(timeout = 4000) public void test186() throws Throwable { JSONPath.compile("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException("LE", "LE"); FileSystemHandling fileSystemHandling0 = new FileSystemHandling(); SQLNonTransientConnectionException sQLNonTransientConnectionException0 = new SQLNonTransientConnectionException("LE", "LE"); StackTraceElement[] stackTraceElementArray0 = sQLNonTransientConnectionException0.getStackTrace(); // // Unstable assertion: assertEquals(14, stackTraceElementArray0.length); JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); jSONPath_JSONPathParser0.buildArraySegement("%%"); SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException("com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer"); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("LE", sQLSyntaxErrorException0); JSONPath.RlikeSegement jSONPath_RlikeSegement0 = new JSONPath.RlikeSegement("json-path can not be null or empty", "json-path can not be null or empty", true); boolean boolean0 = JSONPath.contains((Object) "LE", "\\."); // // Unstable assertion: assertFalse(boolean0); } @Test(timeout = 4000) public void test187() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("rlike"); jSONPath_JSONPathParser0.readOp(); } @Test(timeout = 4000) public void test188() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser(">"); // Undeclared exception! try { jSONPath_JSONPathParser0.readOp(); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test189() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("!31CAM$Ng(6ID'W7;Y"); // Undeclared exception! try { jSONPath_JSONPathParser0.readOp(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // expect '=, but '3' // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test190() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("nin"); // Undeclared exception! try { jSONPath_JSONPathParser0.readValue(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // nin // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test191() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("-99"); // Undeclared exception! try { jSONPath_JSONPathParser0.readValue(); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test192() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("-99"); // Undeclared exception! try { jSONPath_JSONPathParser0.readDoubleValue((-719183851066137122L)); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test193() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("?*"); // Undeclared exception! try { jSONPath_JSONPathParser0.readDoubleValue(2133L); fail("Expecting exception: NumberFormatException"); } catch(NumberFormatException e) { } } @Test(timeout = 4000) public void test194() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("5>v2q63t8an8dsf&"); long long0 = jSONPath_JSONPathParser0.readLongValue(); assertEquals(5L, long0); } @Test(timeout = 4000) public void test195() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("false"); JSONPath.ValueSegment jSONPath_ValueSegment0 = new JSONPath.ValueSegment("", jSONPath_JSONPathParser0, false); JSONPath.Filter jSONPath_Filter0 = jSONPath_JSONPathParser0.filterRest(jSONPath_ValueSegment0); assertSame(jSONPath_ValueSegment0, jSONPath_Filter0); } @Test(timeout = 4000) public void test196() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("{\"fastjson.parser.autoTypeSupport\":99,\"toJSON error\":-99,\"x\":\"hello\",\"value is null\":99,\"/uRLs/0\":false,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}"); Object object0 = jSONPath_JSONPathParser0.parseArrayAccessFilter(false); assertNotNull(object0); } @Test(timeout = 4000) public void test197() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("/stackTrace/8"); // Undeclared exception! try { jSONPath_JSONPathParser0.parseArrayAccess(false); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test198() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("{\"y\":7,\"a\":[],\"x\":\"hello\",\"value is null\":{},\"z\":true,\"com.alibaba.fastjson.JSONPath$NotNullSegement\":[]}"); // Undeclared exception! try { jSONPath_JSONPathParser0.parseArrayAccessFilter(false); fail("Expecting exception: NumberFormatException"); } catch(NumberFormatException e) { // // For input string: \"{\"y\":7\" // verifyException("java.lang.NumberFormatException", e); } } @Test(timeout = 4000) public void test199() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("g._&"); // Undeclared exception! try { jSONPath_JSONPathParser0.parseArrayAccessFilter(false); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // illeal jsonpath syntax. g._& // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test200() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("\u0006:XkD-n42{od#6G<+l"); // Undeclared exception! try { jSONPath_JSONPathParser0.readValue(); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test201() throws Throwable { SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("2m5X", "[F", 1828); String[] stringArray0 = new String[9]; stringArray0[0] = "[F"; // Undeclared exception! try { JSONPath.reserveToArray(sQLTransactionRollbackException0, stringArray0); // fail("Expecting exception: RuntimeException"); // Unstable assertion } catch(RuntimeException e) { // // jsonpath can not be null // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test202() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("W/S(Ik>~~"); // Undeclared exception! try { jSONPath_JSONPathParser0.explain(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : W/S(Ik>~~ // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test203() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.globalInstance; JSONPath jSONPath0 = new JSONPath("d", serializeConfig0, (ParserConfig) null); // Undeclared exception! try { jSONPath0.remove((Object) "/stackTrace/9"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test204() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("z'_$_I.<]!E3r", serializeConfig0, parserConfig0); Map<String, Object> map0 = JSONPath.paths((Object) jSONPath0); assertEquals(1, map0.size()); } @Test(timeout = 4000) public void test205() throws Throwable { HashMap<String, ClientInfoStatus> hashMap0 = new HashMap<String, ClientInfoStatus>(); SQLClientInfoException sQLClientInfoException0 = new SQLClientInfoException((String) null, hashMap0); Map<String, Object> map0 = JSONPath.paths((Object) sQLClientInfoException0); // // Unstable assertion: assertEquals(88, map0.size()); } @Test(timeout = 4000) public void test206() throws Throwable { // Undeclared exception! try { JSONPath.compile((String) null); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // jsonpath can not be null // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test207() throws Throwable { boolean boolean0 = JSONPath.contains((Object) null, "#"); assertFalse(boolean0); } @Test(timeout = 4000) public void test208() throws Throwable { BigDecimal bigDecimal0 = BigDecimal.TEN; SQLFeatureNotSupportedException sQLFeatureNotSupportedException0 = new SQLFeatureNotSupportedException(); // Undeclared exception! JSONPath.set((Object) bigDecimal0, "/stackTrace/12", (Object) sQLFeatureNotSupportedException0); } @Test(timeout = 4000) public void test209() throws Throwable { ParserConfig parserConfig0 = ParserConfig.global; SerializeConfig serializeConfig0 = new SerializeConfig(false); JSONPath jSONPath0 = new JSONPath("fastjson.parser.deny", serializeConfig0, parserConfig0); SQLInvalidAuthorizationSpecException sQLInvalidAuthorizationSpecException0 = new SQLInvalidAuthorizationSpecException("fastjson.parser.autoTypeSupport"); // Undeclared exception! try { jSONPath0.set((Object) sQLInvalidAuthorizationSpecException0, (Object) "|rgKxnuwAh]?$"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test210() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("o"); boolean boolean0 = jSONPath0.set((Object) "o", (Object) "o"); assertTrue(boolean0); } @Test(timeout = 4000) public void test211() throws Throwable { JSONPath jSONPath0 = new JSONPath("$#k0PZAzw_l'1}(/i"); boolean boolean0 = jSONPath0.set((Object) null, (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test212() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("fastjson.parser.deny.internal"); Object object0 = JSONPath.reserveToArray((Object) null, (String[]) null); // Undeclared exception! try { jSONPath0.remove(object0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test213() throws Throwable { SerializeConfig serializeConfig0 = SerializeConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("deny", serializeConfig0, (ParserConfig) null); Object object0 = JSONPath.reserveToArray((Object) null, (String[]) null); // Undeclared exception! try { jSONPath0.remove(object0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test214() throws Throwable { JSONPath jSONPath0 = new JSONPath("/stackTrace/5"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("/stackTrace/5", "/stackTrace/5"); // Undeclared exception! try { jSONPath0.remove((Object) sQLTimeoutException0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported set operation.class [Ljava.lang.StackTraceElement; // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test215() throws Throwable { boolean boolean0 = JSONPath.remove((Object) null, ", fastjson-version "); assertFalse(boolean0); } @Test(timeout = 4000) public void test216() throws Throwable { String[] stringArray0 = new String[7]; SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException(":"); // Undeclared exception! try { JSONPath.arrayAdd((Object) sQLTimeoutException0, "/stackTrace/9", (Object[]) stringArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported array put operation. class java.lang.StackTraceElement // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test217() throws Throwable { Map<String, Object> map0 = JSONPath.paths((Object) ""); Object[] objectArray0 = new Object[3]; // Undeclared exception! try { JSONPath.arrayAdd((Object) map0, "com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer", objectArray0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // value not found in path com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test218() throws Throwable { Object[] objectArray0 = new Object[3]; JSONPath.arrayAdd((Object) null, "o", objectArray0); assertEquals(3, objectArray0.length); } @Test(timeout = 4000) public void test219() throws Throwable { JSONPath jSONPath0 = new JSONPath("b)ANXW-j"); Set<?> set0 = jSONPath0.keySet((Object) null); assertNull(set0); } @Test(timeout = 4000) public void test220() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("fastjson.parser.deny"); int[] intArray0 = new int[0]; BatchUpdateException batchUpdateException0 = new BatchUpdateException("fastjson.parser.deny", "fastjson.parser.autoTypeAccept", intArray0); int int0 = jSONPath0.size((Object) batchUpdateException0); assertEquals((-1), int0); } @Test(timeout = 4000) public void test221() throws Throwable { ParserConfig parserConfig0 = new ParserConfig(); SerializeConfig serializeConfig0 = new SerializeConfig(); JSONPath jSONPath0 = new JSONPath("fastjson.parser.autoTypeSupport", serializeConfig0, parserConfig0); int int0 = jSONPath0.size((Object) null); assertEquals((-1), int0); } @Test(timeout = 4000) public void test222() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(false); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("m}RX^3CypYIBEVHhwC", serializeConfig0, parserConfig0); SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException("3hOinmnRwo2je", "IgnoreErrorGetter"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("fastjson.parser.deny", "PN[4MU!9bt_", 724, sQLRecoverableException0); // Undeclared exception! try { jSONPath0.size((Object) sQLIntegrityConstraintViolationException0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // not support jsonpath : m}RX^3CypYIBEVHhwC // verifyException("com.alibaba.fastjson.JSONPath$JSONPathParser", e); } } @Test(timeout = 4000) public void test223() throws Throwable { String[] stringArray0 = new String[7]; boolean boolean0 = JSONPath.containsValue((Object) stringArray0[2], "NKxFS28h$'}x", (Object) stringArray0[2]); assertTrue(boolean0); } @Test(timeout = 4000) public void test224() throws Throwable { // Undeclared exception! try { JSONPath.extract("length", "/stackTrace/5"); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // error // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test225() throws Throwable { // Undeclared exception! try { JSONPath.extract("}0ysjVZuU!%Rfdq5", "fastjson.parser.autoTypeAccept"); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // int // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test226() throws Throwable { JSONPath jSONPath0 = new JSONPath("com.alibaba.fastjson.JSONPath$StringOpSegement"); ParserConfig parserConfig0 = new ParserConfig(true); DefaultJSONParser defaultJSONParser0 = new DefaultJSONParser("com.alibaba.fastjson.JSONPath$StringOpSegement", parserConfig0); // Undeclared exception! try { jSONPath0.extract(defaultJSONParser0); fail("Expecting exception: UnsupportedOperationException"); } catch(UnsupportedOperationException e) { // // error // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test227() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("o"); char[] charArray0 = new char[1]; ParserConfig parserConfig0 = new ParserConfig(); DefaultJSONParser defaultJSONParser0 = new DefaultJSONParser(charArray0, 0, parserConfig0, (-551)); Object object0 = jSONPath0.extract(defaultJSONParser0); assertNull(object0); } @Test(timeout = 4000) public void test228() throws Throwable { // Undeclared exception! try { JSONPath.extract(">", ">"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // syntax error, pos 1, line 1, column 2> // verifyException("com.alibaba.fastjson.parser.DefaultJSONParser", e); } } @Test(timeout = 4000) public void test229() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("35:&c=p}"); Object object0 = jSONPath0.extract((DefaultJSONParser) null); assertNull(object0); } @Test(timeout = 4000) public void test230() throws Throwable { SerializeConfig serializeConfig0 = new SerializeConfig(); ClassLoader classLoader0 = ClassLoader.getSystemClassLoader(); ParserConfig parserConfig0 = new ParserConfig(classLoader0); JSONPath jSONPath0 = new JSONPath("/stackTrace/5", serializeConfig0, parserConfig0); boolean boolean0 = jSONPath0.isRef(); assertTrue(boolean0); } @Test(timeout = 4000) public void test231() throws Throwable { JSONPath.MaxSegment jSONPath_MaxSegment0 = new JSONPath.MaxSegment(); } @Test(timeout = 4000) public void test232() throws Throwable { JSONPath.KeySetSegment jSONPath_KeySetSegment0 = JSONPath.KeySetSegment.instance; SerializeConfig serializeConfig0 = new SerializeConfig(false); ParserConfig parserConfig0 = ParserConfig.getGlobalInstance(); JSONPath jSONPath0 = new JSONPath("fastjson.parser.safeMode", serializeConfig0, parserConfig0); Class<SQLTransientConnectionException> class0 = SQLTransientConnectionException.class; Object object0 = jSONPath_KeySetSegment0.eval(jSONPath0, (Object) null, class0); assertNull(object0); } @Test(timeout = 4000) public void test233() throws Throwable { JSONPath.KeySetSegment jSONPath_KeySetSegment0 = new JSONPath.KeySetSegment(); } @Test(timeout = 4000) public void test234() throws Throwable { JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.BETWEEN; JSONPath.StringOpSegement jSONPath_StringOpSegement0 = new JSONPath.StringOpSegement("8^k00e!9Qrp<", (String) null, jSONPath_Operator0); JSONPath jSONPath0 = JSONPath.compile("CWCk|J!r-s2"); boolean boolean0 = jSONPath_StringOpSegement0.apply(jSONPath0, (Object) null, "CWCk|J!r-s2", (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test235() throws Throwable { Long[] longArray0 = new Long[1]; JSONPath.IntObjInSegement jSONPath_IntObjInSegement0 = new JSONPath.IntObjInSegement("2+Aah4,*<bgcX", longArray0, true); JSONPath jSONPath0 = new JSONPath("2+Aah4,*<bgcX"); Object object0 = new Object(); SQLTransientException sQLTransientException0 = new SQLTransientException(); boolean boolean0 = jSONPath_IntObjInSegement0.apply(jSONPath0, object0, longArray0[0], sQLTransientException0); assertFalse(boolean0); } @Test(timeout = 4000) public void test236() throws Throwable { JSONPath.NullSegement jSONPath_NullSegement0 = new JSONPath.NullSegement("."); JSONPath jSONPath0 = new JSONPath("."); JSONPath.WildCardSegment jSONPath_WildCardSegment0 = JSONPath.WildCardSegment.instance; boolean boolean0 = jSONPath_NullSegement0.apply(jSONPath0, ".", jSONPath_WildCardSegment0, jSONPath0); assertTrue(boolean0); } @Test(timeout = 4000) public void test237() throws Throwable { JSONPath.JSONPathParser jSONPath_JSONPathParser0 = new JSONPath.JSONPathParser("com.alibaba.fastjson.JSONPath$RegMatchSegement"); char char0 = jSONPath_JSONPathParser0.getNextChar(); assertEquals('o', char0); } @Test(timeout = 4000) public void test238() throws Throwable { JSONPath.ArrayAccessSegment jSONPath_ArrayAccessSegment0 = new JSONPath.ArrayAccessSegment(0); JSONPath jSONPath0 = new JSONPath("b)ANXW-j"); SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException(); // Undeclared exception! try { jSONPath_ArrayAccessSegment0.setValue(jSONPath0, sQLTransactionRollbackException0, (Object) null); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported set operation.class java.sql.SQLTransactionRollbackException // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test239() throws Throwable { JSONPath.ArrayAccessSegment jSONPath_ArrayAccessSegment0 = new JSONPath.ArrayAccessSegment(9); JSONPath jSONPath0 = new JSONPath("T"); // Undeclared exception! try { jSONPath_ArrayAccessSegment0.remove(jSONPath0, jSONPath0); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // unsupported set operation.class com.alibaba.fastjson.JSONPath // verifyException("com.alibaba.fastjson.JSONPath", e); } } @Test(timeout = 4000) public void test240() throws Throwable { SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("zL%jfGM>II0w", "zL%jfGM>II0w", 34); Set<?> set0 = JSONPath.keySet((Object) sQLIntegrityConstraintViolationException0, "/stackTrace/0"); assertEquals(5, set0.size()); assertNotNull(set0); } @Test(timeout = 4000) public void test241() throws Throwable { JSONPath.IntBetweenSegement jSONPath_IntBetweenSegement0 = new JSONPath.IntBetweenSegement(" _FH+IIWLB0#=4C{V'K", (-6586085717218287427L), (-4270347329889690746L), true); JSONPath jSONPath0 = JSONPath.compile(" _FH+IIWLB0#=4C{V'K"); Class<BatchUpdateException> class0 = BatchUpdateException.class; JavaBeanSerializer javaBeanSerializer0 = jSONPath0.getJavaBeanSerializer(class0); assertNotNull(javaBeanSerializer0); boolean boolean0 = jSONPath_IntBetweenSegement0.apply(jSONPath0, javaBeanSerializer0, class0, "zL%jfGM>II0w"); assertFalse(boolean0); } @Test(timeout = 4000) public void test242() throws Throwable { JSONPath.MinSegment jSONPath_MinSegment0 = new JSONPath.MinSegment(); } @Test(timeout = 4000) public void test243() throws Throwable { // Undeclared exception! try { JSONPath.read("Nv(J$mQn|OyGlY>", "Nv(J$mQn|OyGlY>"); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // syntax error, pos 2, line 1, column 3Nv(J$mQn|OyGlY> // verifyException("com.alibaba.fastjson.parser.DefaultJSONParser", e); } } @Test(timeout = 4000) public void test244() throws Throwable { Object object0 = new Object(); boolean boolean0 = JSONPath.containsValue((Object) null, "file relative path not support.", object0); assertFalse(boolean0); } @Test(timeout = 4000) public void test245() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("-99"); String string0 = jSONPath0.getPath(); assertEquals("-99", string0); } @Test(timeout = 4000) public void test246() throws Throwable { JSONPath jSONPath0 = JSONPath.compile("illegal enum. "); // Undeclared exception! try { jSONPath0.toJSONString(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // create asm serializer error, verson 1.2.68, class byte // verifyException("com.alibaba.fastjson.serializer.SerializeConfig", e); } } @Test(timeout = 4000) public void test247() throws Throwable { // Undeclared exception! try { JSONPath.extract("rtQ5E+R-Ujn>3s9*", "-"); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // index must > 0, but -3 // verifyException("com.alibaba.fastjson.parser.JSONScanner", e); } } @Test(timeout = 4000) public void test248() throws Throwable { JSONPath.SizeSegment jSONPath_SizeSegment0 = JSONPath.SizeSegment.instance; SerializeConfig serializeConfig0 = new SerializeConfig(); ParserConfig parserConfig0 = new ParserConfig(); JSONPath jSONPath0 = new JSONPath("[]", serializeConfig0, parserConfig0); Integer integer0 = jSONPath_SizeSegment0.eval(jSONPath0, "[]", parserConfig0); boolean boolean0 = JSONPath.remove((Object) integer0, "fastjson.parser.autoTypeSupport"); assertFalse(boolean0); } @Test(timeout = 4000) public void test249() throws Throwable { BigInteger bigInteger0 = BigInteger.ZERO; Object object0 = JSONPath.eval((Object) bigInteger0, "kotlin.reflect.jvm.internal.KClassImpl"); assertNull(object0); } @Test(timeout = 4000) public void test250() throws Throwable { Object[] objectArray0 = new Object[0]; JSONPath.arrayAdd((Object) "file relative path not support.", "/mpg6sa-+Oa^s", objectArray0); assertEquals(0, objectArray0.length); } @Test(timeout = 4000) public void test251() throws Throwable { long[] longArray0 = new long[0]; JSONPath.IntInSegement jSONPath_IntInSegement0 = new JSONPath.IntInSegement("not support type :", longArray0, true); JSONPath jSONPath0 = new JSONPath("build object error"); SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("not support type :", (String) null); boolean boolean0 = jSONPath_IntInSegement0.apply(jSONPath0, "not support type :", sQLTimeoutException0, (Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test252() throws Throwable { JSONPath.Operator jSONPath_Operator0 = JSONPath.Operator.LT; JSONPath.IntOpSegement jSONPath_IntOpSegement0 = new JSONPath.IntOpSegement("fastjson.parser.deny", 870L, jSONPath_Operator0); boolean boolean0 = JSONPath.set((Object) null, "com.alibaba.fastjson.JSONPath$ValueSegment", (Object) jSONPath_IntOpSegement0); assertFalse(boolean0); } }
3e1633508960a35dfd537cb42f68db2165d9cd85
3,809
java
Java
service/code/src/test/java/ericminio/javaoracle/domain/IncomingTest.java
ericminio/java-oracle
4ded43ab9fa1af2bcb3ba5e0afdac5c9c64866e4
[ "MIT" ]
null
null
null
service/code/src/test/java/ericminio/javaoracle/domain/IncomingTest.java
ericminio/java-oracle
4ded43ab9fa1af2bcb3ba5e0afdac5c9c64866e4
[ "MIT" ]
null
null
null
service/code/src/test/java/ericminio/javaoracle/domain/IncomingTest.java
ericminio/java-oracle
4ded43ab9fa1af2bcb3ba5e0afdac5c9c64866e4
[ "MIT" ]
null
null
null
40.521277
114
0.656603
9,446
package ericminio.javaoracle.domain; import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; public class IncomingTest { Incoming incoming; @Before public void sut() { incoming = new Incoming(); } @Test public void extractTypeNamesFromTypeSpecifications() { incoming.setTypeSpecifications(Arrays.asList( Arrays.asList("create or replace type example_any_type as object(value number(15,4))"), Arrays.asList("create or replace type example_array_type as table of example_any_type") )); assertThat(incoming.getTypeNames().size(), equalTo(2)); assertThat(incoming.getTypeNames().get(0), equalTo("example_any_type")); assertThat(incoming.getTypeNames().get(1), equalTo("example_array_type")); } @Test public void extractTypeDefinedInPackage() { incoming.setPackageSpecification(Arrays.asList( "create package any_package as", " type example_cursor is ref cursor;", " function any_function return example_cursor;", "end any_package;" )); assertThat(incoming.getTypeSpecifications().size(), equalTo(1)); assertThat(incoming.getTypeSpecifications().get(0).size(), equalTo(1)); assertThat(incoming.getTypeSpecifications().get(0).get(0), equalTo("type example_cursor is ref cursor;")); } @Test public void extendsExistingTypeSpecifications() { incoming.setTypeSpecifications(Arrays.asList( Arrays.asList("create or replace type example_any_type as object(value number(15,4))"), Arrays.asList("create or replace type example_array_type as table of example_any_type") )); incoming.setPackageSpecification(Arrays.asList( "create package any_package as", " type example_cursor is ref cursor;", " function any_function return example_cursor;", "end any_package;" )); assertThat(incoming.getTypeSpecifications().size(), equalTo(3)); assertThat(incoming.getTypeSpecifications().get(0).get(0), containsString("example_any_type")); assertThat(incoming.getTypeSpecifications().get(1).get(0), containsString("example_array_type")); assertThat(incoming.getTypeSpecifications().get(2).get(0), containsString("example_cursor")); } @Test public void willStayInTypeSpecifications() { incoming.setPackageSpecification(Arrays.asList( "create package any_package as", " type example_cursor is ref cursor;", " function any_function return example_cursor;", "end any_package;" )); incoming.setTypeSpecifications(Arrays.asList( Arrays.asList("create or replace type example_any_type as object(value number(15,4))"), Arrays.asList("create or replace type example_array_type as table of example_any_type") )); assertThat(incoming.getTypeSpecifications().size(), equalTo(3)); } @Test public void resistsNoType() { incoming.setPackageSpecification(Arrays.asList( "create package any_package as", " function any_function return number;", "end any_package;" )); incoming.setTypeSpecifications(new ArrayList<List<String>>()); assertThat(incoming.getTypeSpecifications().size(), equalTo(0)); assertThat(incoming.getTypeNames().size(), equalTo(0)); } }
3e1633a00d1ec92f7977723ac23ccc6e48d5da80
627
java
Java
src/main/java/com/exemple/spring/rest/resource/BlogResource.java
akramDev/spring_angularjs
38f5c1ad3f689f04807542502bfde6e02612ba1f
[ "MIT" ]
null
null
null
src/main/java/com/exemple/spring/rest/resource/BlogResource.java
akramDev/spring_angularjs
38f5c1ad3f689f04807542502bfde6e02612ba1f
[ "MIT" ]
null
null
null
src/main/java/com/exemple/spring/rest/resource/BlogResource.java
akramDev/spring_angularjs
38f5c1ad3f689f04807542502bfde6e02612ba1f
[ "MIT" ]
null
null
null
17.416667
52
0.610845
9,447
package com.exemple.spring.rest.resource; import org.springframework.hateoas.ResourceSupport; import com.exemple.spring.core.model.Blog; public class BlogResource extends ResourceSupport { private Long rid; private String title; public Long getRid() { return rid; } public void setRid(Long rid) { this.rid = rid; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Blog toBlog() { Blog blog = new Blog(); blog.setTitle(title); return blog; } }
3e1634c27b1e16d1ddb7af888f32512a858a3de1
213
java
Java
app/src/main/java/com/dedsec/materialui/model/MusicSong.java
khangpv202/material
d4a2018b0a347947e46bb3513fc97ae7386b92e7
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/dedsec/materialui/model/MusicSong.java
khangpv202/material
d4a2018b0a347947e46bb3513fc97ae7386b92e7
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/dedsec/materialui/model/MusicSong.java
khangpv202/material
d4a2018b0a347947e46bb3513fc97ae7386b92e7
[ "Apache-2.0" ]
null
null
null
16.384615
42
0.741784
9,448
package com.dedsec.materialui.model; import android.graphics.drawable.Drawable; public class MusicSong { public int image; public Drawable imageDrw; public String title; public String brief; }
3e1634c41b206d4c25c5556965b30bd28fe6b503
1,129
java
Java
sdk/resourcemanager/azure-resourcemanager-eventhubs/src/main/java/com/azure/resourcemanager/eventhubs/models/SchemaType.java
liukun2634/azure-sdk-for-java
a42ba097eef284333c9befba180eea3cfed41312
[ "MIT" ]
1,350
2015-01-17T05:22:05.000Z
2022-03-29T21:00:37.000Z
sdk/resourcemanager/azure-resourcemanager-eventhubs/src/main/java/com/azure/resourcemanager/eventhubs/models/SchemaType.java
liukun2634/azure-sdk-for-java
a42ba097eef284333c9befba180eea3cfed41312
[ "MIT" ]
16,834
2015-01-07T02:19:09.000Z
2022-03-31T23:29:10.000Z
sdk/resourcemanager/azure-resourcemanager-eventhubs/src/main/java/com/azure/resourcemanager/eventhubs/models/SchemaType.java
liukun2634/azure-sdk-for-java
a42ba097eef284333c9befba180eea3cfed41312
[ "MIT" ]
1,586
2015-01-02T01:50:28.000Z
2022-03-31T11:25:34.000Z
32.257143
72
0.714792
9,449
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.eventhubs.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** Defines values for SchemaType. */ public final class SchemaType extends ExpandableStringEnum<SchemaType> { /** Static value Unknown for SchemaType. */ public static final SchemaType UNKNOWN = fromString("Unknown"); /** Static value Avro for SchemaType. */ public static final SchemaType AVRO = fromString("Avro"); /** * Creates or finds a SchemaType from its string representation. * * @param name a name to look for. * @return the corresponding SchemaType. */ @JsonCreator public static SchemaType fromString(String name) { return fromString(name, SchemaType.class); } /** @return known SchemaType values. */ public static Collection<SchemaType> values() { return values(SchemaType.class); } }
3e1634c77a121a8e0b95dd44eddbc8484ec8824e
1,093
java
Java
src/main/java/sirttas/alchemytech/block/jar/IngredientJarRenderer.java
Sirttas/AnchemyTech
ea28b07305e96686bd20301473e9aed877a8220d
[ "Apache-2.0" ]
null
null
null
src/main/java/sirttas/alchemytech/block/jar/IngredientJarRenderer.java
Sirttas/AnchemyTech
ea28b07305e96686bd20301473e9aed877a8220d
[ "Apache-2.0" ]
null
null
null
src/main/java/sirttas/alchemytech/block/jar/IngredientJarRenderer.java
Sirttas/AnchemyTech
ea28b07305e96686bd20301473e9aed877a8220d
[ "Apache-2.0" ]
null
null
null
37.689655
114
0.751144
9,450
package sirttas.alchemytech.block.jar; import static sirttas.alchemytech.block.BlockAT.BIT_SIZE; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import sirttas.alchemytech.block.tile.renderer.ATRenderer; public class IngredientJarRenderer extends ATRenderer<TileIngredientJar> { private static final ResourceLocation TEXTURE = new ResourceLocation("alchemytech", "textures/blocks/milk.png"); @Override public void renderTileEntityAt(TileIngredientJar tileEntity, double x, double y, double z, float partialTicks, int destroyStage) { if (tileEntity.getIngredientCount() > 0) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.scale(1f, (float) tileEntity.getIngredientCount() / (float) ConfigIngredientJar.MAX_INGREDIENTS, 1f); bindTexture(TEXTURE); drawColor(tileEntity.getIngredientsColor()); drawCube(5.5f * BIT_SIZE, 0.5f * BIT_SIZE, 5.5f * BIT_SIZE, 10.5f * BIT_SIZE, 6 * BIT_SIZE, 10.5f * BIT_SIZE); GlStateManager.popMatrix(); } } }
3e1634ff6a5b314daa2a32a3ef8d9bd59ffcc006
17,061
java
Java
src/main/java/com/betfair/marketing/affiliates/core/SportsbookApiHandler.java
betfair/affiliates-integration-reference-app
20f7608b8b656ac3173dee509978513252f348c9
[ "MIT" ]
3
2017-11-23T12:53:49.000Z
2019-04-02T08:27:17.000Z
src/main/java/com/betfair/marketing/affiliates/core/SportsbookApiHandler.java
betfair/affiliates-integration-reference-app
20f7608b8b656ac3173dee509978513252f348c9
[ "MIT" ]
null
null
null
src/main/java/com/betfair/marketing/affiliates/core/SportsbookApiHandler.java
betfair/affiliates-integration-reference-app
20f7608b8b656ac3173dee509978513252f348c9
[ "MIT" ]
1
2017-09-26T13:12:39.000Z
2017-09-26T13:12:39.000Z
48.194915
266
0.692105
9,451
package com.betfair.marketing.affiliates.core; import com.betfair.marketing.affiliates.config.Settings; import com.betfair.marketing.affiliates.util.Utils; import org.apache.commons.io.IOUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.owasp.esapi.ESAPI; import org.owasp.esapi.Encoder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.util.HashMap; import java.util.Map; import java.util.StringJoiner; import static com.betfair.marketing.affiliates.config.PropertyNames.*; import static com.betfair.marketing.affiliates.config.Settings.getSportsbookKey; import static com.betfair.marketing.affiliates.util.Utils.*; @Path("sportsbook/{brand}/{type}") @Produces(MediaType.APPLICATION_JSON) public class SportsbookApiHandler { private static final Logger LOG = LoggerFactory.getLogger(SportsbookApiHandler.class); private final static String LIST_EVENTS = "listEvents"; private final static String LIST_MARKET_PRICES = "listMarketPrices"; private final static String LIST_MARKET_CATALOGUE = "listMarketCatalogue"; private final static String PLACE_BETS = "placeBets"; private final static String IMPLY_BETS = "implyBets"; private final static String GET_ACCOUNT_FUNDS = "getAccountFunds"; private final static String GET_MARKET_PRICES_BY_EVENT = "getMarketPricesByEvent"; private static final String INVALID_JSON_REQUEST_BODY = "INVALID_JSON_REQUEST_BODY"; private static final String INVALID_REQUEST_PATH = "INVALID_REQUEST_PATH"; private static final String PRODUCT_TOKEN_NOT_FOUND = "PRODUCT_TOKEN_NOT_FOUND"; private static final String INVALID_BRAND_PATH = "INVALID_BRAND_PATH"; private static final String INVALID_PRODUCT_TOKEN = "INVALID_PRODUCT_TOKEN"; private static final String INVALID_API_REQUEST = "INVALID_API_REQUEST"; private Encoder encoder = ESAPI.encoder(); private HashMap<String, String> bodies = new HashMap<>(); private String productToken; private String brand; public SportsbookApiHandler() { bodies.put(LIST_EVENTS, "{\"listEventsRequestParams\":{\"marketFilter\":{}}}"); bodies.put(LIST_MARKET_CATALOGUE, "{\"listMarketCatalogueRequestParams\":{\"marketFilter\":{},\"maxResults\":100}}"); bodies.put(LIST_MARKET_PRICES, "{\"listMarketPricesRequestParams\":{}}"); bodies.put(PLACE_BETS, "{\"placeBetsRequestParams\":{\"betDefinitions\":[{\"stakePerLine\":0,\"betNumber\":1,\"betType\":\"SINGLE\",\"betLegs\":[{\"legType\":\"SIMPLE_SELECTION\",\"betRunners\":[{\"runner\":{\"marketId\":\"\",\"selectionId\":\"\"}}]}]}]}}"); bodies.put(IMPLY_BETS, "{\"implyBetsRequestParams\":{}}"); bodies.put(GET_ACCOUNT_FUNDS, "{}"); } @POST @Produces(MediaType.APPLICATION_JSON) public JSONObject handleRequest( @Context HttpServletRequest request, @PathParam("brand") String brandValue, @PathParam("type") String requestType, @CookieParam("productTokenBetfair") String productTokenBetfair, @CookieParam("productTokenPaddypower") String productTokenPaddypower) throws IOException, ParseException { JSONObject requestJsonObject; brandValue = encoder.encodeForJavaScript(brandValue); requestType = encoder.encodeForJavaScript(requestType); try { requestJsonObject = (JSONObject) new JSONParser().parse(new InputStreamReader(request.getInputStream())); } catch (IOException | ParseException e) { LOG.error("Invalid JSON parsed"); return badRequest(INVALID_JSON_REQUEST_BODY); } if (!setBrandProductToken(brandValue, productTokenBetfair, productTokenPaddypower)) { badRequest(INVALID_PRODUCT_TOKEN); } return executeRequest(brand, requestType, requestJsonObject); } private JSONObject executeRequest(String brandValue, String requestType, JSONObject requestJsonObject) throws ParseException, IOException { switch (requestType) { case LIST_EVENTS: return retrieveAllEvents(requestJsonObject); case LIST_MARKET_CATALOGUE: return retrieveMarketCatalogue(requestJsonObject); case LIST_MARKET_PRICES: return retrieveMarketPrices(requestJsonObject); case PLACE_BETS: return placeBet(requestJsonObject); case IMPLY_BETS: return implyBet(requestJsonObject); case GET_ACCOUNT_FUNDS: return requestFunds(brandValue); case GET_MARKET_PRICES_BY_EVENT: return retrieveMarketPricesByEvent(requestJsonObject); default: return badRequest(INVALID_API_REQUEST); } } private boolean setBrandProductToken(String brandValue, String productTokenBetfair, String productTokenPaddypower) { if (brandValue.equals(BETFAIR) && productTokenBetfair != null && Utils.productTokenValid(productTokenBetfair)) { brand = brandValue; productToken = productTokenBetfair; return true; } else if (brandValue.equals(PADDYPOWER) && productTokenPaddypower != null && Utils.productTokenValid(productTokenPaddypower)) { brand = brandValue; productToken = productTokenPaddypower; return true; } else if (brandValue.equals(BETFAIR) || brandValue.equals(PADDYPOWER)) { brand = brandValue; return true; } return false; } private JSONObject retrieveMarketPricesByEvent(JSONObject requestJsonObject) throws IOException, ParseException { JSONObject marketsCatalogueResponse = retrieveMarketCatalogue(requestJsonObject); JSONObject marketPricesRequestObject = new JSONObject(); JSONArray markets = (JSONArray) new JSONParser().parse(marketsCatalogueResponse.get("response").toString()); JSONArray requestArray = new JSONArray(); for (Object object : markets) { JSONObject jsonObject = (JSONObject) object; String marketId = jsonObject.get("marketId").toString(); requestArray.add(marketId); } marketPricesRequestObject.put("marketIds", requestArray); return retrieveMarketPrices(marketPricesRequestObject); } private JSONObject retrieveAllEvents(JSONObject requestJsonObject) { String requestBody = bodies.get(LIST_EVENTS); String affiliateProductToken = getAffiliateSession(brand); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(LIST_EVENTS, requestBody, affiliateProductToken, false); return buildResponseJson(sportsbookResponse); } private JSONObject retrieveMarketCatalogue(JSONObject requestJsonObject) throws ParseException { String affiliateProductToken = getAffiliateSession(brand); String eventId = (String) requestJsonObject.get("eventId"); JSONArray eventIds = new JSONArray(); eventIds.add(eventId); JSONObject marketFilter = new JSONObject(); marketFilter.put("eventIds", eventIds); JSONObject requestBody = (JSONObject) new JSONParser().parse(bodies.get(LIST_MARKET_CATALOGUE)); JSONObject listMarketCatalogueRequestParams = (JSONObject) requestBody.get("listMarketCatalogueRequestParams"); listMarketCatalogueRequestParams.put("marketFilter", marketFilter); requestBody.put("listMarketCatalogueRequestParams", listMarketCatalogueRequestParams); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(LIST_MARKET_CATALOGUE, requestBody.toJSONString(), affiliateProductToken, false); return buildResponseJson(sportsbookResponse); } private JSONObject retrieveMarketPrices(JSONObject requestJsonObject) throws IOException, ParseException { JSONObject requestBody = (JSONObject) new JSONParser().parse(bodies.get(LIST_MARKET_PRICES)); JSONArray marketsIds = (JSONArray) requestJsonObject.get("marketIds"); JSONObject listMarketPrices = new JSONObject(); listMarketPrices.put("marketIds", marketsIds); requestBody.put("listMarketPricesRequestParams", listMarketPrices); String affiliateProductToken = getAffiliateSession(brand); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(LIST_MARKET_PRICES, requestBody.toJSONString(), affiliateProductToken, false); return buildResponseJson(sportsbookResponse); } private JSONObject requestFunds(String brand) throws IOException { String requestBody = bodies.get(GET_ACCOUNT_FUNDS); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(GET_ACCOUNT_FUNDS, requestBody, null, true); return buildResponseJson(sportsbookResponse); } private JSONObject implyBet(JSONObject requestJsonObject) throws IOException, ParseException { JSONObject requestBody = new JSONObject(); JSONObject betLegs = new JSONObject(); String marketId = requestJsonObject.get("marketId").toString(); String selectionId = requestJsonObject.get("selectionId").toString(); betLegs.put("betLegs", buildBetLegs(marketId, selectionId)); requestBody.put("implyBetsRequestParams", betLegs); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(IMPLY_BETS, requestBody.toJSONString(), null, true); return buildResponseJson(sportsbookResponse); } private JSONObject placeBet(JSONObject requestJsonObject) throws IOException { JSONObject requestBody = new JSONObject(); String marketId = requestJsonObject.get("marketId").toString(); String selectionId = requestJsonObject.get("selectionId").toString(); String stake = requestJsonObject.get("stake").toString(); boolean useBonus = Boolean.parseBoolean(requestJsonObject.get("useBonus").toString()); requestBody.put("placeBetsRequestParams", buildBetDefinitions(marketId, selectionId, stake, useBonus)); Map<Integer, String> sportsbookResponse = sportsbookAPIRequest(PLACE_BETS, requestBody.toJSONString(), null, true); return buildResponseJson(sportsbookResponse); } private JSONObject badRequest(String type) { JSONObject response = new JSONObject(); switch (type) { case INVALID_JSON_REQUEST_BODY: response.put("status", "invalid_json"); response.put("message", "Invalid body request!"); break; case INVALID_REQUEST_PATH: response.put("status", "invalid_request_path"); response.put("message", "Invalid request path!"); break; case PRODUCT_TOKEN_NOT_FOUND: response.put("status", "token_not_found"); response.put("message", "Product token not found!!"); break; case INVALID_BRAND_PATH: response.put("status", "invalid_brand_path"); response.put("message", "The brand you are trying to access is not available!"); break; case INVALID_PRODUCT_TOKEN: response.put("status", "invalid_product_token"); response.put("message", "The productToken used is invalid!"); break; case INVALID_API_REQUEST: response.put("status", "invalid_api_request"); response.put("message", "Unknown error!"); break; default: response.put("status", "broken"); response.put("message", "Unknown error!"); break; } return response; } private Map<Integer, String> sportsbookAPIRequest(String type, String body, String productToken, boolean transactionalOperation) { Map<Integer, String> result; String requestPath = Settings.getSportsbookEndpoint(brand) + type + '/'; HttpURLConnection connection = createNewHttpConnection(requestPath, getSportsbookKey(brand), (productToken != null ? productToken : this.productToken), "json", transactionalOperation); try (OutputStream outputStream = connection.getOutputStream()) { outputStream.write(body.getBytes()); result = extractResponseIfSuccess(connection); } catch (IOException e) { throw new RuntimeException("Sportsbook Request Error!"); } return result; } private Map<Integer, String> extractResponseIfSuccess(HttpURLConnection connection) throws IOException { Map<Integer, String> result = new HashMap<>(); if (connection.getResponseCode() == 200) { try (InputStream inputStream = connection.getInputStream()) { result.put(connection.getResponseCode(), IOUtils.toString(inputStream)); } } else { result.put(connection.getResponseCode(), connection.getResponseMessage()); } return result; } private JSONObject buildResponseJson(Map<Integer, String> sportsbookResponse) { JSONObject response = new JSONObject(); if (sportsbookResponse.containsKey(200)) { response.put("status", "success"); response.put("response", sportsbookResponse.get(200)); } else { response.put("status", "fail"); response.put("error", sportsbookResponse.entrySet().iterator().next().getValue()); } return response; } private JSONArray buildBetLegs(String marketId, String selectionId) { JSONArray betLegs = new JSONArray(); JSONObject betLeg = new JSONObject(); JSONArray betRunners = buildBetRunners(marketId, selectionId); betLeg.put("legType", "SIMPLE_SELECTION"); betLeg.put("betRunners", betRunners); betLegs.add(betLeg); return betLegs; } private JSONArray buildBetRunners(String marketId, String selectionId) { JSONObject runnerInformation = new JSONObject(); runnerInformation.put("marketId", marketId); runnerInformation.put("selectionId", selectionId); JSONObject runner = new JSONObject(); runner.put("runner", runnerInformation); JSONArray betRunners = new JSONArray(); betRunners.add(runner); return betRunners; } private JSONObject buildBetDefinition(String marketId, String selectionId, String stake) { JSONObject betDefinition = new JSONObject(); JSONArray betLegsArray = buildBetLegs(marketId, selectionId); betDefinition.put("stakePerLine", Float.valueOf(stake)); betDefinition.put("betNumber", 1); betDefinition.put("betType", "SINGLE"); betDefinition.put("betLegs", betLegsArray); return betDefinition; } private JSONObject buildBetDefinitions(String marketId, String selectionId, String stake, boolean useBonus) { JSONObject betDefinition = new JSONObject(); JSONObject betDefinitionObj = buildBetDefinition(marketId, selectionId, stake); JSONArray betDefinitionsArray = new JSONArray(); betDefinitionsArray.add(betDefinitionObj); betDefinition.put("betDefinitions", betDefinitionsArray); betDefinition.put("useAvailableBonus", useBonus); return betDefinition; } private static String getAffiliateSession(String brand) { String urlString = Settings.getIdentityApiLoginUrl(brand); HttpURLConnection connection = createNewHttpConnection(urlString, getSportsbookKey(brand), null, "www", false); Map<String, String> requestBody = createRequestBody(brand); StringJoiner params = createParamsUrl(requestBody); try (OutputStream outputStream = connection.getOutputStream()) { outputStream.write(params.toString().getBytes()); InputStream inputStream = connection.getInputStream(); String identityResponse = IOUtils.toString(inputStream); inputStream.close(); JSONObject jsonResponse = (JSONObject) new JSONParser().parse(identityResponse); String affiliateProductToken = (String) jsonResponse.get(TOKEN_PARAM); if (Utils.productTokenValid(affiliateProductToken)) { return affiliateProductToken; } else { throw new IllegalStateException("Invalid affliate product token"); } } catch (ParseException | IOException e) { LOG.error("Unable to get Affiliate Main Session"); throw new RuntimeException("Unable to get Affiliate Main Session"); } } }
3e16352183a334f2737a7bf9a6f6e3b8f884b84c
23,668
java
Java
utilcode/src/main/java/com/blankj/utilcode/util/EncryptUtils.java
luoxiuxiu/AppUtil
ea66011122627e7fab6888b7f3148e5084a4ef0d
[ "Apache-2.0" ]
111
2017-08-30T02:33:48.000Z
2022-03-04T08:06:38.000Z
utilcode/src/main/java/com/blankj/utilcode/util/EncryptUtils.java
luoxiuxiu/AppUtil
ea66011122627e7fab6888b7f3148e5084a4ef0d
[ "Apache-2.0" ]
1
2018-04-19T07:52:21.000Z
2018-04-19T07:52:21.000Z
utilcode/src/main/java/com/blankj/utilcode/util/EncryptUtils.java
luoxiuxiu/AppUtil
ea66011122627e7fab6888b7f3148e5084a4ef0d
[ "Apache-2.0" ]
26
2017-09-07T10:12:57.000Z
2021-12-31T09:03:28.000Z
25.614719
126
0.523618
9,452
package com.blankj.utilcode.util; import android.util.Base64; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.security.DigestInputStream; import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2016/08/02 * desc : 加密解密相关的工具类 * </pre> */ public final class EncryptUtils { private EncryptUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /////////////////////////////////////////////////////////////////////////// // 哈希加密相关 /////////////////////////////////////////////////////////////////////////// /** * MD2加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptMD2ToString(String data) { return encryptMD2ToString(data.getBytes()); } /** * MD2加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptMD2ToString(byte[] data) { return bytes2HexString(encryptMD2(data)); } /** * MD2加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptMD2(byte[] data) { return hashTemplate(data, "MD2"); } /** * MD5加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptMD5ToString(String data) { return encryptMD5ToString(data.getBytes()); } /** * MD5加密 * * @param data 明文字符串 * @param salt 盐 * @return 16进制加盐密文 */ public static String encryptMD5ToString(String data, String salt) { return bytes2HexString(encryptMD5((data + salt).getBytes())); } /** * MD5加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptMD5ToString(byte[] data) { return bytes2HexString(encryptMD5(data)); } /** * MD5加密 * * @param data 明文字节数组 * @param salt 盐字节数组 * @return 16进制加盐密文 */ public static String encryptMD5ToString(byte[] data, byte[] salt) { if (data == null || salt == null) return null; byte[] dataSalt = new byte[data.length + salt.length]; System.arraycopy(data, 0, dataSalt, 0, data.length); System.arraycopy(salt, 0, dataSalt, data.length, salt.length); return bytes2HexString(encryptMD5(dataSalt)); } /** * MD5加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptMD5(byte[] data) { return hashTemplate(data, "MD5"); } /** * MD5加密文件 * * @param filePath 文件路径 * @return 文件的16进制密文 */ public static String encryptMD5File2String(String filePath) { File file = isSpace(filePath) ? null : new File(filePath); return encryptMD5File2String(file); } /** * MD5加密文件 * * @param filePath 文件路径 * @return 文件的MD5校验码 */ public static byte[] encryptMD5File(String filePath) { File file = isSpace(filePath) ? null : new File(filePath); return encryptMD5File(file); } /** * MD5加密文件 * * @param file 文件 * @return 文件的16进制密文 */ public static String encryptMD5File2String(File file) { return bytes2HexString(encryptMD5File(file)); } /** * MD5加密文件 * * @param file 文件 * @return 文件的MD5校验码 */ public static byte[] encryptMD5File(File file) { if (file == null) return null; FileInputStream fis = null; DigestInputStream digestInputStream; try { fis = new FileInputStream(file); MessageDigest md = MessageDigest.getInstance("MD5"); digestInputStream = new DigestInputStream(fis, md); byte[] buffer = new byte[256 * 1024]; while (true) { if (!(digestInputStream.read(buffer) > 0)) break; } md = digestInputStream.getMessageDigest(); return md.digest(); } catch (NoSuchAlgorithmException | IOException e) { e.printStackTrace(); return null; } finally { CloseUtils.closeIO(fis); } } /** * SHA1加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptSHA1ToString(String data) { return encryptSHA1ToString(data.getBytes()); } /** * SHA1加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptSHA1ToString(byte[] data) { return bytes2HexString(encryptSHA1(data)); } /** * SHA1加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptSHA1(byte[] data) { return hashTemplate(data, "SHA1"); } /** * SHA224加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptSHA224ToString(String data) { return encryptSHA224ToString(data.getBytes()); } /** * SHA224加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptSHA224ToString(byte[] data) { return bytes2HexString(encryptSHA224(data)); } /** * SHA224加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptSHA224(byte[] data) { return hashTemplate(data, "SHA224"); } /** * SHA256加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptSHA256ToString(String data) { return encryptSHA256ToString(data.getBytes()); } /** * SHA256加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptSHA256ToString(byte[] data) { return bytes2HexString(encryptSHA256(data)); } /** * SHA256加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptSHA256(byte[] data) { return hashTemplate(data, "SHA256"); } /** * SHA384加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptSHA384ToString(String data) { return encryptSHA384ToString(data.getBytes()); } /** * SHA384加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptSHA384ToString(byte[] data) { return bytes2HexString(encryptSHA384(data)); } /** * SHA384加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptSHA384(byte[] data) { return hashTemplate(data, "SHA384"); } /** * SHA512加密 * * @param data 明文字符串 * @return 16进制密文 */ public static String encryptSHA512ToString(String data) { return encryptSHA512ToString(data.getBytes()); } /** * SHA512加密 * * @param data 明文字节数组 * @return 16进制密文 */ public static String encryptSHA512ToString(byte[] data) { return bytes2HexString(encryptSHA512(data)); } /** * SHA512加密 * * @param data 明文字节数组 * @return 密文字节数组 */ public static byte[] encryptSHA512(byte[] data) { return hashTemplate(data, "SHA512"); } /** * hash加密模板 * * @param data 数据 * @param algorithm 加密算法 * @return 密文字节数组 */ private static byte[] hashTemplate(byte[] data, String algorithm) { if (data == null || data.length <= 0) return null; try { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(data); return md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } /** * HmacMD5加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacMD5ToString(String data, String key) { return encryptHmacMD5ToString(data.getBytes(), key.getBytes()); } /** * HmacMD5加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacMD5ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacMD5(data, key)); } /** * HmacMD5加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacMD5(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacMD5"); } /** * HmacSHA1加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA1ToString(String data, String key) { return encryptHmacSHA1ToString(data.getBytes(), key.getBytes()); } /** * HmacSHA1加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA1ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacSHA1(data, key)); } /** * HmacSHA1加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacSHA1(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacSHA1"); } /** * HmacSHA224加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA224ToString(String data, String key) { return encryptHmacSHA224ToString(data.getBytes(), key.getBytes()); } /** * HmacSHA224加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA224ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacSHA224(data, key)); } /** * HmacSHA224加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacSHA224(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacSHA224"); } /** * HmacSHA256加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA256ToString(String data, String key) { return encryptHmacSHA256ToString(data.getBytes(), key.getBytes()); } /** * HmacSHA256加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA256ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacSHA256(data, key)); } /** * HmacSHA256加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacSHA256(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacSHA256"); } /** * HmacSHA384加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA384ToString(String data, String key) { return encryptHmacSHA384ToString(data.getBytes(), key.getBytes()); } /** * HmacSHA384加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA384ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacSHA384(data, key)); } /** * HmacSHA384加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacSHA384(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacSHA384"); } /** * HmacSHA512加密 * * @param data 明文字符串 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA512ToString(String data, String key) { return encryptHmacSHA512ToString(data.getBytes(), key.getBytes()); } /** * HmacSHA512加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 16进制密文 */ public static String encryptHmacSHA512ToString(byte[] data, byte[] key) { return bytes2HexString(encryptHmacSHA512(data, key)); } /** * HmacSHA512加密 * * @param data 明文字节数组 * @param key 秘钥 * @return 密文字节数组 */ public static byte[] encryptHmacSHA512(byte[] data, byte[] key) { return hmacTemplate(data, key, "HmacSHA512"); } /** * Hmac加密模板 * * @param data 数据 * @param key 秘钥 * @param algorithm 加密算法 * @return 密文字节数组 */ private static byte[] hmacTemplate(byte[] data, byte[] key, String algorithm) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec secretKey = new SecretKeySpec(key, algorithm); Mac mac = Mac.getInstance(algorithm); mac.init(secretKey); return mac.doFinal(data); } catch (InvalidKeyException | NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } /////////////////////////////////////////////////////////////////////////// // DES加密相关 /////////////////////////////////////////////////////////////////////////// /** * DES转变 * <p>法算法名称/加密模式/填充方式</p> * <p>加密模式有:电子密码本模式ECB、加密块链模式CBC、加密反馈模式CFB、输出反馈模式OFB</p> * <p>填充方式有:NoPadding、ZerosPadding、PKCS5Padding</p> */ public static String DES_Transformation = "DES/ECB/NoPadding"; private static final String DES_Algorithm = "DES"; /** * DES加密后转为Base64编码 * * @param data 明文 * @param key 8字节秘钥 * @return Base64密文 */ public static byte[] encryptDES2Base64(byte[] data, byte[] key) { return base64Encode(encryptDES(data, key)); } /** * DES加密后转为16进制 * * @param data 明文 * @param key 8字节秘钥 * @return 16进制密文 */ public static String encryptDES2HexString(byte[] data, byte[] key) { return bytes2HexString(encryptDES(data, key)); } /** * DES加密 * * @param data 明文 * @param key 8字节秘钥 * @return 密文 */ public static byte[] encryptDES(byte[] data, byte[] key) { return desTemplate(data, key, DES_Algorithm, DES_Transformation, true); } /** * DES解密Base64编码密文 * * @param data Base64编码密文 * @param key 8字节秘钥 * @return 明文 */ public static byte[] decryptBase64DES(byte[] data, byte[] key) { return decryptDES(base64Decode(data), key); } /** * DES解密16进制密文 * * @param data 16进制密文 * @param key 8字节秘钥 * @return 明文 */ public static byte[] decryptHexStringDES(String data, byte[] key) { return decryptDES(hexString2Bytes(data), key); } /** * DES解密 * * @param data 密文 * @param key 8字节秘钥 * @return 明文 */ public static byte[] decryptDES(byte[] data, byte[] key) { return desTemplate(data, key, DES_Algorithm, DES_Transformation, false); } /////////////////////////////////////////////////////////////////////////// // 3DES加密相关 /////////////////////////////////////////////////////////////////////////// /** * 3DES转变 * <p>法算法名称/加密模式/填充方式</p> * <p>加密模式有:电子密码本模式ECB、加密块链模式CBC、加密反馈模式CFB、输出反馈模式OFB</p> * <p>填充方式有:NoPadding、ZerosPadding、PKCS5Padding</p> */ public static String TripleDES_Transformation = "DESede/ECB/NoPadding"; private static final String TripleDES_Algorithm = "DESede"; /** * 3DES加密后转为Base64编码 * * @param data 明文 * @param key 24字节秘钥 * @return Base64密文 */ public static byte[] encrypt3DES2Base64(byte[] data, byte[] key) { return base64Encode(encrypt3DES(data, key)); } /** * 3DES加密后转为16进制 * * @param data 明文 * @param key 24字节秘钥 * @return 16进制密文 */ public static String encrypt3DES2HexString(byte[] data, byte[] key) { return bytes2HexString(encrypt3DES(data, key)); } /** * 3DES加密 * * @param data 明文 * @param key 24字节密钥 * @return 密文 */ public static byte[] encrypt3DES(byte[] data, byte[] key) { return desTemplate(data, key, TripleDES_Algorithm, TripleDES_Transformation, true); } /** * 3DES解密Base64编码密文 * * @param data Base64编码密文 * @param key 24字节秘钥 * @return 明文 */ public static byte[] decryptBase64_3DES(byte[] data, byte[] key) { return decrypt3DES(base64Decode(data), key); } /** * 3DES解密16进制密文 * * @param data 16进制密文 * @param key 24字节秘钥 * @return 明文 */ public static byte[] decryptHexString3DES(String data, byte[] key) { return decrypt3DES(hexString2Bytes(data), key); } /** * 3DES解密 * * @param data 密文 * @param key 24字节密钥 * @return 明文 */ public static byte[] decrypt3DES(byte[] data, byte[] key) { return desTemplate(data, key, TripleDES_Algorithm, TripleDES_Transformation, false); } /////////////////////////////////////////////////////////////////////////// // AES加密相关 /////////////////////////////////////////////////////////////////////////// /** * AES转变 * <p>法算法名称/加密模式/填充方式</p> * <p>加密模式有:电子密码本模式ECB、加密块链模式CBC、加密反馈模式CFB、输出反馈模式OFB</p> * <p>填充方式有:NoPadding、ZerosPadding、PKCS5Padding</p> */ public static String AES_Transformation = "AES/ECB/NoPadding"; private static final String AES_Algorithm = "AES"; /** * AES加密后转为Base64编码 * * @param data 明文 * @param key 16、24、32字节秘钥 * @return Base64密文 */ public static byte[] encryptAES2Base64(byte[] data, byte[] key) { return base64Encode(encryptAES(data, key)); } /** * AES加密后转为16进制 * * @param data 明文 * @param key 16、24、32字节秘钥 * @return 16进制密文 */ public static String encryptAES2HexString(byte[] data, byte[] key) { return bytes2HexString(encryptAES(data, key)); } /** * AES加密 * * @param data 明文 * @param key 16、24、32字节秘钥 * @return 密文 */ public static byte[] encryptAES(byte[] data, byte[] key) { return desTemplate(data, key, AES_Algorithm, AES_Transformation, true); } /** * AES解密Base64编码密文 * * @param data Base64编码密文 * @param key 16、24、32字节秘钥 * @return 明文 */ public static byte[] decryptBase64AES(byte[] data, byte[] key) { return decryptAES(base64Decode(data), key); } /** * AES解密16进制密文 * * @param data 16进制密文 * @param key 16、24、32字节秘钥 * @return 明文 */ public static byte[] decryptHexStringAES(String data, byte[] key) { return decryptAES(hexString2Bytes(data), key); } /** * AES解密 * * @param data 密文 * @param key 16、24、32字节秘钥 * @return 明文 */ public static byte[] decryptAES(byte[] data, byte[] key) { return desTemplate(data, key, AES_Algorithm, AES_Transformation, false); } /** * DES加密模板 * * @param data 数据 * @param key 秘钥 * @param algorithm 加密算法 * @param transformation 转变 * @param isEncrypt {@code true}: 加密 {@code false}: 解密 * @return 密文或者明文,适用于DES,3DES,AES */ public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, algorithm); Cipher cipher = Cipher.getInstance(transformation); SecureRandom random = new SecureRandom(); cipher.init(isEncrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } } private static final char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; /** * byteArr转hexString * <p>例如:</p> * bytes2HexString(new byte[] { 0, (byte) 0xa8 }) returns 00A8 * * @param bytes 字节数组 * @return 16进制大写字符串 */ private static String bytes2HexString(byte[] bytes) { if (bytes == null) return null; int len = bytes.length; if (len <= 0) return null; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = hexDigits[bytes[i] >>> 4 & 0x0f]; ret[j++] = hexDigits[bytes[i] & 0x0f]; } return new String(ret); } /** * hexString转byteArr * <p>例如:</p> * hexString2Bytes("00A8") returns { 0, (byte) 0xA8 } * * @param hexString 十六进制字符串 * @return 字节数组 */ private static byte[] hexString2Bytes(String hexString) { if (isSpace(hexString)) return null; int len = hexString.length(); if (len % 2 != 0) { hexString = "0" + hexString; len = len + 1; } char[] hexBytes = hexString.toUpperCase().toCharArray(); byte[] ret = new byte[len >> 1]; for (int i = 0; i < len; i += 2) { ret[i >> 1] = (byte) (hex2Dec(hexBytes[i]) << 4 | hex2Dec(hexBytes[i + 1])); } return ret; } /** * hexChar转int * * @param hexChar hex单个字节 * @return 0..15 */ private static int hex2Dec(char hexChar) { if (hexChar >= '0' && hexChar <= '9') { return hexChar - '0'; } else if (hexChar >= 'A' && hexChar <= 'F') { return hexChar - 'A' + 10; } else { throw new IllegalArgumentException(); } } /** * Base64编码 * * @param input 要编码的字节数组 * @return Base64编码后的字符串 */ private static byte[] base64Encode(byte[] input) { return Base64.encode(input, Base64.NO_WRAP); } /** * Base64解码 * * @param input 要解码的字符串 * @return Base64解码后的字符串 */ private static byte[] base64Decode(byte[] input) { return Base64.decode(input, Base64.NO_WRAP); } private static boolean isSpace(String s) { if (s == null) return true; for (int i = 0, len = s.length(); i < len; ++i) { if (!Character.isWhitespace(s.charAt(i))) { return false; } } return true; } }
3e1635709df631f1330516975c7a4d8d6d6bde60
5,538
java
Java
web-services/query/src/main/java/datawave/webservice/query/dashboard/DashboardBean.java
smonaem/datawave-1
03898efed35a3868f0187f9eb864201612d573e9
[ "Apache-2.0" ]
1
2019-10-18T08:58:03.000Z
2019-10-18T08:58:03.000Z
web-services/query/src/main/java/datawave/webservice/query/dashboard/DashboardBean.java
smonaem/datawave-1
03898efed35a3868f0187f9eb864201612d573e9
[ "Apache-2.0" ]
null
null
null
web-services/query/src/main/java/datawave/webservice/query/dashboard/DashboardBean.java
smonaem/datawave-1
03898efed35a3868f0187f9eb864201612d573e9
[ "Apache-2.0" ]
1
2020-01-17T14:10:53.000Z
2020-01-17T14:10:53.000Z
35.729032
143
0.683821
9,453
package datawave.webservice.query.dashboard; import datawave.interceptor.ResponseInterceptor; import datawave.security.authorization.DatawavePrincipal; import datawave.security.util.AuthorizationsUtil; import datawave.security.util.ScannerHelper; import datawave.webservice.common.connection.AccumuloConnectionFactory; import datawave.webservice.common.extjs.ExtJsResponse; import datawave.webservice.query.runner.QueryExecutorBean; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.security.Authorizations; import org.apache.log4j.Logger; import org.jboss.resteasy.annotations.GZIP; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.MutableDateTime; import javax.annotation.Resource; import javax.annotation.security.DeclareRoles; import javax.annotation.security.RolesAllowed; import javax.ejb.EJBContext; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.inject.Inject; import javax.interceptor.Interceptors; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import java.security.Principal; import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.Set; @Path("/Query/Metrics/dashboard") @GZIP @Produces(MediaType.APPLICATION_JSON) @Stateless @LocalBean @RolesAllowed("AuthorizedUser") @DeclareRoles("AuthorizedUser") public class DashboardBean { private static final Logger log = Logger.getLogger(DashboardBean.class); private static final long MS_IN_12_HRS = 43_200_000;// timestamps seem to be about 11 hours behind private static final String TABLE_NAME_JMC = "DpsJmcLogs"; @Inject private AccumuloConnectionFactory connectionFactory; @Inject private QueryExecutorBean queryExecutor; @Resource protected EJBContext ctx; @Path("/dpsjmc/heartbeat") @GET public boolean getHeartbeat() throws Exception { Connector c = null; try { c = createConnector(); return createScanner(c).iterator().hasNext(); } finally { try { connectionFactory.returnConnection(c); } catch (Exception e) { log.error("Error returning connection to factory.", e); } } } @GET @Path("/stats") @Interceptors(ResponseInterceptor.class) public ExtJsResponse<DashboardSummary> getQuerySummary(@QueryParam("start") long startMs, @QueryParam("end") long endMs) throws Exception { MutableDateTime now = new MutableDateTime(DateTimeZone.UTC); MutableDateTime start = new MutableDateTime(startMs); MutableDateTime end = new MutableDateTime(endMs); String auths; DatawavePrincipal principal = getPrincipal(); if (principal == null) { auths = "ALL"; } else { auths = AuthorizationsUtil.buildAuthorizationString(principal.getAuthorizations()); } ExtJsResponse<DashboardSummary> summary = null; try { summary = DashboardQuery.createQuery(queryExecutor, auths, start.toDate(), end.toDate(), now.toDate()); } catch (RuntimeException ex) { log.error("An error occurred querying for dashboard metrics: " + ex.getMessage(), ex); throw ex; } finally { if (summary != null) { queryExecutor.close(summary.getQueryId()); } } return summary; } private DatawavePrincipal getPrincipal() { Principal p = ctx.getCallerPrincipal(); if (p instanceof DatawavePrincipal) { return (DatawavePrincipal) p; } log.warn("Principal is not of the correct type"); return null; } private Set<Authorizations> getAuths() { DatawavePrincipal dp = getPrincipal(); Set<Authorizations> auths = new HashSet<>(); for (Collection<String> cbAuths : dp.getAuthorizations()) { auths.add(new Authorizations(cbAuths.toArray(new String[cbAuths.size()]))); } return auths; } /** * Create scanner for last 60 minutes of logs. * * @param c * the {@link Connector} to use when creating scanners * * @return a {@link Scanner} that will only scan over the last 60 minutes of logs * * @throws TableNotFoundException */ private Scanner createScanner(Connector c) throws TableNotFoundException { long start = new DateTime(DateTimeZone.UTC).getMillis() - MS_IN_12_HRS; long end = start + (1000 * 60 * 10);// 10 minutes Scanner scanner = ScannerHelper.createScanner(c, TABLE_NAME_JMC, getAuths()); Key startKey = new Key(Long.toString(start)); Key endKey = new Key(Long.toString(end)); Range range = new Range(startKey, endKey); scanner.setRange(range); return scanner; } private Connector createConnector() throws Exception { Map<String,String> trackingMap = connectionFactory.getTrackingMap(Thread.currentThread().getStackTrace()); return connectionFactory.getConnection(AccumuloConnectionFactory.Priority.LOW, trackingMap); } }
3e163603fdab3d805f18c94b575e14503511bf39
1,180
java
Java
core/src/main/java/com/routon/plcloud/device/core/servoceimpl/UserinfoServiceImpl.java
cocfire/DMIL
b71693508cff14c346bcd8bd5065a778c8c3366d
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/routon/plcloud/device/core/servoceimpl/UserinfoServiceImpl.java
cocfire/DMIL
b71693508cff14c346bcd8bd5065a778c8c3366d
[ "Apache-2.0" ]
4
2021-05-08T18:21:13.000Z
2022-02-16T01:08:25.000Z
core/src/main/java/com/routon/plcloud/device/core/servoceimpl/UserinfoServiceImpl.java
cocfire/DMIL
b71693508cff14c346bcd8bd5065a778c8c3366d
[ "Apache-2.0" ]
1
2020-04-30T03:36:36.000Z
2020-04-30T03:36:36.000Z
25.652174
101
0.659322
9,454
package com.routon.plcloud.device.core.servoceimpl; import com.routon.plcloud.device.core.service.UserinfoService; import com.routon.plcloud.device.data.entity.Userinfo; import com.routon.plcloud.device.data.mapper.UserinfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; /** * @author FireWang * @date 2020/5/6 13:25 */ @Service public class UserinfoServiceImpl implements UserinfoService { @Autowired private UserinfoMapper userinfoMapper; @Override public Userinfo getadmin() { List<Userinfo> users = userinfoMapper.selectBySql("select * from userinfo where status = 1"); Userinfo admin = new Userinfo(); if (users.size() > 0) { admin = users.get(0); } else { admin = null; } return admin; } @Override public boolean saveadmin(Userinfo user) { boolean succ = false; user.setModifytime(new Date()); int ns = userinfoMapper.uopdateBySql(user); if (ns > 0) { succ = true; } return succ; } }
3e16365de35a7b60455667adb7ed0ceefda048cc
3,786
java
Java
MingKeMing/src/main/java/chat/dim/mkm/Identifier.java
dimchat/mkm-java
d5d9b336675318c5e002e2233ec2de69edd543f1
[ "MIT" ]
null
null
null
MingKeMing/src/main/java/chat/dim/mkm/Identifier.java
dimchat/mkm-java
d5d9b336675318c5e002e2233ec2de69edd543f1
[ "MIT" ]
null
null
null
MingKeMing/src/main/java/chat/dim/mkm/Identifier.java
dimchat/mkm-java
d5d9b336675318c5e002e2233ec2de69edd543f1
[ "MIT" ]
null
null
null
30.813008
82
0.601055
9,455
/* license: https://mit-license.org * * Ming-Ke-Ming : Decentralized User Identity Authentication * * Written in 2019 by Moky <kenaa@example.com> * * ============================================================================== * The MIT License (MIT) * * Copyright (c) 2019 Albert Moky * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * ============================================================================== */ package chat.dim.mkm; import chat.dim.protocol.Address; import chat.dim.protocol.ID; /** * ID for entity (User/Group) * * data format: "name@address[/terminal]" * * fields: * name - entity name, the seed of fingerprint to build address * address - a string to identify an entity * terminal - entity login resource(device), OPTIONAL */ final class Identifier extends chat.dim.type.String implements ID { private final String name; private final Address address; private final String terminal; Identifier(String identifier, String name, Address address, String terminal) { super(identifier); this.name = name; this.address = address; this.terminal = terminal; } /* @Override public boolean equals(Object other) { if (other == null) { return false; } if (!(other instanceof ID)) { if (other instanceof chat.dim.type.String) { other = other.toString(); } assert other instanceof String : "ID error: " + other; other = ID.parse(other); if (other == null) { return false; } } return ID.equals(this, (ID) other); } */ @Override public String getName() { return name; } @Override public Address getAddress() { return address; } @Override public String getTerminal() { return terminal; } /** * Get Network ID * * @return address type as network ID */ @Override public byte getType() { assert address != null : "ID.address should not be empty: " + toString(); return address.getNetwork(); } @Override public boolean isBroadcast() { assert address != null : "ID.address should not be empty: " + toString(); return address.isBroadcast(); } @Override public boolean isUser() { assert address != null : "ID.address should not be empty: " + toString(); return address.isUser(); } @Override public boolean isGroup() { assert address != null : "ID.address should not be empty: " + toString(); return address.isGroup(); } }
3e1636833463d45a5ed23ce0e6e4b4ae680cf459
10,704
java
Java
ftest/src/test/java/org/searchisko/ftest/rest/ContentRestServiceTest.java
JLLeitschuh/searchisko
3d79565d1917a1fa45793c3c3ae4d78d1ebc7444
[ "Apache-2.0" ]
15
2015-03-22T13:04:45.000Z
2020-05-06T08:21:07.000Z
ftest/src/test/java/org/searchisko/ftest/rest/ContentRestServiceTest.java
JLLeitschuh/searchisko
3d79565d1917a1fa45793c3c3ae4d78d1ebc7444
[ "Apache-2.0" ]
114
2015-01-06T10:01:06.000Z
2022-01-21T23:21:17.000Z
ftest/src/test/java/org/searchisko/ftest/rest/ContentRestServiceTest.java
JLLeitschuh/searchisko
3d79565d1917a1fa45793c3c3ae4d78d1ebc7444
[ "Apache-2.0" ]
5
2015-07-03T02:09:12.000Z
2020-02-11T15:49:38.000Z
38.642599
117
0.756353
9,456
/* * JBoss, Home of Professional Open Source * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors * as indicated by the @authors tag. All rights reserved. */ package org.searchisko.ftest.rest; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; import org.searchisko.api.security.Role; import org.searchisko.api.service.ContentManipulationLockService; import org.searchisko.ftest.DeploymentHelpers; import org.searchisko.ftest.ProviderModel; import com.jayway.restassured.http.ContentType; import static com.jayway.restassured.RestAssured.given; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isOneOf; import static org.hamcrest.Matchers.not; import static org.searchisko.ftest.rest.RestTestHelpers.givenJsonAndLogIfFailsAndAuthPreemptive; /** * Integration tests for {@link org.searchisko.api.rest.ContentRestService} REST API * <p/> * see http://docs.jbossorg.apiary.io/#contentmanipulationapi * * @author Libor Krzyzanek * @see org.searchisko.api.rest.ContentRestService */ @RunWith(Arquillian.class) public class ContentRestServiceTest { public static final Set<String> ALLOWED_ROLES = new HashSet<>(); static { ALLOWED_ROLES.add(Role.ADMIN); ALLOWED_ROLES.add(Role.PROVIDER); } public static final String CONTENT_REST_API_BASE = DeploymentHelpers.CURRENT_REST_VERSION + "content/{type}/"; public static final String CONTENT_REST_API = CONTENT_REST_API_BASE + "{contentId}"; public static final String TYPE1 = "provider1_blog"; public static final String TYPE2 = "provider2_issue"; @ArquillianResource protected URL context; @Deployment(testable = false) public static WebArchive createDeployment() throws IOException { return DeploymentHelpers.createDeployment(); } @Test @InSequence(0) public void assertBasicAuthHeader() throws MalformedURLException { int expStatus = 401; given().pathParam("type", TYPE1).pathParam("contentId", "test").contentType(ContentType.JSON).body("{}").expect() .statusCode(expStatus).header("WWW-Authenticate", "Basic realm=\"Insert Provider's username and password\"") .log().ifStatusCodeMatches(is(not(expStatus))).when().post(new URL(context, CONTENT_REST_API).toExternalForm()); } @Test @InSequence(1) public void assertNotAuthenticated() throws MalformedURLException { assertAccess(401, null, null); } @Test @InSequence(2) public void assertForbidden() throws MalformedURLException { for (String role : Role.ALL_ROLES) { if (!ALLOWED_ROLES.contains(role)) { assertAccess(403, role, role); } } } public void assertAccess(int expStatus, String username, String password) throws MalformedURLException { // POST /content/type/id givenJsonAndLogIfFailsAndAuthPreemptive(username, password) .pathParam("type", TYPE1).pathParam("contentId", "id").contentType(ContentType.JSON).body("{}") .expect().statusCode(expStatus) .when().post(new URL(context, CONTENT_REST_API).toExternalForm()); // POST /content/type/ givenJsonAndLogIfFailsAndAuthPreemptive(username, password) .pathParam("type", TYPE1).contentType(ContentType.JSON).body("{}").expect().statusCode(expStatus) .when().post(new URL(context, CONTENT_REST_API_BASE).toExternalForm()); // DELETE /content/type/ givenJsonAndLogIfFailsAndAuthPreemptive(username, password) .pathParam("type", TYPE1).contentType(ContentType.JSON).body("{}") .expect().statusCode(expStatus) .when().delete(new URL(context, CONTENT_REST_API_BASE).toExternalForm()); // DELETE /content/type/id givenJsonAndLogIfFailsAndAuthPreemptive(username, password) .pathParam("type", TYPE1).pathParam("contentId", "id").contentType(ContentType.JSON).body("{}") .expect().statusCode(expStatus) .when().delete(new URL(context, CONTENT_REST_API).toExternalForm()); } static ProviderModel provider1 = new ProviderModel("provider1", "password"); static ProviderModel provider2 = new ProviderModel("provider2", "password2"); @Test @InSequence(1) public void assertCreateProvider1BlogPost() throws MalformedURLException { provider1.addContentType(TYPE1, "blogpost", true); ProviderRestServiceTest.createNewProvider(context, provider1); } @Test @InSequence(2) public void assertCreateProvider2JiraIssue() throws MalformedURLException { provider2.addContentType(TYPE2, "issue", true); ProviderRestServiceTest.createNewProvider(context, provider2); } static final String contentId = "test-id"; public static void createOrUpdateContent(URL context, ProviderModel provider, String contentType, String contentId, Map<String, Object> content) throws MalformedURLException { given().pathParam("type", contentType).pathParam("contentId", contentId).contentType(ContentType.JSON).auth() .basic(provider.name, provider.password).body(content).expect().statusCode(200).contentType(ContentType.JSON) .log().ifValidationFails().body("status", isOneOf("insert", "update")) .body("message", isOneOf("Content inserted successfully.", "Content updated successfully.")).when() .post(new URL(context, CONTENT_REST_API).toExternalForm()); given().pathParam("type", contentType).pathParam("contentId", contentId).contentType(ContentType.JSON).expect() .statusCode(200).contentType(ContentType.JSON).log().ifValidationFails() .body("sys_id", is(contentType + "-" + contentId)).body("sys_content_id", is(contentId)).when() .get(new URL(context, CONTENT_REST_API).toExternalForm()); } @Test @InSequence(10) public void assertPushContentWithId() throws MalformedURLException { Map<String, Object> content = new HashMap<>(); content.put("data", "test"); createOrUpdateContent(context, provider1, TYPE1, contentId, content); } @Test @InSequence(11) public void assertRefreshES() throws MalformedURLException { DeploymentHelpers.refreshES(); } @Test @InSequence(12) public void assertGetAll() throws MalformedURLException { given().pathParam("type", TYPE1).contentType(ContentType.JSON).expect().statusCode(200) .contentType(ContentType.JSON).log().ifValidationFails().body("total", is(1)).body("hits[0].id", is(contentId)) .when().get(new URL(context, CONTENT_REST_API_BASE).toExternalForm()); } @Test @InSequence(13) public void assertUpdateContentWithId() throws MalformedURLException { Map<String, Object> content = new HashMap<>(); content.put("data", "test"); createOrUpdateContent(context, provider1, TYPE1, contentId, content); } @Test @InSequence(20) public void assertDeleteSecurity() throws MalformedURLException { // provider 2 cannot delete content from provider 1 given().pathParam("type", TYPE1).contentType(ContentType.JSON).auth().basic(provider2.name, provider2.password) .body("{\"id\":[\"" + contentId + "\"]}").expect().statusCode(403).contentType(ContentType.JSON).log() .ifStatusCodeMatches(is(not(403))).when().delete(new URL(context, CONTENT_REST_API_BASE).toExternalForm()); } public static void deleteContent(URL context, ProviderModel provider, String contentType, String contentId) throws MalformedURLException { given().pathParam("type", contentType).contentType(ContentType.JSON).auth().basic(provider.name, provider.password) .body("{\"id\":[\"" + contentId + "\"]}").expect().statusCode(200).contentType(ContentType.JSON) .body(contentId, is("ok")).log().ifValidationFails().when() .delete(new URL(context, CONTENT_REST_API_BASE).toExternalForm()); given().pathParam("type", contentType).pathParam("contentId", contentId).contentType(ContentType.JSON).expect() .statusCode(404).log().ifStatusCodeMatches(is(not(404))).when() .get(new URL(context, CONTENT_REST_API).toExternalForm()); } @Test @InSequence(21) public void assertDelete() throws MalformedURLException { deleteContent(context, provider1, TYPE1, contentId); } @Test @InSequence(22) public void assertRefreshES2() throws MalformedURLException { DeploymentHelpers.refreshES(); } @Test @InSequence(30) public void assertPushContentWithId2() throws MalformedURLException { Map<String, Object> content = new HashMap<>(); content.put("data2", "test2"); createOrUpdateContent(context, provider1, TYPE1, contentId, content); } @Test @InSequence(31) public void assertDeleteAsSuperProvider() throws MalformedURLException { deleteContent(context, DeploymentHelpers.DEFAULT_PROVIDER, TYPE1, contentId); } // ///////////////////////////// issue #109 - Content manipulation lock handling @Test @InSequence(40) public void assertContentAPILockForProvider() throws MalformedURLException { ProviderRestServiceTest.cmLockCreate(context, provider1.name, DeploymentHelpers.DEFAULT_PROVIDER_NAME, DeploymentHelpers.DEFAULT_PROVIDER_PASSWORD); Map<String, Object> content = new HashMap<>(); content.put("data", "test"); // API blocked for provider 1 given().pathParam("type", TYPE1).pathParam("contentId", contentId).contentType(ContentType.JSON).auth() .basic(provider1.name, provider1.password).body(content).expect().statusCode(503).log().ifValidationFails() .when().post(new URL(context, CONTENT_REST_API).toExternalForm()); // API works for provider 2 createOrUpdateContent(context, provider2, TYPE2, contentId, content); } @Test @InSequence(41) public void assertContentAPILockForAll() throws MalformedURLException { ProviderRestServiceTest.cmLockCreate(context, ContentManipulationLockService.API_ID_ALL, DeploymentHelpers.DEFAULT_PROVIDER_NAME, DeploymentHelpers.DEFAULT_PROVIDER_PASSWORD); Map<String, Object> content = new HashMap<>(); content.put("data", "test"); // API blocked for provider 1 given().pathParam("type", TYPE1).pathParam("contentId", contentId).contentType(ContentType.JSON).auth() .basic(provider1.name, provider1.password).body(content).expect().statusCode(503).log().ifValidationFails() .when().post(new URL(context, CONTENT_REST_API).toExternalForm()); // API blocked for provider 2 given().pathParam("type", TYPE2).pathParam("contentId", contentId).contentType(ContentType.JSON).auth() .basic(provider2.name, provider2.password).body(content).expect().statusCode(503).log().ifValidationFails() .when().post(new URL(context, CONTENT_REST_API).toExternalForm()); } }
3e16370d5fc77446156f0e3d8979cdea7a7912f3
319
java
Java
app/src/main/java/com/example/productexpo/modules/product_details/ProductDetailsView.java
SachinR90/ProductExposition
ba1cf6fbd45a63a83a0349decf5cde5fc19eee88
[ "Apache-2.0" ]
2
2017-09-19T06:54:29.000Z
2017-09-24T00:01:33.000Z
app/src/main/java/com/example/productexpo/modules/product_details/ProductDetailsView.java
SachinR90/ProductExposition
ba1cf6fbd45a63a83a0349decf5cde5fc19eee88
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/productexpo/modules/product_details/ProductDetailsView.java
SachinR90/ProductExposition
ba1cf6fbd45a63a83a0349decf5cde5fc19eee88
[ "Apache-2.0" ]
null
null
null
24.538462
70
0.805643
9,457
package com.example.productexpo.modules.product_details; import com.example.productexpo.entities.Product; import com.example.productexpo.modules.base.fragment.BaseFragmentView; /** * Created on 9/17/2017. */ public interface ProductDetailsView extends BaseFragmentView { void updateContent(Product product); }
3e1637e2251c018cb12f90f4b037523427db5694
4,118
java
Java
sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
NathanYuchi/FordRealFiesta
cdf71464801267a17e5abecd94944b25ce65834e
[ "BSD-3-Clause" ]
1
2019-02-28T01:17:03.000Z
2019-02-28T01:17:03.000Z
sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
NathanYuchi/FordRealFiesta
cdf71464801267a17e5abecd94944b25ce65834e
[ "BSD-3-Clause" ]
null
null
null
sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
NathanYuchi/FordRealFiesta
cdf71464801267a17e5abecd94944b25ce65834e
[ "BSD-3-Clause" ]
null
null
null
27.637584
151
0.545168
9,458
package com.smartdevicelink.proxy.rpc; import android.support.annotation.NonNull; import com.smartdevicelink.proxy.RPCStruct; import java.util.Hashtable; /** * Specifies the version number of the SDL V4 interface. This is used by both the application and SDL to declare what interface version each is using. * <p><b> Parameter List</b></p> * <table border="1" rules="all"> * <tr> * <th>Name</th> * <th>Type</th> * <th>Description</th> * <th>SmartDeviceLink Ver. Available</th> * </tr> * <tr> * <td>majorVersion</td> * <td>Integer</td> * <td> * <ul> * <li>minvalue="1"</li> * <li>maxvalue="10"</li> * </ul> * </td> * <td>SmartDeviceLink 1.0</td> * </tr> * <tr> * <td>minorVersion</td> * <td>Integer</td> * <td> * <ul> * <li>minvalue="0"</li> * <li>maxvalue="1000"</li> * </ul> * </td> * <td>SmartDeviceLink 1.0</td> * </tr> * </table> * @since SmartDeviceLink 1.0 */ public class SdlMsgVersion extends RPCStruct { public static final String KEY_MAJOR_VERSION = "majorVersion"; public static final String KEY_MINOR_VERSION = "minorVersion"; public static final String KEY_PATCH_VERSION = "patchVersion"; /** * Constructs a newly allocated SdlMsgVersion object */ public SdlMsgVersion() { } /** * Constructs a newly allocated SdlMsgVersion object indicated by the Hashtable parameter * @param hash The Hashtable to use */ public SdlMsgVersion(Hashtable<String, Object> hash) { super(hash); } /** * Get major version * <ul> * <li>minvalue="1"</li> * <li>maxvalue="10"</li> * </ul> * @return the major version */ /** * Constructs a newly allocated SdlMsgVersion object * @param majorVersion minvalue="1" and maxvalue="10" * @param minorVersion min: 0; max: 1000 */ public SdlMsgVersion(@NonNull Integer majorVersion, @NonNull Integer minorVersion) { this(); setMajorVersion(majorVersion); setMinorVersion(minorVersion); } @Override public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) { if(getPatchVersion() == null){ setPatchVersion(0); } super.format(rpcVersion,formatParams); } public Integer getMajorVersion() { return getInteger( KEY_MAJOR_VERSION ); } /** * Set major version * <ul> * <li>minvalue="1"</li> * <li>maxvalue="10"</li> * </ul> * @param majorVersion minvalue="1" and maxvalue="10" */ public void setMajorVersion( @NonNull Integer majorVersion ) { setValue(KEY_MAJOR_VERSION, majorVersion); } /** * Get minor version * <ul> * <li>minvalue="0"</li> * <li>maxvalue="1000"</li> * </ul> * @return the minor version */ public Integer getMinorVersion() { return getInteger( KEY_MINOR_VERSION ); } /** * Set minor version * <ul> * <li>minvalue="0"</li> * <li>maxvalue="1000"</li> * </ul> * @param minorVersion min: 0; max: 1000 */ public void setMinorVersion( @NonNull Integer minorVersion ) { setValue(KEY_MINOR_VERSION, minorVersion); } /** * Get patch version * <ul> * <li>minvalue="0"</li> * <li>maxvalue="1000"</li> * </ul> * @return the patch version */ public Integer getPatchVersion() { return getInteger( KEY_PATCH_VERSION ); } /** * Set patch version * <ul> * <li>minvalue="0"</li> * <li>maxvalue="1000"</li> * </ul> * @param patchVersion min: 0; max: 1000 */ public void setPatchVersion( Integer patchVersion ) { setValue(KEY_PATCH_VERSION, patchVersion); } }
3e1637ea4a4cd5353095abebf965b817e28fe43c
799
java
Java
digital-release-tracker/src/main/java/com/kociszewski/moviekeeper/infrastructure/ReleaseRefreshScheduler.java
matty-matt/movie-keeper-core
c062a22249d6e0f8746855abd5029c2c23b30604
[ "MIT" ]
3
2020-11-04T21:34:21.000Z
2022-03-24T22:09:47.000Z
digital-release-tracker/src/main/java/com/kociszewski/moviekeeper/infrastructure/ReleaseRefreshScheduler.java
matty-matt/movie-keeper-core
c062a22249d6e0f8746855abd5029c2c23b30604
[ "MIT" ]
null
null
null
digital-release-tracker/src/main/java/com/kociszewski/moviekeeper/infrastructure/ReleaseRefreshScheduler.java
matty-matt/movie-keeper-core
c062a22249d6e0f8746855abd5029c2c23b30604
[ "MIT" ]
null
null
null
30.730769
78
0.790989
9,459
package com.kociszewski.moviekeeper.infrastructure; import com.kociszewski.moviekeeper.domain.commands.CreateRefreshMoviesCommand; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.axonframework.commandhandling.gateway.CommandGateway; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.UUID; @Component @Slf4j @RequiredArgsConstructor public class ReleaseRefreshScheduler { private final CommandGateway commandGateway; @Scheduled(initialDelay = 10000, fixedDelay = 60000) public void refreshUnseenMovies() { log.info("Refreshing not seen movies!"); commandGateway.send( new CreateRefreshMoviesCommand(UUID.randomUUID().toString())); } }
3e163849979dfbef7b94b4c488cf15936dd1849e
56
java
Java
org.f8n.reflect/src/org/f8n/reflect/package-info.java
mjameson-se/foundation
f6c29d6d016ad0b0fdfbf631425f37256c91189d
[ "Unlicense" ]
null
null
null
org.f8n.reflect/src/org/f8n/reflect/package-info.java
mjameson-se/foundation
f6c29d6d016ad0b0fdfbf631425f37256c91189d
[ "Unlicense" ]
null
null
null
org.f8n.reflect/src/org/f8n/reflect/package-info.java
mjameson-se/foundation
f6c29d6d016ad0b0fdfbf631425f37256c91189d
[ "Unlicense" ]
null
null
null
14
24
0.696429
9,460
/** * Reflection utilities */ package org.f8n.reflect;
3e163851b2ddbc286f02865469ae370c939c1e96
450
java
Java
src/main/java/xyz/yuanjin/project/common/annotation/ExcelColumn.java
yuanjin8023/jinn-common
f9e28b41112a3e5e8d3b7ee799e8251b7b143b83
[ "MIT" ]
1
2020-07-12T15:12:38.000Z
2020-07-12T15:12:38.000Z
src/main/java/xyz/yuanjin/project/common/annotation/ExcelColumn.java
JavaCodeFish/jinn-common
f9e28b41112a3e5e8d3b7ee799e8251b7b143b83
[ "MIT" ]
1
2022-01-27T16:22:43.000Z
2022-01-27T16:22:43.000Z
src/main/java/xyz/yuanjin/project/common/annotation/ExcelColumn.java
yuanjin8023/jinn-common
f9e28b41112a3e5e8d3b7ee799e8251b7b143b83
[ "MIT" ]
null
null
null
15
54
0.622222
9,461
package xyz.yuanjin.project.common.annotation; import xyz.yuanjin.project.common.enums.ExcelCellEnum; import java.lang.annotation.*; /** * @author yuanjin */ @Documented @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface ExcelColumn { /** * 列明 * * @return {String} */ String value() default ""; /** * 单元格所属列 * * @return {String} */ ExcelCellEnum cell(); }
3e16389c0ce458e5421490f1fa67415d26995072
478
java
Java
app/util/LangUtil.java
kholland950/code-share
69a52996e23d269f1671749c0000dfb9e1757a0b
[ "Apache-2.0" ]
null
null
null
app/util/LangUtil.java
kholland950/code-share
69a52996e23d269f1671749c0000dfb9e1757a0b
[ "Apache-2.0" ]
null
null
null
app/util/LangUtil.java
kholland950/code-share
69a52996e23d269f1671749c0000dfb9e1757a0b
[ "Apache-2.0" ]
null
null
null
18.384615
72
0.460251
9,462
package util; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author kevinholland */ public class LangUtil { public static final List<String> supportedLanguages = Arrays.asList( "C", "C++", "CSS", "HTML", "Java", "JavaScript", "Objective-C", "Python", "Ruby", "SQL", "Swift", "XML" ); }
3e16393039fe1d8a1e5c24ea43d1d56a39d1a798
56
java
Java
CS309_Lab/Assign4/di-assignment-20/src/test/java/testclass/EImpl.java
zc-BEAR/Projs_repo
bbbcc83992f3e837dfb21615bb8e81d86f397f83
[ "MIT" ]
2
2021-09-26T02:51:17.000Z
2021-11-12T04:08:08.000Z
CS309-OOAD/Assignment/Assignment5/src/testclass/EImpl.java
NYH-Dolphin/SUSTech-Course-Info
448566068dcd1e9676b3f3e8f99df32ea57dced0
[ "MIT" ]
null
null
null
CS309-OOAD/Assignment/Assignment5/src/testclass/EImpl.java
NYH-Dolphin/SUSTech-Course-Info
448566068dcd1e9676b3f3e8f99df32ea57dced0
[ "MIT" ]
null
null
null
11.2
33
0.767857
9,463
package testclass; public class EImpl implements E { }
3e163977f05022a1aafe13ce6a92b8f38ddadea4
3,431
java
Java
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VuforiaTesting.java
hortonvilleroboticsben/ftc-app_v3.5
89d7f1e031c607dda3890e38919bfb27b7e42861
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VuforiaTesting.java
hortonvilleroboticsben/ftc-app_v3.5
89d7f1e031c607dda3890e38919bfb27b7e42861
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VuforiaTesting.java
hortonvilleroboticsben/ftc-app_v3.5
89d7f1e031c607dda3890e38919bfb27b7e42861
[ "MIT" ]
null
null
null
51.067568
418
0.779836
9,464
/* Copyright (c) 2017 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.navigation.RelicRecoveryVuMark; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables; //@Autonomous(name="VuforiaTesting", group ="Concept") public class VuforiaTesting extends StateMachine_v5 { VuforiaLocalizer vl; VuforiaTrackable relicTemplate; @Override public void init(){ super.init(); int vuforiaID = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName()); VuforiaLocalizer.Parameters params = new VuforiaLocalizer.Parameters(vuforiaID); params.vuforiaLicenseKey = "74t3tndxag9o7h0890bnpfzh4olk2h9x"; params.cameraDirection = VuforiaLocalizer.CameraDirection.BACK; this.vl = ClassFactory.createVuforiaLocalizer(params); VuforiaTrackables relicTrackables = this.vl.loadTrackablesFromAsset("RelicVuMark"); relicTemplate = relicTrackables.get(0); relicTrackables.activate(); } @Override public void loop(){ set_power(mtrLeftDrive, gamepad1.left_stick_y); set_power(mtrRightDrive, gamepad1.right_stick_x); RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(relicTemplate); if(vuMark != RelicRecoveryVuMark.UNKNOWN){ telemetry.addData("Card", "%s", vuMark); }else{ telemetry.addData("Card", "Not Visible"); } } }
3e1639aa0766fe8eba0854d9b20ee4449a904d0c
2,088
java
Java
spring/boot2-webflux-autoconfigure/src/test/java/com/linecorp/armeria/spring/web/reactive/ArmeriaWebClientWithRetryingClientTest.java
haithamgabr/armeria
0c30eec5bef655268681b06cfd7a7f661dcd9445
[ "Apache-2.0" ]
2
2021-12-22T01:14:30.000Z
2021-12-22T01:14:48.000Z
spring/boot2-webflux-autoconfigure/src/test/java/com/linecorp/armeria/spring/web/reactive/ArmeriaWebClientWithRetryingClientTest.java
haithamgabr/armeria
0c30eec5bef655268681b06cfd7a7f661dcd9445
[ "Apache-2.0" ]
null
null
null
spring/boot2-webflux-autoconfigure/src/test/java/com/linecorp/armeria/spring/web/reactive/ArmeriaWebClientWithRetryingClientTest.java
haithamgabr/armeria
0c30eec5bef655268681b06cfd7a7f661dcd9445
[ "Apache-2.0" ]
null
null
null
41.76
108
0.590517
9,465
/* * Copyright 2020 LINE Corporation * * LINE Corporation licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.linecorp.armeria.spring.web.reactive; import org.junit.jupiter.api.Test; import org.springframework.web.reactive.function.client.WebClient; import com.linecorp.armeria.client.retry.RetryRule; import com.linecorp.armeria.client.retry.RetryingClient; import com.linecorp.armeria.internal.testing.AnticipatedException; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; class ArmeriaWebClientWithRetryingClientTest { @Test void exceptionPropagated() { final WebClient client = WebClient.builder() .clientConnector(new ArmeriaClientHttpConnector(builder -> builder .decorator((delegate, ctx, req) -> { throw new AnticipatedException(); }) .decorator(RetryingClient.newDecorator( RetryRule.builder().thenNoRetry())))) .build(); final Flux<String> body = client.get() .uri("http://127.0.0.1/hello") .retrieve() .bodyToFlux(String.class); StepVerifier.create(body) .expectError(AnticipatedException.class) .verify(); } }
3e1639dff2c015fe6b2d25e83b0d95eabf663e2d
878
java
Java
src/test/java/com/example/lcpjava/array/Lcp_1041_Robot_Bounded_In_CircleTest.java
soranolan/lcpjava
faf2ba3798d1acbdee15e1eb5ce4b319790a3ec1
[ "MIT" ]
null
null
null
src/test/java/com/example/lcpjava/array/Lcp_1041_Robot_Bounded_In_CircleTest.java
soranolan/lcpjava
faf2ba3798d1acbdee15e1eb5ce4b319790a3ec1
[ "MIT" ]
null
null
null
src/test/java/com/example/lcpjava/array/Lcp_1041_Robot_Bounded_In_CircleTest.java
soranolan/lcpjava
faf2ba3798d1acbdee15e1eb5ce4b319790a3ec1
[ "MIT" ]
null
null
null
21.95
80
0.750569
9,466
package com.example.lcpjava.array; import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Test; class Lcp_1041_Robot_Bounded_In_CircleTest { @Test void test_case_1() { Lcp_1041_Robot_Bounded_In_Circle lcp = new Lcp_1041_Robot_Bounded_In_Circle(); String instructions = "GGLLGG"; boolean test = lcp.isRobotBounded(instructions); assertThat(test).isTrue(); } @Test void test_case_2() { Lcp_1041_Robot_Bounded_In_Circle lcp = new Lcp_1041_Robot_Bounded_In_Circle(); String instructions = "GG"; boolean test = lcp.isRobotBounded(instructions); assertThat(test).isFalse(); } @Test void test_case_3() { Lcp_1041_Robot_Bounded_In_Circle lcp = new Lcp_1041_Robot_Bounded_In_Circle(); String instructions = "GL"; boolean test = lcp.isRobotBounded(instructions); assertThat(test).isTrue(); } }
3e163a0cd69463905ec730b0261dfa68d6599848
6,810
java
Java
oscm-app-extsvc-1-0/javasrc/org/oscm/app/v1_0/data/ProvisioningSettings.java
srinathjiinfotach/billingdevelopment
564e66593c9d272b8e04804410b633bc089aa203
[ "Apache-2.0" ]
56
2015-10-06T15:09:39.000Z
2021-08-09T01:18:03.000Z
oscm-app-extsvc-1-0/javasrc/org/oscm/app/v1_0/data/ProvisioningSettings.java
srinathjiinfotach/billingdevelopment
564e66593c9d272b8e04804410b633bc089aa203
[ "Apache-2.0" ]
845
2016-02-10T14:06:17.000Z
2020-10-20T07:44:09.000Z
oscm-app-extsvc-1-0/javasrc/org/oscm/app/v1_0/data/ProvisioningSettings.java
srinathjiinfotach/billingdevelopment
564e66593c9d272b8e04804410b633bc089aa203
[ "Apache-2.0" ]
41
2015-10-22T14:22:23.000Z
2022-03-18T07:55:15.000Z
31.238532
81
0.594126
9,467
/******************************************************************************* * * Copyright FUJITSU LIMITED 2017 * * Creation Date: 2012-08-06 * *******************************************************************************/ package org.oscm.app.v1_0.data; import java.io.Serializable; import java.util.HashMap; /** * Wrapper object for service parameters and configuration settings. Service * parameters are defined at the technical service for an application; values * for the parameters may be specified at subscriptions and evaluated by the * application. Configuration settings are the settings and values defined for * an application-specific service controller; they can also be evaluated by the * application. */ public class ProvisioningSettings extends ControllerSettings implements Serializable { private static final long serialVersionUID = 9161029657174458354L; private String locale; private HashMap<String, String> parameters; private String organizationId; private String organizationName; private String subscriptionId; private String besLoginURL; private ServiceUser requestingUser; /** * Constructs a new provisioning settings instance with the given service * parameters and controller configuration settings. The specified locale is * used for language-dependent strings. * * @param parameters * the service parameters, consisting of a key and a value each * @param configSettings * the configuration settings, consisting of a key and a value * each * @param locale * the language. Specify a language code as returned by * <code>getLanguage()</code> of <code>java.util.Locale</code>. */ public ProvisioningSettings(HashMap<String, String> parameters, HashMap<String, String> configSettings, String locale) { super(configSettings); this.parameters = parameters; this.locale = locale; } /** * Returns a list of the service parameters. * * @return the service parameters, consisting of a key and a value each */ public HashMap<String, String> getParameters() { return parameters; } /** * Sets the service parameters. * * @param parameters * the service parameters, consisting of a key and a value each */ public void setParameters(HashMap<String, String> parameters) { this.parameters = parameters; } /** * Returns the locale used for language-dependent strings. * * @return the language code */ public String getLocale() { return locale; } /** * Returns the identifier of the customer organization which created the * subscription. * * @return the organization ID */ public String getOrganizationId() { return organizationId; } /** * Sets the identifier of the customer organization which created the * subscription. * * @param organizationId * the organization ID */ public void setOrganizationId(String organizationId) { this.organizationId = organizationId; } /** * Returns the name of the customer organization which created the * subscription. * * @return the organization name */ public String getOrganizationName() { return organizationName; } /** * Sets the name of the customer organization which created the * subscription. * * @param organizationName * the organization name */ public void setOrganizationName(String organizationName) { this.organizationName = organizationName; } /** * Returns the name specified by the customer to identify the subscription. * * @return the subscription ID */ public String getSubscriptionId() { return subscriptionId; } /** * Returns the name specified by the customer to identify the subscription. * * @return the subscription ID */ public String getOriginalSubscriptionId() { int index = subscriptionId.indexOf("#"); if (index >= 0) { return subscriptionId.substring(0, index); } else { return subscriptionId; } } /** * Sets the name specified by the customer to identify the subscription. * * @param subscriptionId * the subscription ID */ public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } /** * Returns the platform's login page to which the application can redirect * users who need to log in. This value is set for the <code>LOGIN</code> * access types. * <p> * Typically, the login page is displayed when a user tries to directly * access the application before logging in to the platform first, or when a * user needs to log in again because his previous session has timed out. * * @return the login URL */ public String getBesLoginURL() { return besLoginURL; } /** * Sets the platform's login page to which the application can redirect * users who need to log in. This value is set for the <code>LOGIN</code> * access type. * <p> * Typically, the login page is displayed when a user tries to directly * access the application before logging in to the platform first, or when a * user needs to log in again because his previous session has timed out. * * @param loginUrl * the URL of the platform's login page */ public void setBesLoginUrl(String loginUrl) { this.besLoginURL = loginUrl; } /** * <p> * If APP calls createInstance() of the controller, returns the user who * requested the current provisioning operation. * </p> * * <p> * If a timer calls the controller to switch from one status to the other, * returns 'null'. * </p> * * @return the user or 'null' */ public ServiceUser getRequestingUser() { return requestingUser; } /** * Set the user who requested a the current provisioning operation. * * @param user * the user */ public void setRequestingUser(ServiceUser user) { this.requestingUser = user; } }
3e163a286ced84e61a65416bac9b2bd9301c853d
1,310
java
Java
domino/core/src/main/java/org/openntf/domino/extmgr/events/MailSendNoteEvent.java
perlausten/org.openntf.domino
62fbf0296608f8ceea4a89a4efc1b25138709734
[ "Apache-2.0" ]
36
2015-02-20T22:02:20.000Z
2022-02-14T10:19:47.000Z
domino/core/src/main/java/org/openntf/domino/extmgr/events/MailSendNoteEvent.java
perlausten/org.openntf.domino
62fbf0296608f8ceea4a89a4efc1b25138709734
[ "Apache-2.0" ]
106
2015-01-14T12:11:35.000Z
2022-02-12T07:37:56.000Z
domino/core/src/main/java/org/openntf/domino/extmgr/events/MailSendNoteEvent.java
perlausten/org.openntf.domino
62fbf0296608f8ceea4a89a4efc1b25138709734
[ "Apache-2.0" ]
37
2015-01-17T10:54:01.000Z
2022-03-12T02:05:32.000Z
31.95122
133
0.735878
9,468
/** * Copyright © 2013-2021 The OpenNTF Domino API Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openntf.domino.extmgr.events; import org.openntf.domino.extmgr.EMBridgeEventParams; public class MailSendNoteEvent extends AbstractEMBridgeEvent { private static EMBridgeEventParams[] params = { EMBridgeEventParams.From, EMBridgeEventParams.Flag, EMBridgeEventParams.Username }; @Override public EMBridgeEventParams[] getParams() { return params; } public MailSendNoteEvent() { super(EMEventIds.EM_MAILSENDNOTE.getId()); } public String getFrom() { return (String) getEventValuesMap().get(EMBridgeEventParams.From); } public int getFlags() { return (Integer) getEventValuesMap().get(EMBridgeEventParams.Flag); } }
3e163ab9ef3fa67675efb18198343037f6501acc
562
java
Java
src/main/java/com/oldlie/zshop/zshopvue/model/db/RolePermission.java
oldlie/z-shop-vue
a1085f828acf0b0b13ce3c4cac9d84cffb58407f
[ "MIT" ]
null
null
null
src/main/java/com/oldlie/zshop/zshopvue/model/db/RolePermission.java
oldlie/z-shop-vue
a1085f828acf0b0b13ce3c4cac9d84cffb58407f
[ "MIT" ]
2
2020-07-18T17:56:41.000Z
2022-02-19T04:37:41.000Z
src/main/java/com/oldlie/zshop/zshopvue/model/db/RolePermission.java
oldlie/z-shop-vue
a1085f828acf0b0b13ce3c4cac9d84cffb58407f
[ "MIT" ]
null
null
null
19.37931
45
0.725979
9,469
package com.oldlie.zshop.zshopvue.model.db; import lombok.*; import javax.persistence.Entity; import javax.persistence.Table; /** * @author oldlie * @date 2020/11/1 */ @AllArgsConstructor @Data @Entity @EqualsAndHashCode(callSuper = false) @NoArgsConstructor @Table(name = "t_role_permission") @ToString public class RolePermission extends BaseEo { public final static String RID = "rid"; public final static String PID = "pid"; public final static String ROLE = "role"; private long rid; private long pid; private String role; }
3e163ac1870e26d614348bb44ecdae7d0d5fd7ac
109
java
Java
src/com/fabyosk/strategy/Strategy.java
FabyoSK/strategy-design-pattern-java
3c72dbc89261a25f15764bdb661be2e51640e446
[ "MIT" ]
null
null
null
src/com/fabyosk/strategy/Strategy.java
FabyoSK/strategy-design-pattern-java
3c72dbc89261a25f15764bdb661be2e51640e446
[ "MIT" ]
null
null
null
src/com/fabyosk/strategy/Strategy.java
FabyoSK/strategy-design-pattern-java
3c72dbc89261a25f15764bdb661be2e51640e446
[ "MIT" ]
null
null
null
18.166667
47
0.752294
9,470
package com.fabyosk.strategy; public interface Strategy { public int doOperation(int num1, int num2); }
3e163b759a33ba85a8025592900f08c835489422
610
java
Java
src/model/transformations/Monochrome.java
jjz17/Image-Processor
df024629f31c434dfd383593a38c92410d5d54d6
[ "MIT" ]
null
null
null
src/model/transformations/Monochrome.java
jjz17/Image-Processor
df024629f31c434dfd383593a38c92410d5d54d6
[ "MIT" ]
null
null
null
src/model/transformations/Monochrome.java
jjz17/Image-Processor
df024629f31c434dfd383593a38c92410d5d54d6
[ "MIT" ]
null
null
null
27.727273
100
0.721311
9,471
package model.transformations; import model.image.IPixel; import model.image.RGBPixel; /** * Represents a color transformation which has the effect of converting images to a monochrome tone. */ public class Monochrome extends AColorTransformation { // applies the transformation to the given pixel @Override protected IPixel applyToPixel(IPixel pixel) { int red = pixel.getRedVal(); int green = pixel.getGreenVal(); int blue = pixel.getBlueVal(); int newRGBVal = (int) (0.2126 * red + 0.7152 * green + 0.0722 * blue); return new RGBPixel(newRGBVal, newRGBVal, newRGBVal); } }
3e163b94b852216286a9da91b7b7ade31c38a2ee
209
java
Java
server/src/main/java/com/designbystephen/game/GameRepository.java
designbystephen/quizboard
f7c981551b1119a8c4889311e12c88697508d3f9
[ "Apache-2.0" ]
null
null
null
server/src/main/java/com/designbystephen/game/GameRepository.java
designbystephen/quizboard
f7c981551b1119a8c4889311e12c88697508d3f9
[ "Apache-2.0" ]
null
null
null
server/src/main/java/com/designbystephen/game/GameRepository.java
designbystephen/quizboard
f7c981551b1119a8c4889311e12c88697508d3f9
[ "Apache-2.0" ]
null
null
null
20.9
67
0.784689
9,472
package com.designbystephen.game; import org.springframework.data.repository.CrudRepository; /** * Created by sysmiller on 3/14/17. */ public interface GameRepository extends CrudRepository<Game, Long>{ }
3e163c1ca4af4564d582ed00985bba768e67dfa7
2,213
java
Java
src/main/java/com/lisandro/birdwatching/controller/RegionController.java
lisandrofernandez/birdwatching
20b545d9eaf12dd10283f1faa219dd77374d95c1
[ "MIT" ]
null
null
null
src/main/java/com/lisandro/birdwatching/controller/RegionController.java
lisandrofernandez/birdwatching
20b545d9eaf12dd10283f1faa219dd77374d95c1
[ "MIT" ]
null
null
null
src/main/java/com/lisandro/birdwatching/controller/RegionController.java
lisandrofernandez/birdwatching
20b545d9eaf12dd10283f1faa219dd77374d95c1
[ "MIT" ]
null
null
null
33.029851
80
0.742431
9,473
/* * Copyright (c) 2020 Lisandro Fernandez * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.lisandro.birdwatching.controller; import java.util.List; import com.lisandro.birdwatching.dto.RegionDTO; import com.lisandro.birdwatching.service.RegionService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * Region rest controller. * * @author Lisandro Fernandez */ @RestController @RequestMapping(RegionController.BASE_URL) public class RegionController { public static final String BASE_URL = "/api/v1/regions"; private final RegionService regionService; /** * Constructs a {@link RegionController}. * * @param regionService used by the controller */ public RegionController (RegionService regionService) { this.regionService = regionService; } /** * Returns all regions data, requested by an HTTP GET request. * * @return of all regions data */ @GetMapping public List<RegionDTO> all() { return regionService.findAll(); } }
3e163c906d32a48b2c4f8c7bd282693d80083245
20,189
java
Java
src/Buynow.java
patroh/cbse-class-12-IP-project
ccc6dd8d41d1f4809b038d17a98120ccedc6abd2
[ "Apache-2.0" ]
null
null
null
src/Buynow.java
patroh/cbse-class-12-IP-project
ccc6dd8d41d1f4809b038d17a98120ccedc6abd2
[ "Apache-2.0" ]
null
null
null
src/Buynow.java
patroh/cbse-class-12-IP-project
ccc6dd8d41d1f4809b038d17a98120ccedc6abd2
[ "Apache-2.0" ]
1
2019-06-23T16:50:58.000Z
2019-06-23T16:50:58.000Z
53.837333
589
0.616821
9,474
import java.awt.Color; import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.awt.event.WindowEvent; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author king */ public class Buynow extends javax.swing.JFrame { /** * Creates new form buynow_frame */ public Buynow() { initComponents(); this.getContentPane().setBackground(Color.WHITE); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel8 = new javax.swing.JLabel(); jSeparator2 = new javax.swing.JSeparator(); jLabel9 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jLabel12 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel13 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("CHECKOUT"); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { formMouseEntered(evt); } }); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Project Pictures/snap_buynow_head.PNG"))); // NOI18N jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("jLabel2"); jLabel3.setText("X"); jLabel4.setText("jLabel4"); jLabel5.setText("="); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel6.setText("jLabel6"); jLabel7.setText("jLabel7"); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 0, 0)); jLabel8.setText("Delivery Information"); jLabel9.setText("Name:-"); jLabel10.setText("Address:-"); jLabel11.setText("State:-"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Andhra Pradesh", "Arunachal Pradesh", "Assam", "Bihar", "Chhattisgarh", "Goa", "Gujarat", "Haryana", "Himachal Pradesh", "Jammu & Kashmir", "Jharkhand", "Karnataka", "Kerala", "Madhya Pradesh", "Maharashtra", "Manipur", "Meghalaya", "Mizoram", "Nagaland", "Odisha", "Punjab", "Rajasthan", "Sikkim", "Tamil Nadu", "Telangana ", "Tripura", "Uttar Pradesh", "Uttrakhand", "West Bengal", "Andaman & Nicobar Islands", "Chandigarh", "Dadra & Nagar  Haveli", "Daman & Diu", "Lakshadweep", "Puducherry", "Delhi" })); jComboBox1.setSelectedIndex(-1 ); jComboBox1.setToolTipText(""); jLabel12.setText("City:-"); jLabel13.setText("Pin Code:-"); jTextField4.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTextField4KeyPressed(evt); } }); jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Project Pictures/proceedtopayment__snap.PNG"))); // NOI18N jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel14.setForeground(new java.awt.Color(153, 153, 153)); jLabel14.setText("You Pay."); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel15.setText("jLabel15"); jLabel16.setText("Mobile:-"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel8) .addGap(18, 18, 18) .addComponent(jSeparator2)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel12) .addComponent(jLabel11)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(0, 123, Short.MAX_VALUE))) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabel14) .addGap(18, 18, 18) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(93, 93, 93)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addGap(133, 133, 133) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel8) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel6) .addComponent(jLabel7)) .addGap(14, 14, 14) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(62, 62, 62) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13)) .addGap(26, 26, 26) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened String price=jLabel7.getText().substring(4); int h=Integer.parseInt(price); int i=Integer.parseInt(jLabel4.getText()); int total=h*i; String ttl=Integer.toString(total); jLabel6.setText("Rs. "+ttl); jLabel15.setText("Rs. "+ttl);// TODO add your handling code here: }//GEN-LAST:event_formWindowOpened private void formMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseEntered // TODO add your handling code here: }//GEN-LAST:event_formMouseEntered private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed close(); payment p=new payment(); p.jLabel3.setText(this.jLabel15.getText()); p.jLabel5.setText(this.jLabel2.getText()); p.jLabel6.setText(this.jLabel4.getText()); p.jLabel7.setText(this.jTextField1.getText()); p.jLabel8.setText(this.jTextField2.getText()); p.jLabel9.setText(this.jTextField3.getText()); p.jLabel10.setText(this.jComboBox1.getSelectedItem().toString()); p.jLabel11.setText(this.jTextField4.getText()); p.jLabel12.setText(this.jTextField5.getText()); p.jLabel5.setEnabled(true); p.setVisible(true);// TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed private void jTextField4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyPressed if(evt.getKeyCode()==KeyEvent.VK_ENTER) { jButton1.doClick(); } // TODO add your handling code here: }//GEN-LAST:event_jTextField4KeyPressed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Buynow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Buynow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Buynow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Buynow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Buynow().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JComboBox jComboBox1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; public static javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; public static javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; public static javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; // End of variables declaration//GEN-END:variables private void close() { WindowEvent winc=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winc); //To change body of generated methods, choose Tools | Templates. } }
3e163cd2f06b304e91416c1d283dd3a24395c852
821
java
Java
app/src/main/java/cn/joy/libs/bluetooth/profile/test/MainActivity.java
Joy-Whale/BluetoothProfile
b486149976c1976b0c0fb4414ccc62eda79bd6da
[ "Apache-2.0" ]
15
2016-06-28T11:54:53.000Z
2021-07-29T11:18:49.000Z
app/src/main/java/cn/joy/libs/bluetooth/profile/test/MainActivity.java
Joy-Whale/BluetoothProfile
b486149976c1976b0c0fb4414ccc62eda79bd6da
[ "Apache-2.0" ]
1
2016-07-01T06:50:13.000Z
2016-07-04T12:05:40.000Z
app/src/main/java/cn/joy/libs/bluetooth/profile/test/MainActivity.java
Joy-Whale/BluetoothProfile
b486149976c1976b0c0fb4414ccc62eda79bd6da
[ "Apache-2.0" ]
7
2016-06-30T06:11:39.000Z
2018-05-29T15:04:55.000Z
21.605263
57
0.711328
9,475
package cn.joy.libs.bluetooth.profile.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import butterknife.ButterKnife; import butterknife.OnClick; /** * ********************** * Author: J * Date: 2016/5/12 * Time: 12:36 * ********************** */ public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); } @OnClick(R.id.main_btn_service) void asService() { startActivity(new Intent(this, ServiceActivity.class)); } @OnClick(R.id.main_btn_client) void asClient() { startActivity(new Intent(this, ClientActivity.class)); } }
3e163d119d1fa82694baac7999665c6993f1f480
225
java
Java
src/test/java/com/learn/myrabbitmq/MyrabbitmqApplicationTests.java
TheLIGHTINGFLASH/myrabbitmq
3681b9d700b7708502f135a9f4b78dd1426e238c
[ "Apache-2.0" ]
1
2020-07-30T09:40:32.000Z
2020-07-30T09:40:32.000Z
src/test/java/com/learn/myrabbitmq/MyrabbitmqApplicationTests.java
TheLIGHTINGFLASH/myrabbitmq
3681b9d700b7708502f135a9f4b78dd1426e238c
[ "Apache-2.0" ]
null
null
null
src/test/java/com/learn/myrabbitmq/MyrabbitmqApplicationTests.java
TheLIGHTINGFLASH/myrabbitmq
3681b9d700b7708502f135a9f4b78dd1426e238c
[ "Apache-2.0" ]
null
null
null
16.071429
60
0.76
9,476
package com.learn.myrabbitmq; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class MyrabbitmqApplicationTests { @Test void contextLoads() { } }
3e163db8669b515d89c94ed52e32b17c0074fed2
330
java
Java
tests/bb/205/Test.java
ExtendJ/Regression-Tests
2cae0e2f444a78857980224f9c216edb6a29ece2
[ "BSD-3-Clause" ]
1
2022-02-25T09:20:47.000Z
2022-02-25T09:20:47.000Z
tests/bb/205/Test.java
ExtendJ/Regression-Tests
2cae0e2f444a78857980224f9c216edb6a29ece2
[ "BSD-3-Clause" ]
null
null
null
tests/bb/205/Test.java
ExtendJ/Regression-Tests
2cae0e2f444a78857980224f9c216edb6a29ece2
[ "BSD-3-Clause" ]
null
null
null
25.384615
94
0.687879
9,477
// Test case from BitBucket issue #205. // https://bitbucket.org/extendj/extendj/issues/205/type-propagation-fails-in-certain-rewrites // .result: COMPILE_PASS public class Test { static public class Container { public String o = "x"; } void foo(Container con) { ((String) ((Test.Container) con).o).length(); } }
3e163dbd76fb17d33b8772116430f9032dc3b2f1
394
java
Java
src/frontend/interfaces/worldview/package-info.java
AlexDukeBlue/VoogaSalad
fbbf061ce443c9a9b08a77353bf73d390eb29008
[ "MIT" ]
null
null
null
src/frontend/interfaces/worldview/package-info.java
AlexDukeBlue/VoogaSalad
fbbf061ce443c9a9b08a77353bf73d390eb29008
[ "MIT" ]
null
null
null
src/frontend/interfaces/worldview/package-info.java
AlexDukeBlue/VoogaSalad
fbbf061ce443c9a9b08a77353bf73d390eb29008
[ "MIT" ]
null
null
null
35.818182
78
0.769036
9,478
/** * The WorldView interfaces package specifies the externally-facing interfaces * for the WorldView classes that are created in the factory package. This * allows the classes in the factory package to be hidden, so that any * dependencies between them do not affect classes that use them through the * interfaces. * * @author Dylan Peters * */ package frontend.interfaces.worldview;
3e163e2d46cf6102b9b81b8fe78c85467a610bda
878
java
Java
Sigma 3.9/net/minecraft/util/ChatComponentTranslationFormatException.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
3
2022-02-28T17:34:51.000Z
2022-03-06T21:55:16.000Z
Sigma 3.9/net/minecraft/util/ChatComponentTranslationFormatException.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
2
2022-02-25T20:10:14.000Z
2022-03-03T14:25:03.000Z
Sigma 3.9/net/minecraft/util/ChatComponentTranslationFormatException.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
null
null
null
39.909091
115
0.73918
9,479
package net.minecraft.util; public class ChatComponentTranslationFormatException extends IllegalArgumentException { /** * */ private static final long serialVersionUID = 1L; private static final String __OBFID = "CL_00001271"; public ChatComponentTranslationFormatException(ChatComponentTranslation component, String message) { super(String.format("Error parsing: %s: %s", new Object[]{component, message})); } public ChatComponentTranslationFormatException(ChatComponentTranslation component, int index) { super(String.format("Invalid index %d requested for %s", new Object[]{Integer.valueOf(index), component})); } public ChatComponentTranslationFormatException(ChatComponentTranslation component, Throwable cause) { super(String.format("Error while parsing: %s", new Object[]{component}), cause); } }
3e163ff5127213ad318c292ad8d9be3b410bf123
8,901
java
Java
src/main/java/io/swagger/client/api/GeometryImportApi.java
jlsnell/natural-voice-sdk-java
9b28d6199dc261dea007a8391679b7fff9819351
[ "Apache-2.0" ]
null
null
null
src/main/java/io/swagger/client/api/GeometryImportApi.java
jlsnell/natural-voice-sdk-java
9b28d6199dc261dea007a8391679b7fff9819351
[ "Apache-2.0" ]
null
null
null
src/main/java/io/swagger/client/api/GeometryImportApi.java
jlsnell/natural-voice-sdk-java
9b28d6199dc261dea007a8391679b7fff9819351
[ "Apache-2.0" ]
null
null
null
48.375
323
0.718459
9,480
/* * Natural Voice SDK * Natural Voice SDKs are easiest and best supported way for most developers to quickly build and iterate Natural Voice applications that integrate with our services programmatically. * * OpenAPI spec version: 1.2.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package io.swagger.client.api; import io.swagger.client.ApiCallback; import io.swagger.client.ApiClient; import io.swagger.client.ApiException; import io.swagger.client.ApiResponse; import io.swagger.client.Configuration; import io.swagger.client.Pair; import io.swagger.client.ProgressRequestBody; import io.swagger.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import io.swagger.client.model.GeometryCollection; import io.swagger.client.model.Response; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class GeometryImportApi { private ApiClient apiClient; public GeometryImportApi() { this(Configuration.getDefaultApiClient()); } public GeometryImportApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Build call for insightsGeometryImportPost * @param body A [geometry collection](https://geojson.org/geojson-spec.html#geometrycollection) standard format and the request must specified content type as *application/geo+json* (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call insightsGeometryImportPostCall(GeometryCollection body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/insights/GeometryImport"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/geo+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call insightsGeometryImportPostValidateBeforeCall(GeometryCollection body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling insightsGeometryImportPost(Async)"); } com.squareup.okhttp.Call call = insightsGeometryImportPostCall(body, progressListener, progressRequestListener); return call; } /** * Import vector geographic geometries * Use this API to import vector geographic geometries. This is a POST operation. The imported geometries will be used within our services such as free map and location lists. The imported geometries data must be a 2D [standard GeoJSON](https://geojson.org/geojson-spec.html). Altitude is not supported by our services. * @param body A [geometry collection](https://geojson.org/geojson-spec.html#geometrycollection) standard format and the request must specified content type as *application/geo+json* (required) * @return List&lt;String&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public List<String> insightsGeometryImportPost(GeometryCollection body) throws ApiException { ApiResponse<List<String>> resp = insightsGeometryImportPostWithHttpInfo(body); return resp.getData(); } /** * Import vector geographic geometries * Use this API to import vector geographic geometries. This is a POST operation. The imported geometries will be used within our services such as free map and location lists. The imported geometries data must be a 2D [standard GeoJSON](https://geojson.org/geojson-spec.html). Altitude is not supported by our services. * @param body A [geometry collection](https://geojson.org/geojson-spec.html#geometrycollection) standard format and the request must specified content type as *application/geo+json* (required) * @return ApiResponse&lt;List&lt;String&gt;&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<List<String>> insightsGeometryImportPostWithHttpInfo(GeometryCollection body) throws ApiException { com.squareup.okhttp.Call call = insightsGeometryImportPostValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken<List<String>>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Import vector geographic geometries (asynchronously) * Use this API to import vector geographic geometries. This is a POST operation. The imported geometries will be used within our services such as free map and location lists. The imported geometries data must be a 2D [standard GeoJSON](https://geojson.org/geojson-spec.html). Altitude is not supported by our services. * @param body A [geometry collection](https://geojson.org/geojson-spec.html#geometrycollection) standard format and the request must specified content type as *application/geo+json* (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call insightsGeometryImportPostAsync(GeometryCollection body, final ApiCallback<List<String>> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = insightsGeometryImportPostValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<List<String>>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }
3e16420bd1f5f1d04ce72e1dc6fa0b7b0fe4fe8e
1,782
java
Java
src/menus/Credits.java
LuposX/LetsCreateGame
81f3582e8e51ddf5e67e4294578d44f31850b946
[ "MIT" ]
4
2020-04-05T13:12:04.000Z
2020-04-06T20:50:38.000Z
src/menus/Credits.java
LuposX/LetsCreateGame
81f3582e8e51ddf5e67e4294578d44f31850b946
[ "MIT" ]
66
2020-04-04T16:19:05.000Z
2021-11-10T13:38:29.000Z
src/menus/Credits.java
LuposX/LetsCreateGame
81f3582e8e51ddf5e67e4294578d44f31850b946
[ "MIT" ]
1
2020-04-06T20:50:43.000Z
2020-04-06T20:50:43.000Z
31.821429
109
0.675084
9,481
package menus; import org.lwjgl.input.Mouse; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; public class Credits extends BasicGameState{ /* Credit Menu * ---------- * This State is the Credits Menu. You can see it when you press on "Credits" in the Main Menu. * It shows the Credits of the game. * * //TODO: Make it prettier, do some stuff in the BG e.g. like Minecraft Credits. */ public Credits(int credits) {} public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {} public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { // Here we render the different Credits String //TODO: There must be a better way than using absolute Cordinates. I think it also suck for "Resizability" g.drawString("Programmer: /", 300, 100); g.drawString("Level Designer: /", 300, 150); g.drawString("Director: /", 300, 200); g.drawString("Music & Sound: Little Robot Sound Factory", 300, 250); g.drawString("Texture: spriters-resource.com", 300, 300); g.drawString("Back", 30, 430); g.drawString("License: MIT", 780, 450); } public void update(GameContainer gc, StateBasedGame sbg, int t) throws SlickException { // Getting the current Mouse position int posX = Mouse.getX(); int posY = Mouse.getY(); // Back button // Check if the mouse presses the button if((posX > 25 && posX < 70) && (posY > 30 && posY < 55)){ if(Mouse.isButtonDown(0)){ // Going back to the Main Menu sbg.enterState(0); } } } public int getID() { return 1; } }
3e16437407f7d0ff6aa4e7304f5b31c4ac1d1eff
2,884
java
Java
src/main/java/com/qidao/qidao/msg/msgMenu/controller/CustomMsgMenuController.java
tzbgithub/keqidao
fb54cddac4105f5d25b62cdc67c791eae16b3aae
[ "MIT" ]
null
null
null
src/main/java/com/qidao/qidao/msg/msgMenu/controller/CustomMsgMenuController.java
tzbgithub/keqidao
fb54cddac4105f5d25b62cdc67c791eae16b3aae
[ "MIT" ]
null
null
null
src/main/java/com/qidao/qidao/msg/msgMenu/controller/CustomMsgMenuController.java
tzbgithub/keqidao
fb54cddac4105f5d25b62cdc67c791eae16b3aae
[ "MIT" ]
null
null
null
28
75
0.685853
9,482
package com.qidao.qidao.msg.msgMenu.controller; import com.qidao.framework.aspectj.lang.annotation.Log; import com.qidao.framework.aspectj.lang.enums.BusinessType; import com.qidao.framework.web.controller.BaseController; import com.qidao.framework.web.domain.AjaxResult; import com.qidao.framework.web.page.TableDataInfo; import com.qidao.qidao.msg.msgMenu.domain.MsgMenu; import com.qidao.qidao.msg.msgMenu.domain.MsgMenuListRes; import com.qidao.qidao.msg.msgMenu.service.CustomMsgMenuService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; @Controller @RequestMapping("/msg/menu") public class CustomMsgMenuController extends BaseController { private String prefix = "qidao/msg/menu" ; @Autowired private CustomMsgMenuService customMsgMenuService; /** * 查询消息菜单类型列表供添加消息使用 */ @GetMapping("/getList" ) @ResponseBody public List<MsgMenu> getList() { return customMsgMenuService.getMsgMenu(); } /** * 查询消息菜单类型列表 */ @RequiresPermissions("msg:menu:list" ) @PostMapping("/getList" ) @ResponseBody public TableDataInfo list() { startPage(); List<MsgMenuListRes> list = customMsgMenuService.findMsgMenuList(); return getDataTable(list); } /** * 上架 */ @RequiresPermissions("msg:menu:edit" ) @Log(title = "消息菜单类型" , businessType = BusinessType.UPDATE) @PutMapping("/open/{id}" ) @ResponseBody public AjaxResult open(@PathVariable("id") Long id) { return toAjax(customMsgMenuService.open(id)); } /** * 下架 */ @RequiresPermissions("msg:menu:edit" ) @Log(title = "消息菜单类型" , businessType = BusinessType.UPDATE) @PutMapping("/close/{id}" ) @ResponseBody public AjaxResult close(@PathVariable("id") Long id) { return toAjax(customMsgMenuService.close(id)); } /** * 查询消息菜单类型列表 */ @RequiresPermissions("msg:menu:list" ) @GetMapping("/getFather/{id}" ) @ResponseBody public List<MsgMenu> getFather(@PathVariable("id")Long id) { return customMsgMenuService.findFather(id); } /** * 修改保存消息菜单类型 */ @RequiresPermissions("msg:menu:edit" ) @Log(title = "消息菜单类型" , businessType = BusinessType.UPDATE) @PostMapping("/update" ) @ResponseBody public AjaxResult update(MsgMenu msgMenu) { return toAjax(customMsgMenuService.update(msgMenu)); } /** * 查询消息菜单类型列表 */ @RequiresPermissions("msg:menu:list" ) @PostMapping("/getSonByPid/{pid}" ) @ResponseBody public List<MsgMenu> getSonByPid(@PathVariable("pid")Long pid) { return customMsgMenuService.findSonByPid(pid); } }
3e164397af178aa4c947be50eb7a8aa7df607666
243
java
Java
src/main/java/pokecube/core/entity/pokemobs/AnimalChest.java
HeroBlindNation/Pokecube-Issues-and-Wiki
3a2fdaee6e58abb7ca2a0bf02a8f9a737f8ae443
[ "MIT" ]
24
2019-02-02T20:37:53.000Z
2022-02-09T13:51:41.000Z
src/main/java/pokecube/core/entity/pokemobs/AnimalChest.java
MetaltyrantMk2/Pokecube-Issues-and-Wiki
a64f19bcccc75db26d59d0c0cdd1d3d0ec59ea07
[ "MIT" ]
671
2018-08-20T08:46:35.000Z
2022-03-26T00:11:43.000Z
src/main/java/pokecube/core/entity/pokemobs/AnimalChest.java
MetaltyrantMk2/Pokecube-Issues-and-Wiki
a64f19bcccc75db26d59d0c0cdd1d3d0ec59ea07
[ "MIT" ]
68
2018-09-25T21:03:40.000Z
2022-02-25T19:59:51.000Z
17.357143
42
0.716049
9,483
package pokecube.core.entity.pokemobs; import net.minecraft.inventory.Inventory; public class AnimalChest extends Inventory { public static int INVENSIZE = 7; public AnimalChest() { super(AnimalChest.INVENSIZE); } }
3e1643aaa336c0f2906e965087bbcceedd56e5f7
1,007
java
Java
athing-component/athing-component-dmgr/athing-component-dmgr-core/src/main/java/com/github/ompc/athing/component/dmgr/core/DmgrThingComBoot.java
xiaoxiao-quick/athing
d894618df13404ffeae72a04ee6d89dfa8bf7736
[ "MIT" ]
null
null
null
athing-component/athing-component-dmgr/athing-component-dmgr-core/src/main/java/com/github/ompc/athing/component/dmgr/core/DmgrThingComBoot.java
xiaoxiao-quick/athing
d894618df13404ffeae72a04ee6d89dfa8bf7736
[ "MIT" ]
null
null
null
athing-component/athing-component-dmgr/athing-component-dmgr-core/src/main/java/com/github/ompc/athing/component/dmgr/core/DmgrThingComBoot.java
xiaoxiao-quick/athing
d894618df13404ffeae72a04ee6d89dfa8bf7736
[ "MIT" ]
null
null
null
28.971429
82
0.701183
9,484
package com.github.ompc.athing.component.dmgr.core; import com.github.ompc.athing.component.dmgr.core.impl.DmgrThingComImpl; import com.github.ompc.athing.standard.component.ThingCom; import com.github.ompc.athing.standard.thing.boot.BootOption; import com.github.ompc.athing.standard.thing.boot.ThingComBoot; import org.kohsuke.MetaInfServices; import java.util.Properties; import static javax.swing.UIManager.put; @MetaInfServices public class DmgrThingComBoot implements ThingComBoot { private final ThingCom thingCom = new DmgrThingComImpl(); @Override public Specifications getSpecifications() { //Properties a = new Properties(){{put("sss","dd");}}; return () -> new Properties() {{ put("AUTHOR", "efpyi@example.com"); put("VERSION", "1.0.0-SNAPSHOT"); put("DATE", "2020-12-02"); }}; } @Override public ThingCom bootUp(String productId, String thingId, BootOption bootOpt) { return thingCom; } }
3e1643cf5cf89014cf298b4e0f3e0aa35cd4a20b
2,971
java
Java
services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/RestStop.java
yiwenzhang666999/mapbox-java
39c79cf236c7c31767dc749726422be03dceb3e0
[ "MIT" ]
396
2016-04-18T22:08:25.000Z
2022-03-24T06:43:58.000Z
services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/RestStop.java
yiwenzhang666999/mapbox-java
39c79cf236c7c31767dc749726422be03dceb3e0
[ "MIT" ]
949
2016-04-18T22:22:57.000Z
2022-03-30T15:37:31.000Z
services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/RestStop.java
yiwenzhang666999/mapbox-java
39c79cf236c7c31767dc749726422be03dceb3e0
[ "MIT" ]
142
2016-04-20T06:01:32.000Z
2022-02-20T10:50:16.000Z
32.648352
97
0.711545
9,485
package com.mapbox.api.directions.v5.models; import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.TypeAdapter; import com.mapbox.api.directions.v5.DirectionsAdapterFactory; import com.mapbox.api.directions.v5.DirectionsCriteria; /** * An object containing information about passing rest stops along the route. * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. */ @AutoValue public abstract class RestStop extends DirectionsJsonObject { /** * The type of rest stop, either `rest_area` (includes parking only) or `service_area` * (includes amenities such as gas or restaurants). * Note that adding new possible types is not considered a breaking change. */ @Nullable public abstract String type(); /** * Create a new instance of this class by using the {@link Builder} class. * * @return this classes {@link Builder} for creating a new instance */ public static Builder builder() { return new AutoValue_RestStop.Builder(); } /** * Convert the current {@link RestStop} to its builder holding the currently assigned * values. This allows you to modify a single property and then rebuild the object resulting in * an updated and modified {@link RestStop}. * * @return a {@link Builder} with the same values set to match the ones defined in this {@link * RestStop} */ public abstract Builder toBuilder(); /** * Gson type adapter for parsing Gson to this class. * * @param gson the built {@link Gson} object * @return the type adapter for this class */ public static TypeAdapter<RestStop> typeAdapter(Gson gson) { return new AutoValue_RestStop.GsonTypeAdapter(gson); } /** * Create a new instance of this class by passing in a formatted valid JSON String. * * @param json a formatted valid JSON string defining an Incident * @return a new instance of this class defined by the values passed in the method */ public static RestStop fromJson(String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); return gson.create().fromJson(json, RestStop.class); } /** * This builder can be used to set the values describing the {@link RestStop}. */ @AutoValue.Builder public abstract static class Builder { /** * The type of rest stop, either `rest_area` (includes parking only) or `service_area` * (includes amenities such as gas or restaurants). * Note that adding new possible types is not considered a breaking change. * * @param type rest stop type */ public abstract Builder type(@Nullable String type); /** * Build a new {@link RestStop} object. * * @return a new {@link RestStop} using the provided values in this builder */ public abstract RestStop build(); } }
3e1644869df4f77a79ac0fa2b241086e791c2196
1,906
java
Java
src/main/java/com/activitystream/rofi/sources/EnvironmentSwitchParser.java
activitystream/rofi
8e2b432d337798e1f204b6ce1009816c59a3e82a
[ "MIT" ]
null
null
null
src/main/java/com/activitystream/rofi/sources/EnvironmentSwitchParser.java
activitystream/rofi
8e2b432d337798e1f204b6ce1009816c59a3e82a
[ "MIT" ]
null
null
null
src/main/java/com/activitystream/rofi/sources/EnvironmentSwitchParser.java
activitystream/rofi
8e2b432d337798e1f204b6ce1009816c59a3e82a
[ "MIT" ]
null
null
null
44.325581
133
0.716684
9,486
package com.activitystream.rofi.sources; import java.util.Arrays; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; public class EnvironmentSwitchParser { static final String NONE = "24234NONSDFWERWEE"; static final String ALL_SWITCHES = "*"; final List<String> enabledSwitches; final List<String> disabledSwitches; private final Function<String, String> getenv; public EnvironmentSwitchParser(Function<String, String> getenv) { this(getenv, NONE, NONE); } public EnvironmentSwitchParser(Function<String, String> getenv, String envVariableWithEnabled, String envVariableWithDisabled){ this.getenv = getenv; envVariableWithEnabled = getenv.apply(envVariableWithEnabled); envVariableWithDisabled = getenv.apply(envVariableWithDisabled); if (envVariableWithDisabled == null) envVariableWithDisabled = ""; if (envVariableWithEnabled == null) envVariableWithEnabled = ""; enabledSwitches = Arrays.asList(envVariableWithEnabled.split(",")).stream().map(String::trim).collect(Collectors.toList()); disabledSwitches = Arrays.asList(envVariableWithDisabled.split(",")).stream().map(String::trim).collect(Collectors.toList()); } public String switchValue(String switch_) { final String upperCaseValue = getenv.apply(switch_.toUpperCase()); final String value = getenv.apply(switch_); final boolean onDisabledList = disabledSwitches.indexOf(switch_) != -1; final boolean onEnabledList = enabledSwitches.indexOf(switch_) != -1; if (value != null) return value; if (upperCaseValue != null) return upperCaseValue; if (onDisabledList || disabledSwitches.indexOf(ALL_SWITCHES) > -1) return "0"; if (onEnabledList || enabledSwitches.indexOf(ALL_SWITCHES) > -1) return "1"; return null; } }
3e1645bfc1a947a9c3a5863b0f8804c4e1de8db6
1,126
java
Java
base/src/testFramework/java/tv/mechjack/twitchclient/TestTwitchUsersEndpoint.java
mechjacktv/mechjackbot
67eae2b3459436036096c9196074fe84b36008d7
[ "MIT" ]
1
2019-02-13T02:00:01.000Z
2019-02-13T02:00:01.000Z
base/src/testFramework/java/tv/mechjack/twitchclient/TestTwitchUsersEndpoint.java
mechjacktv/mechjackbot
67eae2b3459436036096c9196074fe84b36008d7
[ "MIT" ]
59
2018-10-20T20:44:52.000Z
2019-03-04T01:36:43.000Z
base/src/testFramework/java/tv/mechjack/twitchclient/TestTwitchUsersEndpoint.java
mechjacktv/mechjackbot
67eae2b3459436036096c9196074fe84b36008d7
[ "MIT" ]
1
2019-02-20T15:46:54.000Z
2019-02-20T15:46:54.000Z
33.117647
118
0.802842
9,487
package tv.mechjack.twitchclient; import java.util.Objects; import java.util.Set; import java.util.function.BiFunction; import javax.inject.Inject; import tv.mechjack.platform.utils.ExecutionUtils; import tv.mechjack.twitchclient.ProtoMessage.Users; public class TestTwitchUsersEndpoint implements TwitchUsersEndpoint { private final ExecutionUtils executionUtils; private BiFunction<Set<TwitchLogin>, Set<TwitchUserId>, Users> getUsersHandler; @Inject TestTwitchUsersEndpoint(final ExecutionUtils executionUtils) { this.executionUtils = executionUtils; this.getUsersHandler = (twitchLogins, twitchUserIds) -> Users.getDefaultInstance(); } @Override public Users getUsers(final Set<TwitchLogin> twitchLogins, final Set<TwitchUserId> twitchUserIds) { return this.getUsersHandler.apply(twitchLogins, twitchUserIds); } public final void setGetUsersHandler(final BiFunction<Set<TwitchLogin>, Set<TwitchUserId>, Users> getUsersHandler) { Objects.requireNonNull(getUsersHandler, this.executionUtils.nullMessageForName("getUsersHandler")); this.getUsersHandler = getUsersHandler; } }
3e1645cb5866b89915c131b34f955576b6add7c9
1,962
java
Java
theming/src/main/java/org/pushingpixels/radiance/theming/internal/utils/icon/TransitionAware.java
dpolivaev/radiance
89716f1bb195f64363160906b51e4f367ec16ca3
[ "BSD-3-Clause" ]
607
2018-05-23T19:11:22.000Z
2022-03-28T17:11:34.000Z
theming/src/main/java/org/pushingpixels/radiance/theming/internal/utils/icon/TransitionAware.java
dpolivaev/radiance
89716f1bb195f64363160906b51e4f367ec16ca3
[ "BSD-3-Clause" ]
379
2018-05-23T18:52:03.000Z
2022-03-28T11:07:05.000Z
theming/src/main/java/org/pushingpixels/radiance/theming/internal/utils/icon/TransitionAware.java
dpolivaev/radiance
89716f1bb195f64363160906b51e4f367ec16ca3
[ "BSD-3-Clause" ]
96
2018-05-26T04:53:09.000Z
2022-03-09T03:25:16.000Z
47.853659
80
0.766055
9,488
/* * Copyright (c) 2005-2021 Radiance Kirill Grouchnikov. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * o Neither the name of the copyright holder nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.pushingpixels.radiance.theming.internal.utils.icon; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface TransitionAware { }
3e1645fc96e34f4104794cbcf9403c63d2476c59
1,516
java
Java
src/main/java/org/elasticsearch/river/couchdb/kernel/index/ChangeCollector.java
rspective/elasticsearch-river-couchdb
35513fd1ff650c7bd0e01169bcdaf648ab50f273
[ "Apache-2.0" ]
1
2015-04-27T21:35:42.000Z
2015-04-27T21:35:42.000Z
src/main/java/org/elasticsearch/river/couchdb/kernel/index/ChangeCollector.java
rspective/elasticsearch-river-couchdb
35513fd1ff650c7bd0e01169bcdaf648ab50f273
[ "Apache-2.0" ]
null
null
null
src/main/java/org/elasticsearch/river/couchdb/kernel/index/ChangeCollector.java
rspective/elasticsearch-river-couchdb
35513fd1ff650c7bd0e01169bcdaf648ab50f273
[ "Apache-2.0" ]
null
null
null
35.255814
108
0.687995
9,489
package org.elasticsearch.river.couchdb.kernel.index; import static java.util.concurrent.TimeUnit.MILLISECONDS; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.common.Nullable; import org.elasticsearch.river.couchdb.IndexConfig; import java.util.concurrent.BlockingQueue; public class ChangeCollector { private final BlockingQueue<String> changesStream; private final ChangeProcessor changeProcessor; private final IndexConfig indexConfig; public ChangeCollector(BlockingQueue<String> changesStream, IndexConfig indexConfig, ChangeProcessor changeProcessor) { this.changesStream = changesStream; this.indexConfig = indexConfig; this.changeProcessor = changeProcessor; } @Nullable public Object collectAndProcessChanges(BulkRequestBuilder bulk) throws InterruptedException { String change = changesStream.take(); Object lineSeq = changeProcessor.processChange(change, bulk); Object lastSeq = lineSeq; // spin a bit to see if we can get some more changes while ((change = changesStream.poll(indexConfig.getBulkTimeout().millis(), MILLISECONDS)) != null) { lineSeq = changeProcessor.processChange(change, bulk); if (lineSeq != null) { lastSeq = lineSeq; } if (bulk.numberOfActions() >= indexConfig.getBulkSize()) { break; } } return lastSeq; } }
3e16460e18466246b03cffb71595961da426ab43
1,458
java
Java
services/port_manager/src/main/java/com/futurewei/alcor/portmanager/restclient/SubnetManagerRestClient.java
xieus/alcor
c15dc8513262a277de2d066776407449acc1668b
[ "Apache-2.0" ]
1
2021-04-15T15:53:34.000Z
2021-04-15T15:53:34.000Z
services/port_manager/src/main/java/com/futurewei/alcor/portmanager/restclient/SubnetManagerRestClient.java
xieus/alcor
c15dc8513262a277de2d066776407449acc1668b
[ "Apache-2.0" ]
null
null
null
services/port_manager/src/main/java/com/futurewei/alcor/portmanager/restclient/SubnetManagerRestClient.java
xieus/alcor
c15dc8513262a277de2d066776407449acc1668b
[ "Apache-2.0" ]
null
null
null
38.368421
93
0.727023
9,490
/* Copyright 2019 The Alcor Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.futurewei.alcor.portmanager.restclient; import com.futurewei.alcor.web.entity.subnet.SubnetWebJson; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @Configuration public class SubnetManagerRestClient extends AbstractRestClient { @Value("${microservices.subnet.service.url:#{\"\"}}") private String subnetManagerUrl; public SubnetWebJson getSubnetState(String projectId, String subnetId) throws Exception { String url = subnetManagerUrl + "/project/" + projectId + "/subnets/" + subnetId; SubnetWebJson subnetStateJson = restTemplate.getForObject(url, SubnetWebJson.class); if (subnetStateJson == null) { throw new Exception("Get subnet failed"); } return subnetStateJson; } }
3e1646cadf433cfacb3630813ddc4be93d99d9e2
519
java
Java
src/com/ufpt/SetMatrixZeros.java
spiky18/interview-practice
52b8bc1b6356576a0dd3f4913bf09296127a79ac
[ "MIT" ]
null
null
null
src/com/ufpt/SetMatrixZeros.java
spiky18/interview-practice
52b8bc1b6356576a0dd3f4913bf09296127a79ac
[ "MIT" ]
null
null
null
src/com/ufpt/SetMatrixZeros.java
spiky18/interview-practice
52b8bc1b6356576a0dd3f4913bf09296127a79ac
[ "MIT" ]
null
null
null
16.21875
39
0.366089
9,491
package com.ufpt; public class SetMatrixZeros { public void setZeroes(int[][] m) { int r = m.length, c = 0; if (r != 0) c = m[0].length; int col0 = 1; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { if (m[i][0] == 0) col0 = 0; if (m[i][j] == 0) { m[i][0] = 0; m[0][j] = 0; } } } for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { if (m[i][0] == 0 || m[0][j] == 0) { m[i][j] = 0; } } if (col0 == 0) m[i][0] = 0; } } }
3e16471f3da63bf899f5c462063885ae94eb9411
111
java
Java
com.github.sormuras.mainrunner.api/main/java/com/github/sormuras/mainrunner/api/package-info.java
sormuras/mainrunner-engine
cfbcad670f52d381dcb9bef2b61f3e5a8c9589f7
[ "MIT" ]
6
2019-01-25T15:48:48.000Z
2021-06-20T15:46:16.000Z
com.github.sormuras.mainrunner.api/main/java/com/github/sormuras/mainrunner/api/package-info.java
sormuras/mainrunner-engine
cfbcad670f52d381dcb9bef2b61f3e5a8c9589f7
[ "MIT" ]
6
2018-12-11T11:57:15.000Z
2019-06-20T12:37:10.000Z
com.github.sormuras.mainrunner.api/main/java/com/github/sormuras/mainrunner/api/package-info.java
sormuras/mainrunner
ba59604b65cb19e4be053f9317aaebbe7190a009
[ "MIT" ]
null
null
null
37
66
0.783784
9,492
/** Defines the optional API for customizing Java program runs. */ package com.github.sormuras.mainrunner.api;
3e1647ce147ffa1e1786a06b288b8fdabd774089
1,502
java
Java
src/Entidades/Locacao.java
Kiostsu/bookstore
376c03f7b0a7b591c1f7c7d1bdfbdb56edef4a5c
[ "Apache-2.0" ]
null
null
null
src/Entidades/Locacao.java
Kiostsu/bookstore
376c03f7b0a7b591c1f7c7d1bdfbdb56edef4a5c
[ "Apache-2.0" ]
null
null
null
src/Entidades/Locacao.java
Kiostsu/bookstore
376c03f7b0a7b591c1f7c7d1bdfbdb56edef4a5c
[ "Apache-2.0" ]
null
null
null
17.264368
45
0.470706
9,493
package Entidades; public class Locacao { private int id; private Aluno aluno; private Livro livro; private String data; private String entrega; public Locacao (){ } @Override public int hashCode() { int hash = 5; hash = 23 * hash + this.id; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Locacao other = (Locacao) obj; if (this.id != other.id) { return false; } return true; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Aluno getAluno() { return aluno; } public void setAluno(Aluno aluno) { this.aluno = aluno; } public Livro getLivro() { return livro; } public void setLivro(Livro livro) { this.livro = livro; } public String getData() { return data; } public void setData(String data) { this.data = data; } public String getEntrega() { return entrega; } public void setEntrega(String entrega) { this.entrega = entrega; } }
3e1647d1393c04f08560a2ae4cd6a22b5d1992bd
1,201
java
Java
src/main/java/com/github/draylar/jigsawdungeon/JigsawDungeon.java
Draylar/jigsaw-dungeon
dd7ab3f4f2611fcbfd04e8416f731a8d74ae9bb2
[ "MIT" ]
null
null
null
src/main/java/com/github/draylar/jigsawdungeon/JigsawDungeon.java
Draylar/jigsaw-dungeon
dd7ab3f4f2611fcbfd04e8416f731a8d74ae9bb2
[ "MIT" ]
null
null
null
src/main/java/com/github/draylar/jigsawdungeon/JigsawDungeon.java
Draylar/jigsaw-dungeon
dd7ab3f4f2611fcbfd04e8416f731a8d74ae9bb2
[ "MIT" ]
null
null
null
36.393939
175
0.790175
9,494
package com.github.draylar.jigsawdungeon; import com.github.draylar.jigsawdungeon.world.World; import net.fabricmc.api.ModInitializer; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.decorator.Decorator; import net.minecraft.world.gen.decorator.DecoratorConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig; public class JigsawDungeon implements ModInitializer { public static final String MODID = "jigsawdungeon"; @Override public void onInitialize() { World.init(); Registry.BIOME.stream().filter(biome -> biome.getCategory() != Biome.Category.NETHER && biome.getCategory() != Biome.Category.THEEND && biome.getCategory() != Biome.Category.OCEAN ).forEach(biome -> { biome.addFeature(GenerationStep.Feature.UNDERGROUND_STRUCTURES, Biome.configureFeature(World.FEATURE, new DefaultFeatureConfig(), Decorator.NOPE, DecoratorConfig.DEFAULT)); biome.addStructureFeature(World.FEATURE, new DefaultFeatureConfig()); }); } public static Identifier id(String name) { return new Identifier(MODID, name); } }
3e16480b086dfb4e4f42bfca707042284323914e
8,967
java
Java
src/simulations/ForagingAnts.java
collinbachi/cellsociety
8660ff104bcf6a1dfda2532faa5dc45990e45499
[ "MIT" ]
null
null
null
src/simulations/ForagingAnts.java
collinbachi/cellsociety
8660ff104bcf6a1dfda2532faa5dc45990e45499
[ "MIT" ]
null
null
null
src/simulations/ForagingAnts.java
collinbachi/cellsociety
8660ff104bcf6a1dfda2532faa5dc45990e45499
[ "MIT" ]
null
null
null
37.835443
99
0.549125
9,495
package simulations; import java.util.ArrayList; import java.util.List; import java.util.Map; import cells.Cell; import cells.ForagingAntsCell; import javafx.scene.paint.Color; import javafx.scene.paint.Paint; public class ForagingAnts extends Simulation { public static final int TOTAL_STATES = 5; public static final int EMPTY = 0; public static final int LOW_PHEROMONES = 1; public static final int MEDIUM_PHEROMONES = 2; public static final int HIGH_PHEROMONES = 3; public static final int ANT = 4; private static final Paint[] COLORS = { Color.WHITE, Color.rgb(255, 168, 168), Color.rgb(255, 20, 20), Color.rgb(141, 0, 0), Color.BLACK }; public static final String ANT_LIFE = "ANT_LIFE"; public static final String MAX_ANTS = "MAX_ANTS"; public static final String ANTS_BORN_PER_TIME = "ANTS_BORN_PER_TIME"; public static final String MIN_PHEROMONE = "MIN_PHEROMONE"; public static final String MAX_PHEROMONE = "MAX_PHEROMONE"; public static final String EVAPORATION_RATE = "EVAPORATION_RATE"; public static final String DIFFUSION_RATE = "DIFFUSION_RATE"; public static final String INIT_ANTS = "INIT_ANTS"; public static final String K = "K"; public static final String N = "N"; public static final int CONSTANT = 2; private int myMaxAnts; private int myAntsBornPerTime; private int myMaxPheromones; private double myK; private double myN; private int myInitAnts; private double myEvaporationRate; private double myDiffusionRate; public ForagingAnts () { super(TOTAL_STATES, COLORS); } @Override public void update (List<ArrayList<Cell>> rows) { for (int i = 0; i < rows.size(); i++) { List<Cell> row = rows.get(i); for (int j = 0; j < row.size(); j++) { ForagingAntsCell cell = (ForagingAntsCell) row.get(j); if (i == 70 && j == 70) { cell.addToNumberOfAnts(myAntsBornPerTime); } checkRules(cell); } } for (List<Cell> row : rows) { for (Cell c : row) { setNextState((ForagingAntsCell) c); updateCell(c); } } } @Override public void initializeCells (List<ArrayList<Cell>> rows) { for (int i = 0; i < rows.size(); i++) { List<Cell> row = rows.get(i); for (int j = 0; j < row.size(); j++) { ForagingAntsCell cell = (ForagingAntsCell) row.get(j); if (i == 70 && j == 70) { cell.setMyNestPheromones(myMaxPheromones); cell.addToNumberOfAnts(myInitAnts); cell.setIsNest(true); } else if (i == 20 && j == 20) { cell.setMyFoodPheromones(myMaxPheromones); cell.setIsFood(true); } setNextState(cell); updateCell(cell); cell.setMyNeighborLocations(); } } } @Override public void checkRules (Cell cell) { ForagingAntsCell antCell = (ForagingAntsCell) cell; int numberOfAntsOnCell = antCell.getMyNumberOfAnts(); for (int i = 0; i < numberOfAntsOnCell; i++) { findNestOrFood(antCell); } if (antCell.getMyCurrentState() != EMPTY) { antCell.diffuse(myDiffusionRate); antCell.evaporate(myEvaporationRate); } } private void setNextState (ForagingAntsCell cell) { int state = EMPTY; if (cell.getMyNumberOfAnts() > 0) { state = ANT; } else if (cell.getTotalPheromones() == 0) { state = EMPTY; } else if (cell.getTotalPheromones() <= myMaxPheromones / 3) { state = LOW_PHEROMONES; } else if (cell.getTotalPheromones() <= myMaxPheromones * 2 / 3) { state = MEDIUM_PHEROMONES; } else if (cell.getTotalPheromones() <= myMaxPheromones) { state = HIGH_PHEROMONES; } cell.setMyNextState(state); } @Override public void setParameters (Map<String, Double> parameterMap) { myMaxAnts = parameterMap.get(MAX_ANTS).intValue(); myAntsBornPerTime = parameterMap.get(ANTS_BORN_PER_TIME).intValue(); myMaxPheromones = parameterMap.get(MAX_PHEROMONE).intValue(); myEvaporationRate = parameterMap.get(EVAPORATION_RATE); myDiffusionRate = parameterMap.get(DIFFUSION_RATE); myK = parameterMap.get(K); myN = parameterMap.get(N); myInitAnts = parameterMap.get(INIT_ANTS).intValue(); } private void findNestOrFood (ForagingAntsCell ant) { if (ant.isFood() || ant.isNest()) { ant.updateForwardLocations(setOrientation(ant)); } int locationToMove = selectLocation(ant.getMyNeighbors(), ant.getMyForwardLocations(), ant.hasFoodItem()); if (locationToMove == -1) { locationToMove = selectLocation(ant .getMyNeighbors(), ant.getMyNeighborLocations(), ant.hasFoodItem()); } if (locationToMove != -1) { dropPheromones(ant); ant.updateForwardLocations(locationToMove); ForagingAntsCell neighborToMoveTo = (ForagingAntsCell) ant.getMyNeighbors()[locationToMove]; neighborToMoveTo.incrementMyNumberOfAnts(); ant.decrementMyNumberOfAnts(); neighborToMoveTo.setMyFoodItem(ant.hasFoodItem()); ant.setMyFoodItem(false); if (neighborToMoveTo.isNest()) { neighborToMoveTo.setMyFoodItem(false); } else if (neighborToMoveTo.isFood()) { neighborToMoveTo.setMyFoodItem(true); } } } private int setOrientation (ForagingAntsCell ant) { int orientation = randomNum(ant.getMyNeighbors().length); for (int i = 0; i < ant.getMyNeighbors().length; i++) { ForagingAntsCell orientationAnt = (ForagingAntsCell) ant.getMyNeighbors()[orientation]; ForagingAntsCell currAnt = (ForagingAntsCell) ant.getMyNeighbors()[i]; if (currAnt != null) { if (ant.hasFoodItem()) { if (currAnt.getMyNestPheromones() > orientationAnt .getMyNestPheromones()) { orientation = i; } } else if (!ant.hasFoodItem() && currAnt.getMyFoodPheromones() > orientationAnt .getMyFoodPheromones()) { orientation = i; } } } return orientation; } private int selectLocation (Cell[] neighbors, int[] locationSet, boolean hasFood) { int location = -1; int max = 0; for (int i = 0; i < locationSet.length; i++) { ForagingAntsCell ant = (ForagingAntsCell) neighbors[locationSet[i]]; if (ant != null && ant.getMyNumberOfAnts() < myMaxAnts) { if (hasFood && ant.getMyNestPheromones() >= max) { max = ant.getMyNestPheromones(); location = locationSet[i]; } else if (!hasFood && Math.pow(myK + ant.getMyFoodPheromones(), myN) > max) { max = (int) Math.pow(myK + ant.getMyFoodPheromones(), myN); location = locationSet[i]; } } } return location; } private void dropPheromones (ForagingAntsCell ant) { if (ant.isFood()) { ant.setMyFoodPheromones(myMaxPheromones); } else if (ant.isNest()) { ant.setMyNestPheromones(myMaxPheromones); } else { int max = 0; for (Cell cell : ant.getMyNeighbors()) { ForagingAntsCell neighbor = (ForagingAntsCell) cell; if (neighbor != null) { int neighborsPheromones = ant.hasFoodItem() ? neighbor.getMyFoodPheromones() : neighbor.getMyNestPheromones(); if (neighborsPheromones > max) max = neighborsPheromones; } } int desired = max - CONSTANT; if (ant.hasFoodItem() && desired > ant.getMyFoodPheromones()) { ant.setMyFoodPheromones(desired); } else if (!ant.hasFoodItem() && desired > ant.getMyNestPheromones()) { ant.setMyNestPheromones(desired); } } } }
3e1649ee8a8c9bc239c1c35489cec48be78ef7d3
2,590
java
Java
java-restify-octet-converter/src/test/java/com/github/ljtfreitas/restify/http/client/message/converter/octet/OctetInputStreamMessageConverterTest.java
ljtfreitas/java-restify
baad629e14958f5688a294019bbe991db7361327
[ "MIT" ]
28
2016-12-13T13:55:20.000Z
2021-06-28T19:02:30.000Z
java-restify-octet-converter/src/test/java/com/github/ljtfreitas/restify/http/client/message/converter/octet/OctetInputStreamMessageConverterTest.java
ljtfreitas/java-restify
baad629e14958f5688a294019bbe991db7361327
[ "MIT" ]
9
2016-12-08T09:59:03.000Z
2021-02-08T21:24:54.000Z
java-restify-octet-converter/src/test/java/com/github/ljtfreitas/restify/http/client/message/converter/octet/OctetInputStreamMessageConverterTest.java
ljtfreitas/java-restify
baad629e14958f5688a294019bbe991db7361327
[ "MIT" ]
7
2016-12-13T13:02:33.000Z
2021-04-15T21:13:39.000Z
28.152174
98
0.802703
9,496
package com.github.ljtfreitas.restify.http.client.message.converter.octet; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.github.ljtfreitas.restify.http.client.message.request.BufferedByteArrayHttpRequestBody; import com.github.ljtfreitas.restify.http.client.message.request.BufferedHttpRequestBody; import com.github.ljtfreitas.restify.http.client.message.request.HttpRequestMessage; import com.github.ljtfreitas.restify.http.client.message.response.HttpResponseMessage; @RunWith(MockitoJUnitRunner.class) public class OctetInputStreamMessageConverterTest { @Mock private HttpRequestMessage request; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private HttpResponseMessage response; private OctetInputStreamMessageConverter converter; @Before public void setup() { converter = new OctetInputStreamMessageConverter(); } @Test public void shouldCanReadWhenTypeIsInputStream() { assertTrue(converter.canRead(InputStream.class)); } @Test public void shouldNotCanReadWhenTypeNotIsInputStream() { assertFalse(converter.canRead(String.class)); } @Test public void shouldReadHttpResponseToInputStream() { String body = "response"; when(response.body().input()).thenReturn(new ByteArrayInputStream(body.getBytes())); InputStream stream = converter.read(response, InputStream.class); BufferedReader buffer = new BufferedReader(new InputStreamReader(stream)); String output = buffer.lines().collect(Collectors.joining("\n")); assertEquals(body, output); } @Test public void shouldCanWriteWhenTypeIsInputStream() { assertTrue(converter.canWrite(InputStream.class)); } @Test public void shouldNotCanWriteWhenTypeNotIsInputStream() { assertFalse(converter.canWrite(String.class)); } @Test public void shouldWriteInputStreamBodyToOutputStream() { String body = "request body"; BufferedHttpRequestBody buffer = new BufferedByteArrayHttpRequestBody(); when(request.body()).thenReturn(buffer); converter.write(new ByteArrayInputStream(body.getBytes()), request); String output = new String(buffer.asBytes()); assertEquals(body, output); } }
3e164a1abf9d4e3b1d17af2d2536ef2bcd6eca3d
928
java
Java
blockchain_courses/SCUT_2021/MRFS/Project/MedicalResourceFlow/src/main/java/cn/edu/scut/medicalresourceflow/config/ThreadPoolConfig.java
Popping007/Community-Activities
9ecdabfe9a4cd53208a41f1a3d6e4740cdc7f4cb
[ "Apache-2.0" ]
null
null
null
blockchain_courses/SCUT_2021/MRFS/Project/MedicalResourceFlow/src/main/java/cn/edu/scut/medicalresourceflow/config/ThreadPoolConfig.java
Popping007/Community-Activities
9ecdabfe9a4cd53208a41f1a3d6e4740cdc7f4cb
[ "Apache-2.0" ]
2
2021-07-12T03:25:49.000Z
2021-07-12T06:05:06.000Z
blockchain_courses/SCUT_2021/MRFS/Project/MedicalResourceFlow/src/main/java/cn/edu/scut/medicalresourceflow/config/ThreadPoolConfig.java
Popping007/Community-Activities
9ecdabfe9a4cd53208a41f1a3d6e4740cdc7f4cb
[ "Apache-2.0" ]
22
2021-06-30T06:46:52.000Z
2021-07-13T04:24:59.000Z
35.692308
82
0.78125
9,497
package cn.edu.scut.medicalresourceflow.config; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; @Configuration @EnableAsync public class ThreadPoolConfig implements AsyncConfigurer { @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(Runtime.getRuntime().availableProcessors()); executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() * 5); executor.setQueueCapacity(Runtime.getRuntime().availableProcessors() * 5); executor.setThreadNamePrefix("mrf-executor-"); executor.initialize(); return executor; } }
3e164b00d656664383918ba80b04170002f19e35
4,704
java
Java
ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
AntonLS/Ardor3D
00eb4564110757c592d40e9b4387d4672e53b0de
[ "Zlib" ]
null
null
null
ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
AntonLS/Ardor3D
00eb4564110757c592d40e9b4387d4672e53b0de
[ "Zlib" ]
null
null
null
ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
AntonLS/Ardor3D
00eb4564110757c592d40e9b4387d4672e53b0de
[ "Zlib" ]
null
null
null
36.184615
121
0.620748
9,498
/** * Copyright (c) 2008-2019 Bird Dog Games, Inc. * * This file is part of Ardor3D. * * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <https://git.io/fjRmv>. */ package com.ardor3d.extension.terrain.providers.procedural; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; import com.ardor3d.extension.terrain.client.TextureConfiguration; import com.ardor3d.extension.terrain.client.TextureSource; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.Vector3; import com.ardor3d.math.functions.Function3D; import com.ardor3d.util.geom.BufferUtils; public class ProceduralNormalMapSource implements TextureSource { private final Function3D function; private static final int tileSize = 128; private static final int availableClipmapLevels = 8; private final double[][] cache = new double[tileSize + 2][tileSize + 2]; private final ReentrantLock textureLock = new ReentrantLock(); private final ThreadLocal<ByteBuffer> tileDataPool = new ThreadLocal<ByteBuffer>() { @Override protected ByteBuffer initialValue() { return BufferUtils.createByteBufferOnHeap(tileSize * tileSize * 3); } }; public ProceduralNormalMapSource(final Function3D function) { this.function = function; } @Override public TextureConfiguration getConfiguration() throws Exception { final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGB8); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, false); } @Override public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { return null; } @Override public Set<Tile> getInvalidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { return null; } @Override public int getContributorId(final int clipmapLevel, final Tile tile) { return 0; } @Override public ByteBuffer getTile(final int clipmapLevel, final Tile tile) throws Exception { final ByteBuffer data = tileDataPool.get(); final int tileX = tile.getX(); final int tileY = tile.getY(); final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1; final Vector3 normal = new Vector3(); textureLock.lock(); try { // clear our cache for (final double[] row : cache) { Arrays.fill(row, Double.NEGATIVE_INFINITY); } for (int y = 0; y < tileSize; y++) { for (int x = 0; x < tileSize; x++) { if (Thread.interrupted()) { return null; } final int heightX = tileX * tileSize + x; final int heightY = tileY * tileSize + y; normal.setZ(1); final double eval1 = getValue(x - 1, y, heightX - 1, heightY, baseClipmapLevel); final double eval2 = getValue(x + 1, y, heightX + 1, heightY, baseClipmapLevel); final double eval3 = getValue(x, y - 1, heightX, heightY - 1, baseClipmapLevel); final double eval4 = getValue(x, y + 1, heightX, heightY + 1, baseClipmapLevel); normal.setX((eval1 - eval2) / 2.); normal.setY((eval3 - eval4) / 2.); normal.normalizeLocal(); final int index = (x + y * tileSize) * 3; data.put(index, (byte) (normal.getX() * 255)); data.put(index + 1, (byte) (normal.getY() * 255)); data.put(index + 2, (byte) (normal.getZ() * 255)); } } } finally { textureLock.unlock(); } return data; } private double getValue(final int x, final int y, final int heightX, final int heightY, final int baseClipmapLevel) { double val = cache[x + 1][y + 1]; if (val == Double.NEGATIVE_INFINITY) { val = cache[x + 1][y + 1] = function.eval(heightX << baseClipmapLevel, heightY << baseClipmapLevel, 0); } return val; } }
3e164b31976d5591593c5481ba9a00e4938b53d2
1,451
java
Java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
34.547619
86
0.754652
9,499
/* * Copyright 2005 Sascha Weinreuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.XPath2ElementTypes; import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathPredicate; import org.jetbrains.annotations.Nullable; public class XPathPredicateImpl extends XPathElementImpl implements XPathPredicate { public XPathPredicateImpl(ASTNode node) { super(node); } @Override @Nullable public XPathExpression getPredicateExpression() { final ASTNode[] nodes = getNode().getChildren(XPath2ElementTypes.EXPRESSIONS); return (XPathExpression)(nodes.length > 0 ? nodes[0].getPsi() : null); } @Override public void accept(XPathElementVisitor visitor) { visitor.visitXPathPredicate(this); } }
3e164b74f08848338586360566c9945415951a71
4,654
java
Java
src/main/java/com/webank/webase/front/performance/PerformanceController.java
liucy2007975/WeBASE-Front
21ec4f10ff3982def8d037ebbdd3f900d8d0ac2b
[ "Apache-2.0" ]
1
2020-05-11T08:20:15.000Z
2020-05-11T08:20:15.000Z
src/main/java/com/webank/webase/front/performance/PerformanceController.java
liucy2007975/WeBASE-Front
21ec4f10ff3982def8d037ebbdd3f900d8d0ac2b
[ "Apache-2.0" ]
null
null
null
src/main/java/com/webank/webase/front/performance/PerformanceController.java
liucy2007975/WeBASE-Front
21ec4f10ff3982def8d037ebbdd3f900d8d0ac2b
[ "Apache-2.0" ]
null
null
null
42.309091
100
0.706704
9,500
/* * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.webank.webase.front.performance; import static org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME; import com.webank.webase.front.base.response.BaseResponse; import com.webank.webase.front.base.code.ConstantCode; import com.webank.webase.front.base.exception.FrontException; import com.webank.webase.front.performance.entity.ToggleHandle; import com.webank.webase.front.performance.result.PerformanceData; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import java.net.UnknownHostException; import java.time.LocalDateTime; import java.util.List; import java.util.Map; import org.hyperic.sigar.SigarException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; /** * Host monitor controller * monitor of host computer's performance * such as cpu, memory, disk etc. */ @RestController @RequestMapping(value = "/performance") public class PerformanceController { @Autowired private PerformanceService performanceService; /** * query performance data. * * @param beginDate beginDate * @param endDate endDate * @param contrastBeginDate contrastBeginDate * @param contrastEndDate contrastEndDate * @param gap gap * @return */ @ApiOperation(value = "query performance data", notes = "query performance data") @ApiImplicitParams({@ApiImplicitParam(name = "beginDate", value = "start time"), @ApiImplicitParam(name = "endDate", value = "end time"), @ApiImplicitParam(name = "contrastBeginDate", value = "compare start time"), @ApiImplicitParam(name = "contrastEndDate", value = "compare end time"), @ApiImplicitParam(name = "gap", value = "time gap", dataType = "int")}) @GetMapping public List<PerformanceData> getPerformanceRatio( @RequestParam(required = false) @DateTimeFormat( iso = DATE_TIME) LocalDateTime beginDate, @RequestParam(required = false) @DateTimeFormat(iso = DATE_TIME) LocalDateTime endDate, @RequestParam(required = false) @DateTimeFormat( iso = DATE_TIME) LocalDateTime contrastBeginDate, @RequestParam(required = false) @DateTimeFormat( iso = DATE_TIME) LocalDateTime contrastEndDate, @RequestParam(required = false, defaultValue = "1") int gap) throws Exception { List<PerformanceData> performanceList = performanceService.findContrastDataByTime(beginDate, endDate, contrastBeginDate, contrastEndDate, gap); return performanceList; } @ApiOperation(value = "获取性能配置信息", notes = "获取性能配置信息") @GetMapping(value = "/config") public Map<String, String> getPerformanceConfig() throws SigarException, UnknownHostException { return performanceService.getConfigInfo(); } @ApiOperation(value = "获取同步任务开关状态", notes = "获取同步任务开关状态") @GetMapping(value = "/toggle") public Object getScheduledStatus() throws Exception{ // on is true, off is false Boolean onOrOff = performanceService.getToggleStatus(); String status = onOrOff ? "ON" : "OFF"; return new BaseResponse(0, "Sync Status is " + status, onOrOff); } @ApiOperation(value = "切换定时同步任务开关", notes = "切换定时同步任务开关") @PostMapping(value = "/toggle") public Object toggleScheduledState(@RequestBody ToggleHandle toggleHandle) throws Exception{ boolean toggle = toggleHandle.isEnable(); try {// on is true, off is false boolean onOrOff = performanceService.toggleSync(toggle); String status = onOrOff ? "ON" : "OFF"; return new BaseResponse(0, "Sync Status is " + status, onOrOff); }catch (FrontException e){ return new BaseResponse(ConstantCode.SYSTEM_ERROR, e.getMessage()); } } }
3e164c3f62836d6b73b5a84cb61d5ab2eb6849d4
2,498
java
Java
src/ecrm-s/src/main/java/com/maven/payment/ap/AstropayOrderConfig.java
Douglas890116/Atom
bd0627d744abcff881f5de9a101215949e0c3f3e
[ "Unlicense" ]
2
2019-01-04T03:00:26.000Z
2019-09-18T10:33:19.000Z
src/ecrm-s/src/main/java/com/maven/payment/ap/AstropayOrderConfig.java
Douglas890116/Atom
bd0627d744abcff881f5de9a101215949e0c3f3e
[ "Unlicense" ]
null
null
null
src/ecrm-s/src/main/java/com/maven/payment/ap/AstropayOrderConfig.java
Douglas890116/Atom
bd0627d744abcff881f5de9a101215949e0c3f3e
[ "Unlicense" ]
2
2019-01-04T03:02:52.000Z
2020-12-16T04:50:48.000Z
25.752577
57
0.727382
9,501
package com.maven.payment.ap; public class AstropayOrderConfig { private String orderNo; // x_invoice_num private String orderType; // x_type private String orderAmount; // x_amount private String currency; // x_currency private String userCardNum; // x_card_num private String userCardCode; // x_card_code private String userCardExpDate; // x_exp_date private String userNo; // x_unique_id private String userEmail; // x_email private String userName; // x_name private String userDocument; // x_document private String userCountry; // x_country private String mobileNum; // x_mobile_number public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getOrderType() { return orderType; } public void setOrderType(String orderType) { this.orderType = orderType; } public String getOrderAmount() { return orderAmount; } public void setOrderAmount(String orderAmount) { this.orderAmount = orderAmount; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } public String getUserCardNum() { return userCardNum; } public void setUserCardNum(String userCardNum) { this.userCardNum = userCardNum; } public String getUserCardCode() { return userCardCode; } public void setUserCardCode(String userCardCode) { this.userCardCode = userCardCode; } public String getUserCardExpDate() { return userCardExpDate; } public void setUserCardExpDate(String userCardExpDate) { this.userCardExpDate = userCardExpDate; } public String getUserNo() { return userNo; } public void setUserNo(String userNo) { this.userNo = userNo; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserDocument() { return userDocument; } public void setUserDocument(String userDocument) { this.userDocument = userDocument; } public String getUserCountry() { return userCountry; } public void setUserCountry(String userCountry) { this.userCountry = userCountry; } public String getMobileNum() { return mobileNum; } public void setMobileNum(String mobileNum) { this.mobileNum = mobileNum; } }
3e164c68502945a6c1c436ea6c87ed234c136cc1
1,326
java
Java
src/com/adamldavis/z/PixelZNodePositioner.java
adamd/z
7a9da8b67743bd67db212846a31341a8b29304cf
[ "BSD-2-Clause" ]
1
2015-03-09T21:55:15.000Z
2015-03-09T21:55:15.000Z
src/com/adamldavis/z/PixelZNodePositioner.java
adamd/z
7a9da8b67743bd67db212846a31341a8b29304cf
[ "BSD-2-Clause" ]
null
null
null
src/com/adamldavis/z/PixelZNodePositioner.java
adamd/z
7a9da8b67743bd67db212846a31341a8b29304cf
[ "BSD-2-Clause" ]
null
null
null
22.474576
79
0.71267
9,502
/** Copyright 2012, The Solution Design Group, Inc. */ package com.adamldavis.z; import java.awt.Dimension; import java.awt.Point; import java.awt.geom.Point2D; import java.util.Map; /** * Converts positions to pixels using given center and dimensions. * * @author Adam Davis * */ public class PixelZNodePositioner implements ZNodePositioner { final ZNodePositioner positioner; final Dimension dimension; final Point center; public PixelZNodePositioner(Point center, Dimension dimension, ZNodePositioner positioner) { super(); this.positioner = positioner; this.dimension = dimension; this.center = center; } public PixelZNodePositioner(Dimension dimension, ZNodePositioner positioner) { this(new Point(dimension.width / 2, dimension.height / 2), dimension, positioner); } /* * (non-Javadoc) * * @see * com.adamldavis.z.ZNodePositioner#getNewPositions(com.adamldavis.z.ZNode) */ @Override public Map<ZNode, Point2D> getNewPositions(ZNode selected) { Map<ZNode, Point2D> map = positioner.getNewPositions(selected); for (ZNode node : map.keySet()) { Point2D p = map.get(node); double halfH = dimension.height * 0.5; double halfW = dimension.width * 0.5; p.setLocation(center.x + halfW * p.getX(), center.y + halfH * p.getY()); } return map; } }
3e164d03e48e35524734d9642bb686b3dc6eb9a7
6,597
java
Java
src/main/java/com/cybernian/ether_io/core/IO24Common.java
jerry-muir/ether_io
5a285ab0a6dd6115387befdc5e5941e77b1f7258
[ "Apache-2.0" ]
null
null
null
src/main/java/com/cybernian/ether_io/core/IO24Common.java
jerry-muir/ether_io
5a285ab0a6dd6115387befdc5e5941e77b1f7258
[ "Apache-2.0" ]
null
null
null
src/main/java/com/cybernian/ether_io/core/IO24Common.java
jerry-muir/ether_io
5a285ab0a6dd6115387befdc5e5941e77b1f7258
[ "Apache-2.0" ]
null
null
null
32.338235
111
0.647112
9,503
/* * (C) Copyright 2019 Gerard L. Muir * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cybernian.ether_io.core; import java.io.IOException; /** * Provides data communication for the Ether IO family of digital I/O Ethernet * boards. This class support the common command set for IO24, IO24F boards. * * @author Gerard L. Muir */ public class IO24Common extends IO24Core { /** * Creates a Datagram Socket to communicate with the I/O board at the given IP * address. * * @param ipAddress * The network IP address of the device to communicate with. * @throws IOException * Thrown if a datagram socket error occurred. */ public IO24Common(String ipAddress) throws IOException { super(ipAddress); } /** * Creates a Datagram Socket, with the specified timeout, to communicate with the * I/O board at the given IP address. * * @param ipAddress * IP address of the I/O board. * @param datagramSocketTimeout * The time out to be used by the UPD Socket connection. * * @throws IOException * Thrown if a datagram socket error occurred. * * @see <code>DatagramSocket</code> */ public IO24Common(String ipAddress, int datagramSocketTimeout) throws IOException { super(ipAddress, datagramSocketTimeout); } /** * Writes the Port Schmitt Trigger value for the specified port. * * @param ioPort * The port letter to read from. * @param value * The port value to write. 0-255 * @throws IOException * Thrown if a datagram socket error occurred. * @throws IllegalArgumentException * Thrown if an invalid port letter is specified. */ public void writePortSchmittTrigger(char ioPort, int value) throws IOException, IllegalArgumentException { this.isPortLetterValid(ioPort); byte[] data = new byte[] { (byte) (int) '$', (byte) (int) Character.toUpperCase(ioPort), (byte) value }; this.send(data); } /** * Writes the Port Threshold value for the specified port. * * @param ioPort * The port letter to read from. * @param value * The port value to write. 0-255 * @throws IOException * Thrown if a datagram socket error occurred. * @throws IllegalArgumentException * Thrown if an invalid port letter is specified. */ public void writePortThreshold(char ioPort, int value) throws IOException, IllegalArgumentException { this.isPortLetterValid(ioPort); byte[] data = new byte[] { (byte) (int) '#', (byte) (int) Character.toUpperCase(ioPort), (byte) value }; this.send(data); } /** * Reads the I/O port Schmitt setting for the specified port. This is a 2 step * process. First a read request is sent, then we will try to read the returned * packet. * * @param ioPort * The port letter to read from. * * @return The I/O port Schmitt register settings. * @throws IOException * Thrown if a datagram socket error occurred. * @throws IllegalArgumentException * Thrown if an invalid port letter is specified. */ public byte[] readPortSchmitt(char ioPort) throws IOException, IllegalArgumentException { // Number of bytes returned in the response packet for this read command. int BYTES_RETURNED = 3; this.isPortLetterValid(ioPort); // Convert the port letter into a port read command and create the request // packet. byte[] sendData = new byte[] { (byte) (int) '$', (byte) (int) Character.toLowerCase(ioPort) }; byte[] returnData = this.readData(sendData, BYTES_RETURNED); return returnData; } /** * Reads the I/O port threshold setting for the specified port. This is a 2 step * process. First a read request is sent, then we will try to read the returned * packet. * * @param ioPort * The port letter to read from. * * @return The I/O port threshold register settings. * @throws IOException * Thrown if a datagram socket error occurred. * @throws IllegalArgumentException * Thrown if an invalid port letter is specified. */ public byte[] readPortThreshold(char ioPort) throws IOException, IllegalArgumentException { // Number of bytes returned in the response packet for this read command. int BYTES_RETURNED = 3; this.isPortLetterValid(ioPort); // Convert the port letter into a port read command create the request packet. byte[] sendData = new byte[] { (byte) (int) '#', (byte) (int) Character.toLowerCase(ioPort) }; byte[] returnData = this.readData(sendData, BYTES_RETURNED); return returnData; } /** * Enables the EEPROM write function. Write enable must be active before any * EEPROM write commands are processed. * * @throws IOException * Thrown if a datagram socket error occurred. */ public void writeEnableEEPROM() throws IOException { byte[] data = new byte[] { (byte) (int) '\'', (byte) (int) '1', (byte) 0, (byte) 170, (byte) 85 }; this.send(data); } /** * Disables the EEPROM write function. * * @throws IOException * Thrown if a datagram socket error occurred. * */ public void writeDisableEEPROM() throws IOException { byte[] data = new byte[] { (byte) (int) '\'', (byte) (int) '0', (byte) 0, (byte) 0, (byte) 0 }; this.send(data); } /** * Erase the EEPROM memory at the specified word address. This sets the register value to * #FFFF * * @param wordAddress * the location address of the word to be erased. (5-63) * @throws IOException * Thrown if a datagram socket error occurred. */ public void eraseEEPROM_Word(int wordAddress) throws IOException { byte[] data = new byte[] { (byte) (int) '\'', (byte) (int) 'E', (byte) wordAddress, (byte) 170, (byte) 85 }; this.send(data); } }
3e164f380f9a3e17e3d21b49f5b760c14e001ade
1,116
java
Java
src/main/java/com/spring/learn/common/utils/AnnotationUtil.java
ZhuJunJi/spring-boot-learn
f9c2a4372b84a250f48ba36184679d335acfe74b
[ "Apache-2.0" ]
2
2019-06-14T10:01:52.000Z
2019-06-23T08:50:35.000Z
src/main/java/com/spring/learn/common/utils/AnnotationUtil.java
ZhuJunJi/spring-boot-learn
f9c2a4372b84a250f48ba36184679d335acfe74b
[ "Apache-2.0" ]
null
null
null
src/main/java/com/spring/learn/common/utils/AnnotationUtil.java
ZhuJunJi/spring-boot-learn
f9c2a4372b84a250f48ba36184679d335acfe74b
[ "Apache-2.0" ]
null
null
null
24.26087
90
0.645161
9,504
package com.spring.learn.common.utils; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * @author J.Zhu * @date 2017/11/1 上午10:28 * @description 注解工具包 */ public class AnnotationUtil { /** * 获取指定类上的指定注解 * @param clazz 目标类 * @param annotationClazz 注解类的Class对象 * @param <T> 注解的类型 * @return 注解对象 */ public static <T> T getAnnotationValueByClass(Class clazz, Class annotationClazz) { return (T) clazz.getAnnotation(annotationClazz); } /** * 获取指定方法上的指定注解 * @param method 目标方法 * @param annotationClazz 注解类的Class对象 * @param <T> 注解类型 * @return 注解对象 */ public static <T> T getAnnotationValueByMethod(Method method, Class annotationClazz) { return (T) method.getAnnotation(annotationClazz); } /** * 获取指定Field上的指定注解 * @param field 目标 成员变量 * @param annotationClazz 注解类的Class对象 * @param <T> 注解类型 * @return 注解对象 */ public static <T> T getAnnotationValueByField(Field field, Class annotationClazz) { return (T) field.getAnnotation(annotationClazz); } }
3e164f3f36a805c2c45ac62859faab313ee1a5dc
4,090
java
Java
app/src/main/java/com/zzh/blackmovie/activity/MoreActivity.java
zzhbug/BlackMovie
91fa3375ce7ce42b1b286c1bc771067f219bb9ba
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/zzh/blackmovie/activity/MoreActivity.java
zzhbug/BlackMovie
91fa3375ce7ce42b1b286c1bc771067f219bb9ba
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/zzh/blackmovie/activity/MoreActivity.java
zzhbug/BlackMovie
91fa3375ce7ce42b1b286c1bc771067f219bb9ba
[ "Apache-2.0" ]
null
null
null
34.083333
91
0.636186
9,505
package com.zzh.blackmovie.activity; import android.content.Intent; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.lhh.ptrrv.library.PullToRefreshRecyclerView; import com.zhy.http.okhttp.OkHttpUtils; import com.zzh.blackmovie.R; import com.zzh.blackmovie.adapter.MoreMovieAdapter; import com.zzh.blackmovie.base.BaseActivity; import com.zzh.blackmovie.http.BaseCallback; import com.zzh.blackmovie.http.Contants; import com.zzh.blackmovie.http.JsonBaseSerializator; import com.zzh.blackmovie.model.MovieContent; import com.zzh.blackmovie.model.MovieListAll; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import okhttp3.Call; public class MoreActivity extends BaseActivity { private static final String TAG = "MoreActivity"; private static final int UP_DATA = 2; private static final int DOWN_DATA = 1; @BindView(R.id.textTopbarTitle) TextView mTextTopbarTitle; @BindView(R.id.imgTopbarSearch) ImageView mImgTopbarSearch; @BindView(R.id.pullMoreRecyclerView) PullToRefreshRecyclerView mPullMoreRecyclerView; @BindView(R.id.imgTopbarBack) ImageView mImgTopbarBack; private MoreMovieAdapter mMoreMovieAdapter; private List<MovieContent> mData; private String mId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_more); ButterKnife.bind(this); initView(); initHttp(DOWN_DATA); } private void initView() { mImgTopbarSearch.setVisibility(View.INVISIBLE); Intent intent = getIntent(); String title = intent.getStringExtra(TITLE); mId = intent.getStringExtra(CATEGORY_ID); mTextTopbarTitle.setText(title); Log.d(TAG, "initView: " + mId); mPullMoreRecyclerView.setLayoutManager(new GridLayoutManager(this, 3)); //添加空白页添加动画 View inflate = View.inflate(this, R.layout.empty_view, null); mPullMoreRecyclerView.setEmptyView(inflate); ImageView imgLoading = (ImageView) inflate.findViewById(R.id.imgLoading); AnimationDrawable animationDrawable = (AnimationDrawable) imgLoading.getDrawable(); animationDrawable.start(); //----------------------------------------------- mData = new ArrayList<>(); mMoreMovieAdapter = new MoreMovieAdapter(this, mData, R.layout.simple_movie); mPullMoreRecyclerView.setAdapter(mMoreMovieAdapter); } private void initHttp(final int type) { String url = Contants.MORE_MOVIE_HEAD_URL + mId + Contants.MORE_MOVIE_FOOT_URL; OkHttpUtils.get() .url(url) .build() .execute(new BaseCallback<MovieListAll>(new JsonBaseSerializator()) { @Override public void onError(Call call, Exception e, int id) { Log.d(TAG, "onError: " + e); } @Override public void onResponse(MovieListAll response, int id) { Log.d(TAG, "onResponse: " + response); List<MovieContent> content = response.getContent(); switch (type) { case DOWN_DATA: //刷新 mMoreMovieAdapter.downDataRes(content); break; case UP_DATA: //加载 mMoreMovieAdapter.updataRes(content); break; } } }); } @OnClick(R.id.imgTopbarBack) public void onClick() { finish(); } @Override protected void onDestroy() { super.onDestroy(); } }
3e164f94cc9ecae4ae65fea385a069611576ef6b
14,017
java
Java
plugins/maven/graphql-java-codegen-maven-plugin/src/main/java/io/github/kobylynskyi/graphql/codegen/GraphQLCodegenMojo.java
lorenzleutgeb/graphql-java-codegen
e5b24be9a1241f7f2257d39fc367cf3d0b87a38f
[ "MIT" ]
null
null
null
plugins/maven/graphql-java-codegen-maven-plugin/src/main/java/io/github/kobylynskyi/graphql/codegen/GraphQLCodegenMojo.java
lorenzleutgeb/graphql-java-codegen
e5b24be9a1241f7f2257d39fc367cf3d0b87a38f
[ "MIT" ]
null
null
null
plugins/maven/graphql-java-codegen-maven-plugin/src/main/java/io/github/kobylynskyi/graphql/codegen/GraphQLCodegenMojo.java
lorenzleutgeb/graphql-java-codegen
e5b24be9a1241f7f2257d39fc367cf3d0b87a38f
[ "MIT" ]
null
null
null
33.613909
129
0.74588
9,506
package io.github.kobylynskyi.graphql.codegen; import com.kobylynskyi.graphql.codegen.GraphQLCodegen; import com.kobylynskyi.graphql.codegen.model.DefaultMappingConfigValues; import com.kobylynskyi.graphql.codegen.model.GraphQLCodegenConfiguration; import com.kobylynskyi.graphql.codegen.model.MappingConfig; import com.kobylynskyi.graphql.codegen.supplier.JsonMappingConfigSupplier; import com.kobylynskyi.graphql.codegen.supplier.MappingConfigSupplier; import com.kobylynskyi.graphql.codegen.supplier.SchemaFinder; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; @Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES) public class GraphQLCodegenMojo extends AbstractMojo implements GraphQLCodegenConfiguration { @Parameter private String[] graphqlSchemaPaths; @Parameter private SchemaFinderConfig graphqlSchemas = new SchemaFinderConfig(); @Parameter(required = true) private File outputDir; @Parameter private Map<String, String> customTypesMapping; @Parameter private Map<String, String> customAnnotationsMapping; @Parameter private String packageName; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_BUILDER_STRING) private boolean generateBuilder; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_APIS_STRING) private boolean generateApis; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_EQUALS_AND_HASHCODE_STRING) private boolean generateEqualsAndHashCode; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_TO_STRING_STRING) private boolean generateToString; @Parameter private String apiPackageName; @Parameter private String modelPackageName; @Parameter private String modelNamePrefix; @Parameter private String modelNameSuffix; @Parameter private String subscriptionReturnType; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_ASYNC_APIS_STRING) private Boolean generateAsyncApi; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_VALIDATION_ANNOTATION) private String modelValidationAnnotation; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_PARAMETERIZED_FIELDS_RESOLVERS_STRING) private boolean generateParameterizedFieldsResolvers; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_EXTENSION_FIELDS_RESOLVERS_STRING) private boolean generateExtensionFieldsResolvers; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_DATA_FETCHING_ENV_STRING) private boolean generateDataFetchingEnvironmentArgumentInApis; @Parameter private Set<String> fieldsWithResolvers = new HashSet<>(); @Parameter private Set<String> fieldsWithoutResolvers = new HashSet<>(); @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_GENERATE_REQUESTS_STRING) private boolean generateRequests; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_REQUEST_SUFFIX) private String requestSuffix; @Parameter(defaultValue = DefaultMappingConfigValues.DEFAULT_RESPONSE_PROJECTION_SUFFIX) private String responseProjectionSuffix; @Parameter private String jsonConfigurationFile; /** * The project being built. */ @Parameter(readonly = true, required = true, defaultValue = "${project}") private MavenProject project; @Override public void execute() throws MojoExecutionException { addCompileSourceRootIfConfigured(); MappingConfig mappingConfig = new MappingConfig(); mappingConfig.setPackageName(packageName); mappingConfig.setCustomTypesMapping(customTypesMapping != null ? customTypesMapping : new HashMap<>()); mappingConfig.setModelNamePrefix(modelNamePrefix); mappingConfig.setModelNameSuffix(modelNameSuffix); mappingConfig.setApiPackageName(apiPackageName); mappingConfig.setModelPackageName(modelPackageName); mappingConfig.setGenerateBuilder(generateBuilder); mappingConfig.setGenerateApis(generateApis); mappingConfig.setModelValidationAnnotation(modelValidationAnnotation); mappingConfig.setCustomAnnotationsMapping(customAnnotationsMapping != null ? customAnnotationsMapping : new HashMap<>()); mappingConfig.setGenerateEqualsAndHashCode(generateEqualsAndHashCode); mappingConfig.setGenerateToString(generateToString); mappingConfig.setSubscriptionReturnType(subscriptionReturnType); mappingConfig.setGenerateAsyncApi(generateAsyncApi); mappingConfig.setGenerateParameterizedFieldsResolvers(generateParameterizedFieldsResolvers); mappingConfig.setGenerateDataFetchingEnvironmentArgumentInApis(generateDataFetchingEnvironmentArgumentInApis); mappingConfig.setGenerateExtensionFieldsResolvers(generateExtensionFieldsResolvers); mappingConfig.setFieldsWithResolvers(fieldsWithResolvers != null ? fieldsWithResolvers : new HashSet<>()); mappingConfig.setFieldsWithoutResolvers(fieldsWithoutResolvers != null ? fieldsWithoutResolvers : new HashSet<>()); mappingConfig.setGenerateRequests(generateRequests); mappingConfig.setRequestSuffix(requestSuffix); mappingConfig.setResponseProjectionSuffix(responseProjectionSuffix); MappingConfigSupplier mappingConfigSupplier = buildJsonSupplier(jsonConfigurationFile); try { new GraphQLCodegen(getSchemas(), outputDir, mappingConfig, mappingConfigSupplier).generate(); } catch (Exception e) { getLog().error(e); throw new MojoExecutionException("Code generation failed. See above for the full exception."); } } private List<String> getSchemas() throws IOException { if (graphqlSchemaPaths != null) { return Arrays.asList(graphqlSchemaPaths); } Path schemasRootDir = getSchemasRootDir(); SchemaFinder finder = new SchemaFinder(schemasRootDir); finder.setRecursive(graphqlSchemas.isRecursive()); finder.setIncludePattern(graphqlSchemas.getIncludePattern()); finder.setExcludedFiles(graphqlSchemas.getExcludedFiles()); return finder.findSchemas(); } private Path getSchemasRootDir() { String rootDir = graphqlSchemas.getRootDir(); if (rootDir == null) { return getDefaultResourcesDirectory().orElseThrow(() -> new IllegalStateException( "Default resource folder not found, please provide <rootDir> in <graphqlSchemas>")); } return Paths.get(rootDir); } private Optional<Path> getDefaultResourcesDirectory() { return project.getResources().stream().findFirst().map(Resource::getDirectory).map(Paths::get); } private MappingConfigSupplier buildJsonSupplier(String jsonConfigurationFile) { if (jsonConfigurationFile != null && !jsonConfigurationFile.isEmpty()) { return new JsonMappingConfigSupplier(jsonConfigurationFile); } return null; } private void addCompileSourceRootIfConfigured() { String path = outputDir.getPath(); getLog().info("Added the following path to the source root: " + path); project.addCompileSourceRoot(path); } public String[] getGraphqlSchemaPaths() { return graphqlSchemaPaths; } public void setGraphqlSchemaPaths(String[] graphqlSchemaPaths) { this.graphqlSchemaPaths = graphqlSchemaPaths; } public SchemaFinderConfig getGraphqlSchemas() { return graphqlSchemas; } public void setGraphqlSchemas(SchemaFinderConfig graphqlSchemas) { this.graphqlSchemas = graphqlSchemas; } public File getOutputDir() { return outputDir; } public void setOutputDir(File outputDir) { this.outputDir = outputDir; } @Override public Map<String, String> getCustomTypesMapping() { return customTypesMapping; } public void setCustomTypesMapping(Map<String, String> customTypesMapping) { this.customTypesMapping = customTypesMapping; } @Override public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } @Override public String getApiPackageName() { return apiPackageName; } public void setApiPackageName(String apiPackageName) { this.apiPackageName = apiPackageName; } @Override public String getModelPackageName() { return modelPackageName; } public void setModelPackageName(String modelPackageName) { this.modelPackageName = modelPackageName; } @Override public String getModelNamePrefix() { return modelNamePrefix; } public void setModelNamePrefix(String modelNamePrefix) { this.modelNamePrefix = modelNamePrefix; } @Override public String getModelNameSuffix() { return modelNameSuffix; } public void setModelNameSuffix(String modelNameSuffix) { this.modelNameSuffix = modelNameSuffix; } @Override public Map<String, String> getCustomAnnotationsMapping() { return customAnnotationsMapping; } public void setCustomAnnotationsMapping(Map<String, String> customAnnotationsMapping) { this.customAnnotationsMapping = customAnnotationsMapping; } @Override public String getModelValidationAnnotation() { return modelValidationAnnotation; } public void setModelValidationAnnotation(String modelValidationAnnotation) { this.modelValidationAnnotation = modelValidationAnnotation; } @Override public Boolean getGenerateBuilder() { return generateBuilder; } public void setGenerateBuilder(boolean generateBuilder) { this.generateBuilder = generateBuilder; } @Override public Boolean getGenerateApis() { return generateApis; } public void setGenerateApis(boolean generateApis) { this.generateApis = generateApis; } @Override public Boolean getGenerateEqualsAndHashCode() { return generateEqualsAndHashCode; } public void setGenerateEqualsAndHashCode(boolean generateEqualsAndHashCode) { this.generateEqualsAndHashCode = generateEqualsAndHashCode; } @Override public Boolean getGenerateToString() { return generateToString; } public void setGenerateToString(boolean generateToString) { this.generateToString = generateToString; } @Override public Boolean getGenerateAsyncApi() { return generateAsyncApi; } public void setGenerateAsyncApi(boolean generateAsyncApi) { this.generateAsyncApi = generateAsyncApi; } @Override public String getSubscriptionReturnType() { return subscriptionReturnType; } public void setSubscriptionReturnType(String subscriptionReturnType) { this.subscriptionReturnType = subscriptionReturnType; } @Override public Boolean getGenerateExtensionFieldsResolvers() { return generateExtensionFieldsResolvers; } public void setGenerateExtensionFieldsResolvers(boolean generateExtensionFieldsResolvers) { this.generateExtensionFieldsResolvers = generateExtensionFieldsResolvers; } @Override public Boolean getGenerateParameterizedFieldsResolvers() { return generateParameterizedFieldsResolvers; } public void setGenerateParameterizedFieldsResolvers(boolean generateParameterizedFieldsResolvers) { this.generateParameterizedFieldsResolvers = generateParameterizedFieldsResolvers; } @Override public Boolean getGenerateDataFetchingEnvironmentArgumentInApis() { return generateDataFetchingEnvironmentArgumentInApis; } public void setGenerateDataFetchingEnvironmentArgumentInApis(boolean generateDataFetchingEnvironmentArgumentInApis) { this.generateDataFetchingEnvironmentArgumentInApis = generateDataFetchingEnvironmentArgumentInApis; } @Override public Set<String> getFieldsWithResolvers() { return fieldsWithResolvers; } public void setFieldsWithResolvers(Set<String> fieldsWithResolvers) { this.fieldsWithResolvers = fieldsWithResolvers; } @Override public Set<String> getFieldsWithoutResolvers() { return fieldsWithoutResolvers; } public void setFieldsWithoutResolvers(Set<String> fieldsWithoutResolvers) { this.fieldsWithoutResolvers = fieldsWithoutResolvers; } @Override public Boolean getGenerateRequests() { return generateRequests; } public void setGenerateRequests(boolean generateRequests) { this.generateRequests = generateRequests; } @Override public String getRequestSuffix() { return requestSuffix; } public void setRequestSuffix(String requestSuffix) { this.requestSuffix = requestSuffix; } @Override public String getResponseProjectionSuffix() { return responseProjectionSuffix; } public void setResponseProjectionSuffix(String responseProjectionSuffix) { this.responseProjectionSuffix = responseProjectionSuffix; } public String getJsonConfigurationFile() { return jsonConfigurationFile; } public void setJsonConfigurationFile(String jsonConfigurationFile) { this.jsonConfigurationFile = jsonConfigurationFile; } }
3e164fc9df8e9bdc52fb30c7594411a731ff2aed
4,103
java
Java
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-client/src/main/java/org/kie/workbench/common/stunner/bpmn/client/dataproviders/ProcessEscalationRefProvider.java
tkobayas/kie-wb-common
2c69347f0f634268fb7cca77ccf9e1311f1486e9
[ "Apache-2.0" ]
34
2017-05-21T11:28:40.000Z
2021-07-03T13:15:03.000Z
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-client/src/main/java/org/kie/workbench/common/stunner/bpmn/client/dataproviders/ProcessEscalationRefProvider.java
tkobayas/kie-wb-common
2c69347f0f634268fb7cca77ccf9e1311f1486e9
[ "Apache-2.0" ]
2,576
2017-03-14T00:57:07.000Z
2022-03-29T07:52:38.000Z
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-client/src/main/java/org/kie/workbench/common/stunner/bpmn/client/dataproviders/ProcessEscalationRefProvider.java
tkobayas/kie-wb-common
2c69347f0f634268fb7cca77ccf9e1311f1486e9
[ "Apache-2.0" ]
158
2017-03-15T08:55:40.000Z
2021-11-19T14:07:17.000Z
50.036585
184
0.726785
9,507
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.workbench.common.stunner.bpmn.client.dataproviders; import java.util.function.Function; import java.util.function.Predicate; import javax.inject.Inject; import org.kie.workbench.common.stunner.bpmn.definition.EndEscalationEvent; import org.kie.workbench.common.stunner.bpmn.definition.IntermediateEscalationEvent; import org.kie.workbench.common.stunner.bpmn.definition.IntermediateEscalationEventThrowing; import org.kie.workbench.common.stunner.bpmn.definition.StartEscalationEvent; import org.kie.workbench.common.stunner.bpmn.definition.property.event.escalation.EscalationRef; import org.kie.workbench.common.stunner.core.client.api.SessionManager; import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.uberfire.commons.data.Pair; public class ProcessEscalationRefProvider extends AbstractProcessFilteredNodeProvider { private static final Predicate<Node> startEscalationEventsFilter = node -> ((View) node.getContent()).getDefinition() instanceof StartEscalationEvent; private static final Predicate<Node> intermediateCatchingEscalationEventsFilter = node -> ((View) node.getContent()).getDefinition() instanceof IntermediateEscalationEvent; private static final Predicate<Node> intermediateThrowingEscalationEventsFilter = node -> ((View) node.getContent()).getDefinition() instanceof IntermediateEscalationEventThrowing; private static final Predicate<Node> endEscalationEventsFilter = node -> ((View) node.getContent()).getDefinition() instanceof EndEscalationEvent; private static final Predicate<Node> allSignalEventsFilter = startEscalationEventsFilter .or(intermediateCatchingEscalationEventsFilter) .or(intermediateThrowingEscalationEventsFilter) .or(endEscalationEventsFilter); @Inject public ProcessEscalationRefProvider(final SessionManager sessionManager) { super(sessionManager); } @Override public Predicate<Node> getFilter() { return allSignalEventsFilter; } @Override public Function<Node, Pair<Object, String>> getMapper() { return node -> { EscalationRef escalationRef = null; if (startEscalationEventsFilter.test(node)) { escalationRef = ((StartEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateCatchingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateThrowingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEventThrowing) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (endEscalationEventsFilter.test(node)) { escalationRef = ((EndEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } if (escalationRef != null && escalationRef.getValue() != null && !escalationRef.getValue().isEmpty()) { return new Pair<>(escalationRef.getValue(), escalationRef.getValue(), Pair.PairEqualsMode.K1); } else { return null; } }; } }
3e16508e98f7b00ba3431a90346dd3ad998a88b7
872
java
Java
platform/platform-impl/src/com/intellij/openapi/preview/PreviewPanelProvider.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
platform/platform-impl/src/com/intellij/openapi/preview/PreviewPanelProvider.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
platform/platform-impl/src/com/intellij/openapi/preview/PreviewPanelProvider.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
32.296296
75
0.751147
9,508
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.openapi.preview; import org.jetbrains.annotations.ApiStatus; /** * @deprecated this class isn't used by the platform anymore */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2021.3") public abstract class PreviewPanelProvider<V, C> { }
3e1650988e89c824de165fae3a4cfed155708545
1,925
java
Java
android/src/xyz/igorgee/Api/Model/Material.java
IgorGee/3D-Image-Creator
4ea0579090fafaeb5da7039cb4fe8aa08c58e2e7
[ "MIT" ]
10
2016-05-13T15:21:03.000Z
2021-07-08T07:19:43.000Z
android/src/xyz/igorgee/Api/Model/Material.java
IgorGee/3D-Image-Creator
4ea0579090fafaeb5da7039cb4fe8aa08c58e2e7
[ "MIT" ]
43
2016-03-11T22:07:02.000Z
2016-04-27T13:58:30.000Z
android/src/xyz/igorgee/Api/Model/Material.java
IgorGee/3D-Image-Creator
4ea0579090fafaeb5da7039cb4fe8aa08c58e2e7
[ "MIT" ]
4
2016-12-01T04:29:54.000Z
2021-04-09T02:53:24.000Z
18.509615
85
0.557922
9,509
package xyz.igorgee.Api.Model; import java.util.HashMap; import java.util.Map; import javax.annotation.Generated; @Generated("org.jsonschema2pojo") public class Material { private Integer materialId; private Float markup; private Integer isActive; private Integer price; private Map<String, Object> additionalProperties = new HashMap<String, Object>(); public Material(Integer materialId, Float markup, Integer isActive) { this.materialId = materialId; this.markup = markup; this.isActive = isActive; } /** * * @return * The materialId */ public Integer getMaterialId() { return materialId; } /** * * @param materialId * The materialId */ public void setMaterialId(Integer materialId) { this.materialId = materialId; } /** * * @return * The markup */ public Float getMarkup() { return markup; } /** * * @param markup * The markup */ public void setMarkup(Float markup) { this.markup = markup; } /** * * @return * The isActive */ public Integer getIsActive() { return isActive; } /** * * @param isActive * The isActive */ public void setIsActive(Integer isActive) { this.isActive = isActive; } /** * * @return * The price */ public Integer getPrice() { return price; } /** * * @param price * The price */ public void setPrice(Integer price) { this.price = price; } public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
3e1650a006a490050242ea210f9676baf5fda708
1,076
java
Java
autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/DateFormatSettingPage.java
mrblippy/Charliequella
f4d233d8e42dd72935b80c2abea06efb20cea989
[ "Apache-2.0" ]
14
2019-10-09T23:59:32.000Z
2022-03-01T08:34:56.000Z
autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/DateFormatSettingPage.java
mrblippy/Charliequella
f4d233d8e42dd72935b80c2abea06efb20cea989
[ "Apache-2.0" ]
1,549
2019-08-16T01:07:16.000Z
2022-03-31T23:57:34.000Z
autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/DateFormatSettingPage.java
mrblippy/Charliequella
f4d233d8e42dd72935b80c2abea06efb20cea989
[ "Apache-2.0" ]
24
2019-09-05T00:09:35.000Z
2021-10-19T05:10:39.000Z
21.52
80
0.737918
9,510
package com.tle.webtests.pageobject.settings; import com.tle.webtests.framework.PageContext; import com.tle.webtests.pageobject.AbstractPage; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class DateFormatSettingPage extends AbstractPage<DateFormatSettingPage> { @FindBy(id = "_dateFormats") private WebElement ul; @FindBy(id = "_dateFormats_0") private WebElement radioApprox; @FindBy(id = "_dateFormats_1") private WebElement radioExact; @FindBy(id = "_saveButton") private WebElement saveButton; public DateFormatSettingPage(PageContext context) { super(context); } @Override protected WebElement findLoadedElement() { return ul; } public void setApproxDateFormat() { radioApprox.click(); } public void setExactDateFormat() { radioExact.click(); } public void saveSettings() { saveButton.click(); } public boolean isApproxDateFormat() { return radioApprox.isSelected(); } public boolean isExactDateFormat() { return radioExact.isSelected(); } }
3e165126cc7ef45045fa555394e4802547157bff
2,575
java
Java
apps/pcc/app/src/main/java/org/onosproject/pcc/rest/PcepAppConfig.java
maheshrajus/actn
8402c2a73758f84daac597958abfd9546cb198be
[ "Apache-2.0" ]
1
2017-09-06T20:02:06.000Z
2017-09-06T20:02:06.000Z
apps/pcc/app/src/main/java/org/onosproject/pcc/rest/PcepAppConfig.java
maheshraju-Huawei/actn
8402c2a73758f84daac597958abfd9546cb198be
[ "Apache-2.0" ]
null
null
null
apps/pcc/app/src/main/java/org/onosproject/pcc/rest/PcepAppConfig.java
maheshraju-Huawei/actn
8402c2a73758f84daac597958abfd9546cb198be
[ "Apache-2.0" ]
1
2018-09-18T09:02:24.000Z
2018-09-18T09:02:24.000Z
23.623853
85
0.605437
9,511
package org.onosproject.pcc.rest; import com.fasterxml.jackson.databind.JsonNode; import org.onosproject.core.ApplicationId; import org.onosproject.net.config.Config; import org.onosproject.pcc.pccmgr.api.PcepCfg; import org.onosproject.pcc.pccmgr.ctl.PcepConfig; import java.util.ArrayList; import java.util.List; import static org.onosproject.net.config.Config.FieldPresence.MANDATORY; import static org.onosproject.net.config.Config.FieldPresence.OPTIONAL; /** * Created by root1 on 9/6/16. */ public class PcepAppConfig extends Config<ApplicationId> { PcepCfg pccConfig = null; public static final String PCEP_PEER = "pcepPeer"; public static final String PEER_IP = "peerIp"; public static final String AS_NUMBER = "asNumber"; @Override public boolean isValid() { boolean fields = false; pccConfig = PcepConfig.getInstance(); fields = hasOnlyFields(PEER_IP, AS_NUMBER) && isIpAddress(PEER_IP, MANDATORY) && isNumber(AS_NUMBER, OPTIONAL); if (!fields) { return false; } return true; } public boolean validatePcepConfiguration() { if (!validatePcepPeers()) { return false; } return true; } public boolean validatePcepPeers() { List<PcepPeerConfig> nodes; nodes = pcepPeer(); /* can do specific validation for each field */ return true; } public List<PcepPeerConfig> pcepPeer() { List<PcepPeerConfig> nodes = new ArrayList<PcepPeerConfig>(); JsonNode jsonNodes = object.get(PCEP_PEER); if (jsonNodes == null) { return null; } jsonNodes.forEach(jsonNode -> nodes.add(new PcepPeerConfig( jsonNode.path(PEER_IP).asText(), jsonNode.path(AS_NUMBER).asInt()))); return nodes; } /** * Configuration for Pcep peer nodes. */ public static class PcepPeerConfig { private final String peerIp; private final int asNumber; public PcepPeerConfig(String peerIp, int asNumber) { this.peerIp = peerIp; this.asNumber = asNumber; } /** * Returns hostname of the peer node. * * @return hostname */ public String peerIp() { return this.peerIp; } /** * Returns asNumber if peer. * * @return asNumber */ public int asNumber() { return this.asNumber; } } }
3e1651ff4844e897f86b8d9b04c971795080ee08
461
java
Java
POOUber/Java/Account.java
bl00p1ng/Curso_POO
04545ebf99e64b0533277cf4cfd8d9e449be5fe8
[ "CNRI-Python" ]
7
2021-01-27T18:34:15.000Z
2022-03-21T05:08:57.000Z
POOUber/Java/Account.java
bl00p1ng/Curso_POO
04545ebf99e64b0533277cf4cfd8d9e449be5fe8
[ "CNRI-Python" ]
null
null
null
POOUber/Java/Account.java
bl00p1ng/Curso_POO
04545ebf99e64b0533277cf4cfd8d9e449be5fe8
[ "CNRI-Python" ]
3
2021-02-27T23:07:09.000Z
2022-01-15T06:55:07.000Z
20.954545
56
0.535792
9,512
public class Account { Integer id; String name; String document; String email; String password; public Account(String name, String document) { this.name = name; this.document = document; } void printAccountInfo() { System.out.println("Name → " + name); System.out.println("Document → " + document); System.out.println("Email → " + email); } }
3e1652432592e2f07a98f610197d66b9710407fe
1,274
java
Java
lamp-public/lamp-model/src/main/java/top/tangyh/lamp/model/enumeration/base/OrgTypeEnum.java
Mu-L/lamp-boot
5f5bb7393bf18c8ce8fabe3ac74a2e708f09babf
[ "Apache-2.0" ]
3,639
2018-01-17T02:53:37.000Z
2020-12-08T01:35:06.000Z
lamp-public/lamp-model/src/main/java/top/tangyh/lamp/model/enumeration/base/OrgTypeEnum.java
Mu-L/lamp-boot
5f5bb7393bf18c8ce8fabe3ac74a2e708f09babf
[ "Apache-2.0" ]
38
2018-01-24T02:02:56.000Z
2020-12-03T07:12:35.000Z
lamp-public/lamp-model/src/main/java/top/tangyh/lamp/model/enumeration/base/OrgTypeEnum.java
Mu-L/lamp-boot
5f5bb7393bf18c8ce8fabe3ac74a2e708f09babf
[ "Apache-2.0" ]
1,194
2018-01-18T03:48:44.000Z
2020-12-08T01:35:46.000Z
19.90625
118
0.642072
9,513
package top.tangyh.lamp.model.enumeration.base; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import top.tangyh.basic.interfaces.BaseEnum; import java.util.stream.Stream; /** * <p> * 实体注释中生成的类型枚举 * 机构类型 * </p> * * @author zuihou * @date 2021-11-08 */ @Getter @AllArgsConstructor @NoArgsConstructor @ApiModel(value = "OrgTypeEnum", description = "机构类型-枚举") public enum OrgTypeEnum implements BaseEnum { /** * 单位 */ COMPANY("01", "单位"), /** * 部门 */ DEPT("02", "部门"), ; private String code; private String desc; /** * 根据当前枚举的name匹配 */ public static OrgTypeEnum match(String val, OrgTypeEnum def) { return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); } public static OrgTypeEnum get(String val) { return match(val, null); } public boolean eq(OrgTypeEnum val) { return val != null && eq(val.name()); } @Override @ApiModelProperty(value = "编码", allowableValues = "10,20", example = "10") public String getCode() { return this.code; } }
3e1652cd1fffd5937530e5f2eba8c560e55ff3f8
7,543
java
Java
Club Calendar/app/src/main/java/com/example/clubcalendar/clubHomeActivity.java
MozPhoenixClubJUET/Winter-of-Code
ee0a85ed3418f88d2cd3bcb0ee116b95fbf3e658
[ "MIT" ]
1
2020-09-25T04:32:44.000Z
2020-09-25T04:32:44.000Z
Club Calendar/app/src/main/java/com/example/clubcalendar/clubHomeActivity.java
MozPhoenixClubJUET/Winter-of-Code
ee0a85ed3418f88d2cd3bcb0ee116b95fbf3e658
[ "MIT" ]
4
2020-01-29T20:45:31.000Z
2020-02-13T19:00:02.000Z
Club Calendar/app/src/main/java/com/example/clubcalendar/clubHomeActivity.java
MozPhoenixClubJUET/Winter-of-Code
ee0a85ed3418f88d2cd3bcb0ee116b95fbf3e658
[ "MIT" ]
8
2019-11-13T16:00:20.000Z
2020-02-11T13:22:25.000Z
38.09596
174
0.617791
9,514
package com.example.clubcalendar; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.example.clubcalendar.model.Event; import com.example.clubcalendar.model.User; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; import de.hdodenhof.circleimageview.CircleImageView; public class clubHomeActivity extends AppCompatActivity { TextView username; FloatingActionButton add; FirebaseUser firebaseUser; DatabaseReference reference; User user; ListView listViewEvents; //our database reference object DatabaseReference databaseEvents; String usernamecurr = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_club_home); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(""); listViewEvents = findViewById(R.id.list_view); username = findViewById(R.id.username); add = findViewById(R.id.add_event_floating_button); firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); reference = FirebaseDatabase.getInstance().getReference("Users").child(firebaseUser.getUid()); for(int i = 0; i < 10; i++){ Toast.makeText(clubHomeActivity.this, "We will get it ready in 5 seconds. Till that, read about the app in the info section.", Toast.LENGTH_LONG).show(); } reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { user = dataSnapshot.getValue(User.class); username.setText(user.getName()); usernamecurr = user.getName(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(clubHomeActivity.this, addEventActivity.class); intent.putExtra("usid", firebaseUser.getUid()); intent.putExtra("usna", usernamecurr); startActivity(intent); } }); } @Override protected void onStart() { super.onStart(); //getting the reference of events (club) node databaseEvents = FirebaseDatabase.getInstance().getReference("Events (club)").child(firebaseUser.getUid()); databaseEvents.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { List<Event> events = new ArrayList<>(); //iterating through all the nodes for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { //getting event Event event = postSnapshot.getValue(Event.class); //adding event to the list event.setEventId(postSnapshot.getKey()); events.add(event); } //creating adapter EventList eventAdapter = new EventList(clubHomeActivity.this, events); //attaching adapter to the listview listViewEvents.setAdapter(eventAdapter); //clicking on the items listViewEvents.setEmptyView(findViewById(R.id.empty)); listViewEvents.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Intent intent = new Intent(clubHomeActivity.this, updateActivity.class); Event event = (Event) adapterView.getItemAtPosition(i); intent.putExtra("eName", event.getEventname()); intent.putExtra("cName", event.getClubName()); intent.putExtra("date", event.getDate()); intent.putExtra("eVenue", event.getVenue()); intent.putExtra("eDesc", event.getDescription()); intent.putExtra("eId", event.getEventId()); intent.putExtra("usid", firebaseUser.getUid()); startActivity(intent); finish(); } }); listViewEvents.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { Event event = (Event) adapterView.getItemAtPosition(i); DatabaseReference databaseTemp1 = FirebaseDatabase.getInstance().getReference("Events (club)").child(firebaseUser.getUid()).child(event.getEventId()); databaseTemp1.removeValue(); DatabaseReference databaseTemp = FirebaseDatabase.getInstance().getReference("Events (all)").child(event.getEventId()); databaseTemp.removeValue(); Toast.makeText(clubHomeActivity.this, "Event Deleted.", Toast.LENGTH_SHORT).show(); return true; } }); } @Override public void onCancelled(DatabaseError databaseError) { } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch(item.getItemId()){ case R.id.logout: FirebaseAuth.getInstance().signOut(); startActivity(new Intent(clubHomeActivity.this, userChoiceActivity.class)); Toast.makeText(this, "You have been logged out", Toast.LENGTH_SHORT).show(); finish(); return true; case R.id.resetpassword: FirebaseAuth.getInstance().signOut(); startActivity(new Intent(clubHomeActivity.this, forgot_password.class)); Toast.makeText(this, "You have been logged out", Toast.LENGTH_SHORT).show(); finish(); return true; case R.id.info: startActivity(new Intent(clubHomeActivity.this, info_club_activity.class)); return true; } return false; } }
3e1653d1f0f4cfa9e7d28cc3cf7ead4ec7730f09
4,297
java
Java
library-api/src/main/java/com/ucmed/library/model/Book.java
EddyAnn/library
ec57f0cadbfd9a74a3dd264e6327cd59d40a4533
[ "Apache-2.0" ]
1
2020-02-11T14:05:03.000Z
2020-02-11T14:05:03.000Z
library-api/src/main/java/com/ucmed/library/model/Book.java
EddyAnn/library
ec57f0cadbfd9a74a3dd264e6327cd59d40a4533
[ "Apache-2.0" ]
3
2020-07-16T22:51:08.000Z
2022-03-15T19:14:07.000Z
library-api/src/main/java/com/ucmed/library/model/Book.java
EddyAnn/library
ec57f0cadbfd9a74a3dd264e6327cd59d40a4533
[ "Apache-2.0" ]
null
null
null
14.868512
52
0.470328
9,515
package com.ucmed.library.model; import java.util.Date; import javax.persistence.*; @Table(name = "book") public class Book { /** * 主键 */ @Id @GeneratedValue(generator = "JDBC") private Long id; /** * 图书编号 */ private String no; /** * 图书名称 */ private String name; /** * 类型编号 */ @Column(name = "category_id") private Integer categoryId; /** * 作者 */ private String author; /** * 书架位置 */ private Double position; /** * 图书总数量 */ private Integer total; /** * 在馆数量 */ private Integer remain; /** * 创建时间 */ @Column(name = "create_time") private Date createTime; /** * 更新时间 */ @Column(name = "update_time") private Date updateTime; /** * 删除标记 */ @Column(name = "is_delete") private Boolean isDelete; /** * 简介 */ private String description; /** * 获取主键 * * @return id - 主键 */ public Long getId() { return id; } /** * 设置主键 * * @param id 主键 */ public void setId(Long id) { this.id = id; } /** * 获取图书编号 * * @return no - 图书编号 */ public String getNo() { return no; } /** * 设置图书编号 * * @param no 图书编号 */ public void setNo(String no) { this.no = no; } /** * 获取图书名称 * * @return name - 图书名称 */ public String getName() { return name; } /** * 设置图书名称 * * @param name 图书名称 */ public void setName(String name) { this.name = name; } /** * 获取类型编号 * * @return category_id - 类型编号 */ public Integer getCategoryId() { return categoryId; } /** * 设置类型编号 * * @param categoryId 类型编号 */ public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } /** * 获取作者 * * @return author - 作者 */ public String getAuthor() { return author; } /** * 设置作者 * * @param author 作者 */ public void setAuthor(String author) { this.author = author; } /** * 获取书架位置 * * @return position - 书架位置 */ public Double getPosition() { return position; } /** * 设置书架位置 * * @param position 书架位置 */ public void setPosition(Double position) { this.position = position; } /** * 获取图书总数量 * * @return total - 图书总数量 */ public Integer getTotal() { return total; } /** * 设置图书总数量 * * @param total 图书总数量 */ public void setTotal(Integer total) { this.total = total; } /** * 获取在馆数量 * * @return remain - 在馆数量 */ public Integer getRemain() { return remain; } /** * 设置在馆数量 * * @param remain 在馆数量 */ public void setRemain(Integer remain) { this.remain = remain; } /** * 获取创建时间 * * @return create_time - 创建时间 */ public Date getCreateTime() { return createTime; } /** * 设置创建时间 * * @param createTime 创建时间 */ public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * 获取更新时间 * * @return update_time - 更新时间 */ public Date getUpdateTime() { return updateTime; } /** * 设置更新时间 * * @param updateTime 更新时间 */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } /** * 获取删除标记 * * @return is_delete - 删除标记 */ public Boolean getIsDelete() { return isDelete; } /** * 设置删除标记 * * @param isDelete 删除标记 */ public void setIsDelete(Boolean isDelete) { this.isDelete = isDelete; } /** * 获取简介 * * @return description - 简介 */ public String getDescription() { return description; } /** * 设置简介 * * @param description 简介 */ public void setDescription(String description) { this.description = description; } }
3e165640b64cba3595269cc91dc9bb39a02052ef
4,925
java
Java
java/com/ttz/taungthuzay/options/WishlistActivity.java
WaiYanTunOo/Taungthuzay
86577b706b0cf6f869a58abc07ff0765bc9d771b
[ "MIT" ]
null
null
null
java/com/ttz/taungthuzay/options/WishlistActivity.java
WaiYanTunOo/Taungthuzay
86577b706b0cf6f869a58abc07ff0765bc9d771b
[ "MIT" ]
null
null
null
java/com/ttz/taungthuzay/options/WishlistActivity.java
WaiYanTunOo/Taungthuzay
86577b706b0cf6f869a58abc07ff0765bc9d771b
[ "MIT" ]
1
2020-06-15T19:22:15.000Z
2020-06-15T19:22:15.000Z
40.702479
132
0.687716
9,516
package com.ttz.taungthuzay.options; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.facebook.drawee.view.SimpleDraweeView; import com.ttz.taungthuzay.R; import com.ttz.taungthuzay.product.ItemDetailsActivity; import com.ttz.taungthuzay.utility.ImageUrlUtils; import java.util.ArrayList; import static com.ttz.taungthuzay.fragments.ImageListFragment.STRING_IMAGE_POSITION; import static com.ttz.taungthuzay.fragments.ImageListFragment.STRING_IMAGE_URI; public class WishlistActivity extends AppCompatActivity { @SuppressLint("StaticFieldLeak") private static Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_recylerview_list); mContext = WishlistActivity.this; ImageUrlUtils imageUrlUtils = new ImageUrlUtils(); ArrayList<String> wishlistImageUri = imageUrlUtils.getWishlistImageUri(); RecyclerView recyclerView = findViewById(R.id.recyclerview); RecyclerView.LayoutManager recylerViewLayoutManager = new LinearLayoutManager(mContext); recyclerView.setLayoutManager(recylerViewLayoutManager); recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(recyclerView, wishlistImageUri)); } public static class SimpleStringRecyclerViewAdapter extends RecyclerView.Adapter<WishlistActivity.SimpleStringRecyclerViewAdapter.ViewHolder> { private ArrayList<String> mWishlistImageUri; public SimpleStringRecyclerViewAdapter(RecyclerView recyclerView, ArrayList<String> wishlistImageUri) { mWishlistImageUri = wishlistImageUri; } @NonNull @Override public WishlistActivity.SimpleStringRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_wishlist_item, parent, false); return new WishlistActivity.SimpleStringRecyclerViewAdapter.ViewHolder(view); } @Override public void onViewRecycled(ViewHolder holder) { if (holder.mImageView.getController() != null) { holder.mImageView.getController().onDetach(); } if (holder.mImageView.getTopLevelDrawable() != null) { holder.mImageView.getTopLevelDrawable().setCallback(null); // ((BitmapDrawable) holder.mImageView.getTopLevelDrawable()).getBitmap().recycle(); } } @Override public void onBindViewHolder(final WishlistActivity.SimpleStringRecyclerViewAdapter.ViewHolder holder, final int position) { final Uri uri = Uri.parse(mWishlistImageUri.get(position)); holder.mImageView.setImageURI(uri); holder.mLayoutItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext, ItemDetailsActivity.class); intent.putExtra(STRING_IMAGE_URI, mWishlistImageUri.get(position)); intent.putExtra(STRING_IMAGE_POSITION, position); mContext.startActivity(intent); } }); //Set click action for wishlist holder.mImageViewWishlist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ImageUrlUtils imageUrlUtils = new ImageUrlUtils(); imageUrlUtils.removeWishlistImageUri(position); notifyDataSetChanged(); } }); } @Override public int getItemCount() { return mWishlistImageUri.size(); } public static class ViewHolder extends RecyclerView.ViewHolder { public final View mView; public final SimpleDraweeView mImageView; public final LinearLayout mLayoutItem; public final ImageView mImageViewWishlist; public ViewHolder(View view) { super(view); mView = view; mImageView = view.findViewById(R.id.image_wishlist); mLayoutItem = view.findViewById(R.id.layout_item_desc); mImageViewWishlist = view.findViewById(R.id.ic_wishlist); } } } }
3e1656a3e770234183e4c3016b8242bea391bf4c
4,649
java
Java
src/main/java/eu/lightest/verifier/client/RemoteATVClient.java
H2020LIGHTest/AutomaticTrustVerifier
63046271bf2543760f1db1bc713ac66051a9dd8d
[ "Apache-2.0" ]
null
null
null
src/main/java/eu/lightest/verifier/client/RemoteATVClient.java
H2020LIGHTest/AutomaticTrustVerifier
63046271bf2543760f1db1bc713ac66051a9dd8d
[ "Apache-2.0" ]
2
2020-01-20T15:58:48.000Z
2020-10-14T15:50:13.000Z
src/main/java/eu/lightest/verifier/client/RemoteATVClient.java
H2020LIGHTest/AutomaticTrustVerifier
63046271bf2543760f1db1bc713ac66051a9dd8d
[ "Apache-2.0" ]
null
null
null
33.207143
118
0.631319
9,517
package eu.lightest.verifier.client; import com.google.gson.Gson; import eu.lightest.verifier.controller.VerificationProcess; import eu.lightest.verifier.model.report.Report; import eu.lightest.verifier.model.report.ReportStatus; import okhttp3.*; import org.apache.log4j.Logger; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.time.Duration; import java.util.Base64; import java.util.Collection; /** * Client for the Automated Trust Verifier REST API. * <p> * Use this class if you want to use the ATV via its REST API (not as library). */ public class RemoteATVClient implements ATVClient { private static MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private static Logger logger = Logger.getLogger(RemoteATVClient.class); private static String ENDPOINT = "/api/v1/addInstance"; private Gson gson; private OkHttpClient httpClient; private Report report; private String hostname; /** * @param hostname HTTP URL (scheme, host, port, path) to the ATV REST API. * @param report {@link Report} object used to retrieve the verification report. */ public RemoteATVClient(String hostname, Report report) { this.hostname = hostname; this.report = report; this.gson = new Gson(); this.httpClient = new OkHttpClient.Builder() .callTimeout(Duration.ZERO) .connectTimeout(Duration.ZERO) .readTimeout(Duration.ZERO) .writeTimeout(Duration.ZERO) .build(); } @Override public boolean verify(String pathPolicy, String pathTransaction) { try { String policy = fileToBase64(pathPolicy); String transaction = fileToBase64(pathTransaction); String requestJson = serialize(policy, transaction); String responseJson = sendRequest(requestJson); ATVResponse response = deserialize(responseJson); this.report.addLines(response.report); return response.result == VerificationProcess.STATUS_OK; } catch(IOException e) { this.report.addLine("Error while initializing ATV communication: " + e.getMessage(), ReportStatus.FAILED); RemoteATVClient.logger.error("Error while initializing ATV communication", e); return false; } } private ATVResponse deserialize(String responseJson) { return this.gson.fromJson(responseJson, ATVResponse.class); } private String sendRequest(String data) throws IOException { String url = this.hostname + RemoteATVClient.ENDPOINT; RemoteATVClient.logger.info("Sending POST request to " + url); RemoteATVClient.logger.info("Data: " + data); RequestBody body = RequestBody.create(RemoteATVClient.JSON, data); Request request = new Request.Builder() .url(url) .post(body) .build(); Response response = this.httpClient.newCall(request).execute(); String responseString = response.body().string(); RemoteATVClient.logger.info("ATV Response: " + responseString); if(!response.isSuccessful()) { throw new IOException("ATV error code: " + response.code()); } return responseString; } private String serialize(String policy, String transaction) { ATVRequest requestData = new ATVRequest(policy, transaction); return this.gson.toJson(requestData); } private String fileToBase64(String path) throws IOException { File file = new File(path); byte[] fileContent = Files.readAllBytes(file.toPath()); return Base64.getEncoder().encodeToString(fileContent); } @Override public String toString() { return this.hostname; } /** * Provides encapsulation for serializing data send to the ATV REST API. */ class ATVRequest { private String policy; private String transaction; public ATVRequest(String policy, String transaction) { this.policy = policy; this.transaction = transaction; } } /** * Provides encapsulation for serializing data received from the ATV REST API. */ class ATVResponse { private Collection<String> report; private String verificationResult; private int result; } }
3e1657387bd7dcc5e3cc16efbaaaf96952d6bd01
5,381
java
Java
addons/nuxeo-apidoc-server/nuxeo-apidoc-core/src/main/java/org/nuxeo/apidoc/adapters/ExtensionPointInfoDocAdapter.java
AC-Rennes-OpenSource/nuxeo
4f20846436c1926d6ad04bc7b02dd777173ef699
[ "Apache-2.0" ]
1
2021-02-15T19:07:59.000Z
2021-02-15T19:07:59.000Z
addons/nuxeo-apidoc-server/nuxeo-apidoc-core/src/main/java/org/nuxeo/apidoc/adapters/ExtensionPointInfoDocAdapter.java
AC-Rennes-OpenSource/nuxeo
4f20846436c1926d6ad04bc7b02dd777173ef699
[ "Apache-2.0" ]
2
2021-03-31T20:01:59.000Z
2021-12-13T20:48:09.000Z
addons/nuxeo-apidoc-server/nuxeo-apidoc-core/src/main/java/org/nuxeo/apidoc/adapters/ExtensionPointInfoDocAdapter.java
AC-Rennes-OpenSource/nuxeo
4f20846436c1926d6ad04bc7b02dd777173ef699
[ "Apache-2.0" ]
1
2022-03-17T14:55:30.000Z
2022-03-17T14:55:30.000Z
32.415663
122
0.66456
9,518
/* * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * Thierry Delprat */ package org.nuxeo.apidoc.adapters; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.nuxeo.apidoc.api.BundleInfo; import org.nuxeo.apidoc.api.ComponentInfo; import org.nuxeo.apidoc.api.ExtensionInfo; import org.nuxeo.apidoc.api.ExtensionPointInfo; import org.nuxeo.apidoc.api.QueryHelper; import org.nuxeo.apidoc.api.VirtualNodesConsts; import org.nuxeo.apidoc.documentation.DocumentationHelper; import org.nuxeo.apidoc.snapshot.DistributionSnapshot; import org.nuxeo.common.utils.Path; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.PathRef; import org.nuxeo.ecm.core.api.PropertyException; public class ExtensionPointInfoDocAdapter extends BaseNuxeoArtifactDocAdapter implements ExtensionPointInfo { public static ExtensionPointInfoDocAdapter create(ExtensionPointInfo xpi, CoreSession session, String containerPath) { DocumentModel doc = session.createDocumentModel(TYPE_NAME); String name = computeDocumentName("xp-" + xpi.getId()); String targetPath = new Path(containerPath).append(name).toString(); boolean exist = false; if (session.exists(new PathRef(targetPath))) { exist = true; doc = session.getDocument(new PathRef(targetPath)); } doc.setPathInfo(containerPath, name); doc.setPropertyValue("dc:title", xpi.getId()); doc.setPropertyValue(PROP_NAME, xpi.getName()); doc.setPropertyValue(PROP_EP_ID, xpi.getId()); doc.setPropertyValue(PROP_DOC, xpi.getDocumentation()); // TODO incoherent naming here, also schema has no types doc.setPropertyValue(PROP_DESCRIPTORS, xpi.getDescriptors()); if (exist) { doc = session.saveDocument(doc); } else { doc = session.createDocument(doc); } return new ExtensionPointInfoDocAdapter(doc); } public ExtensionPointInfoDocAdapter(DocumentModel doc) { super(doc); } @Override public ComponentInfo getComponent() { log.error("getComponent Not implemented"); return null; } @Override public String getComponentId() { return getId().split("--")[0]; } @Override public String getDocumentation() { return safeGet(PROP_DOC); } @Override public String getDocumentationHtml() { return DocumentationHelper.getHtml(getDocumentation()); } @Override public Collection<ExtensionInfo> getExtensions() { List<ExtensionInfo> result = new ArrayList<>(); // find root doc for distribution DocumentModel dist = doc; while (!DistributionSnapshot.TYPE_NAME.equals(dist.getType())) { dist = getCoreSession().getParentDocument(dist.getRef()); } String query = QueryHelper.select(ExtensionInfo.TYPE_NAME, dist, ExtensionInfo.PROP_EXTENSION_POINT, getId()); DocumentModelList docs = getCoreSession().query(query); for (DocumentModel contribDoc : docs) { ExtensionInfo contrib = contribDoc.getAdapter(ExtensionInfo.class); if (contrib != null) { result.add(contrib); } } return result; } @Override public String getName() { return safeGet(PROP_NAME); } @Override public String[] getDescriptors() { try { @SuppressWarnings("unchecked") List<String> descriptors = (List<String>) doc.getPropertyValue(PROP_DESCRIPTORS); return descriptors.toArray(new String[0]); } catch (PropertyException e) { log.error("Unable to get descriptors field", e); } return null; } @Override public String getId() { return safeGet(PROP_EP_ID); } @Override public String getVersion() { BundleInfo parentBundle = getParentNuxeoArtifact(BundleInfo.class); if (parentBundle != null) { return parentBundle.getVersion(); } log.error("Unable to determine version for ExtensionPoint " + getId()); return "?"; } @Override public String getArtifactType() { return TYPE_NAME; } @Override public String getLabel() { return getName() + " (" + getComponent().getId() + ")"; } @Override public String getHierarchyPath() { String path = super.getHierarchyPath() + "###"; String toReplace = "/" + getId() + "###"; return path.replace(toReplace, "/" + VirtualNodesConsts.ExtensionPoints_VNODE_NAME + "/" + getId()); } }
3e1657f5c952a14645087f799b8e1db6acd8a15f
3,967
java
Java
spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java
naget/spring-framework-master
75cbc30da78a8c9bdf6c8e52b7064d275e93a449
[ "Apache-2.0" ]
4
2019-06-18T05:51:48.000Z
2020-11-28T10:42:29.000Z
spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java
naget/spring-framework-master
75cbc30da78a8c9bdf6c8e52b7064d275e93a449
[ "Apache-2.0" ]
null
null
null
spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java
naget/spring-framework-master
75cbc30da78a8c9bdf6c8e52b7064d275e93a449
[ "Apache-2.0" ]
2
2020-09-12T10:02:31.000Z
2021-01-22T17:08:09.000Z
35.419643
100
0.790018
9,519
/* * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.context.annotation; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.EnableLoadTimeWeaving.AspectJWeaving; import org.springframework.context.weaving.AspectJWeavingEnabler; import org.springframework.context.weaving.DefaultContextLoadTimeWeaver; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.type.AnnotationMetadata; import org.springframework.instrument.classloading.LoadTimeWeaver; import org.springframework.lang.NonNullApi; import org.springframework.lang.Nullable; /** * {@code @Configuration} class that registers a {@link LoadTimeWeaver} bean. * * <p>This configuration class is automatically imported when using the * {@link EnableLoadTimeWeaving} annotation. See {@code @EnableLoadTimeWeaving} * javadoc for complete usage details. * * @author Chris Beams * @since 3.1 * @see LoadTimeWeavingConfigurer * @see ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME */ @Configuration @NonNullApi public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoaderAware { private AnnotationAttributes enableLTW; private LoadTimeWeavingConfigurer ltwConfigurer; private ClassLoader beanClassLoader; @Override public void setImportMetadata(AnnotationMetadata importMetadata) { this.enableLTW = AnnotationConfigUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.class); if (this.enableLTW == null) { throw new IllegalArgumentException( "@EnableLoadTimeWeaving is not present on importing class " + importMetadata.getClassName()); } } @Autowired(required = false) public void setLoadTimeWeavingConfigurer(LoadTimeWeavingConfigurer ltwConfigurer) { this.ltwConfigurer = ltwConfigurer; } @Override public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) { this.beanClassLoader = beanClassLoader; } @Bean(name = ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public LoadTimeWeaver loadTimeWeaver() { LoadTimeWeaver loadTimeWeaver = null; if (this.ltwConfigurer != null) { // The user has provided a custom LoadTimeWeaver instance loadTimeWeaver = this.ltwConfigurer.getLoadTimeWeaver(); } if (loadTimeWeaver == null) { // No custom LoadTimeWeaver provided -> fall back to the default loadTimeWeaver = new DefaultContextLoadTimeWeaver(this.beanClassLoader); } AspectJWeaving aspectJWeaving = this.enableLTW.getEnum("aspectjWeaving"); switch (aspectJWeaving) { case DISABLED: // AJ weaving is disabled -> do nothing break; case AUTODETECT: if (this.beanClassLoader.getResource(AspectJWeavingEnabler.ASPECTJ_AOP_XML_RESOURCE) == null) { // No aop.xml present on the classpath -> treat as 'disabled' break; } // aop.xml is present on the classpath -> enable AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClassLoader); break; case ENABLED: AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClassLoader); break; } return loadTimeWeaver; } }
3e1658819a25adbfa012378f1f012320e1258e25
364
java
Java
saibz5base/src/main/java/net/ibizsys/paas/ctrlhandler/ICtrlRender.java
devibizsys/IBizSysRuntime
de18dbf57d6f55d64c225a182a34b7dd47c65b50
[ "Apache-2.0" ]
null
null
null
saibz5base/src/main/java/net/ibizsys/paas/ctrlhandler/ICtrlRender.java
devibizsys/IBizSysRuntime
de18dbf57d6f55d64c225a182a34b7dd47c65b50
[ "Apache-2.0" ]
null
null
null
saibz5base/src/main/java/net/ibizsys/paas/ctrlhandler/ICtrlRender.java
devibizsys/IBizSysRuntime
de18dbf57d6f55d64c225a182a34b7dd47c65b50
[ "Apache-2.0" ]
1
2022-03-01T17:16:00.000Z
2022-03-01T17:16:00.000Z
16.545455
77
0.736264
9,520
package net.ibizsys.paas.ctrlhandler; import net.ibizsys.paas.web.AjaxActionResult; import net.sf.json.JSONObject; /** * 控件绘制器接口 * @author Administrator * */ public interface ICtrlRender { /** * 过滤异步操作结果 * @param ajaxActionResult * @param jo * @throws Exception */ void filteAjaxActionResult(AjaxActionResult ajaxActionResult,JSONObject jo); }
3e165909a446075a90c991d8b2215632f89f26a0
497
java
Java
LACCPlus/Hadoop/2236_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
LACCPlus/Hadoop/2236_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
LACCPlus/Hadoop/2236_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
38.230769
79
0.736419
9,521
//,temp,HostsFileReader.java,298,305,temp,HostsFileReader.java,289,296 //,3 public class xxx { public void updateFileNames(String includesFile, String excludesFile) { LOG.info("Setting the includes file to " + includesFile); LOG.info("Setting the excludes file to " + excludesFile); HostDetails oldDetails = current.get(); HostDetails newDetails = new HostDetails(includesFile, oldDetails.includes, excludesFile, oldDetails.excludes); current.set(newDetails); } };
3e1659e9b93f2fe8e6659b72a6e9e9a42b6adc7b
2,077
java
Java
src/main/java/server/reaptheflag/reaptheflag/gameserver/network/receivable/ReceivableUdpDataPacket.java
atrocitytheme/Reap-The-Flag-Server
7080747547930821c5d07830e7786cc02af8ed7c
[ "MIT" ]
3
2019-08-06T12:40:41.000Z
2019-08-11T12:41:58.000Z
src/main/java/server/reaptheflag/reaptheflag/gameserver/network/receivable/ReceivableUdpDataPacket.java
atrocitytheme/Reap-Server
7080747547930821c5d07830e7786cc02af8ed7c
[ "MIT" ]
null
null
null
src/main/java/server/reaptheflag/reaptheflag/gameserver/network/receivable/ReceivableUdpDataPacket.java
atrocitytheme/Reap-Server
7080747547930821c5d07830e7786cc02af8ed7c
[ "MIT" ]
null
null
null
31.953846
92
0.675975
9,522
package server.reaptheflag.reaptheflag.gameserver.network.receivable; /** * data packet for udp * */ import com.google.gson.JsonSyntaxException; import io.netty.channel.socket.DatagramPacket; import server.reaptheflag.reaptheflag.gameserver.model.OnlinePlayer; import server.reaptheflag.reaptheflag.gameserver.network.receivable.parser.JsonFormatParser; import server.reaptheflag.reaptheflag.gameserver.util.DataWrapper; import javax.xml.crypto.Data; import java.net.InetSocketAddress; /** * mainly used for parse specific ReceivableUdpDataPacket from the client LiteNetLib * */ public final class ReceivableUdpDataPacket { private static int offset = 0; private DatagramPacket rawData; private JsonFormatParser<OnlinePlayer> parser; private boolean formatValid = true; private ReceivableUdpDataPacket(DatagramPacket packet) { this.rawData = packet; loadContent(); } public static ReceivableUdpDataPacket wrap(DatagramPacket packet) { return new ReceivableUdpDataPacket(packet); } public String readString() { DataWrapper wrap = DataWrapper.wrap(rawData); String r = wrap.setReadableOffset(offset).convertToString(); wrap.release(); // release the data since it's copied return r; } public JsonFormatParser<OnlinePlayer> content() { loadContent(); return parser; } public int getLength() { DataWrapper wrap = DataWrapper.wrap(rawData); int r = wrap.setReadableOffset(offset).length(); wrap.release(); return r; } public boolean isFormatValid() { return formatValid; } /** * load the string content to the parser * */ private void loadContent() { if (parser == null) { try { parser = new JsonFormatParser<>(readString(), OnlinePlayer.class); } catch (JsonSyntaxException e) { formatValid = false; } } } public InetSocketAddress senderInfo() { return rawData.sender(); } }
3e165a73c7a53f76f79da916f0f71d5c68994c13
6,324
java
Java
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneInputStream.java
DirectXceriD/apache-ignite
7972da93f7ca851642fe1fb52723b661e3c3933b
[ "Apache-2.0" ]
36
2015-11-05T04:46:27.000Z
2021-12-29T08:26:02.000Z
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneInputStream.java
gridgain/incubator-ignite
7972da93f7ca851642fe1fb52723b661e3c3933b
[ "Apache-2.0" ]
13
2016-08-29T11:54:08.000Z
2020-12-08T08:47:04.000Z
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneInputStream.java
gridgain/incubator-ignite
7972da93f7ca851642fe1fb52723b661e3c3933b
[ "Apache-2.0" ]
15
2016-03-18T09:25:39.000Z
2021-10-01T05:49:39.000Z
27.615721
116
0.58191
9,523
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.internal.processors.query.h2.opt; import org.apache.ignite.internal.util.offheap.unsafe.*; import org.apache.lucene.store.*; import java.io.*; import static org.apache.ignite.internal.processors.query.h2.opt.GridLuceneOutputStream.*; /** * A memory-resident {@link IndexInput} implementation. */ public class GridLuceneInputStream extends IndexInput { /** */ private GridLuceneFile file; /** */ private long length; /** */ private long currBuf; /** */ private int currBufIdx; /** */ private int bufPosition; /** */ private long bufStart; /** */ private int bufLength; /** */ private final GridUnsafeMemory mem; /** * Constructor. * * @param name Name. * @param f File. * @throws IOException If failed. */ public GridLuceneInputStream(String name, GridLuceneFile f) throws IOException { super("RAMInputStream(name=" + name + ")"); file = f; length = file.getLength(); if (length / BUFFER_SIZE >= Integer.MAX_VALUE) throw new IOException("RAMInputStream too large length=" + length + ": " + name); mem = file.getDirectory().memory(); // make sure that we switch to the // first needed buffer lazily currBufIdx = -1; currBuf = 0; } /** {@inheritDoc} */ @Override public void close() { // nothing to do here } /** {@inheritDoc} */ @Override public long length() { return length; } /** {@inheritDoc} */ @Override public byte readByte() throws IOException { if (bufPosition >= bufLength) { currBufIdx++; switchCurrentBuffer(true); } return mem.readByte(currBuf + bufPosition++); } /** {@inheritDoc} */ @Override public void readBytes(byte[] b, int offset, int len) throws IOException { while (len > 0) { if (bufPosition >= bufLength) { currBufIdx++; switchCurrentBuffer(true); } int remainInBuf = bufLength - bufPosition; int bytesToCp = len < remainInBuf ? len : remainInBuf; mem.readBytes(currBuf + bufPosition, b, offset, bytesToCp); offset += bytesToCp; len -= bytesToCp; bufPosition += bytesToCp; } } /** * Switch buffer to next. * * @param enforceEOF if we need to enforce {@link EOFException}. * @throws IOException if failed. */ private void switchCurrentBuffer(boolean enforceEOF) throws IOException { bufStart = (long)BUFFER_SIZE * (long)currBufIdx; if (currBufIdx >= file.numBuffers()) { // end of file reached, no more buffers left if (enforceEOF) throw new EOFException("read past EOF: " + this); // Force EOF if a read takes place at this position currBufIdx--; bufPosition = BUFFER_SIZE; } else { currBuf = file.getBuffer(currBufIdx); bufPosition = 0; long buflen = length - bufStart; bufLength = buflen > BUFFER_SIZE ? BUFFER_SIZE : (int)buflen; } } /** {@inheritDoc} */ @Override public void copyBytes(IndexOutput out, long numBytes) throws IOException { assert numBytes >= 0 : "numBytes=" + numBytes; GridLuceneOutputStream gridOut = out instanceof GridLuceneOutputStream ? (GridLuceneOutputStream)out : null; long left = numBytes; while (left > 0) { if (bufPosition == bufLength) { ++currBufIdx; switchCurrentBuffer(true); } final int bytesInBuf = bufLength - bufPosition; final int toCp = (int)(bytesInBuf < left ? bytesInBuf : left); if (gridOut != null) gridOut.writeBytes(currBuf + bufPosition, toCp); else { byte[] buff = new byte[toCp]; mem.readBytes(currBuf + bufPosition, buff); out.writeBytes(buff, toCp); } bufPosition += toCp; left -= toCp; } assert left == 0 : "Insufficient bytes to copy: numBytes=" + numBytes + " copied=" + (numBytes - left); } /** * For direct calls from {@link GridLuceneOutputStream}. * * @param ptr Pointer. * @param len Length. * @throws IOException If failed. */ void readBytes(long ptr, int len) throws IOException { while (len > 0) { if (bufPosition >= bufLength) { currBufIdx++; switchCurrentBuffer(true); } int remainInBuf = bufLength - bufPosition; int bytesToCp = len < remainInBuf ? len : remainInBuf; mem.copyMemory(currBuf + bufPosition, ptr, bytesToCp); ptr += bytesToCp; len -= bytesToCp; bufPosition += bytesToCp; } } /** {@inheritDoc} */ @Override public long getFilePointer() { return currBufIdx < 0 ? 0 : bufStart + bufPosition; } /** {@inheritDoc} */ @Override public void seek(long pos) throws IOException { if (currBuf == 0 || pos < bufStart || pos >= bufStart + BUFFER_SIZE) { currBufIdx = (int)(pos / BUFFER_SIZE); switchCurrentBuffer(false); } bufPosition = (int)(pos % BUFFER_SIZE); } }
3e165ae84dc5bf2ff02bd30e00b0ffcacac0562a
5,607
java
Java
client/src/test/java/org/gluu/oxtrust/api/openidconnect/OpenIdConnectClientTest.java
shoebkhan09/oxTrust
218a00fe9e85bfede1ae7965da612c0ed949afc8
[ "MIT" ]
null
null
null
client/src/test/java/org/gluu/oxtrust/api/openidconnect/OpenIdConnectClientTest.java
shoebkhan09/oxTrust
218a00fe9e85bfede1ae7965da612c0ed949afc8
[ "MIT" ]
null
null
null
client/src/test/java/org/gluu/oxtrust/api/openidconnect/OpenIdConnectClientTest.java
shoebkhan09/oxTrust
218a00fe9e85bfede1ae7965da612c0ed949afc8
[ "MIT" ]
null
null
null
31.5
97
0.689852
9,524
package org.gluu.oxtrust.api.openidconnect; import java.util.Arrays; import java.util.List; import java.util.Random; import org.gluu.oxtrust.api.GluuOxAuthClient; import org.gluu.oxtrust.model.OxAuthApplicationType; import org.gluu.oxtrust.model.OxAuthScope; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.xdi.oxauth.model.common.GrantType; import org.xdi.oxauth.model.common.ResponseType; public class OpenIdConnectClientTest { private String inum; private static String searchPattern = "scim"; private OxAuthClientRepository clientRepository; private GluuOxAuthClient client; private static boolean canRunOtherTest = false; @BeforeClass public static void testConnection() { try { OxAuthClientRepository clientRepository = new OxAuthClientRepository(); clientRepository.searchClients(searchPattern, 1); canRunOtherTest = true; } catch (Exception e) { System.out.println("***********************"); System.out.println("ERROR OCCURS: POSSIBLE CAUSES"); System.out.println("1. MAKE SURE THE HOSTNAME DEFINE IN CONFIGURATION FILE IS RESOLVABLE"); System.out.println("2. MAKE SURE THE CERTS FILE ARE IMPORTED IN JAVA KEY STORE"); System.out.println("***********************"); } } @Before public void setup() { Assume.assumeTrue(canRunOtherTest); clientRepository = new OxAuthClientRepository(); } @Test public void getAllClientsTest() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("List clients"); System.out.println("=================="); List<GluuOxAuthClient> clients = clientRepository.getAllClients(); Assert.assertNotNull(clients); Assert.assertTrue(!clients.isEmpty()); System.out.println("*******************"); System.out.println("Done"); } @Test public void searchClients() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Search clients"); System.out.println("=================="); List<GluuOxAuthClient> clientsFound = clientRepository.searchClients(searchPattern, 2); Assert.assertNotNull(clientsFound); Assert.assertTrue(!clientsFound.isEmpty()); System.out.println("*******************"); System.out.println("Done"); } @Test public void getClientScopesTest() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Get clients scopes"); System.out.println("=================="); client = clientRepository.searchClients(searchPattern, 1).get(0); inum = client.getInum(); List<OxAuthScope> scopes = clientRepository.getClientScopes(inum); Assert.assertNotNull(scopes); Assert.assertTrue(!scopes.isEmpty()); System.out.println("*******************"); System.out.println("Done"); } @Test public void getClientByInum() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Get client by inum"); System.out.println("=================="); client = clientRepository.addClient(generatedNewClient()); inum = client.getInum(); client = clientRepository.getClientByInum(inum); Assert.assertNotNull(client); Assert.assertEquals(inum, client.getInum()); System.out.println("*******************"); System.out.println("Done"); } @Test public void addClientTest() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Add new client"); System.out.println("=================="); client = clientRepository.addClient(generatedNewClient()); Assert.assertNotNull(client); Assert.assertNotNull(client.getInum()); System.out.println("*******************"); System.out.println("Done"); } @Test public void updateClientTest() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Update client"); System.out.println("=================="); client = clientRepository.addClient(generatedNewClient()); inum = client.getInum(); String displayName = "UpdatedClient"; client.setDisplayName(displayName); client = clientRepository.updateClient(client); Assert.assertNotNull(client); Assert.assertNotNull(client.getInum()); System.out.println("*******************"); System.out.println("Done"); } @Test public void deleteClientTest() { Assume.assumeTrue(canRunOtherTest); System.out.println("=================="); System.out.println("Delete client"); System.out.println("=================="); client = clientRepository.addClient(generatedNewClient()); inum = client.getInum(); clientRepository.deleteClient(inum); Assert.assertNull(clientRepository.getClientByInum(inum)); System.out.println("*******************"); System.out.println("Done"); } private GluuOxAuthClient generatedNewClient() { int next1 = new Random().nextInt(100); int next2 = new Random().nextInt(50); String clientName = "NewAddedClient" + next1 + next2; GluuOxAuthClient gluuOxAuthClient = new GluuOxAuthClient(); gluuOxAuthClient.setDescription(""); gluuOxAuthClient.setDisplayName(clientName); gluuOxAuthClient.setOxAuthAppType(OxAuthApplicationType.WEB); GrantType[] grantTypes = { GrantType.AUTHORIZATION_CODE }; gluuOxAuthClient.setGrantTypes(grantTypes); ResponseType[] responseTypes = { ResponseType.CODE, ResponseType.ID_TOKEN }; gluuOxAuthClient.setResponseTypes(responseTypes); gluuOxAuthClient.setOxAuthRedirectURIs(Arrays.asList("https://gasmyr.livevision.com" + next1)); return gluuOxAuthClient; } }
3e165b236c0d51ad9e43d73fffdf2ca1a0a79d9b
257
java
Java
jax-rs-security/src/main/java/daggerok/user/data/UserRepository.java
daggerok/spring-examples
918817bc9895798c710034b38bfdf97384168d25
[ "MIT" ]
null
null
null
jax-rs-security/src/main/java/daggerok/user/data/UserRepository.java
daggerok/spring-examples
918817bc9895798c710034b38bfdf97384168d25
[ "MIT" ]
null
null
null
jax-rs-security/src/main/java/daggerok/user/data/UserRepository.java
daggerok/spring-examples
918817bc9895798c710034b38bfdf97384168d25
[ "MIT" ]
null
null
null
28.555556
68
0.840467
9,525
package daggerok.user.data; import daggerok.user.domain.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface UserRepository extends JpaRepository<User, Long> {}
3e165b4656bfa7e1eea6153006eb8368d9c2d4c1
549
java
Java
inventory-core/src/main/java/no/helgeby/inventory/model/Inventory.java
rhelgeby/inventory
51277c138b85df11434d1108f71524737d1e273d
[ "MIT" ]
null
null
null
inventory-core/src/main/java/no/helgeby/inventory/model/Inventory.java
rhelgeby/inventory
51277c138b85df11434d1108f71524737d1e273d
[ "MIT" ]
null
null
null
inventory-core/src/main/java/no/helgeby/inventory/model/Inventory.java
rhelgeby/inventory
51277c138b85df11434d1108f71524737d1e273d
[ "MIT" ]
null
null
null
14.837838
49
0.70674
9,526
package no.helgeby.inventory.model; /** * A collection of assets. */ public class Inventory { private long ownerId; private String name; private String description; public long getOwnerId() { return ownerId; } public void setOwnerId(long ownerId) { this.ownerId = ownerId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
3e165c06e5d09400cf8e1f19fce39b7db87d50c9
4,876
java
Java
zookeeper-contrib/zookeeper-contrib-rest/src/test/org/apache/zookeeper/server/jersey/SessionTest.java
LiuWillow/zookeeper
a8b739a8a67fc2dd7ec280236ce9b15ca54d6192
[ "Apache-2.0" ]
255
2015-07-16T06:23:51.000Z
2022-03-22T06:43:23.000Z
src/contrib/rest/src/test/org/apache/zookeeper/server/jersey/SessionTest.java
LCB14/zookeeper
0bc2d41537bd1adf80f4d9d48efac70c6ddb91f2
[ "Apache-2.0" ]
46
2015-11-18T01:46:53.000Z
2022-03-21T21:19:55.000Z
src/contrib/rest/src/test/org/apache/zookeeper/server/jersey/SessionTest.java
LCB14/zookeeper
0bc2d41537bd1adf80f4d9d48efac70c6ddb91f2
[ "Apache-2.0" ]
132
2015-01-07T08:54:50.000Z
2021-06-23T07:48:34.000Z
36.118519
83
0.690115
9,527
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zookeeper.server.jersey; import java.io.IOException; import javax.ws.rs.core.MediaType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.server.jersey.jaxb.ZSession; import org.codehaus.jettison.json.JSONException; import org.junit.Test; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.WebResource.Builder; public class SessionTest extends Base { protected static final Logger LOG = LoggerFactory.getLogger(SessionTest.class); private ZSession createSession() { return createSession("30"); } private ZSession createSession(String expire) { WebResource wr = sessionsr.queryParam("op", "create") .queryParam("expire", expire); Builder b = wr.accept(MediaType.APPLICATION_JSON); ClientResponse cr = b.post(ClientResponse.class, null); assertEquals(ClientResponse.Status.CREATED, cr .getClientResponseStatus()); return cr.getEntity(ZSession.class); } @Test public void testCreateNewSession() throws JSONException { ZSession session = createSession(); assertEquals(session.id.length(), 36); // use out-of-band method to verify assertTrue(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); } @Test public void testSessionExpires() throws InterruptedException { ZSession session = createSession("1"); // use out-of-band method to verify assertTrue(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); // wait for the session to be closed Thread.sleep(1500); assertFalse(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); } @Test public void testDeleteSession() { ZSession session = createSession("30"); WebResource wr = sessionsr.path(session.id); Builder b = wr.accept(MediaType.APPLICATION_JSON); assertTrue(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); ClientResponse cr = b.delete(ClientResponse.class, null); assertEquals(ClientResponse.Status.NO_CONTENT, cr.getClientResponseStatus()); assertFalse(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); } @Test public void testSendHeartbeat() throws InterruptedException { ZSession session = createSession("2"); Thread.sleep(1000); WebResource wr = sessionsr.path(session.id); Builder b = wr.accept(MediaType.APPLICATION_JSON); ClientResponse cr = b.put(ClientResponse.class, null); assertEquals(ClientResponse.Status.OK, cr.getClientResponseStatus()); Thread.sleep(1500); assertTrue(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); Thread.sleep(1000); assertFalse(ZooKeeperService.isConnected(CONTEXT_PATH, session.id)); } @Test public void testCreateEphemeralZNode() throws KeeperException, InterruptedException, IOException { ZSession session = createSession("30"); WebResource wr = znodesr.path("/") .queryParam("op", "create") .queryParam("name", "ephemeral-test") .queryParam("ephemeral", "true") .queryParam("session", session.id) .queryParam("null", "true"); Builder b = wr.accept(MediaType.APPLICATION_JSON); ClientResponse cr = b.post(ClientResponse.class); assertEquals(ClientResponse.Status.CREATED, cr.getClientResponseStatus()); Stat stat = new Stat(); zk.getData("/ephemeral-test", false, stat); ZooKeeper sessionZK = ZooKeeperService.getClient(CONTEXT_PATH, session.id); assertEquals(stat.getEphemeralOwner(), sessionZK.getSessionId()); } }
3e165c0c40f51f7d7cd7ffd9b88d68e2910ffca5
2,042
java
Java
biomedicus-rtf/src/main/java/edu/umn/biomedicus/rtf/beans/keywords/DestinationKeywordAction.java
NLPIE/biomedicus
f2cb8cb40010b53b15f062407d90c750a1d7bb19
[ "Apache-2.0" ]
49
2016-03-03T19:01:39.000Z
2021-02-23T22:50:46.000Z
biomedicus-rtf/src/main/java/edu/umn/biomedicus/rtf/beans/keywords/DestinationKeywordAction.java
NLPIE/biomedicus
f2cb8cb40010b53b15f062407d90c750a1d7bb19
[ "Apache-2.0" ]
67
2016-06-23T19:52:27.000Z
2019-09-30T17:19:35.000Z
biomedicus-rtf/src/main/java/edu/umn/biomedicus/rtf/beans/keywords/DestinationKeywordAction.java
NLPIE/biomedicus
f2cb8cb40010b53b15f062407d90c750a1d7bb19
[ "Apache-2.0" ]
18
2016-05-27T18:14:33.000Z
2020-09-09T19:50:11.000Z
28.361111
87
0.747796
9,528
/* * Copyright (c) 2018 Regents of the University of Minnesota. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package edu.umn.biomedicus.rtf.beans.keywords; import edu.umn.biomedicus.rtf.exc.RtfReaderException; import edu.umn.biomedicus.rtf.reader.KeywordAction; import edu.umn.biomedicus.rtf.reader.State; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A keyword action that switches the current state to a different destination. * * @author Ben Knoll * @since 1.3.0 */ @XmlRootElement @XmlType public class DestinationKeywordAction extends AbstractKeywordAction { /** * The name of the destination. */ private String destinationName; /** * Getter for the destination name. * * @return the destination name. */ @XmlElement(required = true) public String getDestinationName() { return destinationName; } /** * Sets the destination name. * * @param destinationName the destination name. */ public void setDestinationName(String destinationName) { this.destinationName = destinationName; } @Override public void executeKeyword(State state) throws RtfReaderException { state.changeDestination(destinationName); } @Override public KeywordAction copy() { DestinationKeywordAction destinationKeywordAction = new DestinationKeywordAction(); destinationKeywordAction.setDestinationName(destinationName); return destinationKeywordAction; } }
3e165d72e3944be1e63564af8d548e8f824533f3
1,656
java
Java
src/org/jitsi/impl/neomedia/quicktime/QTSampleBuffer.java
madscientist159/libjitsi
06bf07e656031108d912f51c7df42cff24cfa4b8
[ "Apache-2.0" ]
3
2019-03-06T09:34:13.000Z
2020-06-01T16:15:57.000Z
src/org/jitsi/impl/neomedia/quicktime/QTSampleBuffer.java
ass-a2s/libjitsi
f784719d44403c909771f6fd6c15902b0b483d91
[ "Apache-2.0" ]
1
2019-10-30T14:04:09.000Z
2020-11-20T07:24:14.000Z
src/org/jitsi/impl/neomedia/quicktime/QTSampleBuffer.java
ass-a2s/libjitsi
f784719d44403c909771f6fd6c15902b0b483d91
[ "Apache-2.0" ]
1
2021-04-09T13:39:26.000Z
2021-04-09T13:39:26.000Z
28.551724
76
0.682367
9,529
/* * Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jitsi.impl.neomedia.quicktime; /** * Represents a QuickTime/QTKit <tt>QTSampleBuffer</tt> object. * * @author Lyubomir Marinov */ public class QTSampleBuffer extends NSObject { /** * Initializes a new <tt>QTSampleBuffer</tt> which is to represent a * specific QuickTime/QTKit <tt>QTSampleBuffer</tt> object. * * @param ptr the pointer to the QuickTime/QTKit <tt>QTSampleBuffer</tt> * object to be represented by the new instance */ public QTSampleBuffer(long ptr) { super(ptr); } public byte[] bytesForAllSamples() { return bytesForAllSamples(getPtr()); } private static native byte[] bytesForAllSamples(long ptr); public QTFormatDescription formatDescription() { long formatDescriptionPtr = formatDescription(getPtr()); return (formatDescriptionPtr == 0) ? null : new QTFormatDescription(formatDescriptionPtr); } private static native long formatDescription(long ptr); }
3e165daef794c02f4fe18811362beb9b1a21c530
966
java
Java
src/test/java/com/avaje/tests/basic/TestUuidInsertMasterDetail.java
mochalov/avaje-ebeanorm-server
fe4bd22c159a61510ce89825b211369af477bbfe
[ "Apache-2.0" ]
2
2015-04-08T15:36:35.000Z
2015-04-10T07:52:59.000Z
src/test/java/com/avaje/tests/basic/TestUuidInsertMasterDetail.java
mochalov/avaje-ebeanorm-server
fe4bd22c159a61510ce89825b211369af477bbfe
[ "Apache-2.0" ]
null
null
null
src/test/java/com/avaje/tests/basic/TestUuidInsertMasterDetail.java
mochalov/avaje-ebeanorm-server
fe4bd22c159a61510ce89825b211369af477bbfe
[ "Apache-2.0" ]
null
null
null
21.954545
58
0.584886
9,530
package com.avaje.tests.basic; import java.util.ArrayList; import junit.framework.TestCase; import com.avaje.ebean.Ebean; import com.avaje.tests.model.basic.UUOne; import com.avaje.tests.model.basic.UUTwo; public class TestUuidInsertMasterDetail extends TestCase { public void testInsert() { UUTwo two = new UUTwo(); two.setName("something"); ArrayList<UUTwo> list = new ArrayList<UUTwo>(); list.add(two); UUOne one = new UUOne(); one.setName("some one"); one.setComments(list); Ebean.save(one); UUOne oneB = Ebean.find(UUOne.class, one.getId()); UUTwo twoB = new UUTwo(); twoB.setName("another something"); oneB.getComments().add(twoB); Ebean.save(oneB); } public void testNullFK() { UUTwo two = new UUTwo(); two.setName("something"); Ebean.save(two); } }
3e165e178446fb67f43e9c39e28abfb01a4f14fb
2,581
java
Java
src/main/java/com/app/airport/service/BookingsService.java
pieliedie321/airport_app
c22ff09a0e4e45a412fe1d5781e81d1aa8c16e23
[ "Apache-2.0" ]
null
null
null
src/main/java/com/app/airport/service/BookingsService.java
pieliedie321/airport_app
c22ff09a0e4e45a412fe1d5781e81d1aa8c16e23
[ "Apache-2.0" ]
null
null
null
src/main/java/com/app/airport/service/BookingsService.java
pieliedie321/airport_app
c22ff09a0e4e45a412fe1d5781e81d1aa8c16e23
[ "Apache-2.0" ]
null
null
null
32.2625
97
0.765595
9,531
package com.app.airport.service; import javax.persistence.EntityNotFoundException; import javax.transaction.Transactional; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import com.app.airport.dto.BookingDto; import com.app.airport.entity.Booking; import com.app.airport.repository.BookingsRepository; import com.app.airport.utils.mapper.BookingsMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** Service for bookings repo and mapping. */ @Slf4j @Service @Transactional(value = Transactional.TxType.SUPPORTS) public class BookingsService { private final BookingsRepository repository; private final BookingsMapper mapper; @Autowired public BookingsService(BookingsRepository repository, BookingsMapper mapper) { this.repository = repository; this.mapper = mapper; } public List<BookingDto> findBookingsById(String id) { return Optional.of(mapBookingDtosFromEntities(repository.findBookingsById(id))) .orElseThrow(() -> new EntityNotFoundException("Can't find bookings with id: " + id)); } public BookingDto findBookingById(String id) { return mapBookingDtoFromEntity( repository .findById(id) .orElseThrow(() -> new EntityNotFoundException("Can't find booking with id " + id))); } @Transactional(value = Transactional.TxType.REQUIRED) public void saveBookings(@NotEmpty @NotNull List<BookingDto> bookingDtos) { for (BookingDto bookingDto : bookingDtos) { saveNewBooking(bookingDto); } } private void saveNewBooking(@NotNull BookingDto bookingDto) { repository.save(mapBookingEntityFromDto(bookingDto)); } @Transactional(value = Transactional.TxType.REQUIRED) public void deleteBookings(@NotEmpty @NotNull List<BookingDto> bookingDtos) { for (BookingDto bookingDto : bookingDtos) { deleteBooking(bookingDto.getBookingRef()); } } private void deleteBooking(String code) { repository.deleteById(code); } private List<BookingDto> mapBookingDtosFromEntities(List<Booking> bookings) { return bookings.stream().map(mapper::mapEntityToDto).collect(Collectors.toList()); } private BookingDto mapBookingDtoFromEntity(Booking booking) { return mapper.mapEntityToDto(booking); } private Booking mapBookingEntityFromDto(BookingDto bookingDto) { return mapper.mapDtoToEntity(bookingDto); } }
3e165e42c3ff354eb7660fe978e3166251a9d118
1,945
java
Java
main/java/com/wishhard/nf/numbersfacts/tabfrags/InfoFrag.java
wishhard/numbers-facts
d8b2b4380c83314a82d37c74995d4d309eeacd66
[ "Apache-2.0" ]
null
null
null
main/java/com/wishhard/nf/numbersfacts/tabfrags/InfoFrag.java
wishhard/numbers-facts
d8b2b4380c83314a82d37c74995d4d309eeacd66
[ "Apache-2.0" ]
null
null
null
main/java/com/wishhard/nf/numbersfacts/tabfrags/InfoFrag.java
wishhard/numbers-facts
d8b2b4380c83314a82d37c74995d4d309eeacd66
[ "Apache-2.0" ]
null
null
null
33.534483
94
0.68946
9,532
package com.wishhard.nf.numbersfacts.tabfrags; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.Html; import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import com.wishhard.nf.numbersfacts.NumberFactActivity; import com.wishhard.nf.numbersfacts.R; public class InfoFrag extends Fragment { RelativeLayout mLayout; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mLayout = (RelativeLayout) inflater.inflate(R.layout.info_layout,container,false); TextView tv1 = mLayout.findViewById(R.id.thk_numb_api); tv1.setText(fromHtml(getString(R.string.numb_api_info))); tv1.setMovementMethod(LinkMovementMethod.getInstance()); TextView tv2 = mLayout.findViewById(R.id.thk_pixalbay_api); tv2.setText(fromHtml(getString(R.string.pixal_bay_api_info))); tv2.setMovementMethod(LinkMovementMethod.getInstance()); mLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((NumberFactActivity)getActivity()).showHideInfo(false); } }); return mLayout; } @SuppressWarnings("deprecation") private Spanned fromHtml(String html){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY); } else { return Html.fromHtml(html); } } }
3e165e59c3ca8ee806ba6750b7b42f10b246772e
9,597
java
Java
util/src/test/java/net/consensys/beaconchain/util/uint/UInt256BytesTest.java
shemnon/BeaconChain
5f3889337f8d0843e0b53a44401f0a7e7c0b07cd
[ "Apache-2.0" ]
3
2018-12-20T22:05:50.000Z
2021-09-21T04:23:51.000Z
util/src/test/java/net/consensys/beaconchain/util/uint/UInt256BytesTest.java
shemnon/BeaconChain
5f3889337f8d0843e0b53a44401f0a7e7c0b07cd
[ "Apache-2.0" ]
null
null
null
util/src/test/java/net/consensys/beaconchain/util/uint/UInt256BytesTest.java
shemnon/BeaconChain
5f3889337f8d0843e0b53a44401f0a7e7c0b07cd
[ "Apache-2.0" ]
1
2021-09-21T04:23:53.000Z
2021-09-21T04:23:53.000Z
34.397849
100
0.668021
9,533
package net.consensys.beaconchain.util.uint; import net.consensys.beaconchain.util.bytes.Bytes32; import net.consensys.beaconchain.util.bytes.MutableBytes32; import net.consensys.beaconchain.util.uint.UInt256Bytes.BinaryLongOp; import net.consensys.beaconchain.util.uint.UInt256Bytes.BinaryOp; import java.math.BigInteger; import org.junit.Assert; import org.junit.Test; public class UInt256BytesTest { private static String h(String n) { return UInt256.of(new BigInteger(n)).toShortHexString(); } @Test public void shiftLeft() { shiftLeft("0x01", 1, "0x02"); shiftLeft("0x01", 2, "0x04"); shiftLeft("0x01", 8, "0x0100"); shiftLeft("0x01", 9, "0x0200"); shiftLeft("0x01", 16, "0x10000"); shiftLeft("0x00FF00", 4, "0x0FF000"); shiftLeft("0x00FF00", 8, "0xFF0000"); shiftLeft("0x00FF00", 1, "0x01FE00"); } @Test public void shiftRight() { shiftRight("0x01", 1, "0x00"); shiftRight("0x10", 1, "0x08"); shiftRight("0x10", 2, "0x04"); shiftRight("0x10", 8, "0x00"); shiftRight("0x1000", 4, "0x0100"); shiftRight("0x1000", 5, "0x0080"); shiftRight("0x1000", 8, "0x0010"); shiftRight("0x1000", 9, "0x0008"); shiftRight("0x1000", 16, "0x0000"); shiftRight("0x00FF00", 4, "0x000FF0"); shiftRight("0x00FF00", 8, "0x0000FF"); shiftRight("0x00FF00", 1, "0x007F80"); } @Test public void longModulo() { longModulo(h("0"), 2, h("0")); longModulo(h("1"), 2, h("1")); longModulo(h("2"), 2, h("0")); longModulo(h("3"), 2, h("1")); longModulo(h("13492324908428420834234908342"), 2, h("0")); longModulo(h("13492324908428420834234908343"), 2, h("1")); longModulo(h("0"), 8, h("0")); longModulo(h("1"), 8, h("1")); longModulo(h("2"), 8, h("2")); longModulo(h("3"), 8, h("3")); longModulo(h("7"), 8, h("7")); longModulo(h("8"), 8, h("0")); longModulo(h("9"), 8, h("1")); longModulo(h("1024"), 8, h("0")); longModulo(h("1026"), 8, h("2")); longModulo(h("13492324908428420834234908342"), 8, h("6")); longModulo(h("13492324908428420834234908343"), 8, h("7")); longModulo(h("13492324908428420834234908344"), 8, h("0")); } @Test public void divide() { longDivide(h("0"), 2, h("0")); longDivide(h("1"), 2, h("0")); longDivide(h("2"), 2, h("1")); longDivide(h("3"), 2, h("1")); longDivide(h("4"), 2, h("2")); longDivide(h("13492324908428420834234908341"), 2, h("6746162454214210417117454170")); longDivide(h("13492324908428420834234908342"), 2, h("6746162454214210417117454171")); longDivide(h("13492324908428420834234908343"), 2, h("6746162454214210417117454171")); longDivide(h("2"), 8, h("0")); longDivide(h("7"), 8, h("0")); longDivide(h("8"), 8, h("1")); longDivide(h("9"), 8, h("1")); longDivide(h("17"), 8, h("2")); longDivide(h("1024"), 8, h("128")); longDivide(h("1026"), 8, h("128")); longDivide(h("13492324908428420834234908342"), 8, h("1686540613553552604279363542")); longDivide(h("13492324908428420834234908342"), 2048, h("6588049271693564860466263")); longDivide(h("13492324908428420834234908342"), 131072, h("102938269870211950944785")); } @Test public void multiply() { longMultiply(h("0"), 2, h("0")); longMultiply(h("1"), 2, h("2")); longMultiply(h("2"), 2, h("4")); longMultiply(h("3"), 2, h("6")); longMultiply(h("4"), 2, h("8")); longMultiply(h("10"), 18, h("180")); longMultiply(h("13492324908428420834234908341"), 2, h("26984649816856841668469816682")); longMultiply(h("13492324908428420834234908342"), 2, h("26984649816856841668469816684")); longMultiply(h("2"), 8, h("16")); longMultiply(h("7"), 8, h("56")); longMultiply(h("8"), 8, h("64")); longMultiply(h("17"), 8, h("136")); longMultiply(h("13492324908428420834234908342"), 8, h("107938599267427366673879266736")); longMultiply(h("13492324908428420834234908342"), 2048, h("27632281412461405868513092284416")); longMultiply(h("13492324908428420834234908342"), 131072, h("1768466010397529975584837906202624")); } @Test public void add() { longAdd(h("0"), 1, h("1")); longAdd(h("0"), 100, h("100")); longAdd(h("2"), 2, h("4")); longAdd(h("100"), 90, h("190")); longAdd(h("13492324908428420834234908342"), 10, h("13492324908428420834234908352")); longAdd(h("13492324908428420834234908342"), 23422141424214L, h("13492324908428444256376332556")); longAdd(h("1"), Long.MAX_VALUE, h(UInt256.of(2).pow(UInt256.of(63)).toString())); longAdd(h("69539042617438235654073171722120479225708093440527479355806409025672010641359"), 0, h("69539042617438235654073171722120479225708093440527479355806409025672010641359")); longAdd(h("69539042617438235654073171722120479225708093440527479355806409025672010641359"), 10, h("69539042617438235654073171722120479225708093440527479355806409025672010641369")); } @Test public void subtract() { longSubtract(h("1"), 0, h("1")); longSubtract(h("100"), 0, h("100")); longSubtract(h("4"), 2, h("2")); longSubtract(h("100"), 10, h("90")); longSubtract(h("1"), 1, h("0")); longSubtract(h("69539042617438235654073171722120479225708093440527479355806409025672010641359"), 0, h("69539042617438235654073171722120479225708093440527479355806409025672010641359")); longSubtract(h("69539042617438235654073171722120479225708093440527479355806409025672010641359"), 10, h("69539042617438235654073171722120479225708093440527479355806409025672010641349")); } @Test public void bitLength() { bitLength("0x", 0); bitLength("0x1", 1); bitLength("0x2", 2); bitLength("0x3", 2); bitLength("0xF", 4); bitLength("0x8F", 8); bitLength("0x100000000", 33); } private void bitLength(String input, int expectedLength) { Assert.assertEquals(expectedLength, UInt256Bytes.bitLength(Bytes32.fromHexStringLenient(input))); } private void shiftLeft(String input, int shift, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(input); intOp(UInt256Bytes::shiftLeft, v, shift, expected); } private void shiftRight(String input, int shift, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(input); intOp(UInt256Bytes::shiftRight, v, shift, expected); } private void longModulo(String input, long modulo, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(input); longOp(UInt256Bytes::modulo, UInt256Bytes::modulo, v, modulo, expected); } private void longDivide(String input, long divisor, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(input); longOp(UInt256Bytes::divide, UInt256Bytes::divide, v, divisor, expected); } private void longMultiply(String input, long divisor, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(input); longOp(UInt256Bytes::multiply, UInt256Bytes::multiply, v, divisor, expected); } private void longAdd(String v1, long v2, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(v1); longOp(UInt256Bytes::add, UInt256Bytes::add, v, v2, expected); } private void longSubtract(String v1, long v2, String expected) { Bytes32 v = Bytes32.fromHexStringLenient(v1); longOp(UInt256Bytes::subtract, UInt256Bytes::subtract, v, v2, expected); } interface BinaryIntOp { void applyOp(Bytes32 op1, int op2, MutableBytes32 result); } private void intOp(BinaryIntOp op, Bytes32 v1, int v2, String expected) { intOp(op, v1, v2, Bytes32.fromHexStringLenient(expected)); } private void intOp(BinaryIntOp op, Bytes32 v1, int v2, Bytes32 expected) { // Note: we only use this for bit-related operations, so displaying as Hex on error. MutableBytes32 r1 = MutableBytes32.create(); op.applyOp(v1, v2, r1); assertEquals(expected, r1, true); // Also test in-place. MutableBytes32 r2 = MutableBytes32.create(); v1.copyTo(r2); op.applyOp(r2, v2, r2); assertEquals(expected, r2, true); } private void longOp(BinaryLongOp opLong, BinaryOp op, Bytes32 v1, long v2, String expected) { Bytes32 result = Bytes32.fromHexStringLenient(expected); longOp(opLong, v1, v2, result); // Also test the Bytes32 variant to avoid tests duplication. op(op, v1, UInt256Bytes.of(v2), result); } private void longOp(BinaryLongOp op, Bytes32 v1, long v2, Bytes32 expected) { MutableBytes32 r1 = MutableBytes32.create(); op.applyOp(v1, v2, r1); assertEquals(expected, r1, false); // Also test in-place. MutableBytes32 r2 = MutableBytes32.create(); v1.copyTo(r2); op.applyOp(r2, v2, r2); assertEquals(expected, r2, false); } private void op(BinaryOp op, Bytes32 v1, Bytes32 v2, String expected) { op(op, v1, v2, Bytes32.fromHexStringLenient(expected)); } private void op(BinaryOp op, Bytes32 v1, Bytes32 v2, Bytes32 expected) { MutableBytes32 r1 = MutableBytes32.create(); op.applyOp(v1, v2, r1); assertEquals(expected, r1, false); // Also test in-place. MutableBytes32 r2 = MutableBytes32.create(); v1.copyTo(r2); op.applyOp(r2, v2, r2); assertEquals(expected, r2, false); } private void assertEquals(Bytes32 expected, Bytes32 actual, boolean displayAsHex) { if (displayAsHex) { Assert.assertEquals(expected, actual); } else { String msg = String.format("Expected %s but got %s", UInt256Bytes.toString(expected), UInt256Bytes.toString(actual)); Assert.assertEquals(msg, expected, actual); } } }
3e165ebfd074e75ec2ac292d6f7da8145243e149
4,932
java
Java
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/UITextUtils.java
tomas303/dbeaver
f96af4733065668b9483132714b1fbb11bba02a9
[ "Apache-2.0" ]
3
2017-10-25T01:25:55.000Z
2020-12-23T06:05:00.000Z
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/UITextUtils.java
tomas303/dbeaver
f96af4733065668b9483132714b1fbb11bba02a9
[ "Apache-2.0" ]
4
2020-05-16T17:16:10.000Z
2020-05-16T17:18:13.000Z
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/UITextUtils.java
tomas303/dbeaver
f96af4733065668b9483132714b1fbb11bba02a9
[ "Apache-2.0" ]
1
2017-10-18T20:06:47.000Z
2017-10-18T20:06:47.000Z
31.806452
111
0.545233
9,534
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2019 Serge Rider (envkt@example.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jkiss.dbeaver.ui; import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.jkiss.utils.CommonUtils; /** * Text utils */ public class UITextUtils { /** * Shortens a supplied string so that it fits within the area specified by * the width argument. Strings that have been shorted have an "..." attached * to the end of the string. The width is computed using the * {@link org.eclipse.swt.graphics.GC#textExtent(String)}. * * @param gc GC used to perform calculation. * @param t text to modify. * @param width Pixels to display. * @return shortened string that fits in area specified. */ public static String getShortText(GC gc, String t, int width) { if (CommonUtils.isEmpty(t)) { return t; } if (width >= gc.textExtent(t).x) { return t; } int w = gc.textExtent("...").x; String text = t; int l = text.length(); if (l > 500) l = 500; // Performance issue fix int pivot = l / 2; int s = pivot; int e = pivot + 1; while (s >= 0 && e < l) { String s1 = text.substring(0, s); String s2 = text.substring(e, l); int l1 = gc.textExtent(s1).x; int l2 = gc.textExtent(s2).x; if (l1 + w + l2 < width) { text = s1 + " ... " + s2; break; } s--; e++; } if (s == 0 || e == l) { text = text.substring(0, 1) + "..." + text.substring(l - 1, l); } return text; } /** * Shortens a supplied string so that it fits within the area specified by * the width argument. Strings that have been shorted have an "..." attached * to the end of the string. The width is computed using the * {@link org.eclipse.swt.graphics.GC#stringExtent(String)}. * <p/> * Text shorten removed due to awful algorithm (it works really slow on long strings). * TODO: make something better * * @param fontMetrics fontMetrics used to perform calculation. * @param t text to modify. * @param width Pixels to display. * @return shortened string that fits in area specified. */ public static String getShortString(FontMetrics fontMetrics, String t, int width) { // return t; if (CommonUtils.isEmpty(t)) { return t; } if (width <= 0) { return ""; //$NON-NLS-1$ } int avgCharWidth = fontMetrics.getAverageCharWidth(); float length = t.length(); if (width < length * avgCharWidth) { length = (float) width / avgCharWidth; length *= 2; // In case of big number of narrow characters if (length < t.length()) { t = t.substring(0, (int) length); //return getShortText(gc, t, width); } } return t; } public static boolean isPointInRectangle(int x, int y, int rectX, int rectY, int rectWidth, int rectHeight) { return (x >= rectX) && (y >= rectY) && x < (rectX + rectWidth) && y < (rectY + rectHeight); } /** * Gets text size. * x: maximum line length * y: number of lines * @param text source text * @return size */ public static Point getTextSize(String text) { int length = text.length(); int maxLength = 0; int lineCount = 1; int lineLength = 0; for (int i = 0; i < length; i++) { char c = text.charAt(i); switch (c) { case '\n': maxLength = Math.max(maxLength, lineLength); lineCount++; lineLength = 0; break; case '\r': break; case '\t': lineLength += 4; break; default: lineLength++; break; } } maxLength = Math.max(maxLength, lineLength); return new Point(maxLength, lineCount); } }
3e165ef7fbad105f041e5415393aa6ea7e4e5b59
7,636
java
Java
src/main/org/deidentifier/arx/risk/RiskModelAttributes.java
bitraten/arx
bcd79f013c68743a7422934f54bdec4053bfe19f
[ "Apache-2.0" ]
null
null
null
src/main/org/deidentifier/arx/risk/RiskModelAttributes.java
bitraten/arx
bcd79f013c68743a7422934f54bdec4053bfe19f
[ "Apache-2.0" ]
null
null
null
src/main/org/deidentifier/arx/risk/RiskModelAttributes.java
bitraten/arx
bcd79f013c68743a7422934f54bdec4053bfe19f
[ "Apache-2.0" ]
null
null
null
32.913793
115
0.547407
9,535
package org.deidentifier.arx.risk; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.deidentifier.arx.risk.RiskEstimateBuilder.ComputationInterruptedException; import org.deidentifier.arx.risk.RiskEstimateBuilder.WrappedBoolean; import org.deidentifier.arx.risk.RiskEstimateBuilder.WrappedInteger; /** * A class for attribute-related risks * * @author Fabian Prasser */ public abstract class RiskModelAttributes { /** * Risks associated to a certain quasi-identifier * * @author Fabian Prasser */ public final class QuasiIdentifierRisk implements Comparable<QuasiIdentifierRisk> { /** Field */ private final Set<String> identifier; /** Field */ private double highestReidentificationRisk; /** Field */ private double averageReidentificationRisk; /** Field */ private double fractionOfUniqueTuples; /** * Creates a new instance * * @param identifier */ private QuasiIdentifierRisk(Set<String> identifier) { RiskProvider provider = getRiskProvider(identifier, stop); this.identifier = identifier; this.highestReidentificationRisk = provider.getHighestRisk(); this.averageReidentificationRisk = provider.getAverageRisk(); this.fractionOfUniqueTuples = provider.getFractionOfUniqueTuples(); } @Override public int compareTo(QuasiIdentifierRisk other) { int cmp = Integer.compare(this.identifier.size(), other.identifier.size()); if (cmp != 0) { return cmp; } cmp = Double.compare(this.fractionOfUniqueTuples, other.fractionOfUniqueTuples); if (cmp != 0) { return cmp; } cmp = Double.compare(this.highestReidentificationRisk, other.highestReidentificationRisk); if (cmp != 0) { return cmp; } return Double.compare(this.averageReidentificationRisk, other.averageReidentificationRisk); } /** * @return the averageReidentificationRisk */ public double getAverageReidentificationRisk() { return averageReidentificationRisk; } /** * @return the fractionOfUniqueTuples */ public double getFractionOfUniqueTuples() { return fractionOfUniqueTuples; } /** * @return the highestReidentificationRisk */ public double getHighestReidentificationRisk() { return highestReidentificationRisk; } /** * @return the identifier */ public Set<String> getIdentifier() { return identifier; } } /** * Helper interface * * @author Fabian Prasser */ static interface RiskProvider { public abstract double getAverageRisk(); public abstract double getFractionOfUniqueTuples(); public abstract double getHighestRisk(); } /** Stop */ private final WrappedBoolean stop; /** Result */ private final QuasiIdentifierRisk[] risks; /** Result */ private final int numIdentifiers; /** * Creates a new instance * * @param identifiers * @param stop */ RiskModelAttributes(Set<String> identifiers, WrappedBoolean stop, WrappedInteger percentageDone) { this.stop = stop; this.numIdentifiers = identifiers.size(); // Compute risk estimates for all elements in the power set Set<Set<String>> powerset = getPowerSet(identifiers); Map<Set<String>, QuasiIdentifierRisk> scores = new HashMap<Set<String>, QuasiIdentifierRisk>(); int done = 0; for (Set<String> set : powerset) { checkInterrupt(); if (!set.isEmpty()) { scores.put(set, new QuasiIdentifierRisk(set)); percentageDone.value = (int) Math.round((double) done++ / (double) (powerset.size() - 1) * 100d); } } // Now compute the average of all sets for (Entry<Set<String>, QuasiIdentifierRisk> entry : scores.entrySet()) { int count = 1; for (Entry<Set<String>, QuasiIdentifierRisk> entry2 : scores.entrySet()) { checkInterrupt(); if (!entry.getKey().equals(entry2.getKey()) && entry2.getKey().containsAll(entry.getKey())) { entry.getValue().averageReidentificationRisk += entry2.getValue().averageReidentificationRisk; entry.getValue().fractionOfUniqueTuples += entry2.getValue().fractionOfUniqueTuples; entry.getValue().highestReidentificationRisk += entry2.getValue().highestReidentificationRisk; count++; } } entry.getValue().averageReidentificationRisk /= (double) count; entry.getValue().fractionOfUniqueTuples /= (double) count; entry.getValue().highestReidentificationRisk /= (double) count; } // Now create sorted array risks = new QuasiIdentifierRisk[scores.size()]; int idx = 0; for (QuasiIdentifierRisk value : scores.values()) { risks[idx++] = value; } Arrays.sort(risks); } /** * Returns the quasi-identifiers, sorted by risk * * @return */ public QuasiIdentifierRisk[] getAttributeRisks() { return this.risks; } /** * Returns the number of identifiers * * @return */ public int getNumIdentifiers() { return this.numIdentifiers; } /** * Checks for interrupts */ private void checkInterrupt() { if (stop.value) { throw new ComputationInterruptedException(); } } /** * Returns the power set * * @param originalSet * @return */ private <T> Set<Set<T>> getPowerSet(Set<T> originalSet) { checkInterrupt(); Set<Set<T>> sets = new HashSet<Set<T>>(); if (originalSet.isEmpty()) { sets.add(new HashSet<T>()); return sets; } List<T> list = new ArrayList<T>(originalSet); T head = list.get(0); Set<T> rest = new HashSet<T>(list.subList(1, list.size())); for (Set<T> set : getPowerSet(rest)) { checkInterrupt(); Set<T> newSet = new HashSet<T>(); newSet.add(head); newSet.addAll(set); sets.add(newSet); sets.add(set); } return sets; } /** * Implement this to provide risk estimates * * @param attributes * @param stop * @return */ protected abstract RiskProvider getRiskProvider(Set<String> attributes, WrappedBoolean stop); }
3e16623c65b285c28d5ee50d1839945319dfe80f
1,208
java
Java
spring-boot/src/main/java/com/exercise/demo/common/config/RedisConfig.java
ab300819/JavaConcurrencyInPractice
c2f8dced0d7d5a07504153d0ed6f084947aa86d0
[ "Apache-2.0" ]
null
null
null
spring-boot/src/main/java/com/exercise/demo/common/config/RedisConfig.java
ab300819/JavaConcurrencyInPractice
c2f8dced0d7d5a07504153d0ed6f084947aa86d0
[ "Apache-2.0" ]
3
2021-03-10T23:31:29.000Z
2022-01-27T09:44:01.000Z
spring-boot/src/main/java/com/exercise/demo/common/config/RedisConfig.java
ab300819/java-playground
2892786b097931a5629d9890e0d42b6148522741
[ "Apache-2.0" ]
null
null
null
36.606061
113
0.815397
9,536
package com.exercise.demo.common.config; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import java.io.Serializable; /** * redis 配置 * * @author mason */ @Configuration @AutoConfigureAfter(RedisAutoConfiguration.class) public class RedisConfig { @Bean public RedisTemplate<String, Serializable> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) { RedisTemplate<String, Serializable> template = new RedisTemplate<>(); template.setConnectionFactory(lettuceConnectionFactory); template.setKeySerializer(new StringRedisSerializer()); template.setValueSerializer(new GenericJackson2JsonRedisSerializer()); return template; } }
3e1662a658a5dd58bf6c845cd34699ebe6210dde
1,189
java
Java
src/main/java/test/TestHtmlCleanerExtractor.java
moma-tech/spiderman-sl
7c24e582589e1577029e80f75ef40272a56f587c
[ "Apache-2.0" ]
3
2018-01-23T16:06:39.000Z
2021-05-28T20:44:08.000Z
src/main/java/test/TestHtmlCleanerExtractor.java
moma-tech/spiderman-sl
7c24e582589e1577029e80f75ef40272a56f587c
[ "Apache-2.0" ]
null
null
null
src/main/java/test/TestHtmlCleanerExtractor.java
moma-tech/spiderman-sl
7c24e582589e1577029e80f75ef40272a56f587c
[ "Apache-2.0" ]
1
2017-10-05T10:06:33.000Z
2017-10-05T10:06:33.000Z
39.6
132
0.652357
9,537
package test; import com.alibaba.fastjson.JSON; import net.kernal.spiderman.worker.extract.extractor.Extractor; import net.kernal.spiderman.worker.extract.extractor.impl.HtmlCleanerExtractor; import net.kernal.spiderman.worker.extract.schema.Model; /** * @author 赖伟威 upchh@example.com * @version V0.1.0 */ public class TestHtmlCleanerExtractor { public static void main(String[] args) { String html = "<html><title>Hello</title><targets>dfd<target name='vivi' /><target name='linda' /></targets></html>"; Extractor extractor = new HtmlCleanerExtractor(html); Model page = new Model("page"); page.addField("title").set("xpath", "//title/text()"); page.addField("target").set("xpath", "//target").set("isAutoExtractAttrs", true).set("isArray", true); extractor.addModel(page); extractor.extract(new Extractor.Callback() { public void onModelExtracted(ModelEntry entry) { System.out.println(entry.getModel().getName() + "->\r\n" + JSON.toJSONString(entry.getFields(), true) + "\r\n\r\n"); } public void onFieldExtracted(FieldEntry entry) { } }); } }