blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
627a3ab1f8fc2ab7514d777fc6f388a4c7bd6210
ad76e355162545170e5c06958e1588637088acc6
/src/main/java/top/jloeve/aigou/services/ISearchHistoryService.java
5a34e1b9951fe9a8086e3f12e4aef7adf4345c92
[]
no_license
LonelySteve/aigou
fcc8244b2ddfbf3732980fd9ae0f40c7a2c1c9fa
f27df348c6eb679c11807145f83854e1f0a3cca2
refs/heads/master
2022-12-10T10:03:54.232968
2020-09-07T12:57:41
2020-09-07T12:57:41
284,291,169
4
0
null
null
null
null
UTF-8
Java
false
false
763
java
package top.jloeve.aigou.services; import top.jloeve.aigou.domains.impl.SearchHistory; import java.util.List; public interface ISearchHistoryService extends IService { default List<SearchHistory> getPopularSearchHistories() { return getPopularSearchHistories(null); } default List<SearchHistory> getRecentSearchHistories() { return getRecentSearchHistories(null); } default List<SearchHistory> getRecentPopularSearchHistories() { return getRecentPopularSearchHistories(null); } List<SearchHistory> getPopularSearchHistories(Integer limit); List<SearchHistory> getRecentSearchHistories(Integer limit); List<SearchHistory> getRecentPopularSearchHistories(Integer limit); boolean updateSearchHistoryCount(String keyword); }
380a74f62a347dcf43ab2003bed42acecf71d7ed
9e3ebe9976745df2936de1e2e176911b77dc5b0c
/aula-06-01-optionals-and-async-programming/src/main/java/isel/leirt/mpd/optionals/Car.java
55076056ae424a8d127743a860f9839b1580d8fb
[]
no_license
isel-leic-mpd/mpd-2021-leirt
0b4ec5f3ebd36983092f309d3c00a535bb68361a
04ad47ae1fc27188669d31a84113ab63e22602a5
refs/heads/main
2023-06-01T05:36:09.453614
2021-06-22T16:32:15
2021-06-22T16:32:15
347,735,625
3
0
null
null
null
null
UTF-8
Java
false
false
372
java
package isel.leirt.mpd.optionals; import java.util.Optional; import java.util.function.IntUnaryOperator; public class Car { private Optional<Insurance> insurance; public Car(Insurance insurance) { this.insurance = Optional.of(insurance); } public Car() { insurance = Optional.empty(); } public Optional<Insurance> getInsurance() { return insurance; } }
17d7948f626a8bd8c5114f7654a5f11b04a27599
05dd02ab29df9a3ee5dfabedac659d50bf7249b5
/HackerRank/Sorting/Sorting: Bubble Sort/Solution.java
86db0dd6356c86184d80c6529254bd66b01b4e63
[]
no_license
Mach330/ChallengeSolutions
a12d0c14b596463efb5313dcb389b837889bb250
281f3cc0fac8b1538053ece2bbed17459a88ee11
refs/heads/master
2020-06-06T07:25:36.455790
2019-07-08T08:15:52
2019-07-08T08:15:52
192,677,174
0
0
null
null
null
null
UTF-8
Java
false
false
1,431
java
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the countSwaps function below. static void countSwaps(int[] a) { int counter = 0; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a.length - 1; j++) { // Swap adjacent elements if they are in decreasing order if (a[j] > a[j + 1]) { int temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; counter++; } } } System.out.println("Array is sorted in " + counter + " swaps."); System.out.println("First Element: " + a[0]); System.out.println("Last Element: " + a[a.length - 1]); } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int[] a = new int[n]; String[] aItems = scanner.nextLine().split(" "); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); for (int i = 0; i < n; i++) { int aItem = Integer.parseInt(aItems[i]); a[i] = aItem; } countSwaps(a); scanner.close(); } }
17ac3da4bb2f3af73508935c587e5d37ab4a2333
c1c9c6be3a04e54b441b5ac6822b0402c88d7bd5
/app/src/main/java/com/example/alexa/carwiki/Helper/Async/AddCar.java
a82fb97648f663cfc2fbfbe5d92abe5cbf86ab7f
[]
no_license
VolVoX94/CarWikiFire
d72302265ea35257c4b2a032c471b36d2b543a53
51f36c0ea3a7b4fd16ecd3780bbe367864f0364a
refs/heads/master
2020-03-18T00:04:07.900340
2018-05-27T15:20:54
2018-05-27T15:20:54
134,076,086
0
0
null
null
null
null
UTF-8
Java
false
false
993
java
package com.example.alexa.carwiki.Helper.Async; import android.arch.persistence.room.Room; import android.os.AsyncTask; import android.view.View; import com.example.alexa.carwiki.Entities.AppDatabase; import com.example.alexa.carwiki.Entities.CarEntity; import java.lang.ref.WeakReference; /** * Created by alexa on 17.04.2018. */ public class AddCar extends AsyncTask<CarEntity, Void, Void> { // Weak references will still allow the Activity to be garbage-collected private final WeakReference<View> mView; public AddCar(View view) { mView = new WeakReference<>(view); } @Override protected Void doInBackground(CarEntity... carEntities) { AppDatabase db = DatabaseCreator.getInstance(mView.get().getContext()).getDatabase(); //AppDatabase db = Room.databaseBuilder(mView.get().getContext(), AppDatabase.class, "production").build(); db.carDao().insertCarEntity(carEntities[0]); //db.close(); return null; } }
d8defe58abc5ff7dd10489689ae408b66620457e
93694c90cef607e99faddb2c116fc1f2a2766952
/pinyougou_service_sellergoods/src/main/java/com/jlb/core/service/spec/SpecificationServiceImpl.java
a8305591281b0863490348e7e63271562561a4b1
[]
no_license
yuxfan/pingyougou_parent
c404cc95966866966dd419939e340a2505758253
ab550be8045af62fb964dcd6e0e3032182ac9282
refs/heads/master
2020-04-08T02:30:05.312575
2018-11-24T13:07:31
2018-11-24T13:09:15
158,937,592
0
0
null
null
null
null
UTF-8
Java
false
false
5,587
java
package com.jlb.core.service.spec; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.jlb.core.dao.specification.SpecificationDao; import com.jlb.core.dao.specification.SpecificationOptionDao; import com.jlb.core.entity.PageResult; import com.jlb.core.pojo.specification.Specification; import com.jlb.core.pojo.specification.SpecificationOption; import com.jlb.core.pojo.specification.SpecificationOptionQuery; import com.jlb.core.pojo.specification.SpecificationQuery; import com.jlb.core.vo.SpecificationVo; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; import java.util.Map; @Service public class SpecificationServiceImpl implements SpecificationService { @Resource private SpecificationDao specificationDao; @Resource private SpecificationOptionDao specificationOptionDao; //分页查询列表 @Override public PageResult search(Integer page, Integer rows, Specification specification) { PageHelper.startPage(page,rows); PageHelper.orderBy("id desc"); //对象封装的是查询的结果 SpecificationQuery specificationQuery=new SpecificationQuery(); if (specification.getSpecName() != null && !"".equals(specification.getSpecName().trim())){ specificationQuery.createCriteria().andSpecNameLike("%"+specification.getSpecName().trim()+"%"); } Page<Specification> pageList = (Page<Specification>) specificationDao.selectByExample(specificationQuery); //返回总条数和结果集 return new PageResult(pageList.getTotal(),pageList.getResult()); } //查询数据回显 一个规格 对应 多个规格选项 @Override public SpecificationVo findOne(Long id) { // 查询规格 Specification specification = specificationDao.selectByPrimaryKey(id); // 查询规格选项 SpecificationOptionQuery optionQuery = new SpecificationOptionQuery(); //主外键关联统一 optionQuery.createCriteria().andSpecIdEqualTo(id); List<SpecificationOption> specificationOptionList = specificationOptionDao.selectByExample(optionQuery); // 封装数据 SpecificationVo specificationVo = new SpecificationVo(); specificationVo.setSpecification(specification); specificationVo.setSpecificationOptionList(specificationOptionList); return specificationVo; } //保存 //SpecificationVo 有specification对象和SpecificationOption对象 @Transactional @Override public void add(SpecificationVo specificationVo) { //保存规格 Specification specification = specificationVo.getSpecification(); //返回自增主键的id usegenaratedkeys 使用自动生成主键 specificationDao.insertSelective(specification); //保存规格选项 List<SpecificationOption> specificationOptionList = specificationVo.getSpecificationOptionList(); if (specificationOptionList != null && specificationOptionList.size()>0 ){ for (SpecificationOption specificationOption : specificationOptionList) { //设置外键 将specification(规格)的id保存到specificationOption(规格选项)中,就是主键和外键统一 specificationOption.setSpecId(specification.getId()); //单条插入 // specificationOptionDao.insertSelective(specificationOption); } //批量插入 specificationOptionDao.insertSelectives(specificationOptionList); } } //更新 @Transactional @Override public void update(SpecificationVo specificationVo) { // 更新规格 Specification specification = specificationVo.getSpecification(); specificationDao.updateByPrimaryKeySelective(specification); // 更新规格选项 // 先删除 SpecificationOptionQuery optionQuery = new SpecificationOptionQuery(); optionQuery.createCriteria().andSpecIdEqualTo(specification.getId()); //设置外键 specificationOptionDao.deleteByExample(optionQuery); // 后插入 List<SpecificationOption> specificationOptionList = specificationVo.getSpecificationOptionList(); if(specificationOptionList != null && specificationOptionList.size() > 0){ for (SpecificationOption specificationOption : specificationOptionList) { specificationOption.setSpecId(specification.getId()); // 设置外键 } // 批量插入 specificationOptionDao.insertSelectives(specificationOptionList); } } //删除 @Transactional @Override public void dele(Long[] ids) { if (ids != null && ids.length>0){ for (Long id : ids) { //删除规格 specificationDao.deleteByPrimaryKey(id); //将查询创造的id封装到SpecificationOptionQuery中并作为删除的例子返回 SpecificationOptionQuery speQuery = new SpecificationOptionQuery(); speQuery.createCriteria().andSpecIdEqualTo(id); //删除规格选项 specificationOptionDao.deleteByExample(speQuery); } } } //分类模板之规格选项回显 @Override public List<Map<String, String>> selectOptionList() { return specificationDao.selectOptionList(); } }
8912df88896b17770c9406130a6011fb64e36c83
733493ab0a9f3232954769a364e271ec547f2cec
/src/main/java/br/com/blz/testjava/controller/ProductController.java
5f61cda59a7ffe7afcd8e83dd04d273ff698fff6
[]
no_license
evignacio/test-java
1533a7fe6ab2328543d8b88f28e28fc63b3777ca
6e4702f299e45ad8d144cfc9f3bbb7f8101ce89c
refs/heads/master
2023-02-14T20:50:07.374094
2021-01-17T18:32:42
2021-01-17T18:32:42
330,005,496
0
0
null
2021-01-15T19:38:53
2021-01-15T19:38:33
null
UTF-8
Java
false
false
1,552
java
package br.com.blz.testjava.controller; import br.com.blz.testjava.controller.request.ProductRequest; import br.com.blz.testjava.domain.entity.Product; import br.com.blz.testjava.service.ProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.Set; @RestController @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; @GetMapping public ResponseEntity<Set<Product>> findAll() { return new ResponseEntity<>(productService.findAll(), HttpStatus.OK); } @GetMapping("{sku}") public ResponseEntity<Product> findBySku(@PathVariable Long sku) { return new ResponseEntity<>(productService.findBySku(sku), HttpStatus.OK); } @PostMapping public ResponseEntity<Void> create(@RequestBody @Valid ProductRequest productRequest) { productService.create(productRequest); return new ResponseEntity<>(HttpStatus.CREATED); } @PatchMapping public ResponseEntity<Product> update(@RequestBody ProductRequest productRequest) { return new ResponseEntity<>(productService.update(productRequest), HttpStatus.OK); } @DeleteMapping("{sku}") public ResponseEntity<Void> delete(@PathVariable Long sku) { productService.delete(sku); return new ResponseEntity<>(HttpStatus.OK); } }
38bebb7e9d24d7a33e4401a37b50380a8c0714c7
bc81e0f5e18c98b2c9705616d9ef976d5a8a3547
/src/main/java/com/expedia/fitflights/models/enums/TimeOfDay.java
bf9f5b48ac58d2b8d983cd5ae437318772bb60c1
[]
no_license
EnzoRoselli/globant-fit
61d16ba5b5ca9fe4ec65e1da9ef2245906260054
54bea74b1eeee6168ca73559ab9f696e629fd784
refs/heads/main
2023-06-04T15:55:12.584356
2021-06-20T18:43:02
2021-06-20T18:43:02
375,508,102
0
0
null
null
null
null
UTF-8
Java
false
false
103
java
package com.expedia.fitflights.models.enums; public enum TimeOfDay { AM, PM, am, pm }
2adb5c2c3c8eefe7805e14e8602bdb60a89964b9
14d1ceda0a3be4e1a1d0af9105c49f97a7a6336d
/android-application/ChineseCheckers/src/instrumentTest/java/ca/brocku/chinesecheckers/tests/SettingsActivityUnitTest.java
765c11fe93ea107e9fc15680182761ab10df4879
[]
no_license
kubasub/chinese-checkers
5cc0d3342a8ed7cf3bb861ed60c66db36f17dc4e
a744c61bc113e14458c434887e85efafa23a9459
refs/heads/master
2021-01-17T21:57:43.401284
2014-04-03T21:12:36
2014-04-03T21:12:36
13,486,584
0
1
null
null
null
null
UTF-8
Java
false
false
3,885
java
package ca.brocku.chinesecheckers.tests; import android.app.Activity; import android.app.Instrumentation; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.test.ActivityInstrumentationTestCase2; import android.test.TouchUtils; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import ca.brocku.chinesecheckers.HelpActivity; import ca.brocku.chinesecheckers.MainActivity; import ca.brocku.chinesecheckers.R; import ca.brocku.chinesecheckers.SettingsActivity; /** * Created by Main on 3/18/14. */ public class SettingsActivityUnitTest extends ActivityInstrumentationTestCase2<SettingsActivity> { private TestHelpers testHelper; private Activity curAct; private Instrumentation curInstruments; private Instrumentation.ActivityMonitor monitor; public SettingsActivityUnitTest() { super(SettingsActivity.class); testHelper = new TestHelpers(); } public SettingsActivityUnitTest(Activity curAct, Instrumentation curInstruments) { super(SettingsActivity.class); this.curAct = curAct; this.curInstruments = curInstruments; testHelper = new TestHelpers(); } protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(false); curAct = getActivity(); curInstruments = getInstrumentation(); } public void activityTest() { final ActivityInstrumentationTestCase2 actInsTest = this; final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(curAct); assertNotNull("SettingsActivity Not Started", curAct); synchronized (curAct) { curAct.runOnUiThread(new Runnable() { public void run() { RadioButton showMoveOn = (RadioButton) curAct.findViewById(R.id.settingsShowMoveOnButton); RadioButton showMoveOff = (RadioButton) curAct.findViewById(R.id.settingsShowMoveOffButton); RadioGroup showMoveGroup = (RadioGroup) curAct.findViewById(R.id.settingsShowMovesRadioGroup); showMoveGroup.clearCheck(); showMoveGroup.check(R.id.settingsShowMoveOnButton); try{Thread.sleep(1000);}catch (Exception e){} testHelper.RadioButtonTest(actInsTest, showMoveOn, true, true); testHelper.RadioButtonTest(actInsTest, showMoveOff, true, false); showMoveGroup.check(R.id.settingsShowMoveOffButton); try{Thread.sleep(1000);}catch (Exception e){} testHelper.RadioButtonTest(actInsTest, showMoveOn, true, false); testHelper.RadioButtonTest(actInsTest, showMoveOff, true, true); showMoveGroup.check(R.id.settingsShowMoveOnButton); try{Thread.sleep(1000);}catch (Exception e){} testHelper.RadioButtonTest(actInsTest, showMoveOn, true, true); testHelper.RadioButtonTest(actInsTest, showMoveOff, true, false); String username = sharedPrefs.getString(MainActivity.PREF_USER_ID, ""); testHelper.EditTextTest(actInsTest, (EditText) curAct.findViewById(R.id.settingsUsernameEditText), true,username); } }); } SettingsRunnable sR = new SettingsRunnable(); synchronized (sR) { try { curAct.runOnUiThread(sR); ((Object) sR).wait(); } catch (Exception e) { } } } class SettingsRunnable implements Runnable { public void run() { synchronized (this) { curAct.onBackPressed(); ((Object) this).notify(); } } } }
443f60bea9c287f29c404efecfc042d91e5d7485
bc5231970ae7d1cd717c81dd168b620ac8ff9001
/app/src/main/java/com/roman/fightnet/ui/activities/profileActivities/fragments/SearchFragment.java
5834953f5ea181c71dc9e402b7cc80fcd2dd4543
[]
no_license
Dardem30/fightnetAndroid
3c62662acfd8187a0d0820d0116c41dbf1c65127
3a64aa864a75c85ea190d5970cfc66bc69c883de
refs/heads/master
2020-06-21T06:57:19.336777
2019-11-17T13:21:28
2019-11-17T13:21:28
197,375,365
0
0
null
null
null
null
UTF-8
Java
false
false
11,243
java
package com.roman.fightnet.ui.activities.profileActivities.fragments; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import com.roman.fightnet.BR; import com.roman.fightnet.R; import com.roman.fightnet.databinding.FragmentSearchBinding; import com.roman.fightnet.requests.models.AppUser; import com.roman.fightnet.requests.models.City; import com.roman.fightnet.requests.models.Country; import com.roman.fightnet.requests.models.SearchResponse; import com.roman.fightnet.requests.models.searchCriteria.UserSearchCriteria; import com.roman.fightnet.requests.service.AuthService; import com.roman.fightnet.requests.service.UserService; import com.roman.fightnet.requests.service.util.UtilService; import com.roman.fightnet.ui.util.UserAdapter; import com.tiper.MaterialSpinner; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static com.roman.fightnet.IConstants.PREFERABLE_KIND; import static com.roman.fightnet.IConstants.fightStyles; import static com.roman.fightnet.IConstants.storage; public class SearchFragment extends Fragment { private final AuthService authService = UtilService.getAuthService(); private final UserService userService = UtilService.getUserService(); private final UserSearchCriteria searchCriteria = new UserSearchCriteria(); private boolean allRecordsShown = false; private List<Country> countriesList = new ArrayList<>(); private List<City> cityList = new ArrayList<>(); String preferredKind; String country; String city; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { searchCriteria.setPageNum(searchCriteria.getPageNum() + 1); searchCriteria.setSearcherEmail(storage.getEmail()); final FragmentSearchBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_search, container, false); binding.setVariable(BR.searchCriteria, searchCriteria); final View view = binding.getRoot(); final EditText searchField = view.findViewById(R.id.searchField); searchField.setOnTouchListener((v, event) -> { final int DRAWABLE_RIGHT = 2; if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getRawX() >= (searchField.getRight() - searchField.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { search(view, false); return true; } } return false; }); LinearLayout llBottomSheet = view.findViewById(R.id.bottom_sheet); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(llBottomSheet); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); bottomSheetBehavior.setPeekHeight(140); bottomSheetBehavior.setHideable(false); bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { if (newState == BottomSheetBehavior.STATE_COLLAPSED) { search(view, false); } } @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { } }); final MaterialSpinner preferableFightStyleSpinner = view.findViewById(R.id.searchPreferableFightStyle); preferableFightStyleSpinner.setAdapter(UtilService.setupStringAdapter(fightStyles, container.getContext())); preferableFightStyleSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onNothingSelected(MaterialSpinner materialSpinner) { } @Override public void onItemSelected(MaterialSpinner materialSpinner, View view, int position, long l) { preferredKind = fightStyles.get(position); } }); // TODO parallel stream try { authService.getCountries().enqueue(new Callback<List<Country>>() { @Override public void onResponse(Call<List<Country>> call, Response<List<Country>> response) { countriesList = response.body(); view.findViewById(R.id.searchFromSearchPanel).setOnClickListener(view1 -> search(view, false)); MaterialSpinner countries = view.findViewById(R.id.searchCountries); final MaterialSpinner cititesSpinner = view.findViewById(R.id.searchCitites); final List<String> countryNames = new ArrayList<>(countriesList.size()); countryNames.add("Country"); for (final Country country : countriesList) { countryNames.add(country.getName()); } countries.setAdapter(UtilService.setupStringAdapter(countryNames, container.getContext())); countries.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onNothingSelected(MaterialSpinner materialSpinner) { } @Override public void onItemSelected(MaterialSpinner materialSpinner, View view, int position, long l) { country = countryNames.get(position); try { authService.getCities(country).enqueue(new Callback<List<City>>() { @Override public void onResponse(Call<List<City>> call, Response<List<City>> responseCity) { cityList = responseCity.body(); if (cityList != null) { final List<String> cityNames = new ArrayList<>(cityList.size()); cityNames.add("City"); for (final City city : cityList) { cityNames.add(city.getName()); } cititesSpinner.setAdapter(UtilService.setupStringAdapter(cityNames, container.getContext())); cititesSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onNothingSelected(MaterialSpinner materialSpinner) { } @Override public void onItemSelected(MaterialSpinner materialSpinner, View view, int positionCity, long l) { city = cityNames.get(positionCity); } }); } } @Override public void onFailure(Call<List<City>> call, Throwable t) { } }); } catch (Exception e) { Log.e("SearchFragment", "Error during trying to setup cities spinner", e); } } }); } @Override public void onFailure(Call<List<Country>> call, Throwable t) { } }); } catch (Exception e) { Log.e("SearchFragment", "Error during trying to setup countries spinner", e); } search(view, false); return view; } private void search(final View view, boolean addArray) { if (!addArray) { searchCriteria.setPageNum(1); } if (city != null && !city.equals("City")) { searchCriteria.setCity(city); } if (country != null && !country.equals("Country")) { searchCriteria.setCountry(country); } if (preferredKind != null && !preferredKind.equals(PREFERABLE_KIND)) { searchCriteria.setPreferredKind(preferredKind); } try { for (final Field field : searchCriteria.getClass().getDeclaredFields()) { field.setAccessible(true); final Object value = field.get(searchCriteria); if (value instanceof String && value.equals("")) { field.set(searchCriteria, null); } } } catch (final Exception e) { Log.e("SearchFragment", "Error during trying to nullify field", e); } userService.listUsers(searchCriteria).enqueue(new Callback<SearchResponse<AppUser>>() { @Override public void onResponse(Call<SearchResponse<AppUser>> call, Response<SearchResponse<AppUser>> response) { final RecyclerView recyclerView = view.findViewById(R.id.recyclerView); recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { // API level 18 @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (!recyclerView.canScrollVertically(1) && !allRecordsShown) { searchCriteria.setPageNum(searchCriteria.getPageNum() + 1); search(view, true); } } }); recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); if (addArray) { allRecordsShown = ((UserAdapter) recyclerView.getAdapter()).updateDataSet(response.body().getRecords(), recyclerView) == response.body().getCount(); } else { recyclerView.setAdapter(new UserAdapter(view.getContext(), response.body().getRecords(), getFragmentManager())); } } @Override public void onFailure(Call<SearchResponse<AppUser>> call, Throwable t) { System.out.println("error"); } }); } }
4184d57c239a214c0e54e8435abd0109c73fc357
79cf7adc9360fa29c565cc02865c63b1c18a30cf
/src/com/company/arrays/Maximum_absolute_value_expression.java
cf8bc1f4b44e1eff3b0eea9fb7712581ded9f627
[]
no_license
justdvnsh/Leetcode_solutions
9e183f43800d27d5f1ad6bd962be449d7c4adb5d
b4881a0444f8acc69d95fc2f7aa01d3741845b0b
refs/heads/master
2023-07-02T06:39:54.902627
2021-07-31T17:51:08
2021-07-31T17:51:08
379,597,175
0
0
null
null
null
null
UTF-8
Java
false
false
1,768
java
package com.company.arrays; import java.util.ArrayList; import java.util.Arrays; public class Maximum_absolute_value_expression { public static void main(String[] args){ int[] arr1 = {1,2,3,4}; int[] arr2 = {-1,4,5,6}; int[] arr3 = {1,-2,-5,0,10}; int[] arr4 = {0,-2,-1,-7,-4}; int[] arr5 = {1,-2}; int[] arr6 = {8,8}; // System.out.println(maxAbsvalExp(arr1, arr2)); // System.out.println(maxAbsvalExp(arr3, arr4)); System.out.println(maxAbsValExpOptimized(arr1, arr2)); System.out.println(maxAbsValExpOptimized(arr3, arr4)); System.out.println(maxAbsValExpOptimized(arr5, arr6)); } // O(n^2) approach -> Brute force public static int maxAbsvalExp(int[] arr1, int[] arr2) { int max = 0; for (int i = 0; i < arr1.length; i++) { for (int j=i; j < arr1.length; j++) { int val = Math.abs(arr1[i] - arr1[j]) + Math.abs(arr2[i] - arr2[j]) + Math.abs(i - j); if (val > max) max = val; } } return max; } // O(n) approach -> Simplyfying the expression public static int maxAbsValExpOptimized(int[] arr1, int[] arr2) { int[] signs = new int[] {-1, 1}; int best = 0; for (int s1 : signs) { for (int s2 : signs) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for (int i = 0; i < arr1.length; i++) { int val = s1 * arr1[i] + s2 * arr2[i] + i; min = Math.min(val, min); max = Math.max(val, max); } best = Math.max(max - min, best); } } return best; } }
7452194dbf7ddcf0b52cc8b9a29fabe0d7ff7105
fed778472dcdf4f872f485769eb6ce46ba62166c
/p4/wordTree/src/wordTree/threadMgmt/PopulateThread.java
01d59b265b037dd6e8fcf9b589f6d4db835616e5
[]
no_license
KsirbJ/Design-Patterns
87aa1ff449f1c7f1e5c75ad36d116c7dc21a108a
caabd5be09a5648f58bdf811df0e9b2e0d89006e
refs/heads/master
2021-08-28T11:16:45.528203
2017-12-12T03:20:34
2017-12-12T03:20:34
113,937,171
1
2
null
null
null
null
UTF-8
Java
false
false
1,138
java
package wordTree.threadMgmt; import wordTree.util.FileProcessor; import wordTree.util.MyLogger; import wordTree.store.Results; import wordTree.wordNode.Tree; import java.util.regex.PatternSyntaxException; public class PopulateThread implements Runnable { Tree tree; FileProcessor myFile; public PopulateThread(FileProcessor file, Results res, Tree tree_in){ MyLogger.writeMessage("PopulateThread constructor called.", MyLogger.DebugLevel.CONSTRUCTOR); tree = tree_in; myFile = file; } public void run(){ try { MyLogger.writeMessage("PopulateThread run method called.", MyLogger.DebugLevel.RUN); String line = myFile.readLine(); while(line != null){ if(line.trim().isEmpty()){ line = myFile.readLine(); continue; } String[] words = line.split(" +"); for (String word : words){ tree.addWord(word); } line = myFile.readLine(); } } catch (PatternSyntaxException | NullPointerException e){ //no sleep, wait, or join called, so can't catch InterruptedException e.printStackTrace(); } finally { } } @Override public String toString(){ return ""; } }
0201d4e0924a5e70176515d177ce8d27cedc2a68
27c90e727c49c907ad2f4c22747e8b920bcc4d75
/src/stackqueuepackage/Stack.java
ad86edc57b435d932442524c2f2322a2f8e69e0a
[]
no_license
satyasagar/eclipse-DS
3b8b585666242218f6b1f2433cfa5a54bb2b8093
d53451ff6952f9805601a75495c4eded05b3f5aa
refs/heads/master
2020-03-26T19:05:36.634953
2018-08-18T20:12:28
2018-08-18T20:12:28
145,248,612
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package stackqueuepackage; public class Stack { Node top; public void push(int data){ if(top == null){ top = new Node(data); top.value = data; return; } Node newNode = new Node(data); newNode.next = top; top = newNode; } public int pop(){ int popped = top.value; top = top.next; return popped; } public void displayStack(){ System.out.println("--Recently pushed first--"); Node current = top; while(current.next != null){ current.displayNode(); current = current.next; } current.displayNode(); } }
4f9adf460b70a398a2cfe3cda329933374280159
2e924b045959e20a7ae5a286f794e8609664c68c
/BibliotecaApp/src/cl/inacap/bibliotecaApp/frames/package-info.java
2dc6981be97d2b42b63d9f80f619e5767bf680a0
[]
no_license
constanzaB72/biblioteca
40e79d29e3cef73027b1f52f39188b70664eb1c9
4d2cb82fc21ee3e764d9529c983ac43a540fe813
refs/heads/main
2023-06-29T11:44:51.652477
2021-07-28T17:18:20
2021-07-28T17:18:20
377,364,486
0
0
null
null
null
null
UTF-8
Java
false
false
39
java
package cl.inacap.bibliotecaApp.frames;
f6861e09b3c4a60ad5a93ababd2b5f0b3d6db317
11ad2a4b481deca08f5f174211cf8a82511bf86d
/dpsrc_2009-10-10/src/AbstractFactory/A2/listfactory/ListPage.java
0bbb1fc912506702f71a8ef1824df1b736d1abb1
[ "Zlib" ]
permissive
MaoTSUJI/Java_design
5fd83decceeb73d61b20c07d7aef03ca3403ed33
8287e028b357771cc4a27d00e94677a50247a76b
refs/heads/master
2023-02-01T04:44:37.280680
2020-12-20T04:55:46
2020-12-20T04:55:46
272,476,081
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package listfactory; import factory.*; import java.util.Iterator; public class ListPage extends Page { public ListPage(String title, String author) { super(title, author); } public String makeHTML() { StringBuffer buffer = new StringBuffer(); buffer.append("<html><head><title>" + title + "</title></head>\n"); buffer.append("<body>\n"); buffer.append("<h1>" + title + "</h1>\n"); buffer.append("<ul>\n"); Iterator it = content.iterator(); while (it.hasNext()) { Item item = (Item) it.next(); buffer.append(item.makeHTML()); } buffer.append("</ul>\n"); buffer.append("<hr><address>" + author + "</address>"); buffer.append("</body></html>\n"); return buffer.toString(); } }
[ "" ]
07ee95610e65d35341bad3eeb2b0513948698e76
d9983b2a036d8409f6ba019aceac679e11984e33
/transfer/core/src/test/java/com/asta/app2/dao/TicketTempDaoTestOff.java
ac75c8904777890f20b54a37025183597d6a98a7
[]
no_license
transx/transx
0354c884937337b4506f8960cd27a2f8a510d5cb
bdb0c8b048764b173bd0588c0cea6ac17c722222
refs/heads/master
2016-09-06T01:47:36.624698
2013-03-04T18:49:25
2013-03-04T18:49:25
7,987,873
1
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
/* *Class created on [ Jun 24, 2008 | 12:31:01 PM ] */ package com.asta.app2.dao; import com.asta.app2.model.Service; import com.asta.app2.model.TicketTemp; /** * * @author <a href="mailto:[email protected]">Saeid Moradi</a> */ public class TicketTempDaoTestOff extends BaseDaoTestCase { private TicketTempDao ticketTempDao; private ServiceDao serviceDao; /* public void testFindTTbyService() { log.debug("testing findTicketTempsByService......"); Service service = serviceDao.get(-1L); assertTrue(ticketTempDao.findTicketTempsByService(service).size() >= 1); log.debug("the size of list is :" + ticketTempDao.findTicketTempsByService(service).size()); }*/ /* public void testFindTTbyTicketTemp(){ log.debug("testing findTicketTempByServiceAndPassenger"); TicketTemp ticketTemp = ticketTempDao.get(-1L); assertTrue(ticketTempDao.findTicketTempsByServiceAndPassenger(ticketTemp).size() >= 1); log.debug("the size of list is :" + ticketTempDao.findTicketTempsByServiceAndPassenger(ticketTemp).size()); }*/ public void setTicketTempDao(TicketTempDao ttDao) { this.ticketTempDao = ttDao; } public void setServiceDao(ServiceDao serviceDao) { this.serviceDao = serviceDao; } }
[ "saeid@236e5a06-0ea0-467e-baea-b0eaaccbcb26" ]
saeid@236e5a06-0ea0-467e-baea-b0eaaccbcb26
39f19eae8f4978f0466cf63752fad0a497b02912
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/vs-20181212/src/main/java/com/aliyun/vs20181212/models/SetVsStreamsNotifyUrlConfigResponse.java
8d64259111a34281b3b11c63006e101dc622b219
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
1,168
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.vs20181212.models; import com.aliyun.tea.*; public class SetVsStreamsNotifyUrlConfigResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("body") @Validation(required = true) public SetVsStreamsNotifyUrlConfigResponseBody body; public static SetVsStreamsNotifyUrlConfigResponse build(java.util.Map<String, ?> map) throws Exception { SetVsStreamsNotifyUrlConfigResponse self = new SetVsStreamsNotifyUrlConfigResponse(); return TeaModel.build(map, self); } public SetVsStreamsNotifyUrlConfigResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public SetVsStreamsNotifyUrlConfigResponse setBody(SetVsStreamsNotifyUrlConfigResponseBody body) { this.body = body; return this; } public SetVsStreamsNotifyUrlConfigResponseBody getBody() { return this.body; } }
b33897e260d4ed7adb1c34f712ce092fc4a9c704
c885ef92397be9d54b87741f01557f61d3f794f3
/results/JacksonDatabind-103/com.fasterxml.jackson.databind.deser.BasicDeserializerFactory/BBC-F0-opt-70/tests/19/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory_ESTest.java
f40797040788132ac7c59050c4e90c4defc73512
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
96,156
java
/* * This file was automatically generated by EvoSuite * Thu Oct 21 19:44:07 GMT 2021 */ package com.fasterxml.jackson.databind.deser; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.ObjectIdResolver; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.filter.FilteringParserDelegate; import com.fasterxml.jackson.core.filter.TokenFilter; import com.fasterxml.jackson.core.json.ReaderBasedJsonParser; import com.fasterxml.jackson.core.util.JsonParserDelegate; import com.fasterxml.jackson.databind.AbstractTypeResolver; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.KeyDeserializer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.PropertyName; import com.fasterxml.jackson.databind.cfg.BaseSettings; import com.fasterxml.jackson.databind.cfg.ConfigOverrides; import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory; import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext; import com.fasterxml.jackson.databind.deser.DeserializerFactory; import com.fasterxml.jackson.databind.deser.Deserializers; import com.fasterxml.jackson.databind.deser.KeyDeserializers; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.deser.ValueInstantiators; import com.fasterxml.jackson.databind.deser.impl.CreatorCandidate; import com.fasterxml.jackson.databind.deser.impl.CreatorCollector; import com.fasterxml.jackson.databind.deser.std.StdKeyDeserializers; import com.fasterxml.jackson.databind.ext.NioPathDeserializer; import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.introspect.AnnotatedClass; import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; import com.fasterxml.jackson.databind.introspect.AnnotatedParameter; import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams; import com.fasterxml.jackson.databind.introspect.AnnotationMap; import com.fasterxml.jackson.databind.introspect.BasicBeanDescription; import com.fasterxml.jackson.databind.introspect.ObjectIdInfo; import com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector; import com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder; import com.fasterxml.jackson.databind.introspect.SimpleMixInResolver; import com.fasterxml.jackson.databind.introspect.TypeResolutionContext; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer; import com.fasterxml.jackson.databind.jsontype.impl.AsExternalTypeDeserializer; import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver; import com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver; import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; import com.fasterxml.jackson.databind.module.SimpleDeserializers; import com.fasterxml.jackson.databind.module.SimpleValueInstantiators; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.BooleanNode; import com.fasterxml.jackson.databind.node.DoubleNode; import com.fasterxml.jackson.databind.node.FloatNode; import com.fasterxml.jackson.databind.node.LongNode; import com.fasterxml.jackson.databind.node.MissingNode; import com.fasterxml.jackson.databind.type.ArrayType; import com.fasterxml.jackson.databind.type.CollectionLikeType; import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.MapLikeType; import com.fasterxml.jackson.databind.type.MapType; import com.fasterxml.jackson.databind.type.PlaceholderForType; import com.fasterxml.jackson.databind.type.ReferenceType; import com.fasterxml.jackson.databind.type.ResolvedRecursiveType; import com.fasterxml.jackson.databind.type.SimpleType; import com.fasterxml.jackson.databind.type.TypeBindings; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.databind.util.AccessPattern; import com.fasterxml.jackson.databind.util.RootNameLookup; import com.fasterxml.jackson.databind.util.TokenBuffer; import java.io.IOException; import java.sql.BatchUpdateException; import java.sql.DataTruncation; import java.sql.SQLClientInfoException; import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLNonTransientException; import java.sql.SQLRecoverableException; import java.sql.SQLSyntaxErrorException; import java.sql.SQLTimeoutException; import java.sql.SQLTransientConnectionException; import java.sql.SQLTransientException; import java.sql.SQLWarning; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.atomic.AtomicReference; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class BasicDeserializerFactory_ESTest extends BasicDeserializerFactory_ESTest_scaffolding { @Test(timeout = 4000) public void test000() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory(deserializerFactoryConfig1); Class<SQLWarning> class0 = SQLWarning.class; JavaType[] javaTypeArray0 = new JavaType[2]; javaTypeArray0[1] = javaType0; CollectionType collectionType0 = CollectionType.construct((Class<?>) class0, (TypeBindings) null, (JavaType) arrayType0, javaTypeArray0, javaTypeArray0[1]); beanDeserializerFactory1._findCustomCollectionDeserializer(collectionType0, (DeserializationConfig) null, basicBeanDescription0, (TypeDeserializer) null, jsonDeserializer0); assertTrue(arrayType0.hasValueHandler()); assertTrue(arrayType0.hasHandlers()); } @Test(timeout = 4000) public void test001() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory(deserializerFactoryConfig1); ReferenceType referenceType0 = ReferenceType.upgradeFrom(arrayType0, javaType0); beanDeserializerFactory1._findCustomReferenceDeserializer(referenceType0, (DeserializationConfig) null, basicBeanDescription0, (TypeDeserializer) null, jsonDeserializer0); assertTrue(referenceType0.hasValueHandler()); assertTrue(arrayType0.hasHandlers()); } @Test(timeout = 4000) public void test002() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<CreatorCandidate> class0 = CreatorCandidate.class; Class<ConcurrentSkipListMap> class1 = ConcurrentSkipListMap.class; MapType mapType0 = typeFactory0.constructMapType(class1, class0, class1); // Undeclared exception! try { beanDeserializerFactory0.createMapLikeDeserializer(defaultDeserializationContext_Impl0, mapType0, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test003() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((List) null).when(pOJOPropertiesCollector0).getProperties(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forDeserialization(pOJOPropertiesCollector0); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0._findCreatorsFromProperties(defaultDeserializationContext_Impl0, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test004() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; BeanDeserializerModifier beanDeserializerModifier0 = mock(BeanDeserializerModifier.class, new ViolatedAssumptionAnswer()); DeserializerFactory deserializerFactory0 = beanDeserializerFactory0.withDeserializerModifier(beanDeserializerModifier0); assertNotSame(beanDeserializerFactory0, deserializerFactory0); } @Test(timeout = 4000) public void test005() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); DeserializerFactory deserializerFactory0 = beanDeserializerFactory0.withAdditionalDeserializers(simpleDeserializers0); assertFalse(deserializerFactory0.equals((Object)beanDeserializerFactory0)); } @Test(timeout = 4000) public void test006() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<ObjectIdGenerators.UUIDGenerator> class0 = ObjectIdGenerators.UUIDGenerator.class; Class<SQLFeatureNotSupportedException> class1 = SQLFeatureNotSupportedException.class; SimpleType simpleType0 = SimpleType.constructUnsafe(class1); ArrayType arrayType0 = ArrayType.construct((JavaType) simpleType0, (TypeBindings) null); JavaType[] javaTypeArray0 = new JavaType[8]; javaTypeArray0[0] = (JavaType) arrayType0; ReferenceType referenceType0 = ReferenceType.construct((Class<?>) class0, (TypeBindings) null, (JavaType) arrayType0, javaTypeArray0, javaTypeArray0[0]); SimpleType simpleType1 = referenceType0.withStaticTyping(); JavaType javaType0 = beanDeserializerFactory0.mapAbstractType((DeserializationConfig) null, simpleType1); assertEquals(0, javaType0.containedTypeCount()); } @Test(timeout = 4000) public void test007() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<List> class0 = List.class; CollectionType collectionType0 = typeFactory0.constructRawCollectionType(class0); StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver(); RootNameLookup rootNameLookup0 = new RootNameLookup(); ConfigOverrides configOverrides0 = new ConfigOverrides(); DeserializationConfig deserializationConfig0 = new DeserializationConfig((BaseSettings) null, stdSubtypeResolver0, (SimpleMixInResolver) null, rootNameLookup0, configOverrides0); JavaType javaType0 = beanDeserializerFactory0.mapAbstractType(deserializationConfig0, collectionType0); assertTrue(javaType0.isInterface()); } @Test(timeout = 4000) public void test008() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); JavaType javaType1 = beanDeserializerFactory0.mapAbstractType((DeserializationConfig) null, arrayType0); assertTrue(javaType1.hasHandlers()); } @Test(timeout = 4000) public void test009() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); JavaType javaType1 = beanDeserializerFactory0.mapAbstractType((DeserializationConfig) null, javaType0); assertFalse(javaType1.isMapLikeType()); } @Test(timeout = 4000) public void test010() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); DeserializerFactoryConfig deserializerFactoryConfig0 = beanDeserializerFactory0.getFactoryConfig(); assertNull(deserializerFactoryConfig0); } @Test(timeout = 4000) public void test011() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); SimpleValueInstantiators simpleValueInstantiators0 = new SimpleValueInstantiators(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withValueInstantiators(simpleValueInstantiators0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); DeserializerFactoryConfig deserializerFactoryConfig2 = beanDeserializerFactory0.getFactoryConfig(); assertNotSame(deserializerFactoryConfig0, deserializerFactoryConfig2); } @Test(timeout = 4000) public void test012() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(simpleDeserializers0); SimpleAbstractTypeResolver simpleAbstractTypeResolver0 = new SimpleAbstractTypeResolver(); DeserializerFactoryConfig deserializerFactoryConfig2 = deserializerFactoryConfig1.withAbstractTypeResolver(simpleAbstractTypeResolver0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig2); DeserializerFactoryConfig deserializerFactoryConfig3 = beanDeserializerFactory0.getFactoryConfig(); assertFalse(deserializerFactoryConfig3.hasValueInstantiators()); } @Test(timeout = 4000) public void test013() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerModifier beanDeserializerModifier0 = mock(BeanDeserializerModifier.class, new ViolatedAssumptionAnswer()); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withDeserializerModifier(beanDeserializerModifier0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); DeserializerFactoryConfig deserializerFactoryConfig2 = beanDeserializerFactory0.getFactoryConfig(); assertTrue(deserializerFactoryConfig2.hasKeyDeserializers()); } @Test(timeout = 4000) public void test014() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.findOptionalStdDeserializer(defaultDeserializationContext_Impl0, javaType0, basicBeanDescription0); assertNull(jsonDeserializer0); } @Test(timeout = 4000) public void test015() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JsonDeserializer<?> jsonDeserializer1 = beanDeserializerFactory0.findDefaultDeserializer(defaultDeserializationContext_Impl0, arrayType0, basicBeanDescription0); assertNull(jsonDeserializer1); assertTrue(arrayType0.hasValueHandler()); assertTrue(arrayType0.hasHandlers()); } @Test(timeout = 4000) public void test016() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); PlaceholderForType placeholderForType0 = new PlaceholderForType((-1)); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.findDefaultDeserializer(defaultDeserializationContext_Impl0, placeholderForType0, basicBeanDescription0); assertEquals(AccessPattern.CONSTANT, jsonDeserializer0.getNullAccessPattern()); } @Test(timeout = 4000) public void test017() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); Class<BooleanNode> class0 = BooleanNode.class; JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0._findCustomTreeNodeDeserializer(class0, (DeserializationConfig) null, (BeanDescription) null); assertNull(jsonDeserializer0); } @Test(timeout = 4000) public void test018() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); SimpleValueInstantiators simpleValueInstantiators0 = new SimpleValueInstantiators(); // Undeclared exception! try { beanDeserializerFactory0.withValueInstantiators(simpleValueInstantiators0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test019() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.withValueInstantiators((ValueInstantiators) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Cannot pass null resolver // verifyException("com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig", e); } } @Test(timeout = 4000) public void test020() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); // Undeclared exception! try { beanDeserializerFactory0.withDeserializerModifier((BeanDeserializerModifier) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test021() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); StdKeyDeserializers stdKeyDeserializers0 = new StdKeyDeserializers(); // Undeclared exception! try { beanDeserializerFactory0.withAdditionalKeyDeserializers(stdKeyDeserializers0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test022() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.withAdditionalKeyDeserializers((KeyDeserializers) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Cannot pass null KeyDeserializers // verifyException("com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig", e); } } @Test(timeout = 4000) public void test023() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); // Undeclared exception! try { beanDeserializerFactory0.withAdditionalDeserializers(simpleDeserializers0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test024() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); SimpleAbstractTypeResolver simpleAbstractTypeResolver0 = new SimpleAbstractTypeResolver(); // Undeclared exception! try { beanDeserializerFactory0.withAbstractTypeResolver(simpleAbstractTypeResolver0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test025() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.withAbstractTypeResolver((AbstractTypeResolver) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Cannot pass null resolver // verifyException("com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig", e); } } @Test(timeout = 4000) public void test026() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.resolveMemberAndTypeAnnotations(defaultDeserializationContext_Impl0, (AnnotatedMember) null, (JavaType) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.DeserializationContext", e); } } @Test(timeout = 4000) public void test027() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); // Undeclared exception! try { beanDeserializerFactory0.modifyTypeByAnnotation((DeserializationContext) null, (Annotated) null, javaType0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test028() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.mapAbstractType((DeserializationConfig) null, (JavaType) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test029() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.findValueInstantiator(defaultDeserializationContext_Impl0, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test030() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); // Undeclared exception! try { beanDeserializerFactory0.findTypeDeserializer((DeserializationConfig) null, javaType0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test031() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.findPropertyTypeDeserializer((DeserializationConfig) null, (JavaType) null, (AnnotatedMember) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test032() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.findPropertyContentTypeDeserializer((DeserializationConfig) null, (JavaType) null, (AnnotatedMember) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test033() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<ReaderBasedJsonParser> class0 = ReaderBasedJsonParser.class; Class<BatchUpdateException> class1 = BatchUpdateException.class; SimpleType simpleType0 = SimpleType.constructUnsafe(class1); JavaType[] javaTypeArray0 = new JavaType[5]; javaTypeArray0[0] = (JavaType) simpleType0; MapType mapType0 = MapType.construct((Class<?>) class0, (TypeBindings) null, (JavaType) simpleType0, javaTypeArray0, javaTypeArray0[0], javaTypeArray0[0]); CollectionLikeType collectionLikeType0 = CollectionLikeType.upgradeFrom(mapType0, javaTypeArray0[2]); // Undeclared exception! try { beanDeserializerFactory0.findOptionalStdDeserializer((DeserializationContext) null, collectionLikeType0, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test034() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.findKeyDeserializerFromAnnotation(defaultDeserializationContext_Impl0, (Annotated) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.DeserializationContext", e); } } @Test(timeout = 4000) public void test035() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.findDeserializerFromAnnotation(defaultDeserializationContext_Impl0, (Annotated) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.DeserializationContext", e); } } @Test(timeout = 4000) public void test036() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); ReferenceType referenceType0 = ReferenceType.upgradeFrom(javaType0, javaType0); // Undeclared exception! try { beanDeserializerFactory0.findDefaultDeserializer((DeserializationContext) null, referenceType0, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test037() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.findContentDeserializerFromAnnotation((DeserializationContext) null, (Annotated) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test038() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, (JavaType) null, (AnnotatedClass) null); // Undeclared exception! try { beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, (JavaType) null, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test039() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JavaType javaType0 = TypeFactory.unknownType(); ReferenceType referenceType0 = ReferenceType.upgradeFrom(javaType0, javaType0); SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException("txk-l?W=Jdc("); ReferenceType referenceType1 = referenceType0.withContentTypeHandler(sQLTransientConnectionException0); // Undeclared exception! try { beanDeserializerFactory0.createReferenceDeserializer(defaultDeserializationContext_Impl0, referenceType1, (BeanDescription) null); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.sql.SQLTransientConnectionException cannot be cast to com.fasterxml.jackson.databind.jsontype.TypeDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test040() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; TypeFactory typeFactory0 = TypeFactory.defaultInstance(); ClassLoader classLoader0 = ClassLoader.getSystemClassLoader(); Class<MapType> class0 = MapType.class; ArrayType arrayType0 = typeFactory0.constructArrayType(class0); ArrayType arrayType1 = arrayType0.withValueHandler(classLoader0); MapLikeType mapLikeType0 = MapLikeType.upgradeFrom(arrayType1, arrayType1, arrayType1); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createMapLikeDeserializer(defaultDeserializationContext_Impl0, mapLikeType0, (BeanDescription) null); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // sun.misc.Launcher$AppClassLoader cannot be cast to com.fasterxml.jackson.databind.JsonDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test041() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createMapDeserializer(defaultDeserializationContext_Impl0, (MapType) null, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test042() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); Class<SQLTransientConnectionException> class0 = SQLTransientConnectionException.class; Class<AsExternalTypeDeserializer> class1 = AsExternalTypeDeserializer.class; Class<Boolean> class2 = Boolean.class; SimpleType simpleType0 = SimpleType.constructUnsafe(class2); TypeBindings typeBindings0 = TypeBindings.createIfNeeded((Class<?>) class1, (JavaType) simpleType0); JavaType[] javaTypeArray0 = new JavaType[3]; javaTypeArray0[0] = (JavaType) simpleType0; javaTypeArray0[1] = (JavaType) simpleType0; ArrayType arrayType0 = ArrayType.construct(javaTypeArray0[0], typeBindings0); javaTypeArray0[2] = (JavaType) arrayType0; MapType mapType0 = MapType.construct((Class<?>) class0, typeBindings0, (JavaType) simpleType0, javaTypeArray0, javaTypeArray0[2], javaTypeArray0[1]); MapType mapType1 = mapType0.withKeyValueHandler(javaTypeArray0[1]); // Undeclared exception! try { beanDeserializerFactory0.createMapDeserializer(defaultDeserializationContext_Impl0, mapType1, (BeanDescription) null); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // com.fasterxml.jackson.databind.type.SimpleType cannot be cast to com.fasterxml.jackson.databind.KeyDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test043() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createKeyDeserializer(defaultDeserializationContext_Impl0, (JavaType) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test044() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createEnumDeserializer(defaultDeserializationContext_Impl0, (JavaType) null, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test045() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); TypeBindings typeBindings0 = TypeBindings.emptyBindings(); ArrayType arrayType0 = ArrayType.construct(javaType0, typeBindings0, (Object) javaType0, (Object) basicBeanDescription0); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); Class<SQLTransientException> class0 = SQLTransientException.class; JavaType[] javaTypeArray0 = new JavaType[0]; CollectionType collectionType0 = CollectionType.construct((Class<?>) class0, typeBindings0, (JavaType) arrayType0, javaTypeArray0, javaType0); CollectionType collectionType1 = collectionType0.withContentValueHandler(deserializers_Base0); // Undeclared exception! try { beanDeserializerFactory0.createCollectionLikeDeserializer((DeserializationContext) null, collectionType1, basicBeanDescription0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // com.fasterxml.jackson.databind.deser.Deserializers$Base cannot be cast to com.fasterxml.jackson.databind.JsonDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test046() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createCollectionDeserializer(defaultDeserializationContext_Impl0, (CollectionType) null, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test047() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<List> class0 = List.class; Class<NioPathDeserializer> class1 = NioPathDeserializer.class; CollectionType collectionType0 = typeFactory0.constructCollectionType(class0, class1); Class<MissingNode> class2 = MissingNode.class; NamedType namedType0 = new NamedType(class2, "com.fasterxml.jackson.databind.annotation.JsonSerialize$Typing"); CollectionType collectionType1 = collectionType0.withContentValueHandler(namedType0); // Undeclared exception! try { beanDeserializerFactory0.createCollectionDeserializer(defaultDeserializationContext_Impl0, collectionType1, (BeanDescription) null); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // com.fasterxml.jackson.databind.jsontype.NamedType cannot be cast to com.fasterxml.jackson.databind.JsonDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test048() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0.createArrayDeserializer(defaultDeserializationContext_Impl0, (ArrayType) null, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test049() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<List> class0 = List.class; CollectionType collectionType0 = typeFactory0.constructRawCollectionType(class0); Class<AnnotatedMethod> class1 = AnnotatedMethod.class; TypeBindings typeBindings0 = TypeBindings.createIfNeeded((Class<?>) class1, (JavaType) collectionType0); ArrayType arrayType0 = ArrayType.construct((JavaType) collectionType0, typeBindings0); JsonParserDelegate jsonParserDelegate0 = new JsonParserDelegate((JsonParser) null); TokenFilter tokenFilter0 = TokenFilter.INCLUDE_ALL; FilteringParserDelegate filteringParserDelegate0 = new FilteringParserDelegate(jsonParserDelegate0, tokenFilter0, true, false); ArrayType arrayType1 = arrayType0.withContentTypeHandler(filteringParserDelegate0); // Undeclared exception! try { beanDeserializerFactory0.createArrayDeserializer(defaultDeserializationContext_Impl0, arrayType1, (BeanDescription) null); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // com.fasterxml.jackson.core.filter.FilteringParserDelegate cannot be cast to com.fasterxml.jackson.databind.jsontype.TypeDeserializer // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test050() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); PropertyName propertyName0 = PropertyName.NO_NAME; // Undeclared exception! try { beanDeserializerFactory0.constructCreatorProperty(defaultDeserializationContext_Impl0, basicBeanDescription0, propertyName0, (-1460), (AnnotatedParameter) null, (JacksonInject.Value) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test051() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); AnnotationMap annotationMap0 = new AnnotationMap(); AnnotatedParameter annotatedParameter0 = new AnnotatedParameter((AnnotatedWithParams) null, javaType0, (TypeResolutionContext) null, annotationMap0, (-3689)); try { beanDeserializerFactory0._reportUnwrappedCreatorProperty(defaultDeserializationContext_Impl0, basicBeanDescription0, annotatedParameter0); fail("Expecting exception: IOException"); } catch(IOException e) { // // Cannot define Creator parameter -3689 as `@JsonUnwrapped`: combination not yet supported // verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e); } } @Test(timeout = 4000) public void test052() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<List> class0 = List.class; Class<String> class1 = String.class; CollectionType collectionType0 = typeFactory0.constructCollectionType(class0, class1); // Undeclared exception! try { beanDeserializerFactory0._mapAbstractCollectionType(collectionType0, (DeserializationConfig) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test053() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0._hasCreatorAnnotation(defaultDeserializationContext_Impl0, (Annotated) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test054() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0._handleSingleArgumentCreator((CreatorCollector) null, (AnnotatedWithParams) null, false, false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test055() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<SQLRecoverableException> class0 = SQLRecoverableException.class; // Undeclared exception! try { beanDeserializerFactory0._findRemappedType((DeserializationConfig) null, class0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test056() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); Class<DoubleNode> class0 = DoubleNode.class; POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); // Undeclared exception! try { beanDeserializerFactory0._findCustomTreeNodeDeserializer(class0, (DeserializationConfig) null, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test057() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); ReferenceType referenceType0 = ReferenceType.upgradeFrom(javaType0, javaType0); JsonDeserializer<SQLNonTransientException> jsonDeserializer0 = (JsonDeserializer<SQLNonTransientException>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); // Undeclared exception! try { beanDeserializerFactory0._findCustomReferenceDeserializer(referenceType0, (DeserializationConfig) null, (BeanDescription) null, (TypeDeserializer) null, jsonDeserializer0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test058() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); JsonDeserializer<FloatNode> jsonDeserializer0 = (JsonDeserializer<FloatNode>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); KeyDeserializer keyDeserializer0 = StdKeyDeserializers.constructDelegatingKeyDeserializer((DeserializationConfig) null, javaType0, jsonDeserializer0); JsonDeserializer<ObjectIdResolver> jsonDeserializer1 = (JsonDeserializer<ObjectIdResolver>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); // Undeclared exception! try { beanDeserializerFactory0._findCustomMapDeserializer((MapType) null, (DeserializationConfig) null, basicBeanDescription0, keyDeserializer0, (TypeDeserializer) null, jsonDeserializer1); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test059() throws Throwable { POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); Class<SQLWarning> class0 = SQLWarning.class; BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); // Undeclared exception! try { beanDeserializerFactory0._findCustomEnumDeserializer(class0, (DeserializationConfig) null, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test060() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<SQLSyntaxErrorException> class0 = SQLSyntaxErrorException.class; CollectionLikeType collectionLikeType0 = typeFactory0.constructRawCollectionLikeType(class0); ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(javaType0, typeFactory0); AsArrayTypeDeserializer asArrayTypeDeserializer0 = new AsArrayTypeDeserializer(javaType0, classNameIdResolver0, "+Ts~Vta4U;FaC", false, javaType0); // Undeclared exception! try { beanDeserializerFactory1._findCustomCollectionLikeDeserializer(collectionLikeType0, (DeserializationConfig) null, basicBeanDescription0, asArrayTypeDeserializer0, jsonDeserializer0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test061() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); // Undeclared exception! try { beanDeserializerFactory1._findCustomCollectionDeserializer((CollectionType) null, (DeserializationConfig) null, basicBeanDescription0, (TypeDeserializer) null, jsonDeserializer0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test062() throws Throwable { BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, (JavaType) null, (AnnotatedClass) null); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); // Undeclared exception! try { beanDeserializerFactory0._findCustomBeanDeserializer((JavaType) null, (DeserializationConfig) null, basicBeanDescription0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test063() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory((DeserializerFactoryConfig) null); // Undeclared exception! try { beanDeserializerFactory1._findCustomArrayDeserializer(arrayType0, (DeserializationConfig) null, basicBeanDescription0, (TypeDeserializer) null, jsonDeserializer0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test064() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0._constructDefaultValueInstantiator(defaultDeserializationContext_Impl0, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.impl.CreatorCollector", e); } } @Test(timeout = 4000) public void test065() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0._addExplicitDelegatingCreator(defaultDeserializationContext_Impl0, (BeanDescription) null, (CreatorCollector) null, (CreatorCandidate) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test066() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! try { beanDeserializerFactory0._addExplicitAnyCreator(defaultDeserializationContext_Impl0, basicBeanDescription0, (CreatorCollector) null, (CreatorCandidate) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test067() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; AnnotatedMethod annotatedMethod0 = beanDeserializerFactory0._findJsonValueFor((DeserializationConfig) null, (JavaType) null); assertNull(annotatedMethod0); } @Test(timeout = 4000) public void test068() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); // Undeclared exception! try { beanDeserializerFactory0._findJsonValueFor((DeserializationConfig) null, javaType0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test069() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<AnnotatedConstructor> class0 = AnnotatedConstructor.class; AnnotationMap annotationMap0 = new AnnotationMap(); AnnotatedParameter annotatedParameter0 = new AnnotatedParameter((AnnotatedWithParams) null, (JavaType) null, (TypeResolutionContext) null, annotationMap0, 117); // Undeclared exception! try { beanDeserializerFactory0.constructEnumResolver(class0, (DeserializationConfig) null, annotatedParameter0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test070() throws Throwable { Class<SQLSyntaxErrorException> class0 = SQLSyntaxErrorException.class; ObjectMapper objectMapper0 = new ObjectMapper((JsonFactory) null); ObjectMapper.DefaultTyping objectMapper_DefaultTyping0 = ObjectMapper.DefaultTyping.NON_FINAL; objectMapper0.enableDefaultTypingAsProperty(objectMapper_DefaultTyping0, "Q5t?"); ObjectReader objectReader0 = objectMapper0.readerFor(class0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test071() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(simpleDeserializers0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); JsonDeserializer<POJOPropertyBuilder> jsonDeserializer0 = (JsonDeserializer<POJOPropertyBuilder>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); JsonDeserializer<?> jsonDeserializer1 = beanDeserializerFactory0._findCustomMapLikeDeserializer((MapLikeType) null, (DeserializationConfig) null, basicBeanDescription0, (KeyDeserializer) null, (TypeDeserializer) null, jsonDeserializer0); assertNull(jsonDeserializer1); } @Test(timeout = 4000) public void test072() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(simpleDeserializers0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); JsonDeserializer<CreatorCandidate> jsonDeserializer0 = (JsonDeserializer<CreatorCandidate>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); JsonDeserializer<?> jsonDeserializer1 = beanDeserializerFactory0._findCustomMapDeserializer((MapType) null, (DeserializationConfig) null, basicBeanDescription0, (KeyDeserializer) null, (TypeDeserializer) null, jsonDeserializer0); assertNull(jsonDeserializer1); } @Test(timeout = 4000) public void test073() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); Class<SQLWarning> class0 = SQLWarning.class; JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0._findCustomEnumDeserializer(class0, (DeserializationConfig) null, basicBeanDescription0); assertNull(jsonDeserializer0); } @Test(timeout = 4000) public void test074() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); JsonDeserializer<Object> jsonDeserializer0 = SettableBeanProperty.MISSING_VALUE_DESERIALIZER; Class<SQLWarning> class0 = SQLWarning.class; TypeFactory typeFactory0 = TypeFactory.defaultInstance(); CollectionLikeType collectionLikeType0 = typeFactory0.constructRawCollectionLikeType(class0); JavaType javaType0 = TypeFactory.unknownType(); ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(javaType0, typeFactory0); AsArrayTypeDeserializer asArrayTypeDeserializer0 = new AsArrayTypeDeserializer(javaType0, classNameIdResolver0, "KWJy~PvIL1<4t", false, javaType0); JsonDeserializer<?> jsonDeserializer1 = beanDeserializerFactory0._findCustomCollectionLikeDeserializer(collectionLikeType0, (DeserializationConfig) null, basicBeanDescription0, asArrayTypeDeserializer0, jsonDeserializer0); assertNull(jsonDeserializer1); } @Test(timeout = 4000) public void test075() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); JsonDeserializer<Object> jsonDeserializer0 = beanDeserializerFactory0._findCustomBeanDeserializer((JavaType) null, (DeserializationConfig) null, basicBeanDescription0); assertNull(jsonDeserializer0); } @Test(timeout = 4000) public void test076() throws Throwable { JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); SimpleDeserializers simpleDeserializers0 = new SimpleDeserializers(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(simpleDeserializers0); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig1); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); assertTrue(jsonDeserializer0.isCachable()); } @Test(timeout = 4000) public void test077() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); Class<TokenBuffer> class0 = TokenBuffer.class; ObjectReader objectReader0 = objectMapper0.readerFor(class0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test078() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); JsonFactory jsonFactory0 = new JsonFactory(); JsonParser jsonParser0 = jsonFactory0.createParser(")"); TokenFilter tokenFilter0 = TokenFilter.INCLUDE_ALL; FilteringParserDelegate filteringParserDelegate0 = new FilteringParserDelegate(jsonParser0, tokenFilter0, true, false); ObjectReader objectReader0 = objectMapper0.readerForUpdating(filteringParserDelegate0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test079() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); ObjectMapper.DefaultTyping objectMapper_DefaultTyping0 = ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT; objectMapper0.enableDefaultTypingAsProperty(objectMapper_DefaultTyping0, ">"); Class<JsonDeserializer> class0 = JsonDeserializer.class; ObjectReader objectReader0 = objectMapper0.readerFor(class0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test080() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); AtomicReference<JsonLocation> atomicReference0 = new AtomicReference<JsonLocation>(); ObjectReader objectReader0 = objectMapper0.readerForUpdating(atomicReference0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test081() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JavaType javaType0 = TypeFactory.unknownType(); ReferenceType referenceType0 = ReferenceType.upgradeFrom(javaType0, javaType0); // Undeclared exception! try { beanDeserializerFactory0.createReferenceDeserializer(defaultDeserializationContext_Impl0, referenceType0, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test082() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, javaType0, (AnnotatedClass) null); JsonDeserializer<?> jsonDeserializer0 = beanDeserializerFactory0.createTreeDeserializer((DeserializationConfig) null, javaType0, basicBeanDescription0); ArrayType arrayType0 = ArrayType.construct(javaType0, (TypeBindings) null, (Object) jsonDeserializer0, (Object) null); DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); Deserializers.Base deserializers_Base0 = new Deserializers.Base(); DeserializerFactoryConfig deserializerFactoryConfig1 = deserializerFactoryConfig0.withAdditionalDeserializers(deserializers_Base0); BeanDeserializerFactory beanDeserializerFactory1 = new BeanDeserializerFactory(deserializerFactoryConfig1); JsonDeserializer<ArrayNode> jsonDeserializer1 = (JsonDeserializer<ArrayNode>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer()); beanDeserializerFactory1._findCustomArrayDeserializer(arrayType0, (DeserializationConfig) null, basicBeanDescription0, (TypeDeserializer) null, jsonDeserializer1); assertTrue(arrayType0.hasValueHandler()); assertTrue(arrayType0.hasHandlers()); } @Test(timeout = 4000) public void test083() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<List> class0 = List.class; CollectionType collectionType0 = typeFactory0.constructRawCollectionType(class0); // Undeclared exception! try { beanDeserializerFactory0.createCollectionLikeDeserializer(defaultDeserializationContext_Impl0, collectionType0, (BeanDescription) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } @Test(timeout = 4000) public void test084() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<LongNode> class0 = LongNode.class; ResolvedRecursiveType resolvedRecursiveType0 = new ResolvedRecursiveType(class0, (TypeBindings) null); CollectionType collectionType0 = beanDeserializerFactory0._mapAbstractCollectionType(resolvedRecursiveType0, (DeserializationConfig) null); assertNull(collectionType0); } @Test(timeout = 4000) public void test085() throws Throwable { POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); ObjectMapper objectMapper0 = new ObjectMapper(); ObjectReader objectReader0 = objectMapper0.readerForUpdating(basicBeanDescription0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test086() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); LinkedHashSet<DoubleNode> linkedHashSet0 = new LinkedHashSet<DoubleNode>(); ObjectReader objectReader0 = objectMapper0.readerForUpdating(linkedHashSet0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test087() throws Throwable { ObjectMapper objectMapper0 = new ObjectMapper(); Class<SQLClientInfoException> class0 = SQLClientInfoException.class; ObjectReader objectReader0 = objectMapper0.readerFor(class0); assertNotNull(objectReader0); } @Test(timeout = 4000) public void test088() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; JavaType javaType0 = TypeFactory.unknownType(); // Undeclared exception! try { beanDeserializerFactory0._valueInstantiatorInstance((DeserializationConfig) null, (Annotated) null, javaType0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // AnnotationIntrospector returned key deserializer definition of type com.fasterxml.jackson.databind.type.SimpleType; expected type KeyDeserializer or Class<KeyDeserializer> instead // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test089() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); Class<SQLTimeoutException> class0 = SQLTimeoutException.class; ValueInstantiator.Base valueInstantiator_Base0 = new ValueInstantiator.Base(class0); ValueInstantiator valueInstantiator0 = beanDeserializerFactory0._valueInstantiatorInstance((DeserializationConfig) null, (Annotated) null, valueInstantiator_Base0); assertFalse(valueInstantiator0.canCreateUsingArrayDelegate()); } @Test(timeout = 4000) public void test090() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; ValueInstantiator valueInstantiator0 = beanDeserializerFactory0._valueInstantiatorInstance((DeserializationConfig) null, (Annotated) null, (Object) null); assertNull(valueInstantiator0); } @Test(timeout = 4000) public void test091() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; Class<DataTruncation> class0 = DataTruncation.class; // Undeclared exception! try { beanDeserializerFactory0._valueInstantiatorInstance((DeserializationConfig) null, (Annotated) null, class0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // AnnotationIntrospector returned Class java.sql.DataTruncation; expected Class<ValueInstantiator> // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test092() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); ObjectMapper objectMapper0 = new ObjectMapper(); ObjectReader objectReader0 = objectMapper0.readerForUpdating(defaultDeserializationContext_Impl0); TypeFactory typeFactory0 = objectReader0.getTypeFactory(); Class<TreeMap> class0 = TreeMap.class; MapType mapType0 = typeFactory0.constructRawMapType(class0); ObjectReader objectReader1 = objectReader0.forType((JavaType) mapType0); assertNotSame(objectReader0, objectReader1); } @Test(timeout = 4000) public void test093() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; SimpleAbstractTypeResolver simpleAbstractTypeResolver0 = new SimpleAbstractTypeResolver(); DeserializerFactory deserializerFactory0 = beanDeserializerFactory0.withAbstractTypeResolver(simpleAbstractTypeResolver0); assertFalse(deserializerFactory0.equals((Object)beanDeserializerFactory0)); } @Test(timeout = 4000) public void test094() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; StdKeyDeserializers stdKeyDeserializers0 = new StdKeyDeserializers(); DeserializerFactory deserializerFactory0 = beanDeserializerFactory0.withAdditionalKeyDeserializers(stdKeyDeserializers0); assertNotSame(beanDeserializerFactory0, deserializerFactory0); } @Test(timeout = 4000) public void test095() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forDeserialization(pOJOPropertiesCollector0); // Undeclared exception! try { beanDeserializerFactory0._reportUnwrappedCreatorProperty(defaultDeserializationContext_Impl0, basicBeanDescription0, (AnnotatedParameter) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.deser.BasicDeserializerFactory", e); } } @Test(timeout = 4000) public void test096() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; ValueInstantiators.Base valueInstantiators_Base0 = new ValueInstantiators.Base(); DeserializerFactory deserializerFactory0 = beanDeserializerFactory0.withValueInstantiators(valueInstantiators_Base0); assertNotSame(beanDeserializerFactory0, deserializerFactory0); } @Test(timeout = 4000) public void test097() throws Throwable { DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig(); BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0); JavaType javaType0 = TypeFactory.unknownType(); ReferenceType referenceType0 = ReferenceType.upgradeFrom(javaType0, javaType0); TypeFactory typeFactory0 = TypeFactory.defaultInstance(); Class<ConcurrentSkipListMap> class0 = ConcurrentSkipListMap.class; MapType mapType0 = typeFactory0.constructMapType((Class<? extends Map>) class0, (JavaType) referenceType0, (JavaType) referenceType0); JavaType javaType1 = beanDeserializerFactory0.mapAbstractType((DeserializationConfig) null, mapType0); assertFalse(javaType1.isAbstract()); } @Test(timeout = 4000) public void test098() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); Class<String> class0 = String.class; SimpleType simpleType0 = SimpleType.constructUnsafe(class0); PlaceholderForType placeholderForType0 = new PlaceholderForType(62); ReferenceType referenceType0 = ReferenceType.upgradeFrom(simpleType0, placeholderForType0); POJOPropertiesCollector pOJOPropertiesCollector0 = mock(POJOPropertiesCollector.class, new ViolatedAssumptionAnswer()); doReturn((AnnotatedClass) null).when(pOJOPropertiesCollector0).getClassDef(); doReturn((MapperConfig) null).when(pOJOPropertiesCollector0).getConfig(); doReturn((ObjectIdInfo) null).when(pOJOPropertiesCollector0).getObjectIdInfo(); doReturn((JavaType) null).when(pOJOPropertiesCollector0).getType(); BasicBeanDescription basicBeanDescription0 = BasicBeanDescription.forSerialization(pOJOPropertiesCollector0); // Undeclared exception! try { beanDeserializerFactory0.resolveType(defaultDeserializationContext_Impl0, basicBeanDescription0, referenceType0, (AnnotatedMember) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.fasterxml.jackson.databind.DeserializationContext", e); } } @Test(timeout = 4000) public void test099() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.withDeserializerModifier((BeanDeserializerModifier) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Cannot pass null modifier // verifyException("com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig", e); } } @Test(timeout = 4000) public void test100() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; // Undeclared exception! try { beanDeserializerFactory0.withAdditionalDeserializers((Deserializers) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Cannot pass null Deserializers // verifyException("com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig", e); } } }
8a225e6a35665bca40cfdeb57266bbe81ffa7d97
09f936dbd84816c340acb6ab2d952527358e8646
/WoPeD-Editor/src/main/java/org/woped/editor/controller/bpel/BPELwaitPanel.java
721127d52fb1de152d183c4036c959ce2fae2bf9
[]
no_license
CodeWithFriendsKa/woped
dc7d047d3cea1da41d11b4ba10b0ad83f11d6c66
4c0a96530dc1cc990275d17171aca46688b4632c
refs/heads/master
2022-05-30T23:15:56.482652
2020-06-22T11:36:28
2020-06-22T11:36:28
235,068,677
0
1
null
2021-06-16T18:00:36
2020-01-20T09:52:35
Java
UTF-8
Java
false
false
20,175
java
package org.woped.editor.controller.bpel; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Calendar; import java.util.Locale; import javax.swing.ButtonGroup; import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JSeparator; import javax.swing.JTextField; import org.woped.core.model.petrinet.TransitionModel; import org.woped.core.utilities.IntegerFilter; import org.woped.core.utilities.JTextFieldEvalution; import org.woped.editor.controller.TransitionPropertyEditor; import org.woped.editor.gui.PopUpDialog; import org.woped.gui.translations.Messages; import com.toedter.calendar.JCalendar; /** * @author Kristian Kindler / Esther Landes / Frank Sch�ler * * This is a panel in the transition properties, which enables the user to * maintain data for a "wait" BPEL activity. * * Created on 16.12.2007 */ public class BPELwaitPanel extends BPELadditionalPanel implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private final String PANELNAME = "wait"; private ButtonGroup waitButtonGroup = null; private JPanel waitDurationEntry = null; private JRadioButton waitDurationRadioButton = null; private JRadioButton waitDeadlineRadioButton = null; private JPanel radioButtonPanel; private JPanel radioButtonSubPanel; private JPanel calendarPanel; private JPanel deadlinePanel; private JPanel deadlineTimePanel; private JPanel deadlineTimeSubPanel; private JCalendar calendar; private JPanel durationPanel; private JPanel durationSubPanel; private JFormattedTextField deadLineTextFieldHour; private JTextFieldEvalution deadLineHourFilter; private JFormattedTextField deadLineTextFieldMinute; private JTextFieldEvalution deadLineMinuteFilter; private JFormattedTextField deadLineTextFieldSecond; private JTextFieldEvalution deadLineSecondFilter; private JTextField durationTextFieldYear; private JTextField durationTextFieldMonth; private JTextField durationTextFieldDay; private JTextField durationTextFieldHour; private JTextField durationTextFieldMinute; private JTextField durationTextFieldSecond; private static final String WAIT_DURATION = Messages .getString("Transition.Properties.BPEL.Wait.Duration"); private static final String WAIT_DEADLINE = Messages .getString("Transition.Properties.BPEL.Wait.Deadline"); private GridBagConstraints c1; public BPELwaitPanel(TransitionPropertyEditor t_editor, TransitionModel transition) { super(t_editor, transition); setLayout(new GridBagLayout()); c1 = new GridBagConstraints(); waitButtonGroup = new ButtonGroup(); waitButtonGroup.add(getWaitDurationRadioButton()); waitButtonGroup.add(getWaitDeadlineRadioButton()); c1.weightx = 1; c1.weighty = 1; c1.anchor = GridBagConstraints.WEST; c1.fill = GridBagConstraints.HORIZONTAL; c1.gridx = 0; c1.gridy = 0; add(getRadioButtonPanel(), c1); c1.gridx = 0; c1.gridy = 1; c1.insets = new Insets(5, 0, 20, 0); add(new JSeparator(), c1); c1.gridx = 0; c1.gridy = 2; c1.insets = new Insets(0, 0, 10, 0); add(getDurationPanel(), c1); } private JPanel getDurationPanel() { if (durationPanel == null) { durationPanel = new JPanel(); durationPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 10, 0, 0); c.gridx = 0; c.gridy = 0; durationPanel.add(getDurationSubPanel(), c); } return durationPanel; } private JPanel getDurationSubPanel() { if (durationSubPanel == null) { durationSubPanel = new JPanel(); durationSubPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 0, 0, 20); c.gridx = 0; c.gridy = 0; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Years")), c); c.gridx = 1; c.gridy = 0; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Months")), c); c.gridx = 2; c.gridy = 0; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Days")), c); c.insets = new Insets(0, 0, 5, 20); c.gridx = 0; c.gridy = 1; durationSubPanel.add(getDurationInputfieldYear(), c); c.gridx = 1; c.gridy = 1; durationSubPanel.add(getDurationInputfieldMonth(), c); c.gridx = 2; c.gridy = 1; durationSubPanel.add(getDurationInputfieldDay(), c); c.insets = new Insets(0, 0, 0, 20); c.gridx = 0; c.gridy = 2; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Hours")), c); c.gridx = 1; c.gridy = 2; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Minutes")), c); c.gridx = 2; c.gridy = 2; durationSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Seconds")), c); c.gridx = 0; c.gridy = 3; c.insets = new Insets(0, 0, 0, 20); durationSubPanel.add(getDurationInputfieldHour(), c); c.gridx = 1; c.gridy = 3; durationSubPanel.add(getDurationInputfieldMinute(), c); c.gridx = 2; c.gridy = 3; durationSubPanel.add(getDurationInputfieldSecond(), c); } return durationSubPanel; } private JPanel getDeadlinePanel() { if (deadlinePanel == null) { deadlinePanel = new JPanel(); deadlinePanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 10, 0, 0); c.gridx = 0; c.gridy = 0; deadlinePanel.add(getCalendarPanel(), c); c.gridx = 0; c.gridy = 1; deadlinePanel.add(getDeadlineTimePanel(), c); } return deadlinePanel; } private JPanel getCalendarPanel() { if (calendarPanel == null) { calendarPanel = new JPanel(); calendarPanel.setLayout(new BorderLayout()); calendarPanel.add(getDeadlineCalendar(), BorderLayout.WEST); } return calendarPanel; } private JCalendar getDeadlineCalendar() { if (calendar == null) { calendar = new JCalendar(); calendar.setLocale(Locale.ENGLISH); } return calendar; } private JPanel getDeadlineTimePanel() { if (deadlineTimePanel == null) { deadlineTimePanel = new JPanel(); deadlineTimePanel.setLayout(new BorderLayout()); deadlineTimePanel.add(getDeadlineTimeSubPanel(), BorderLayout.WEST); } return deadlineTimePanel; } private JPanel getDeadlineTimeSubPanel() { if (deadlineTimeSubPanel == null) { deadlineTimeSubPanel = new JPanel(); deadlineTimeSubPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 0, 0, 20); deadlineTimeSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Hours")), c); c.gridx = 1; c.gridy = 0; deadlineTimeSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Minutes")), c); c.gridx = 2; c.gridy = 0; deadlineTimeSubPanel.add(new JLabel(Messages .getString("Transition.Properties.BPEL.Wait.Seconds")), c); c.gridx = 0; c.gridy = 1; c.insets = new Insets(0, 0, 0, 20); deadlineTimeSubPanel.add(getDeadlineInputfieldHour(), c); c.gridx = 1; c.gridy = 1; deadlineTimeSubPanel.add(getDeadlineInputfieldMinute(), c); c.gridx = 2; c.gridy = 1; deadlineTimeSubPanel.add(getDeadlineInputfieldSecond(), c); } return deadlineTimeSubPanel; } private JFormattedTextField getDeadlineInputfieldHour() { if (deadLineTextFieldHour == null) { // deadLineTextFieldHour = new JTextField("00", 10); deadLineTextFieldHour = new JFormattedTextField(new Integer(00)); this.deadLineHourFilter = new JTextFieldEvalution( this.deadLineTextFieldHour, null, new IntegerFilter( 0, 23), null); deadLineTextFieldHour.addKeyListener(this.deadLineHourFilter); deadLineTextFieldHour.setActionCommand(WAIT_DEADLINE); } return deadLineTextFieldHour; } private JFormattedTextField getDeadlineInputfieldMinute() { if (deadLineTextFieldMinute == null) { deadLineTextFieldMinute = new JFormattedTextField(new Integer(00)); this.deadLineMinuteFilter = new JTextFieldEvalution( this.deadLineTextFieldMinute, null, new IntegerFilter(0, 59), null); deadLineTextFieldMinute.addKeyListener(this.deadLineMinuteFilter); deadLineTextFieldMinute.setActionCommand(WAIT_DEADLINE); } return deadLineTextFieldMinute; } private JFormattedTextField getDeadlineInputfieldSecond() { if (deadLineTextFieldSecond == null) { deadLineTextFieldSecond = new JFormattedTextField(new Integer(00)); this.deadLineSecondFilter = new JTextFieldEvalution( this.deadLineTextFieldSecond, null, new IntegerFilter(0, 59), null); deadLineTextFieldSecond.addKeyListener(this.deadLineSecondFilter); deadLineTextFieldSecond.setActionCommand(WAIT_DEADLINE); } return deadLineTextFieldSecond; } private JTextField getDurationInputfieldYear() { if (durationTextFieldYear == null) { durationTextFieldYear = new JTextField("0", 10); durationTextFieldYear.setActionCommand(WAIT_DEADLINE); } return durationTextFieldYear; } private JTextField getDurationInputfieldMonth() { if (durationTextFieldMonth == null) { durationTextFieldMonth = new JTextField("0", 10); durationTextFieldMonth.setActionCommand(WAIT_DEADLINE); } return durationTextFieldMonth; } private JTextField getDurationInputfieldDay() { if (durationTextFieldDay == null) { durationTextFieldDay = new JTextField("0", 10); durationTextFieldDay.setActionCommand(WAIT_DEADLINE); } return durationTextFieldDay; } private JTextField getDurationInputfieldHour() { if (durationTextFieldHour == null) { durationTextFieldHour = new JTextField("00", 10); durationTextFieldHour.setActionCommand(WAIT_DEADLINE); } return durationTextFieldHour; } private JTextField getDurationInputfieldMinute() { if (durationTextFieldMinute == null) { durationTextFieldMinute = new JTextField("00", 10); durationTextFieldMinute.setActionCommand(WAIT_DEADLINE); } return durationTextFieldMinute; } private JTextField getDurationInputfieldSecond() { if (durationTextFieldSecond == null) { durationTextFieldSecond = new JTextField("00", 10); durationTextFieldSecond.setActionCommand(WAIT_DEADLINE); } return durationTextFieldSecond; } private JPanel getRadioButtonPanel() { if (radioButtonPanel == null) { radioButtonPanel = new JPanel(); radioButtonPanel.setLayout(new BorderLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.gridx = 0; c.gridy = 0; radioButtonPanel.add(getRadioButtonSubPanel(), BorderLayout.WEST); } return radioButtonPanel; } private JPanel getRadioButtonSubPanel() { if (radioButtonSubPanel == null) { radioButtonSubPanel = new JPanel(); radioButtonSubPanel.setLayout(new FlowLayout()); radioButtonSubPanel.add(getWaitDurationEntry()); radioButtonSubPanel.add(getWaitDeadlineRadioButton()); } return radioButtonSubPanel; } private JPanel getWaitDurationEntry() { if (waitDurationEntry == null) { waitDurationEntry = new JPanel(); waitDurationEntry.setLayout(new BorderLayout()); waitDurationEntry.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.gridx = 0; c.gridy = 0; waitDurationEntry.add(getWaitDurationRadioButton(), c); } return waitDurationEntry; } private JRadioButton getWaitDurationRadioButton() { if (waitDurationRadioButton == null) { waitDurationRadioButton = new JRadioButton(WAIT_DURATION); waitDurationRadioButton.setSelected(true); waitDurationRadioButton.setActionCommand(WAIT_DURATION); waitDurationRadioButton.addActionListener(this); } return waitDurationRadioButton; } private JRadioButton getWaitDeadlineRadioButton() { if (waitDeadlineRadioButton == null) { waitDeadlineRadioButton = new JRadioButton(WAIT_DEADLINE); waitDeadlineRadioButton.setActionCommand(WAIT_DEADLINE); waitDeadlineRadioButton.addActionListener(this); } return waitDeadlineRadioButton; } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(WAIT_DURATION)) { if (deadlinePanel != null) { remove(deadlinePanel); c1.gridx = 0; c1.gridy = 2; c1.insets = new Insets(0, 0, 10, 0); add(getDurationPanel(), c1); t_editor.repaintTabPane(); } } else if (e.getActionCommand().equals(WAIT_DEADLINE)) { if (durationPanel != null) { remove(durationPanel); c1.gridx = 0; c1.gridy = 2; c1.insets = new Insets(0, 0, 10, 0); add(getDeadlinePanel(), c1); t_editor.repaintTabPane(); } } } // ***************** content getter methods ************************** public String getSelectedRadioButton() { if (waitDurationRadioButton.isSelected() == true) { return "Duration"; } return "Deadline"; } // ***** Deadline ***** public String getDeadline() { return "" + getDeadLineYear() + "-" + getDeadLineMonth() + "-" + getDeadLineDay() + "T" + getDeadLineHour() + ":" + getDeadLineMinute() + ":" + getDeadLineSecond() + "+1:00"; } public void setDeadline() { Wait wait = (Wait) this.transition.getBpelData(); this.deadLineTextFieldHour.setText("" + wait.getHour()); this.deadLineTextFieldMinute.setText("" + wait.getMinute()); this.deadLineTextFieldSecond.setText("" + wait.getSecond()); calendar.getCalendar().set(wait.getYear(), wait.getMonth(), wait.getDay()); Calendar c = new JCalendar().getCalendar(); c.set(wait.getYear(), wait.getMonth() - 1, wait.getDay()); calendar.setDate(c.getTime()); } public String getDuration() { return "P" + getDurationYear() + "Y" + getDurationMonth() + "M" + getDurationDay() + "DT" + getDurationHour() + "H" + getDurationMinute() + "M" + getDurationSecond() + "S"; } public void setDuration() { Wait wait = (Wait) this.transition.getBpelData(); this.durationTextFieldYear.setText("" + wait.getYear()); this.durationTextFieldMonth.setText("" + wait.getMonth()); this.durationTextFieldDay.setText("" + wait.getDay()); this.durationTextFieldHour.setText("" + wait.getHour()); this.durationTextFieldMinute.setText("" + wait.getMinute()); this.durationTextFieldSecond.setText("" + wait.getSecond()); } public String getDeadLineDay() { Calendar c = Calendar.getInstance(); c.setTime(calendar.getDate()); int day = c.get(Calendar.DAY_OF_MONTH); if (day / 10 > 0) { return "" + day; } else { return "0" + day; } } public String getDeadLineMonth() { if (deadLineTextFieldMinute.getText() == null) return null; Calendar c = Calendar.getInstance(); c.setTime(calendar.getDate()); int month = c.get(Calendar.MONTH) + 1; if (month / 10 > 0) { return "" + month; } else { return "0" + month; } } public String getDeadLineYear() { Calendar c = Calendar.getInstance(); c.setTime(calendar.getDate()); return "" + c.get(Calendar.YEAR); } public String getDeadLineHour() { if (deadLineTextFieldHour.getText() == null) return null; return deadLineTextFieldHour.getText(); } public String getDeadLineMinute() { if (deadLineTextFieldMinute.getText() == null) return null; return deadLineTextFieldMinute.getText(); } public String getDeadLineSecond() { if (deadLineTextFieldSecond.getText() == null) return null; return deadLineTextFieldSecond.getText(); } // ***** Duration ****** public String getDurationYear() { if (durationTextFieldYear.getText() == null) return null; return durationTextFieldYear.getText(); } public String getDurationMonth() { if (durationTextFieldMonth.getText() == null) return null; return durationTextFieldMonth.getText(); } public String getDurationDay() { if (durationTextFieldDay.getText() == null) return null; return durationTextFieldDay.getText(); } public String getDurationHour() { if (durationTextFieldHour.getText() == null) return null; return durationTextFieldHour.getText(); } public String getDurationMinute() { if (durationTextFieldMinute.getText() == null) return null; return durationTextFieldMinute.getText(); } public String getDurationSecond() { if (durationTextFieldSecond.getText() == null) return null; return durationTextFieldSecond.getText(); } public boolean allFieldsFilled() { if (waitDeadlineRadioButton.isSelected()) { if (this.deadLineHourFilter.isInputAccepted() && this.deadLineMinuteFilter.isInputAccepted() && this.deadLineSecondFilter.isInputAccepted()) return true; else return false; } else { if (durationTextFieldYear.getText().equals("") || durationTextFieldMonth.getText().equals("") || durationTextFieldDay.getText().equals("") || durationTextFieldHour.getText().equals("") || durationTextFieldMinute.getText().equals("") || durationTextFieldSecond.getText().equals("")) { return false; } else return true; } } @Override public void refresh() { if (Wait.class.isInstance(this.transition.getBpelData())) { Wait re = (Wait) this.transition.getBpelData(); if (re.getWaitConditionType() == Wait._DEADLINE) { waitDeadlineRadioButton.setSelected(true); remove(getDurationPanel()); c1.gridx = 0; c1.gridy = 2; c1.insets = new Insets(0, 0, 10, 0); add(getDeadlinePanel(), c1); this.setDeadline(); } else { waitDurationRadioButton.setSelected(true); remove(getDeadlinePanel()); c1.gridx = 0; c1.gridy = 2; c1.insets = new Insets(0, 0, 10, 0); add(getDurationPanel(), c1); this.setDuration(); } } this.repaint(); } @Override public void saveInfomation() { if (allFieldsFilled() == false) { new PopUpDialog( t_editor, true, Messages.getString("Transition.Properties.BPEL.Error"), Messages .getString("Transition.Properties.BPEL.ErrorDuringFieldCheck")) .setVisible(true); } else { // Values in TextField already checked try { if (waitDeadlineRadioButton.isSelected()) { this.transition.setBaseActivity(new Wait(this.transition .getNameValue(), Wait._DEADLINE, Integer .parseInt(getDeadLineYear()), Integer .parseInt(getDeadLineMonth()), Integer .parseInt(getDeadLineDay()), Integer .parseInt(getDeadLineHour()), Integer .parseInt(getDeadLineMinute()), Integer .parseInt(getDeadLineSecond())) .saveInformation(this)); } if (waitDurationRadioButton.isSelected()) { this.transition.setBaseActivity(new Wait(this.transition .getNameValue(), Wait._DURATION, Integer .parseInt(getDurationYear()), Integer .parseInt(getDurationMonth()), Integer .parseInt(getDurationDay()), Integer .parseInt(getDurationHour()), Integer .parseInt(getDurationMinute()), Integer .parseInt(getDurationSecond())) .saveInformation(this)); } } catch (Exception e) { e.printStackTrace(); } } } @Override public String getName() { return this.PANELNAME; } @Override public void showPanel(JPanel panel, GridBagConstraints c) { this.refresh(); panel.add(this, c); } }
65b624e84e9e5c8f25be76d15ca4beddeb67aac9
75394abecf3532c228a8a9fd1dc62599c8414d31
/zap/src/main/java/org/zaproxy/zap/extension/alert/AlertPanel.java
f1d10730a8b4251d622f0183cd3eba54bf31df23
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-free-unknown" ]
permissive
netsec/zaproxy
4020780845bd946fef4229bf218451b235e07583
a372a9b17c1f72409a99dd6498d2920d325106ed
refs/heads/develop
2020-06-26T19:41:16.544628
2019-07-30T14:31:20
2019-07-30T14:31:20
199,734,091
1
1
Apache-2.0
2019-07-30T22:07:38
2019-07-30T22:05:32
Java
UTF-8
Java
false
false
33,513
java
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * Copyright 2010 The ZAP Development 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.zaproxy.zap.extension.alert; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.apache.log4j.Logger; import org.parosproxy.paros.Constant; import org.parosproxy.paros.core.scanner.Alert; import org.parosproxy.paros.extension.AbstractPanel; import org.parosproxy.paros.extension.ViewDelegate; import org.parosproxy.paros.model.HistoryReference; import org.parosproxy.paros.model.SiteNode; import org.parosproxy.paros.network.HttpMessage; import org.parosproxy.paros.view.View; import org.zaproxy.zap.extension.httppanel.HttpPanel; import org.zaproxy.zap.extension.search.SearchMatch; import org.zaproxy.zap.utils.DisplayUtils; import org.zaproxy.zap.view.DeselectableButtonGroup; import org.zaproxy.zap.view.LayoutHelper; import org.zaproxy.zap.view.ZapToggleButton; import org.zaproxy.zap.view.messagecontainer.http.DefaultSelectableHistoryReferencesContainer; import org.zaproxy.zap.view.messagecontainer.http.SelectableHistoryReferencesContainer; public class AlertPanel extends AbstractPanel { public static final String ALERT_TREE_PANEL_NAME = "treeAlert"; private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(AlertPanel.class); private ViewDelegate view = null; private JTree treeAlert = null; private JScrollPane paneScroll = null; private JPanel panelCommand = null; private JToolBar panelToolbar = null; private JSplitPane splitPane = null; private AlertViewPanel alertViewPanel = null; private ZapToggleButton scopeButton = null; /** * The {@code AlertTreeModel} that holds the alerts of a selected "Sites" tree node when the * filter "Link with Sites selection" is enabled, otherwise it will be empty. * * <p>The tree model is lazily initialised (in the method {@code getLinkWithSitesTreeModel()}). * * @see #getLinkWithSitesTreeModel() * @see #setLinkWithSitesTreeSelection(boolean) */ private AlertTreeModel linkWithSitesTreeModel; /** * The tree selection listener that triggers the filter "Link with Sites selection" of the * "Alerts" tree based on selected "Sites" tree node. * * <p>The listener is lazily initialised (in the method {@code * getLinkWithSitesTreeSelectionListener()}). * * @see #getLinkWithSitesTreeSelectionListener() * @see #setLinkWithSitesTreeSelection(boolean) */ private LinkWithSitesTreeSelectionListener linkWithSitesTreeSelectionListener; /** * The toggle button that enables/disables the "Alerts" tree filtering based on the "Sites" tree * selection. * * <p>The toggle button is lazily initialised (in the method {@code * getLinkWithSitesTreeButton()}). * * @see #getLinkWithSitesTreeButton() */ private ZapToggleButton linkWithSitesTreeButton; /** * The button group used to control mutually exclusive "Alerts" tree filtering buttons. * * <p>Any filtering buttons that are mutually exclusive should be added to this button group. */ private DeselectableButtonGroup alertsTreeFiltersButtonGroup; private JButton editButton = null; private ExtensionAlert extension = null; /** * A button that allows to delete all alerts. * * @see #getDeleteAllButton() */ private JButton deleteAllButton; public AlertPanel(ExtensionAlert extension) { super(); this.extension = extension; this.view = extension.getView(); alertsTreeFiltersButtonGroup = new DeselectableButtonGroup(); initialize(); } /** This method initializes this */ private void initialize() { this.setLayout(new CardLayout()); this.setSize(274, 251); this.setName(Constant.messages.getString("alerts.panel.title")); this.setIcon( new ImageIcon( AlertPanel.class.getResource("/resource/icon/16/071.png"))); // 'flag' icon this.add(getPanelCommand(), getPanelCommand().getName()); this.setDefaultAccelerator( view.getMenuShortcutKeyStroke(KeyEvent.VK_A, KeyEvent.SHIFT_DOWN_MASK, false)); this.setMnemonic(Constant.messages.getChar("alerts.panel.mnemonic")); this.setShowByDefault(true); } private javax.swing.JPanel getPanelCommand() { if (panelCommand == null) { panelCommand = new javax.swing.JPanel(); panelCommand.setLayout(new java.awt.GridBagLayout()); panelCommand.setName("AlertPanel"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0D; gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 1; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.weighty = 1.0; gridBagConstraints2.insets = new java.awt.Insets(0, 0, 0, 0); gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; panelCommand.add(getSplitPane(), gridBagConstraints2); } return panelCommand; } private javax.swing.JToolBar getPanelToolbar() { if (panelToolbar == null) { panelToolbar = new javax.swing.JToolBar(); panelToolbar.setEnabled(true); panelToolbar.setFloatable(false); panelToolbar.setRollover(true); panelToolbar.setPreferredSize(new java.awt.Dimension(800, 30)); panelToolbar.setName("AlertToolbar"); panelToolbar.add(getScopeButton()); panelToolbar.add(getLinkWithSitesTreeButton()); panelToolbar.addSeparator(); panelToolbar.add(getEditButton()); panelToolbar.addSeparator(); panelToolbar.add(getDeleteAllButton()); } return panelToolbar; } private JSplitPane getSplitPane() { if (splitPane == null) { splitPane = new JSplitPane(); splitPane.setName("AlertPanels"); splitPane.setDividerSize(3); splitPane.setDividerLocation(400); splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); // Add toolbar JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); panel.add(this.getPanelToolbar(), LayoutHelper.getGBC(0, 0, 1, 0.0D)); panel.add(getPaneScroll(), LayoutHelper.getGBC(0, 1, 1, 1.0D, 1.0D)); splitPane.setLeftComponent(panel); splitPane.setRightComponent(getAlertViewPanel()); splitPane.setPreferredSize(new Dimension(100, 200)); } return splitPane; } public AlertViewPanel getAlertViewPanel() { if (alertViewPanel == null) { alertViewPanel = new AlertViewPanel(); } return alertViewPanel; } private JToggleButton getScopeButton() { if (scopeButton == null) { scopeButton = new ZapToggleButton(); scopeButton.setIcon( new ImageIcon( AlertPanel.class.getResource("/resource/icon/fugue/target-grey.png"))); scopeButton.setToolTipText( Constant.messages.getString("history.scope.button.unselected")); scopeButton.setSelectedIcon( new ImageIcon(AlertPanel.class.getResource("/resource/icon/fugue/target.png"))); scopeButton.setSelectedToolTipText( Constant.messages.getString("history.scope.button.selected")); DisplayUtils.scaleIcon(scopeButton); scopeButton.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { extension.setShowJustInScope(scopeButton.isSelected()); } }); alertsTreeFiltersButtonGroup.add(scopeButton); } return scopeButton; } /** * Returns the toggle button that enables/disables the "Alerts" tree filtering based on the * "Sites" tree selection. * * <p>The instance variable {@code linkWithSitesTreeButton} is initialised on the first call to * this method. * * @see #linkWithSitesTreeButton * @return the toggle button that enables/disables the "Alerts" tree filtering based on the * "Sites" tree selection */ private JToggleButton getLinkWithSitesTreeButton() { if (linkWithSitesTreeButton == null) { linkWithSitesTreeButton = new ZapToggleButton(); linkWithSitesTreeButton.setIcon( new ImageIcon( AlertPanel.class.getResource("/resource/icon/16/earth-grey.png"))); linkWithSitesTreeButton.setToolTipText( Constant.messages.getString( "alerts.panel.linkWithSitesSelection.unselected.button.tooltip")); linkWithSitesTreeButton.setSelectedIcon( new ImageIcon(AlertPanel.class.getResource("/resource/icon/16/094.png"))); linkWithSitesTreeButton.setSelectedToolTipText( Constant.messages.getString( "alerts.panel.linkWithSitesSelection.selected.button.tooltip")); DisplayUtils.scaleIcon(linkWithSitesTreeButton); linkWithSitesTreeButton.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { setLinkWithSitesTreeSelection(linkWithSitesTreeButton.isSelected()); } }); alertsTreeFiltersButtonGroup.add(linkWithSitesTreeButton); } return linkWithSitesTreeButton; } /** * Sets whether the "Alerts" tree is filtered, or not based on a selected "Sites" tree node. * * <p>If {@code enabled} is {@code true} only the alerts of the selected "Sites" tree node will * be shown. * * <p>Calling this method removes the filter "Just in Scope", if enabled, as they are mutually * exclusive. * * @param enabled {@code true} if the "Alerts" tree should be filtered based on the "Sites" tree * selection, {@code false} otherwise. * @see ExtensionAlert#setShowJustInScope(boolean) */ public void setLinkWithSitesTreeSelection(boolean enabled) { linkWithSitesTreeButton.setSelected(enabled); if (enabled) { extension.setShowJustInScope(false); final JTree sitesTree = view.getSiteTreePanel().getTreeSite(); final TreePath selectionPath = sitesTree.getSelectionPath(); getTreeAlert().setModel(getLinkWithSitesTreeModel()); if (selectionPath != null) { recreateLinkWithSitesTreeModel((SiteNode) selectionPath.getLastPathComponent()); } sitesTree.addTreeSelectionListener(getLinkWithSitesTreeSelectionListener()); } else { extension.setMainTreeModel(); ((AlertNode) getLinkWithSitesTreeModel().getRoot()).removeAllChildren(); view.getSiteTreePanel() .getTreeSite() .removeTreeSelectionListener(getLinkWithSitesTreeSelectionListener()); } } /** * Returns the {@code AlertTreeModel} that holds the alerts of the selected "Sites" tree node * when the filter "Link with Sites selection" is enabled, otherwise it will be empty. * * <p>The instance variable {@code linkWithSitesTreeModel} is initialised on the first call to * this method. * * @see #linkWithSitesTreeModel * @return the {@code AlertTreeModel} that holds the alerts of the selected "Sites" tree node * when the filter "Link with Sites selection" is enabled, otherwise it will be empty */ private AlertTreeModel getLinkWithSitesTreeModel() { if (linkWithSitesTreeModel == null) { linkWithSitesTreeModel = new AlertTreeModel(); } return linkWithSitesTreeModel; } /** * Recreates the {@code linkWithSitesTreeModel} with the alerts of the given {@code siteNode}. * * <p>If the given {@code siteNode} doesn't contain any alerts the resulting model will only * contain the root node, otherwise the model will contain the root node and the alerts returned * by the method {@code SiteNode#getAlerts()} although if the node has an HistoryReference only * the alerts whose URI is equal to the URI returned by the method {@code * HistoryReference#getURI()} will be included. * * <p>After a call to this method the number of total alerts will be recalculated by calling the * method {@code ExtensionAlert#recalcAlerts()}. * * @param siteNode the "Sites" tree node that will be used to recreate the alerts tree model. * @throws IllegalArgumentException if {@code siteNode} is {@code null}. * @see #linkWithSitesTreeModel * @see #setLinkWithSitesTreeSelection * @see Alert * @see ExtensionAlert#recalcAlerts() * @see HistoryReference * @see SiteNode#getAlerts() */ private void recreateLinkWithSitesTreeModel(SiteNode siteNode) { if (siteNode == null) { throw new IllegalArgumentException("Parameter siteNode must not be null."); } ((AlertNode) getLinkWithSitesTreeModel().getRoot()).removeAllChildren(); if (siteNode.isRoot()) { getLinkWithSitesTreeModel().reload(); extension.recalcAlerts(); return; } String uri = null; HistoryReference historyReference = siteNode.getHistoryReference(); if (historyReference != null) { uri = historyReference.getURI().toString(); } for (Alert alert : siteNode.getAlerts()) { // Just show ones for this node if (uri != null && !alert.getUri().equals(uri)) { continue; } getLinkWithSitesTreeModel().addPath(alert); } getLinkWithSitesTreeModel().reload(); expandRootChildNodes(); extension.recalcAlerts(); } /** * Returns the tree selection listener that triggers the filter of the "Alerts" tree based on a * selected {@code SiteNode}. * * <p>The instance variable {@code linkWithSitesTreeSelectionListener} is initialised on the * first call to this method. * * @see #linkWithSitesTreeSelectionListener * @return the tree selection listener that triggers the filter of the "Alerts" tree based on a * selected {@code SiteNode}. */ private LinkWithSitesTreeSelectionListener getLinkWithSitesTreeSelectionListener() { if (linkWithSitesTreeSelectionListener == null) { linkWithSitesTreeSelectionListener = new LinkWithSitesTreeSelectionListener(); } return linkWithSitesTreeSelectionListener; } /** * This method initializes treeAlert * * @return javax.swing.JTree */ JTree getTreeAlert() { if (treeAlert == null) { treeAlert = new JTree() { private static final long serialVersionUID = 1L; @Override public Point getPopupLocation(final MouseEvent event) { if (event != null) { // Select item on right click TreePath tp = treeAlert.getPathForLocation(event.getX(), event.getY()); if (tp != null) { // Only select a new item if the current item is not // already selected - this is to allow multiple items // to be selected if (!treeAlert.getSelectionModel().isPathSelected(tp)) { treeAlert.getSelectionModel().setSelectionPath(tp); } } } return super.getPopupLocation(event); } }; treeAlert.setName(ALERT_TREE_PANEL_NAME); treeAlert.setShowsRootHandles(true); treeAlert.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); treeAlert.setComponentPopupMenu( new JPopupMenu() { private static final long serialVersionUID = 1L; @Override public void show(Component invoker, int x, int y) { final int countSelectedNodes = treeAlert.getSelectionCount(); final ArrayList<HistoryReference> uniqueHistoryReferences = new ArrayList<>(countSelectedNodes); if (countSelectedNodes > 0) { SortedSet<Integer> historyReferenceIdsAdded = new TreeSet<>(); for (TreePath path : treeAlert.getSelectionPaths()) { final AlertNode node = (AlertNode) path.getLastPathComponent(); final Object userObject = node.getUserObject(); if (userObject instanceof Alert) { HistoryReference historyReference = ((Alert) userObject).getHistoryRef(); if (historyReference != null && !historyReferenceIdsAdded.contains( historyReference.getHistoryId())) { historyReferenceIdsAdded.add( historyReference.getHistoryId()); uniqueHistoryReferences.add(historyReference); } } } uniqueHistoryReferences.trimToSize(); } SelectableHistoryReferencesContainer messageContainer = new DefaultSelectableHistoryReferencesContainer( treeAlert.getName(), treeAlert, Collections.<HistoryReference>emptyList(), uniqueHistoryReferences); view.getPopupMenu().show(messageContainer, x, y); } }); treeAlert.addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) { // Its a double click - edit the alert editSelectedAlert(); } } }); treeAlert.addTreeSelectionListener( new javax.swing.event.TreeSelectionListener() { @Override public void valueChanged(javax.swing.event.TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent(); if (node != null && node.getUserObject() != null) { Object obj = node.getUserObject(); if (obj instanceof Alert) { Alert alert = (Alert) obj; setMessage(alert.getMessage(), alert.getEvidence()); treeAlert.requestFocusInWindow(); getAlertViewPanel().displayAlert(alert); } else { getAlertViewPanel().clearAlert(); } } else { getAlertViewPanel().clearAlert(); } } }); treeAlert.setCellRenderer(new AlertTreeCellRenderer()); treeAlert.setExpandsSelectedPaths(true); String deleteAlertKey = "zap.delete.alert"; treeAlert.getInputMap().put(view.getDefaultDeleteKeyStroke(), deleteAlertKey); treeAlert .getActionMap() .put( deleteAlertKey, new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { Set<Alert> alerts = getSelectedAlerts(); if (alerts.size() > 1 && View.getSingleton() .showConfirmDialog( Constant.messages.getString( "scanner.delete.confirm")) != JOptionPane.OK_OPTION) { return; } for (Alert alert : alerts) { extension.deleteAlert(alert); } } }); } return treeAlert; } /** * Gets the selected alerts from the {@link #treeAlert alerts tree}. * * @return a {@code Set} with the selected alerts, never {@code null}. * @see #getSelectedAlert() */ Set<Alert> getSelectedAlerts() { return getSelectedAlertsImpl(true); } /** * Gets the selected alerts from the {@link #treeAlert alerts tree}. * * @param allAlerts {@code true} if it should return all selected alerts, {@code false} to just * return the first selected alert. * @return a {@code Set} with the selected alerts, never {@code null}. */ private Set<Alert> getSelectedAlertsImpl(boolean allAlerts) { TreePath[] paths = getTreeAlert().getSelectionPaths(); if (paths == null || paths.length == 0) { return Collections.emptySet(); } Set<Alert> alerts = new HashSet<>(); if (!allAlerts) { DefaultMutableTreeNode alertNode = (DefaultMutableTreeNode) paths[0].getLastPathComponent(); alerts.add((Alert) alertNode.getUserObject()); return alerts; } for (int i = 0; i < paths.length; i++) { DefaultMutableTreeNode alertNode = (DefaultMutableTreeNode) paths[i].getLastPathComponent(); if (alertNode.getChildCount() == 0) { alerts.add((Alert) alertNode.getUserObject()); continue; } for (int j = 0; j < alertNode.getChildCount(); j++) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) alertNode.getChildAt(j); alerts.add((Alert) node.getUserObject()); } } return alerts; } /** * Gets the first selected alert from the {@link #treeAlert alerts tree}. * * @return a {@code Set} with the first selected alert, never {@code null}. * @see #getSelectedAlerts() */ Set<Alert> getSelectedAlert() { return getSelectedAlertsImpl(false); } /** * This method initializes paneScroll * * @return javax.swing.JScrollPane */ private JScrollPane getPaneScroll() { if (paneScroll == null) { paneScroll = new JScrollPane(); paneScroll.setName("paneScroll"); paneScroll.setViewportView(getTreeAlert()); } return paneScroll; } /** @return Returns the view. */ private ViewDelegate getView() { return view; } public void expandRoot() { if (EventQueue.isDispatchThread()) { getTreeAlert().expandPath(new TreePath(getTreeAlert().getModel().getRoot())); return; } try { EventQueue.invokeLater( new Runnable() { @Override public void run() { expandRoot(); } }); } catch (Exception e) { logger.error(e.getMessage(), e); } } /** * Expands all child nodes of the root node. * * <p>This method should be called only from the EDT (Event Dispatch Thread). */ public void expandRootChildNodes() { TreeNode root = (TreeNode) getTreeAlert().getModel().getRoot(); if (root == null) { return; } TreePath basePath = new TreePath(root); for (int i = 0; i < root.getChildCount(); ++i) { getTreeAlert().expandPath(basePath.pathByAddingChild(root.getChildAt(i))); } } private void setMessage(HttpMessage msg, String highlight) { getView().displayMessage(msg); if (msg == null) { return; } if (!msg.getResponseHeader().isEmpty()) { HttpPanel requestPanel = getView().getRequestPanel(); HttpPanel responsePanel = getView().getResponsePanel(); SearchMatch sm = null; int start; // Highlight the 'attack' / evidence if (highlight == null || highlight.length() == 0) { // ignore } else if ((start = msg.getResponseHeader().toString().indexOf(highlight)) >= 0) { sm = new SearchMatch( msg, SearchMatch.Location.RESPONSE_HEAD, start, start + highlight.length()); responsePanel.highlightHeader(sm); responsePanel.setTabFocus(); } else if ((start = msg.getResponseBody().toString().indexOf(highlight)) >= 0) { sm = new SearchMatch( msg, SearchMatch.Location.RESPONSE_BODY, start, start + highlight.length()); responsePanel.highlightBody(sm); responsePanel.setTabFocus(); } else if ((start = msg.getRequestHeader().toString().indexOf(highlight)) >= 0) { sm = new SearchMatch( msg, SearchMatch.Location.REQUEST_HEAD, start, start + highlight.length()); requestPanel.highlightHeader(sm); requestPanel.setTabFocus(); } else if ((start = msg.getRequestBody().toString().indexOf(highlight)) >= 0) { sm = new SearchMatch( msg, SearchMatch.Location.REQUEST_BODY, start, start + highlight.length()); requestPanel.highlightBody(sm); requestPanel.setTabFocus(); } } } /** * The tree selection listener that triggers the filter of the "Alerts" tree by calling the * method {@code recreateLinkWithSitesTreeModel(SiteNode)} with the selected {@code SiteNode} as * parameter. * * @see #recreateLinkWithSitesTreeModel(SiteNode) */ private class LinkWithSitesTreeSelectionListener implements TreeSelectionListener { @Override public void valueChanged(TreeSelectionEvent e) { recreateLinkWithSitesTreeModel((SiteNode) e.getPath().getLastPathComponent()); } } private void editSelectedAlert() { DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent(); if (node != null && node.getUserObject() != null) { Object obj = node.getUserObject(); if (obj instanceof Alert) { Alert alert = (Alert) obj; extension.showAlertEditDialog(alert); } } } private JButton getEditButton() { if (editButton == null) { editButton = new JButton(); editButton.setToolTipText(Constant.messages.getString("alert.edit.button.tooltip")); editButton.setIcon( new ImageIcon(AlertPanel.class.getResource("/resource/icon/16/018.png"))); editButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editSelectedAlert(); } }); } return editButton; } private JButton getDeleteAllButton() { if (deleteAllButton == null) { deleteAllButton = new JButton(); deleteAllButton.setToolTipText( Constant.messages.getString("alert.deleteall.button.tooltip")); deleteAllButton.setIcon( DisplayUtils.getScaledIcon( AlertPanel.class.getResource("/resource/icon/fugue/broom-alerts.png"))); deleteAllButton.addActionListener( e -> { if (View.getSingleton() .showConfirmDialog( Constant.messages.getString( "alert.deleteall.confirm")) != JOptionPane.OK_OPTION) { return; } extension.deleteAllAlerts(); }); } return deleteAllButton; } }
e861decbb61bc6f381e39bf6d021c99e3ab9581e
8c2d585245900d0fbdd4b5f623b28b4db212833e
/src/main/java/com/ghassen/arbres/entities/ArbreProjection.java
677151ca7ad2cf36fbaf046a455d3dcb80561c0a
[]
no_license
ghassendev/Spring-Boot-Simple-Crud
d4b4cd6de4ba7e6fd1f5a5f690c183dd3e3e6d35
546397b618054cc1c606231ea5fae6f8eb194eb1
refs/heads/main
2023-01-21T12:30:37.678390
2020-12-03T20:43:57
2020-12-03T20:43:57
301,571,748
0
0
null
2020-12-03T20:43:58
2020-10-06T00:20:08
Java
UTF-8
Java
false
false
223
java
package com.ghassen.arbres.entities; import org.springframework.data.rest.core.config.Projection; @Projection(name = "nomArb", types = { Arbre.class }) public interface ArbreProjection { public String getNomArbre(); }
dcf7512ad3176b320bb4a95660a4d03b784f869d
127c82b80b8603493a3e3b0cabfd92b5fd74fb1d
/whp-visual/whp-monitor/src/main/java/com/cloud/whp/monitor/support/RedisEventStore.java
4c2fc32a602e102c0a78e190101fb4c2ef0e4275
[]
no_license
fengclondy/whp-cloud
ff6fe61494b93856e9e481a429ba7ec5e4fc8d20
824fd5b2290d6744d214d755d97be7401feda36f
refs/heads/master
2020-04-24T02:14:48.884067
2018-12-26T10:27:19
2018-12-26T10:27:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package com.cloud.whp.monitor.support; import com.cloud.whp.common.core.constant.CommonConstant; import de.codecentric.boot.admin.server.domain.events.InstanceEvent; import de.codecentric.boot.admin.server.eventstore.InMemoryEventStore; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import reactor.core.publisher.Mono; import java.util.List; /** * @author whp * @date 2018-12-20 * <p> * redis store event * default 100 */ @Slf4j @Configuration public class RedisEventStore extends InMemoryEventStore { @Autowired private RedisTemplate redisTemplate; @Override public Mono<Void> append(List<InstanceEvent> events) { events.forEach(event -> { String key = event.getInstance().getValue() + "_" + event.getTimestamp().toString(); log.info("保存实例事件的KEY:{},EVENT: {}", key, event.getType()); redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer<>(InstanceEvent.class)); redisTemplate.opsForHash().put(CommonConstant.EVENT_KEY, key, event); }); return super.append(events); } }
c8e43d4fa9504b3e76eaaa86adb63a6ab4bba4bf
a9185f673e9e30614143def66628671379099b1c
/market-data-processor/src/main/java/org/kaloz/datafeed/processor/infrastructure/messaging/listener/ProcessorListener.java
80238872a3c165726dac27987208ba41dafaf58e
[ "Apache-2.0" ]
permissive
parrondo/market-data-feed
800671eec214688360decc4a511904e443e0277d
46e39c7fd3a32988e4c49107504cd27c2db87c79
refs/heads/master
2020-12-11T04:11:25.596303
2013-12-16T21:59:34
2013-12-16T21:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
/* * Copyright 2013 Krisztian Lachata * * 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.kaloz.datafeed.processor.infrastructure.messaging.listener; import com.google.common.base.Optional; import org.kaloz.datafeed.processor.api.instrument.*; import org.kaloz.datafeed.processor.app.ProcessorService; import org.kaloz.datafeed.processor.domain.instrument.model.InstrumentPrice; import org.kaloz.datafeed.processor.domain.instrument.model.InstrumentPriceListRequest; import org.kaloz.datafeed.processor.domain.instrument.model.InstrumentPriceRequest; import org.kaloz.datafeed.processor.infrastructure.acl.ProcessorConverter; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.List; @Component public class ProcessorListener { @Resource private ProcessorService processorService; @Resource private ProcessorConverter processorConverter; public void processInstrumentPriceCommandMessage(InstrumentPriceCommandMessage instrumentPriceCommandMessage) { InstrumentPrice instrumentPrice = processorConverter.toInstrumentPrice(instrumentPriceCommandMessage); processorService.saveInstrumentPrice(instrumentPrice); } public InstrumentPriceResponseMessage processInstrumentPriceRequestMessage(InstrumentPriceRequestMessage instrumentPriceRequestMessage) { InstrumentPriceRequest instrumentPriceRequest = processorConverter.toInstrumentPriceRequest(instrumentPriceRequestMessage); Optional<InstrumentPrice> price = processorService.findByProviderAndShortName(instrumentPriceRequest); return processorConverter.toInstrumentPriceResponseMessage(price); } public InstrumentPriceListResponseMessage processInstrumentPriceListRequestMessage(InstrumentPriceListRequestMessage instrumentPriceListRequestMessage) { InstrumentPriceListRequest instrumentPriceListRequest = processorConverter.toInstrumentPriceListRequest(instrumentPriceListRequestMessage); List<InstrumentPrice> instrumentPrices = processorService.findByProvider(instrumentPriceListRequest); return processorConverter.toInstrumentPriceListResponseMessage(instrumentPrices); } }
dc0c0501d3f77be5fb6ebad544ca082f60d57020
5f783378eb66481617346c3ea9aa8df20c683b0a
/src/main/java/com/netsuite/suitetalk/proxy/v2018_1/lists/accounting/types/RevRecScheduleAmortizationStatus.java
9a9ba662b7029dfc7a61acb670f309ea764e961a
[]
no_license
djXplosivo/suitetalk-axis-proxy
b9bd506bcb43e4254439baf3a46c7ef688c7e57f
0ffba614f117962f9de2867a0677ec8494a2605a
refs/heads/master
2020-03-28T02:49:27.612364
2018-09-06T02:36:05
2018-09-06T02:36:05
147,599,598
0
0
null
null
null
null
UTF-8
Java
false
false
2,960
java
package com.netsuite.suitetalk.proxy.v2018_1.lists.accounting.types; import java.io.ObjectStreamException; import java.io.Serializable; import java.util.HashMap; import javax.xml.namespace.QName; import org.apache.axis.description.TypeDesc; import org.apache.axis.encoding.Deserializer; import org.apache.axis.encoding.Serializer; import org.apache.axis.encoding.ser.EnumDeserializer; import org.apache.axis.encoding.ser.EnumSerializer; public class RevRecScheduleAmortizationStatus implements Serializable { private String _value_; private static HashMap _table_ = new HashMap(); public static final String __notStarted = "_notStarted"; public static final String __inProgress = "_inProgress"; public static final String __completed = "_completed"; public static final String __onHold = "_onHold"; public static final RevRecScheduleAmortizationStatus _notStarted = new RevRecScheduleAmortizationStatus("_notStarted"); public static final RevRecScheduleAmortizationStatus _inProgress = new RevRecScheduleAmortizationStatus("_inProgress"); public static final RevRecScheduleAmortizationStatus _completed = new RevRecScheduleAmortizationStatus("_completed"); public static final RevRecScheduleAmortizationStatus _onHold = new RevRecScheduleAmortizationStatus("_onHold"); private static TypeDesc typeDesc = new TypeDesc(RevRecScheduleAmortizationStatus.class); protected RevRecScheduleAmortizationStatus(String value) { super(); this._value_ = value; _table_.put(this._value_, this); } public String getValue() { return this._value_; } public static RevRecScheduleAmortizationStatus fromValue(String value) throws IllegalArgumentException { RevRecScheduleAmortizationStatus enumeration = (RevRecScheduleAmortizationStatus)_table_.get(value); if (enumeration == null) { throw new IllegalArgumentException(); } else { return enumeration; } } public static RevRecScheduleAmortizationStatus fromString(String value) throws IllegalArgumentException { return fromValue(value); } public boolean equals(Object obj) { return obj == this; } public int hashCode() { return this.toString().hashCode(); } public String toString() { return this._value_; } public Object readResolve() throws ObjectStreamException { return fromValue(this._value_); } public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) { return new EnumSerializer(_javaType, _xmlType); } public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) { return new EnumDeserializer(_javaType, _xmlType); } public static TypeDesc getTypeDesc() { return typeDesc; } static { typeDesc.setXmlType(new QName("urn:types.accounting_2018_1.lists.webservices.netsuite.com", "RevRecScheduleAmortizationStatus")); } }
dad3a193bfe870da3aea2e76c3edacd20d376269
e108d65747c07078ae7be6dcd6369ac359d098d7
/com/itextpdf/text/pdf/security/VerificationException.java
0feccf3954eb0d86dd1ff164bd9df9a7b602f597
[ "MIT" ]
permissive
kelu124/pyS3
50f30b51483bf8f9581427d2a424e239cfce5604
86eb139d971921418d6a62af79f2868f9c7704d5
refs/heads/master
2020-03-13T01:51:42.054846
2018-04-24T21:03:03
2018-04-24T21:03:03
130,913,008
1
0
null
null
null
null
UTF-8
Java
false
false
651
java
package com.itextpdf.text.pdf.security; import java.security.GeneralSecurityException; import java.security.cert.Certificate; import java.security.cert.X509Certificate; public class VerificationException extends GeneralSecurityException { private static final long serialVersionUID = 2978604513926438256L; public VerificationException(Certificate cert, String message) { String str = "Certificate %s failed: %s"; Object[] objArr = new Object[2]; objArr[0] = cert == null ? "Unknown" : ((X509Certificate) cert).getSubjectDN().getName(); objArr[1] = message; super(String.format(str, objArr)); } }
236979564caa974373b690e192de18bf9afec9f7
550c0a8aada492436154b655dc7ff0a9debc172b
/src/main/java/org/leg/library/type/core/ITree.java
9ee63314821a36dd4c00033620671c347b0ff25f
[]
no_license
linlieycm/leg
4cfd92c1da8ee8fc338d986fde072cc542dc6279
1a3a9608b654f5d6b2028a8d60fb644361e031b8
refs/heads/master
2021-01-10T08:12:54.833724
2015-05-29T08:17:31
2015-05-29T08:17:31
36,490,765
1
0
null
null
null
null
UTF-8
Java
false
false
544
java
package org.leg.library.type.core; /** * 树接口 */ public interface ITree<T extends ITree<T>> extends IGraph<T> { /** * 获取父节点 * * @return 父节点对象 */ public T parent(); /** * 设置父节点 * * @param parent 待设置为父节点的节点对象 * @return 原父节点,若原父节点不存在则返回null */ public T setParent(T parent); /** * 获取子节点集合 * * @return 子节点集合 */ public ISet<T> children(); }
006963e3ba7ba20f15316f3d68989a1fbc3516fd
b5a4343608394c99dbf4e6d906d6e343c5f95432
/gmall-mbg/src/main/java/com/atguigu/gmall/pms/service/impl/SkuStockServiceImpl.java
098bf882155658ac406328cdfdc3821bda96599b
[]
no_license
w8ava8w/gmall-parent
ace36a051e33c8f58ab8db407a5cbb8025384778
89ed2d095289964c8aa48a496354b687ecd617ac
refs/heads/master
2020-04-30T21:48:30.873779
2019-03-22T14:56:14
2019-03-22T14:56:14
176,322,877
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
package com.atguigu.gmall.pms.service.impl; import com.atguigu.gmall.pms.entity.SkuStock; import com.atguigu.gmall.pms.mapper.SkuStockMapper; import com.atguigu.gmall.pms.service.SkuStockService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** * <p> * sku的库存 服务实现类 * </p> * * @author AVA_mbg * @since 2019-03-22 */ @Service public class SkuStockServiceImpl extends ServiceImpl<SkuStockMapper, SkuStock> implements SkuStockService { }
43ab109047434d203c823742c2d937cb0b7d7e20
ef12a03a0dd66aafb20a2847c851fbd44dc45bc8
/Guice/ch05.02-ProviderInterface Inject Constants/my-guice-app/src/main/java/com/app01/ch01/module/AppModule.java
80cab4eb01fe43d308437c410776972dca1b2a11
[]
no_license
softwareengineerhub/learning
24727a07e646a134c9d4db9d424ba546f90c0b52
dc572f685ffdf8f356ee82b1d28ad940871d05fb
refs/heads/master
2023-07-27T04:16:26.988338
2022-11-10T09:40:46
2022-11-10T09:40:46
179,563,742
0
0
null
2023-09-05T21:58:38
2019-04-04T19:28:55
Java
UTF-8
Java
false
false
722
java
package com.app01.ch01.module; import com.app01.ch01.providers.DrawSquareProvider; import com.app01.ch01.request.SquareColorValue; import com.app01.ch01.shape.DrawShape; import com.app01.ch01.shape.DrawSquare; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Scopes; import com.google.inject.Singleton; public class AppModule extends AbstractModule { public void configure(){ // not gives a singletone from get() bind(DrawShape.class).toProvider(DrawSquareProvider.class).in(Scopes.SINGLETON); //bind(String.class).toInstance("MyColor"); bind(String.class).annotatedWith(SquareColorValue.class).toInstance("MyColor2"); } }
572ee52a3b43b80d4b2e5b20400978cfba7be19b
88e9c95706428ffdba71799302dda47bd49ecbc9
/src/java/logica/Tiquete.java
dcb6148bb3f8e0bb3abb5f19dda4169791eeb234
[]
no_license
moiso0499/Lab-No1-Moviles
3546e67ada4275fbe95a671a6c6cba242313f22c
51ac9debb5934e59479b38b528d0cc44f679d694
refs/heads/master
2023-04-10T00:23:14.448106
2021-04-19T05:19:07
2021-04-19T05:19:07
354,410,973
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
/* * 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. */ package logica; /** * * @author Moi */ public class Tiquete { Compra compra_id; int asiento; Vuelo vuelo_id; public Tiquete() { } public Tiquete(Compra compra_id, int asiento) { this.compra_id = compra_id; this.asiento = asiento; } public Tiquete(Compra compra_id, int asiento, Vuelo vuelo_id) { this.compra_id = compra_id; this.asiento = asiento; this.vuelo_id = vuelo_id; } public Vuelo getVuelo_id() { return vuelo_id; } public void setVuelo_id(Vuelo vuelo_id) { this.vuelo_id = vuelo_id; } public Compra getCompra_id() { return compra_id; } public void setCompra_id(Compra compra_id) { this.compra_id = compra_id; } public int getAsiento() { return asiento; } public void setAsiento(int asiento) { this.asiento = asiento; } }
1670c6b471713102b1f7a23503074b472c745585
23e81fa38c4b214316e9764787e732dad581ece6
/src/main/java/auction/demo/repository/UserRepository.java
20efa2e5cb0e20b2e2bed7047c8702ec2484f707
[]
no_license
mkergal/auction-api
a58cdcb6114a3d1f19fb6e5106a64317730f9046
b2313fbb23cc3f43593fde60d24c4603c1dc54d9
refs/heads/master
2022-01-07T01:46:16.973110
2019-04-24T09:18:14
2019-04-24T09:18:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package auction.demo.repository; import org.springframework.data.repository.CrudRepository; import auction.demo.models.User; public interface UserRepository extends CrudRepository<User, Integer> { }
96b016081d5d0d8add3433a8c1c581d65438eb7a
0e175cf3f2caeca8f258d9c48ad55d28f2608442
/src/View/UserViewScreen/UserViewController.java
6f57e7bd35f4b899e8ad9432f85ffba4a4124817
[]
no_license
tal8374/EverythingForRent
83843a4596f1c530f19d0976425e91e1b0775e6c
26376733365c745de53c19c53d65351cd76365dc
refs/heads/master
2021-03-30T21:56:15.855024
2018-03-12T14:44:51
2018-03-12T14:44:51
124,902,241
0
0
null
null
null
null
UTF-8
Java
false
false
5,734
java
package View.UserViewScreen; import App.Product; import App.User; import App.Package; import View.ProductDescriptionView.ProductViewController; import Main.ViewModel; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableRow; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; import java.io.IOException; import java.net.URL; import java.util.List; import java.util.ResourceBundle; public class UserViewController implements Initializable { public TableView<ProductEntry> product_table; public TableColumn<ProductEntry, Integer> colPrice; public TableColumn<ProductEntry, Integer> colPackageId; public TableColumn<ProductEntry, Integer> colProductId; public TableColumn<ProductEntry, Integer> colCategory; public TableColumn<ProductEntry, Integer> colEnd; public TableColumn<ProductEntry, Integer> colStart; public TableColumn<ProductEntry, Integer> colDescription; private ViewModel viewModel; private ObservableList<ProductEntry> productEntries; private User user; public void addPackage(MouseEvent mouseEvent) { viewModel.goToAddPackage(); } public void setViewModel(ViewModel viewModel) { this.viewModel = viewModel; } @Override public void initialize(URL location, ResourceBundle resources) { colProductId.setCellValueFactory(new PropertyValueFactory<>("productID")); colPackageId.setCellValueFactory(new PropertyValueFactory<>("packageID")); colPrice.setCellValueFactory(new PropertyValueFactory<>("price")); colCategory.setCellValueFactory(new PropertyValueFactory<>("category")); colStart.setCellValueFactory(new PropertyValueFactory<>("startDate")); colEnd.setCellValueFactory(new PropertyValueFactory<>("endDate")); colDescription.setCellValueFactory(new PropertyValueFactory<>("description")); productEntries = FXCollections.observableArrayList(); product_table.setRowFactory(tv -> { TableRow<ProductEntry> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (!row.isEmpty() && event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) { ProductEntry clickedRow = row.getItem(); showProduct(clickedRow); } }); return row; }); } private void showProduct(ProductEntry clickedRow) { try { Stage productWindow = new Stage(); FXMLLoader productViewLoader = new FXMLLoader(getClass().getResource("../ProductDescriptionView/ProductView.fxml")); Parent productViewRoot = productViewLoader.load(); ProductViewController controller = productViewLoader.getController(); controller.setDataFromRow(clickedRow); controller.setViewModel(viewModel); controller.setWindow(productWindow); viewModel.setDraggable(productWindow, productViewRoot); Scene productViewScene = new Scene(productViewRoot); productWindow.setScene(productViewScene); productWindow.show(); } catch (IOException e) { e.printStackTrace(); } } public void setUser(User user) { this.user = user; } public void loadUserData(User user) { product_table.setItems(FXCollections.observableArrayList()); productEntries = FXCollections.observableArrayList(); List<Package> packageList = viewModel.getPackagesOfUser(); for (Package pack : packageList) { addPackageToTable(pack); } product_table.setItems(productEntries); } private void addPackageToTable(Package pack) { for (Product product : pack.getProducts()) { ProductEntry productEntry = new ProductEntry(product); productEntry.setAvailability("All week"); productEntry.setAddress(pack.getAddress()); productEntry.setStartDate(pack.getStartDateString()); productEntry.setEndDate(pack.getEndDateString()); productEntries.add(productEntry); } } public void addToTable(Package aPackage) { System.out.println("add to table"); addPackageToTable(aPackage); } public void signOut(MouseEvent mouseEvent) { this.user = null; productEntries = FXCollections.observableArrayList(); product_table.setItems(productEntries); // viewModel.goToSignIn(); viewModel.loguotUser(); viewModel.goToSearchView(); } public void deleteProductFromTable(String owner_email, int packageID, int productID) { ObservableList<ProductEntry> entries = FXCollections.observableArrayList(this.productEntries); for (int i = 0; i < entries.size(); i++) { ProductEntry p = entries.get(i); if(p.getProductID() == productID && p.getOwnerEmail().equals(owner_email) && p.getPackageID() == packageID){ productEntries.remove(i); break; } } } public void deletePackageFromTable(Package pack) { for (Product p : pack.getProducts()) { deleteProductFromTable(p.ownerEmail, p.packageID, p.productID); } } public void goToSearchView(MouseEvent mouseEvent) { viewModel.goToSearchView(); } }
56ddeebb4eb0ce6087fe105784b6529b04766ea9
a3250c5ae4614a3392f422cfa60114b310f02641
/Android App/GlucUp-2Date/app/src/main/java/magnusdroid/com/glucup_2date/Model/MValueGlucose.java
9dafe8a2a0ed2c3f175d61bd5b372d4cd65620a5
[]
no_license
rubielchapal/Glucemia
f25ef5a95b3c8ac6674f3d232865f6a10453d805
5f1bf1d0b7928766b5aa288e6042906c763359cc
refs/heads/verBeta
2021-01-13T05:49:38.500401
2018-08-25T02:37:59
2018-08-25T02:37:59
70,057,410
0
0
null
2016-10-05T12:18:21
2016-10-05T12:18:21
null
UTF-8
Java
false
false
5,687
java
package magnusdroid.com.glucup_2date.Model; import android.content.Context; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.math.RoundingMode; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLEncoder; import java.text.DecimalFormat; import java.util.LinkedHashMap; import java.util.Map; /** * Model to connect Android App to the server. Use HtppURLConnection class to build the request and * add the headers with the data. * Get the response from the server and pass it to the controller */ public class MValueGlucose { private String Fix, Min, Max, response; private JSONObject jsonObject; public JSONObject getValue(String document, String fix, String min, String max, String mUnit) throws JSONException { //String urlServer = "http://"+ipServer+":8084/FHIRTest/ListGlucose"; //String urlServer = "http://"+ipServer+":8084/FHIRTest/DateFilterGlucose"; //String urlServer = "http://"+ipServer+":8084/FHIRTest/ValueFilterGlucose"; String urlServer = "http://186.113.30.230:8080/Glucometrias/ValueFilterGlucose"; Map<String,Object> map = new LinkedHashMap<>(); if(mUnit.equalsIgnoreCase("mg/dl")){ DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.CEILING); if(!(fix.isEmpty()) && min.isEmpty() && max.isEmpty()){ Double dFix = Double.parseDouble(fix); Fix = String.valueOf(df.format(dFix/18)); Min = "nn"; Max = "nn"; }else if(!(min.isEmpty()) && fix.isEmpty() && max.isEmpty()){ Double dMin = Double.parseDouble(min); Fix = "nn"; Min = String.valueOf(df.format(dMin/18)); Max = "nn"; }else if(!(min.isEmpty()) && fix.isEmpty() && !(max.isEmpty())){ Double dMin = Double.parseDouble(min); Double dMax = Double.parseDouble(max); Fix = "nn"; Min = String.valueOf(df.format(dMin/18)); Max = String.valueOf(df.format(dMax/18)); }else{ Double dMax = Double.parseDouble(max); Fix = "nn"; Max = String.valueOf(df.format(dMax/18)); Min = "nn"; } /*tFix = String.valueOf(df.format(dataFix/18)); tMin = String.valueOf(df.format(dataMin/18)); tMax = String.valueOf(df.format(dataMax/18));*/ //value = String.valueOf(df.format(data/18)); //cancel = false; }else{ if(!(fix.isEmpty()) && min.isEmpty() && max.isEmpty()){ Fix = fix; Min = "nn"; Max = "nn"; }else if(!(min.isEmpty()) && fix.isEmpty() && max.isEmpty()){ Fix = "nn"; Min = min; Max = "nn"; }else if(!(min.isEmpty()) && fix.isEmpty() && !(max.isEmpty())){ Fix = "nn"; Min = min; Max = max; }else{ Fix = "nn"; Max = max; Min = "nn"; } } try { map.put("user",document); map.put("fixvalue",Fix); map.put("minvalue",Min); map.put("maxvalue",Max); Log.i("Datos",""+map); StringBuilder postData = new StringBuilder(); for (Map.Entry<String,Object> param : map.entrySet()) { if (postData.length() != 0) postData.append('&'); postData.append(URLEncoder.encode(param.getKey(), "ISO-8859-1")); postData.append('='); postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "ISO-8859-1")); } byte[] postDataBytes = postData.toString().getBytes("ISO-8859-1"); URL url = new URL(urlServer); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(20000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); conn.setRequestProperty("Accept-Charset", "UTF-8"); conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); conn.getOutputStream().write(postDataBytes); if(conn.getResponseCode() == HttpURLConnection.HTTP_OK) { Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); StringBuilder sb = new StringBuilder(); for (int c; (c = in.read()) >= 0; ) sb.append((char) c); response = sb.toString(); jsonObject = new JSONObject(response); }else { jsonObject.put("status",3); } } catch (MalformedURLException | JSONException e) { jsonObject.put("status",3); e.printStackTrace(); } catch (SocketTimeoutException e){ jsonObject.put("status",3); }catch (IOException e) { jsonObject.put("status",3); e.printStackTrace(); } return jsonObject; } }
dcdd9689b873d109717dc22fb7bac4efba99d1bc
95020c7e244426fa05bbacba32b328d6693361c2
/lei20_21_s4_2dl_02/HelpdeskService/helpdesk.core/src/main/java/eapli/helpdesk/equipa/exception/DesignationException.java
9d17c05e6dede29b9ebc3c5a2bdab0bf2699f13f
[ "MIT" ]
permissive
GJordao12/ISEP-LAPR4
cd98eec39010f2ea566376a247e7ebfbd441e12d
06e6b2f515445777180faaa603c023ce9b702bdf
refs/heads/main
2023-08-23T19:19:47.228134
2021-10-02T17:23:19
2021-10-02T17:23:19
412,626,451
2
3
null
null
null
null
UTF-8
Java
false
false
166
java
package eapli.helpdesk.equipa.exception; public class DesignationException extends Exception { public DesignationException(String s) { super(s); } }
447bcd703580792179f9b63d0bedf8c24fd2f570
b698ce1c1b798ea23e33c7a51ce59de4d8856d49
/code/src/main/java/com/kangyl/test/controller/TestController.java
bd8fbf4b5964cb97676c14bf86e7d2322d58b3eb
[]
no_license
kangyl/mycode
a98387ee6e255a32f9d7ba7bbeabe67057af8fd3
d1e9cc7c32a096c80a5d014f7ef158d50f82a6bf
refs/heads/master
2022-12-21T09:51:24.955182
2020-05-19T08:01:11
2020-05-19T08:01:11
145,866,956
0
0
null
2022-12-16T04:31:54
2018-08-23T14:42:37
JavaScript
UTF-8
Java
false
false
243
java
/** * Copyright 2018 */ package com.kangyl.test.controller; import org.springframework.web.bind.annotation.RestController; /** * *@author : kangyl([email protected]) *@date: 2018/3/10 */ @RestController public class TestController { }
ef59427898537246fbfa3c9041f3979d79a517b0
c89317715262e0091d4c2333898a8a7fede7a9e2
/MybusTrip-backend/src/main/java/com/bus/booking/Dao/BusCompanyDao.java
1e6969949a720d3f6ae6ba2894d55be1de537900
[]
no_license
suryaaravind97/MybusTrip-backend
bcdea4163d8d915d440e0c494720544e6c2ec4fc
bbd2f3c00f3ff6b7e0dac777f9af2beb926c2e4f
refs/heads/master
2022-04-17T11:29:16.215921
2020-04-10T09:20:03
2020-04-10T09:20:03
254,592,123
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.bus.booking.Dao; import com.bus.booking.models.Buscompany; import org.springframework.data.repository.CrudRepository; public interface BusCompanyDao extends CrudRepository<Buscompany, Integer> { public Buscompany findByCompanyName(String companyName); }
cadf31679220831282c6c95f67c65a12addfd74a
b66bdee811ed0eaea0b221fea851f59dd41e66ec
/src/com/google/android/gms/d/af$1.java
da329beb0f2268f82f1261161ec8998409cc3081
[]
no_license
reverseengineeringer/com.grubhub.android
3006a82613df5f0183e28c5e599ae5119f99d8da
5f035a4c036c9793483d0f2350aec2997989f0bb
refs/heads/master
2021-01-10T05:08:31.437366
2016-03-19T20:41:23
2016-03-19T20:41:23
54,286,207
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package com.google.android.gms.d; import android.os.RemoteException; import com.google.android.gms.appdatasearch.UsageInfo; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.Status; class af$1 extends ah<Status> { af$1(af paramaf, GoogleApiClient paramGoogleApiClient, String paramString, UsageInfo[] paramArrayOfUsageInfo) { super(paramGoogleApiClient); } protected void a(w paramw) throws RemoteException { paramw.a(new ai(this), b, c); } } /* Location: * Qualified Name: com.google.android.gms.d.af.1 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
89de47890032223ea6fa7f19a0a8de3bdbf70e3d
07e2221d48f3f778b0a2694544d5a6933857313f
/src/test/java/helpers/InitDriver.java
663817caea662c6133b16ddc62777a09d9cf6df1
[]
no_license
sloymad/TestExercise
b1794111556dc58f9c4e2421f9be64c3cd95696f
5e8c015cd7a67bf6379d5226892e15cd86f691c7
refs/heads/master
2020-03-07T19:27:20.660717
2018-04-18T12:30:30
2018-04-18T12:30:30
127,670,980
0
0
null
null
null
null
UTF-8
Java
false
false
815
java
package helpers; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import java.net.MalformedURLException; import java.net.URI; public class InitDriver { private WebDriver driver; public WebDriver chromeDriver() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setBrowserName("chrome"); capabilities.setVersion("65.0"); capabilities.setCapability("enableVNC", true); try { driver = new RemoteWebDriver( URI.create("http://localhost:4444/wd/hub").toURL(), capabilities); } catch (MalformedURLException e) { e.printStackTrace(); } return driver; } }
abaa74060b4c76d2d8463f4e85c6f3b1f1cca5b3
dd1541bed714f0e3a8c7e2e1360c483cc935013f
/app/src/main/java/com/example/TheArcade/BrickGame/Brick.java
cad94a2e1852a717f889eada7913093c4b9835e2
[]
no_license
AlyssaChow/TheArcade
f3cd3b5891b516556f83a83cd7627017ac5f40a1
83a5297db72b37e752fc17eb0945c30cd8850849
refs/heads/master
2023-01-28T21:14:02.154170
2020-12-13T16:24:09
2020-12-13T16:24:09
294,725,604
0
0
null
2020-12-07T04:22:19
2020-09-11T15:00:56
Java
UTF-8
Java
false
false
2,006
java
package com.example.TheArcade.BrickGame; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; import com.example.TheArcade.CustomOnClick; import com.example.TheArcade.MainActivity; import com.example.TheArcade.R; import com.example.TheArcade.tankMain; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class Brick extends AppCompatActivity { private SurfaceHolder surfaceHolder; private BrickGameView gameView; private int score; SharedPreferences prefs; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.brick_activity); findViewById(R.id.PaddleLeft).setOnTouchListener(new CustomOnClick()); findViewById(R.id.PaddleRight).setOnTouchListener(new CustomOnClick()); TextView playerScore = findViewById(R.id.brick_lives); playerScore.setText("5"); Button exitButton = findViewById(R.id.exit_button); exitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Brick.this, MainActivity.class); startActivity(intent); } }); } }
58526e8d12a1007df0e88187950e346153fde4b0
c1d8a2f4250503b33c4a9ab33366553b3af226b4
/src/test/java/com/imz1/service/security/jwt/JWTFilterTest.java
95052e59aa8f516e32e0acb10b3f35093c15cd7d
[]
no_license
anupgupta100/imz1-utdb-service-sample2
8b02e65436e59fec83fbcad9d97bf49f6069ddf2
a1b3312e82de7beccbf42f8981bca3441b86a8b2
refs/heads/master
2022-11-25T08:06:08.841660
2020-07-31T12:01:40
2020-07-31T12:01:40
284,026,851
0
0
null
2020-07-31T12:18:52
2020-07-31T12:01:21
Java
UTF-8
Java
false
false
5,559
java
package com.imz1.service.security.jwt; import static org.assertj.core.api.Assertions.assertThat; import com.imz1.service.security.AuthoritiesConstants; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; import java.util.Collections; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.util.ReflectionTestUtils; public class JWTFilterTest { private TokenProvider tokenProvider; private JWTFilter jwtFilter; @BeforeEach public void setup() { JHipsterProperties jHipsterProperties = new JHipsterProperties(); tokenProvider = new TokenProvider(jHipsterProperties); ReflectionTestUtils.setField( tokenProvider, "key", Keys.hmacShaKeyFor( Decoders.BASE64.decode("fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8") ) ); ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", 60000); jwtFilter = new JWTFilter(tokenProvider); SecurityContextHolder.getContext().setAuthentication(null); } @Test public void testJWTFilter() throws Exception { UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( "test-user", "test-password", Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER)) ); String jwt = tokenProvider.createToken(authentication, false); MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); request.setRequestURI("/api/test"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); jwtFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(SecurityContextHolder.getContext().getAuthentication().getName()).isEqualTo("test-user"); assertThat(SecurityContextHolder.getContext().getAuthentication().getCredentials().toString()).isEqualTo(jwt); } @Test public void testJWTFilterInvalidToken() throws Exception { String jwt = "wrong_jwt"; MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); request.setRequestURI("/api/test"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); jwtFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @Test public void testJWTFilterMissingAuthorization() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); request.setRequestURI("/api/test"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); jwtFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @Test public void testJWTFilterMissingToken() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer "); request.setRequestURI("/api/test"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); jwtFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @Test public void testJWTFilterWrongScheme() throws Exception { UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( "test-user", "test-password", Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER)) ); String jwt = tokenProvider.createToken(authentication, false); MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Basic " + jwt); request.setRequestURI("/api/test"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); jwtFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } }
ae62f78b0f097a9d7e4dccbfd7a02c32f20a2224
3370a0d2a9e3c73340b895de3566f6e32aa3ca4a
/alwin-middleware-grapescode/alwin-rest/src/main/java/com/codersteam/alwin/rest/ContactDetailResource.java
a8a8ef6315165b3b0f769063767d9539c3bafcbe
[]
no_license
Wilczek01/alwin-projects
8af8e14601bd826b2ec7b3a4ce31a7d0f522b803
17cebb64f445206320fed40c3281c99949c47ca3
refs/heads/master
2023-01-11T16:37:59.535951
2020-03-24T09:01:01
2020-03-24T09:01:01
249,659,398
0
0
null
2023-01-07T16:18:14
2020-03-24T09:02:28
Java
UTF-8
Java
false
false
6,417
java
package com.codersteam.alwin.rest; import com.codersteam.alwin.auth.annotation.Secured; import com.codersteam.alwin.core.api.model.customer.ContactDetailDto; import com.codersteam.alwin.core.api.model.customer.ContactStateDto; import com.codersteam.alwin.core.api.model.customer.ContactTypeDto; import com.codersteam.alwin.core.api.model.customer.PhoneNumberDto; import com.codersteam.alwin.core.api.service.customer.ContactDetailService; import com.codersteam.alwin.core.api.service.customer.PhoneNumberService; import io.swagger.annotations.*; import io.swagger.jaxrs.PATCH; import javax.inject.Inject; import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.util.List; import static com.codersteam.alwin.comparator.ContactDetailDtoComparatorProvider.CONTACT_DETAIL_DTO_COMPARATOR; import static com.codersteam.alwin.core.api.model.customer.ContactStateDto.ALL_CONTACT_STATES_WITH_ORDER; import static com.codersteam.alwin.core.api.model.customer.ContactTypeDto.ALL_CONTACT_TYPES_WITH_ORDER; import static javax.ws.rs.core.HttpHeaders.AUTHORIZATION; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; @Path("/contactDetails") @Api("/contactDetails") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public class ContactDetailResource { private ContactDetailService contactDetailService; private PhoneNumberService phoneNumberService; public ContactDetailResource() { } @Inject public ContactDetailResource(final ContactDetailService contactDetailService, final PhoneNumberService phoneNumberService) { this.contactDetailService = contactDetailService; this.phoneNumberService = phoneNumberService; } @GET @Path("company/{companyId}") @Secured(all = true) @ApiOperation("Pobieranie wszystkich kontaktów dla danej firmy") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public List<ContactDetailDto> findAllContactDetailsForCompany(@ApiParam(name = "companyId", value = "Identyfikator firmy") @PathParam("companyId") final long companyId) { final List<ContactDetailDto> allContactDetailsForCompany = contactDetailService.findAllContactDetailsForCompany(companyId); allContactDetailsForCompany.sort(CONTACT_DETAIL_DTO_COMPARATOR); return allContactDetailsForCompany; } @POST @Path("company/{companyId}") @Secured(all = true) @ApiOperation("Dodanie nowego kontaktu dla firmy") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public Response createNewContactDetailsForCompany(@ApiParam(name = "companyId", value = "Identyfikator firmy") @PathParam("companyId") final long companyId, @ApiParam(required = true, value = "Kontakt do utworzenia") final ContactDetailDto contactDetail) { contactDetailService.createNewContactDetailForCompany(companyId, contactDetail); return Response.created(null).build(); } @GET @Path("person/{personId}") @Secured(all = true) @ApiOperation("Pobieranie wszystkich kontaktów dla danej osoby") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public List<ContactDetailDto> findAllContactDetailsForPerson(@ApiParam(name = "personId", value = "Identyfikator osoby") @PathParam("personId") final long personId) { final List<ContactDetailDto> allContactDetailsForPerson = contactDetailService.findAllContactDetailsForPerson(personId); allContactDetailsForPerson.sort(CONTACT_DETAIL_DTO_COMPARATOR); return allContactDetailsForPerson; } @POST @Path("person/{personId}") @Secured(all = true) @ApiOperation("Dodanie nowego kontaktu dla osoby") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public Response createNewContactDetailsForPerson(@ApiParam(name = "personId", value = "Identyfikator osoby") @PathParam("personId") final long personId, @ApiParam(required = true, value = "Kontakt do utworzenia") final ContactDetailDto contactDetailDto) { contactDetailService.createNewContactDetailForPerson(personId, contactDetailDto); return Response.created(null).build(); } @PATCH @Path("/{contactDetailId}") @Secured(all = true) @ApiOperation("Edycja kontaktu dla firmy") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public Response updateContactDetail(@ApiParam(name = "contactDetailId", value = "Identyfikator kontaktu") @PathParam("contactDetailId") final long contactDetailId, @ApiParam(required = true, value = "Kontakt do edycji") final ContactDetailDto contactDetail) { contactDetail.setId(contactDetailId); contactDetailService.updateContactDetail(contactDetail); return Response.accepted().build(); } @GET @Path("types") @Secured(all = true) @ApiOperation("Pobieranie wszystkich typów kontaktów") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public List<ContactTypeDto> findAllContactDetailsTypes() { return ALL_CONTACT_TYPES_WITH_ORDER; } @GET @Path("states") @Secured(all = true) @ApiOperation("Pobieranie wszystkich statusów kontaktów") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public List<ContactStateDto> findAllContactDetailsStates() { return ALL_CONTACT_STATES_WITH_ORDER; } @GET @Path("suggestedPhoneNumbers/{companyId}") @Secured(all = true) @ApiOperation("Pobieranie wszystkich kontaktów dla danej osoby") @ApiImplicitParams({@ApiImplicitParam(name = AUTHORIZATION, value = "Token", dataType = "string", paramType = "header")}) public List<PhoneNumberDto> findSuggestedPhoneNumbers(@ApiParam(name = "companyId", value = "Identyfikator firmy") @PathParam("companyId") final long companyId) { return phoneNumberService.findSuggestedPhoneNumbers(companyId); } }
edfb15c4a68dc653bf55ebb4958e98575e4dc31d
4dc9c476e31c161fb57fe6d1fc5fdce1ec18af0d
/src/com/example/app_fitness/Samedi.java
00e9cff9f33d12e55b9598b0370170142ef260b2
[]
no_license
MaarefSa/App_fitness
df1094eca6b85f95afbd334061695e69f6281425
de057c5ff25fc7abc8e78da70bc4a2a9d68be3a4
refs/heads/master
2020-05-01T00:23:30.711386
2019-03-22T15:43:07
2019-03-22T15:43:07
177,167,747
0
0
null
null
null
null
UTF-8
Java
false
false
4,108
java
package com.example.app_fitness; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.json.JSONArray; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.os.StrictMode; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; import android.widget.Toast; public class Samedi extends Activity { String id=MainActivity.myId; String urladdressM=id+"/coach/ex_jour/minceSa.php"; String urladdressN=id+"/coach/ex_jour/normaleSa.php"; String urladdressS=id+"/coach/ex_jour/surpoidSa.php"; String[] titre; String[] desc; String[] imagepath; BufferedInputStream is; String line=null; String result=null; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exercice); Bundle extras = getIntent().getExtras(); String code = extras.getString("numbers"); if(code.equals("minceSa")) { listView=(ListView)findViewById(R.id.lview6); StrictMode.setThreadPolicy((new StrictMode.ThreadPolicy.Builder().permitNetwork().build())); collectData(urladdressM); CustomListView customListView=new CustomListView(this,titre,desc,imagepath); listView.setAdapter(customListView); }else if(code.equals("normaleSa")){ listView=(ListView)findViewById(R.id.lview6); StrictMode.setThreadPolicy((new StrictMode.ThreadPolicy.Builder().permitNetwork().build())); collectData(urladdressN); CustomListView customListView=new CustomListView(this,titre,desc,imagepath); listView.setAdapter(customListView); }else if(code.equals("surpoidSa")){ listView=(ListView)findViewById(R.id.lview6); StrictMode.setThreadPolicy((new StrictMode.ThreadPolicy.Builder().permitNetwork().build())); collectData(urladdressS); CustomListView customListView=new CustomListView(this,titre,desc,imagepath); listView.setAdapter(customListView); } } private void collectData(String add) { //Connection try{ URL url=new URL(add); HttpURLConnection con=(HttpURLConnection)url.openConnection(); con.setRequestMethod("GET"); is=new BufferedInputStream(con.getInputStream()); } catch (Exception ex) { ex.printStackTrace(); } //content try{ BufferedReader br=new BufferedReader(new InputStreamReader(is)); StringBuilder sb=new StringBuilder(); while ((line=br.readLine())!=null){ sb.append(line+"\n"); } is.close(); result=sb.toString(); } catch (Exception ex) { ex.printStackTrace(); } //JSON try{ JSONArray ja=new JSONArray(result); JSONObject jo=null; titre=new String[ja.length()]; desc=new String[ja.length()]; imagepath=new String[ja.length()]; for(int i=0;i<=ja.length();i++){ jo=ja.getJSONObject(i); titre[i]=jo.getString("titre"); desc[i]=jo.getString("description"); imagepath[i]=jo.getString("image"); } } catch (Exception ex) { ex.printStackTrace(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.lundi, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
6c31504fbf9588d983740f10fee4d5bfc92a29a7
00e3015e580b602fb8cee02af4e23384c441e34f
/foodvendor/src/main/java/starterproject/foodvendor/data/Ingredient.java
7eb9b33c9e2a92901d2bef266b1a36818df91469
[]
no_license
mabdinur/open-census-example
a4b90591e54e1e438642ef161a6283837da4c3bd
fcf4f72b736eaab21f4ba6375a8b3c88d1e4e38c
refs/heads/master
2022-09-29T10:27:04.153467
2020-05-28T01:54:19
2020-05-28T01:54:19
269,102,365
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package starterproject.foodvendor.data; import lombok.Data; @Data public class Ingredient { private String name; private float price; private float quantity; private String currency; public Ingredient() { } public Ingredient(String name, float price, float quantity, String currency) { this.name = name; this.price = price; this.quantity = quantity; this.currency = currency; } }
049835f8066a0c2222424a80f3864fba4f42407f
a5db9c593af0ae024d7cf2dcbb5bd95b58b8337b
/贯穿案例/SMBMS/src/main/java/cn/smbms/service/user/UserServiceImpl.java
32d42f8239a0d617edaa816c6e873f3c3024065f
[]
no_license
pangzhenhuazhendeshuai/Y2
4a6417a589159b7139c9d05a391c333ba331d72d
fa794842280793e63c47d570dca9403b697ac051
refs/heads/master
2020-03-22T15:10:20.430631
2018-07-19T05:39:15
2018-07-19T05:39:15
139,794,833
0
0
null
null
null
null
UTF-8
Java
false
false
5,206
java
package cn.smbms.service.user; import java.util.List; import cn.smbms.dao.user.UserMapper; import cn.smbms.pojo.User; import cn.smbms.tools.Constants; import cn.smbms.tools.MybatisUtil; import org.apache.ibatis.session.SqlSession; /** * service层捕获异常,进行事务处理 * 事务处理:调用不同dao的多个方法,必须使用同一个connection(connection作为参数传递) * 事务完成之后,需要在service层进行connection的关闭,在dao层关闭(PreparedStatement和ResultSet对象) * @author Administrator * */ public class UserServiceImpl implements UserService{ private UserMapper userDao; private SqlSession sqlSession = MybatisUtil.getSession(); public UserServiceImpl(){ userDao = sqlSession.getMapper(UserMapper.class); } /** * 添加新用户 * @param user * @return */ @Override public boolean add(User user) { // TODO Auto-generated method stub try { int row = userDao.add(user); sqlSession.commit(); if(row == 1) return true; } catch (Exception e){ e.printStackTrace(); sqlSession.rollback(); return false; } finally { if(sqlSession != null){ sqlSession.close(); } } return false; } /** * 登录 * @param userCode * @param userPassword * @return */ @Override public User login(String userCode, String userPassword) { User user = null; try { user=userDao.queryUserByUserNameAndPassword(userCode,userPassword); }catch (Exception e){ e.printStackTrace(); }finally { if(sqlSession != null) sqlSession.close(); } return user; } /** *获取所有用户列表并分页显示 * @param queryUserName * @param queryUserRole * @param currentPageNo * @param pageSize * @return */ @Override public List<User> getUserList(String queryUserName,int queryUserRole,int currentPageNo, int pageSize) { List<User> userList = null; try { userList = userDao.getUserList( queryUserName,queryUserRole,(currentPageNo-1)*Constants.pageSize,pageSize); }catch (Exception e){ e.printStackTrace(); } return userList; } @Override public User selectUserCodeExist(String userCode) { // TODO Auto-generated method stub // Connection connection = null; // User user = null; // try { // connection = BaseDao.getConnection(); // user = userDao.getLoginUser(connection, userCode); // } catch (Exception e) { // // TODO Auto-generated catch block // e.printStackTrace(); // }finally{ // BaseDao.closeResource(connection, null, null); // } return null; } /** * 删除用户 * @param delId * @return */ @Override public boolean deleteUserById(Integer delId) { // TODO Auto-generated method stub try { if(userDao.deleteUserById(delId) > 0) sqlSession.commit(); return true; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); sqlSession.rollback(); }finally{ if(sqlSession != null) sqlSession.close(); } return false; } /** * 根据ID获取User信息 * @param id * @return */ @Override public User getUserById(String id) { // TODO Auto-generated method stub User user = null; try{ user = userDao.getUserById(id); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); user = null; } return user; } /** * 修改用户信息 * @param user * @return */ @Override public boolean modify(User user) { // TODO Auto-generated method stub try { if(userDao.modify(user) > 0) sqlSession.commit(); return true; } catch (Exception e) { // TODO Auto-generated catch block sqlSession.rollback(); e.printStackTrace(); }finally{ if(sqlSession != null) sqlSession.close(); } return false; } /** * 修改密码 * @param id * @param pwd * @return */ @Override public boolean updatePwd(int id, String pwd) { // TODO Auto-generated method stub // boolean flag = false; // Connection connection = null; // try{ // connection = BaseDao.getConnection(); // if(userDao.updatePwd(connection,id,pwd) > 0) // flag = true; // }catch (Exception e) { // // TODO: handle exception // e.printStackTrace(); // }finally{ // BaseDao.closeResource(connection, null, null); // } return false; } /** * 获取用户表和角色表的-记录数 * @param queryUserName * @param queryUserRole * @return */ @Override public int getUserCount(String queryUserName, int queryUserRole) { // TODO Auto-generated method stub int count = 0; System.out.println("queryUserName ---- > " + queryUserName); System.out.println("queryUserRole ---- > " + queryUserRole); try { count = userDao.getUserCount( queryUserName,queryUserRole); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return count; } }
8afab0db788a07e5afa00a317906f31a48e571d5
8edc5ceb51a89305bf737ffae076b68a482a1431
/Boohbah 0410/Gameplay.java
31b6085aad19cd753f21beaca053e10b67025fce
[]
no_license
justinappave/cpsc-233-group
7e6aca49eacbe1aec33a7907d085c2a00ffe88ea
870b348b80b8c46d4d851e06e53eea347573184d
refs/heads/master
2021-03-21T23:53:24.075844
2017-04-12T16:14:12
2017-04-12T16:14:12
79,484,249
0
1
null
null
null
null
UTF-8
Java
false
false
25,042
java
import leaderboards.*; import java.awt.*; import javax.swing.*; import java.util.ArrayList; import java.util.Collections; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.AbstractButton; import javax.swing.ImageIcon; public class Gameplay implements ActionListener{ //Initialize game components public JFrame frame; public ArrayList list; private int size; private int moves; private int mode; private int counter = 0; JPanel gridPane, movesPane, timePane; JButton movesButton = new JButton("Moves: 0"); JButton timeButton = new JButton("Start Game!"); JButton timeDisplayButton = new JButton("0"); Timer time; public void increaseMoves() { moves += 1; } public int getMoves() { return moves; } public void increaseTime() { counter += 1; } public int getTime() { return counter; } public void setSize(int newSize) { size = newSize; } public int getSize() { return size; } public void setMode(int newMode) { mode = newMode; } public int getMode() { return mode; } public Gameplay(int size, int mode) { setSize(size); setMode(mode); } public JPanel makeGrid(int size) { boolean solvable = false; while(!solvable) { JButton[] tile = new JButton[size*size]; gridPane = new JPanel(new GridLayout(size,size)); list = new ArrayList(); for(int x = 0; x < (size * size); x++) { if(x < (size * size) - 1){ if(getMode() != 0) { tile[x] = new JButton("" + (x + 1)); } else { tile[x] = new JButton(); String filePath = ("resources/" + x + ".png"); tile[x].setIcon(new ImageIcon(filePath)); } } else { if(getMode() != 0) { tile[x] = new JButton(""); } else { tile[x] = new JButton(); String filePath = ("resources/null.png"); tile[x].setIcon(new ImageIcon(filePath)); } } tile[x].setFont(new Font("ARIAL", Font.BOLD, 70)); tile[x].setForeground(Color.ORANGE); tile[x].setBackground(Color.BLACK); tile[x].setFocusPainted(false); list.add(tile[x]); } Collections.shuffle(list); solvable = checkSolvability(list, size); if(solvable) { for(int x = 0; x < list.size(); x++) { gridPane.add((JButton)list.get(x)); if (getMode() != 0) { ((JButton)list.get(x)).setActionCommand("" + x); ((JButton)list.get(x)).addActionListener(this); } else { ((JButton)list.get(x)).setActionCommand("pic" + x); ((JButton)list.get(x)).addActionListener(this); } } } } return gridPane; } public JPanel infoBar() { JPanel topPane = new JPanel(new FlowLayout()); JButton quitToMenuButton = new JButton("Quit to menu"); quitToMenuButton.setActionCommand("quit"); quitToMenuButton.addActionListener(this); topPane.add(quitToMenuButton); return topPane; } public boolean checkSolvability(ArrayList gridList, int gridSize) { boolean solvable = false; int length = gridList.size(); int numInversions = 0; for (int itemsInList = 0; itemsInList < length; itemsInList++) { for (int restOfList = itemsInList; restOfList < length; restOfList++) { if (getMode() == 0) { try { if (Integer.parseInt(((JButton)gridList.get(itemsInList)).getIcon().toString().substring(10,11)) - Integer.parseInt(((JButton)gridList.get(restOfList)).getIcon().toString().substring(10,11)) > 0) { numInversions++; } } catch (NumberFormatException except) { } } else { try { if (Integer.parseInt(((JButton)gridList.get(itemsInList)).getText())-Integer.parseInt(((JButton)gridList.get(restOfList)).getText()) > 0) { numInversions ++; } } catch (NumberFormatException e) { } } } } if ((gridSize%2 != 0) && (numInversions%2 == 0)) { solvable = true; } else if ((gridSize%2 == 0) && (numInversions%2 == 0)) { solvable = true; } return solvable; } public boolean checkGame(ArrayList list) { boolean won = false; int counter = 1; for (int i = 0; i < size*size; i++) { if (counter == size*size) { won = true; } try { if (Integer.parseInt(((JButton) list.get(i)).getText()) == counter) { counter++; } } catch (NumberFormatException e) { } } return won; } public boolean checkGamePicture(ArrayList list) { boolean won = false; int counter = 1; for (int i = 0; i < size*size; i++) { if (counter == size*size) { won = true; } try { if ((((JButton) list.get(i)).getIcon()).toString().equals("resources/" + i + ".png")) { counter++; } } catch (NumberFormatException e) { } } return won; } public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); if (!(button.getText().equals(""))) { //increaseMoves(); } //movesButton.setText("Moves: #" + getMoves()); if (e.getActionCommand().equals("quit")) { frame.dispose(); Driver getMenu = new Driver(); getMenu.MainMenu(); //PauseMenu pause = new PauseMenu(); } else if (e.getActionCommand().equals("0")) { //top left corner if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(1); JButton bottomButton = (JButton) list.get(3); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("1")) { if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(2); JButton bottomButton = (JButton) list.get(4); JButton leftButton = (JButton) list.get(0); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("2")) { if (button.getText().equals("")) { } else { JButton bottomButton = (JButton) list.get(5); JButton leftButton = (JButton) list.get(1); if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("3")) { if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(4); JButton bottomButton = (JButton) list.get(6); JButton topButton = (JButton) list.get(0); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("4")) { if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(5); JButton bottomButton = (JButton) list.get(7); JButton topButton = (JButton) list.get(1); JButton leftButton = (JButton) list.get(3); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("5")) { if (button.getText().equals("")) { } else { JButton leftButton = (JButton) list.get(4); JButton bottomButton = (JButton) list.get(8); JButton topButton = (JButton) list.get(2); if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (bottomButton.getText().equals("")) { bottomButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("6")) { if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(7); JButton topButton = (JButton) list.get(3); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("7")) { if (button.getText().equals("")) { } else { JButton rightButton = (JButton) list.get(8); JButton topButton = (JButton) list.get(4); JButton leftButton = (JButton) list.get(6); if (rightButton.getText().equals("")) { rightButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } } } else if (e.getActionCommand().equals("8")) { if (button.getText().equals("")) { } else { JButton topButton = (JButton) list.get(5); JButton leftButton = (JButton) list.get(7); if (topButton.getText().equals("")) { topButton.setText(button.getText()); button.setText(""); increaseMoves(); } else if (leftButton.getText().equals("")) { leftButton.setText(button.getText()); button.setText(""); increaseMoves(); } } boolean won = checkGame(list); if (won == true && mode == 1) { HighScores hs = new HighScores(); String name = JOptionPane.showInputDialog(null, "Enter your name:", "CONGRATULATIONS! YOU WON!", JOptionPane.WARNING_MESSAGE) ; hs.writeFile(name, getMoves(), 1); frame.dispose(); Driver getMenu = new Driver(); getMenu.MainMenu(); } } else if (e.getActionCommand().equals("pic0")) { JButton rightButton = (JButton) list.get(1); JButton bottomButton = (JButton) list.get(3); String rightIcon = (rightButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic1")) { Icon icon = button.getIcon(); JButton rightButton = (JButton) list.get(2); JButton bottomButton = (JButton) list.get(4); JButton leftButton = (JButton) list.get(0); String rightIcon = (rightButton.getIcon()).toString(); String leftIcon = (leftButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic2")) { Icon icon = button.getIcon(); JButton bottomButton = (JButton) list.get(5); JButton leftButton = (JButton) list.get(1); String leftIcon = (leftButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic3")) { Icon icon = button.getIcon(); JButton rightButton = (JButton) list.get(4); JButton bottomButton = (JButton) list.get(6); JButton topButton = (JButton) list.get(0); String rightIcon = (rightButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic4")) { Icon icon = button.getIcon(); JButton rightButton = (JButton) list.get(5); JButton bottomButton = (JButton) list.get(7); JButton topButton = (JButton) list.get(1); JButton leftButton = (JButton) list.get(3); String rightIcon = (rightButton.getIcon()).toString(); String leftIcon = (leftButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic5")) { Icon icon = button.getIcon(); JButton leftButton = (JButton) list.get(4); JButton bottomButton = (JButton) list.get(8); JButton topButton = (JButton) list.get(2); String leftIcon = (leftButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); String bottomIcon = (bottomButton.getIcon()).toString(); if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (bottomIcon.equals("resources/null.png")) { bottomButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic6")) { JButton rightButton = (JButton) list.get(7); JButton topButton = (JButton) list.get(3); String rightIcon = (rightButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic7")) { Icon icon = button.getIcon(); JButton rightButton = (JButton) list.get(8); JButton topButton = (JButton) list.get(4); JButton leftButton = (JButton) list.get(6); String rightIcon = (rightButton.getIcon()).toString(); String leftIcon = (leftButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); if (rightIcon.equals("resources/null.png")) { rightButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } } else if (e.getActionCommand().equals("pic8")) { JButton leftButton = (JButton) list.get(7); JButton topButton = (JButton) list.get(5); String leftIcon = (leftButton.getIcon()).toString(); String topIcon = (topButton.getIcon()).toString(); if (leftIcon.equals("resources/null.png")) { leftButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } else if (topIcon.equals("resources/null.png")) { topButton.setIcon(new ImageIcon(button.getIcon().toString())); button.setIcon(new ImageIcon("resources/null.png")); } boolean won = checkGamePicture(list); if (won == true) { JOptionPane.showMessageDialog(null, "CONGRATULATIONS! YOU WON!"); frame.dispose(); Driver getMenu = new Driver(); getMenu.MainMenu(); } } else if(e.getActionCommand().equals("Start timer!")) { timeButton.removeActionListener(this); gridPane = makeGrid(size); frame.add(gridPane); time = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { boolean won = checkGame(list); if (won == true) { time.stop(); HighScores hs = new HighScores(); String name = JOptionPane.showInputDialog(null, "Enter your name:", "CONGRATULATIONS! YOU WON!", JOptionPane.WARNING_MESSAGE) ; hs.writeFile(name, getTime(), 0); frame.dispose(); Driver getMenu = new Driver(); getMenu.MainMenu(); } timeDisplayButton.setText(String.valueOf(getTime())); increaseTime(); } }); time.start(); } movesButton.setText("Moves: " + getMoves()); } }
f9ea90de29f95eeece230f237f875d9cc58cd10c
7e1b1b0cee00c321ee8852ea788ecebce68b53c7
/DiamonShop/src/main/java/DiamonShop/Controller/User/CartController.java
519234ca7d6a318d6cc6acbd9ff7465569c03ede
[]
no_license
tungLC99999/tung81098
e34a8cb97637e8e28887eb0c90a7b60630c1e324
2d6c48f78b9c04bdc44ff42dbb95831afe695b42
refs/heads/master
2022-11-29T16:22:21.048769
2020-08-12T06:23:17
2020-08-12T06:23:17
286,931,833
0
0
null
null
null
null
UTF-8
Java
false
false
4,644
java
package DiamonShop.Controller.User; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import DiamonShop.Dto.CartDto; import DiamonShop.Entity.Bills; import DiamonShop.Entity.Users; import DiamonShop.Service.User.BillsServiceImpl; import DiamonShop.Service.User.CartServiceImpl; @Controller public class CartController extends BaseController { @Autowired private CartServiceImpl cartService = new CartServiceImpl(); @Autowired private BillsServiceImpl billsService = new BillsServiceImpl(); @RequestMapping(value = "gio-hang") public ModelAndView Index() { _mvShare.addObject("slides", _homeService.GetDataSlide()); _mvShare.addObject("categorys", _homeService.GetDataCategorys()); _mvShare.addObject("products", _homeService.GetDataProducts()); _mvShare.setViewName("user/cart/list_cart"); return _mvShare; } @RequestMapping(value = "AddCart/{id}") public String AddCart(HttpServletRequest request, HttpSession session, @PathVariable long id) { HashMap<Long, CartDto> cart = (HashMap<Long, CartDto>) session.getAttribute("Cart"); if (cart == null) { cart = new HashMap<Long, CartDto>(); } cartService.AddCart(id, cart); session.setAttribute("Cart", cart); session.setAttribute("TotalQuantyCart", cartService.TotalQuanty(cart)); session.setAttribute("TotalPriceCart", cartService.TotalPrice(cart)); return "redirect:" + request.getHeader("Referer"); } @RequestMapping(value = "EditCart/{id}/{quanty}") public String EditCart(HttpServletRequest request, HttpSession session, @PathVariable long id,@PathVariable int quanty) { HashMap<Long, CartDto> cart = (HashMap<Long, CartDto>) session.getAttribute("Cart"); if (cart == null) { cart = new HashMap<Long, CartDto>(); } cartService.EditCart(id,quanty, cart); session.setAttribute("Cart", cart); session.setAttribute("TotalQuantyCart", cartService.TotalQuanty(cart)); session.setAttribute("TotalPriceCart", cartService.TotalPrice(cart)); return "redirect:" + request.getHeader("Referer"); } @RequestMapping(value = "DeleteCart/{id}") public String DeleteCart(HttpServletRequest request, HttpSession session, @PathVariable long id) { HashMap<Long, CartDto> cart = (HashMap<Long, CartDto>) session.getAttribute("Cart"); if (cart == null) { cart = new HashMap<Long, CartDto>(); } cartService.DeleteCart(id, cart); session.setAttribute("Cart", cart); session.setAttribute("TotalQuantyCart", cartService.TotalQuanty(cart)); session.setAttribute("TotalPriceCart", cartService.TotalPrice(cart)); return "redirect:" + request.getHeader("Referer"); } @RequestMapping(value = "checkout",method = RequestMethod.GET) public ModelAndView CheckOut(HttpServletRequest request, HttpSession session) { _mvShare.setViewName("user/bills/checkout"); Bills bills = new Bills(); Users loginInfo = (Users)session.getAttribute("LoginInfo"); if(loginInfo != null) { bills.setAddress(loginInfo.getAddress()); bills.setDisplay_name(loginInfo.getDisplay_name()); bills.setUsername(loginInfo.getUsername()); } _mvShare.addObject("bills",bills); return _mvShare; } @RequestMapping(value = "checkout",method = RequestMethod.POST) public String CheckOutBill(HttpServletRequest request, HttpSession session,@ModelAttribute("bills") Bills bill) { if(billsService.AddBills(bill)>0) { HashMap<Long, CartDto> carts = (HashMap<Long, CartDto>)session.getAttribute("Cart"); billsService.AddBillsDetail(carts); } session.removeAttribute("Cart"); return "redirect:gio-hang"; } // @RequestMapping(value = "checkout",method = RequestMethod.POST) // public String CheckOutBill(HttpServletRequest request, HttpSession session,@ModelAttribute("bills") Bills bill) { // // bill.setQuanty(Integer.parseInt((String) session.getAttribute("TotalPriceCart"))); // bill.setTotal(Double.parseDouble( (String) session.getAttribute("TotalQuantyCart"))); // if(billsService.AddBills(bill)>0) { // HashMap<Long, CartDto> carts = (HashMap<Long, CartDto>)session.getAttribute("Cart"); // billsService.AddBillsDetail(carts); // } // session.removeAttribute("Cart"); // return "redirect:gio-hang"; // } }
0267d9bb776ea5b8136e1532c3d80d467839f2dc
fd6009760f0844654d9895a490d0cdfcd15b37ca
/src/Movable.java
f16ff545b6c663a8cd82aec6bd2b6dbfb8043fff
[]
no_license
rlauswmd/pa8-60171631-kimhyeonjung
bb892ca0ee2d86168b4ef6042ab72acddb617ad3
ac9152b77c540b4b268265911d50c6a4b49bac71
refs/heads/master
2021-08-23T15:59:05.014702
2017-12-05T14:55:08
2017-12-05T14:55:08
113,193,593
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
interface Movable { void move(double dx, double dy); }
9dd440eec3bd9f6e415055562066280bf8c93ac4
94c338a26b03c07ea852e0b9d40390a001a8a04d
/Native/Android/LunarConsole/lunarConsole/src/main/java/spacemadness/com/lunarconsole/json/Rename.java
12402bc0e92b4cd6d55aa16013e2deeabd2d459d
[ "Apache-2.0" ]
permissive
shackerlong/lunar-unity-console
75e34b3355cdcbff665ccb300af3283694a5c135
db209eddcb9274515a76b85a1b50d2c613345be9
refs/heads/master
2022-11-28T10:30:30.295375
2020-07-29T04:08:29
2020-07-29T04:08:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
// // Rename.java // // Lunar Unity Mobile Console // https://github.com/SpaceMadness/lunar-unity-console // // Copyright 2015-2020 Alex Lementuev, SpaceMadness. // // 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 spacemadness.com.lunarconsole.json; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Rename { String value(); }
a8569537e41a9302dd73cc3f6f498207a47341fb
3f18d1355371c74395eaa60af70b5ecfad7fa7a8
/src/main/java/com/icook/_00_init/config/RootAppConfig.java
2e73067d14b4133179391854ed640917d60b6e04
[]
no_license
myjava0221/icookProject
124a6301d430405428dc504495ac6008be462cb2
6b7400d793895cf1e1d36b40e79790316bdddb31
refs/heads/master
2022-12-29T10:21:58.146916
2020-04-05T13:33:21
2020-04-05T13:33:21
253,236,188
0
0
null
2022-12-16T15:06:41
2020-04-05T13:02:27
Java
UTF-8
Java
false
false
3,277
java
package com.icook._00_init.config; import java.beans.PropertyVetoException; import java.util.Properties; import javax.sql.DataSource; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; import com.mchange.v2.c3p0.ComboPooledDataSource; @Configuration @EnableTransactionManagement @ComponentScan(basePackages = "com.websystique.spring") public class RootAppConfig { @Bean//gmail驗證碼 public JavaMailSender getMailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); // Using gmail mailSender.setHost("smtp.gmail.com"); mailSender.setPort(587); mailSender.setUsername("[email protected]"); mailSender.setPassword("Aoqoghteeuosdbdw"); // mailSender.setPassword("homeoaxejcrcrpbv"); Properties javaMailProperties = new Properties(); javaMailProperties.put("mail.smtp.ssl.trust", "*"); javaMailProperties.put("mail.smtp.starttls.enable", "true"); javaMailProperties.put("mail.smtp.auth", "true"); javaMailProperties.put("mail.transport.protocol", "smtp"); javaMailProperties.put("mail.debug", "true");// Prints out everything on screen mailSender.setJavaMailProperties(javaMailProperties); return mailSender; } @Bean public DataSource dataSource() { ComboPooledDataSource ds = new ComboPooledDataSource(); ds.setUser("sa"); ds.setPassword("passw0rd"); try { ds.setDriverClass("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (PropertyVetoException e) { e.printStackTrace(); } ds.setJdbcUrl("jdbc:sqlserver://localhost:1433;databaseName=icook"); ds.setInitialPoolSize(4); ds.setMaxPoolSize(8); return ds; } @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean factory = new LocalSessionFactoryBean(); factory.setDataSource(dataSource()); factory.setPackagesToScan(new String[] {"com.icook.model"}); factory.setHibernateProperties(additionalProperties()); return factory; } @Bean(name="transactionManager") @Autowired public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) { HibernateTransactionManager txManager = new HibernateTransactionManager(); txManager.setSessionFactory(sessionFactory); return txManager; } private Properties additionalProperties() { Properties properties = new Properties(); properties.put("hibernate.dialect", org.hibernate.dialect.SQLServer2012Dialect.class); properties.put("hibernate.show_sql", Boolean.FALSE); properties.put("hibernate.format_sql", Boolean.TRUE); properties.put("default_batch_fetch_size", 10); properties.put("hiberante.hbm2ddl.auto", "update"); return properties; } }
b4e42e946630f9b2a9a38d0aa399b4014b4cf85d
8980b023c9ee407190c60017a6600ae8d7f50d30
/core-app/src/main/java/com/revature/data/impl/CategoryDAOImpl.java
5760737c648edd32cd248d2d57be86b102ce4a1d
[]
no_license
BhuvaneswariMohan/top-results
5312157a6b5c0394c3d8c6dd914744a279d3ab55
39ccaa9d17071852fcaadb77496eaf204f3b5659
refs/heads/master
2021-01-18T22:58:18.492698
2017-04-03T14:07:05
2017-04-03T14:07:05
87,080,975
0
0
null
null
null
null
UTF-8
Java
false
false
1,437
java
package com.revature.data.impl; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.revature.data.CategoryDAO; import com.revature.data.access.DataRetriver; import com.revature.data.access.exception.DataAccessException; import com.revature.data.exception.DataServiceException; import com.revature.data.utils.DataUtils; import com.revature.model.Category; @Repository public class CategoryDAOImpl implements CategoryDAO { private static Logger logger = Logger.getLogger(CategoryDAOImpl.class); @Autowired private DataRetriver dataRetriver; public DataRetriver getDataRetriver() { return dataRetriver; } public void setDataRetriver(DataRetriver dataRetriver) { this.dataRetriver = dataRetriver; } @Override public List<Category> getAllCategories() throws DataServiceException { List<Category> categories = null; try { StringBuilder sb = new StringBuilder("SELECT ID,NAME FROM categories"); categories = dataRetriver.retrieveBySQL(sb.toString()); logger.info("Categories data retrieval success.."); } catch (DataAccessException e) { logger.error(e.getMessage(), e); throw new DataServiceException(DataUtils.getPropertyMessage("data_retrieval_fail"), e); } return categories; } }
b9ef4f70f00b38b8a91b4e0f61c4b3365dec4a9e
44944a88428eaf3051e8bd731edc63fe84ba8603
/src/com/automation/ui/base/common/core/annotations/Execute.java
1013b23b9a6b1d1457829c2cf2b3a9dbb6ed2ea5
[]
no_license
cloudties/Automation
00cee965d4be0a8d4d6bfc4eabedc5661b1f00fe
94928ce2b4765fbe345b932f06bbed2f68a963a0
refs/heads/master
2023-02-07T07:27:55.872549
2023-01-31T03:42:00
2023-01-31T03:42:00
170,799,698
0
2
null
2022-12-14T20:37:05
2019-02-15T04:02:31
Java
UTF-8
Java
false
false
670
java
package com.automation.ui.base.common.core.annotations; import com.automation.ui.base.common.auth.User; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(value = RetentionPolicy.RUNTIME) @Target(value = {ElementType.METHOD, ElementType.TYPE}) public @interface Execute { User asUser() default User.ANONYMOUS; String onSite() default ""; String disableFlash() default ""; String mockAds() default ""; String language() default ""; boolean trackingOptIn() default true; boolean trackingOptOut() default false; }
339e427baee4e5a11e6e3fb541c90d8e9c0f0e76
9f27226457124b74361f6813de9e3e127ce3b955
/src/DictionaryClient/src/client/Client.java
555bfcfa2811c0d5411cd469fdea0b296de36bdf
[]
no_license
ruofzhang/COMP90015-Multi-threaded-Dictionary-Server
102eb24763aa558a35d758d6b85041ee4d502402
82eb05e3da5a430092dac45752fe4a852195bb34
refs/heads/master
2022-11-12T08:00:54.602751
2020-07-02T10:43:19
2020-07-02T10:43:19
276,618,297
0
0
null
null
null
null
UTF-8
Java
false
false
1,352
java
package client; import gui.SelectFrame; import gui.WrongPortFrame; import service.ServiceResultEnum; import java.io.*; import java.net.Socket; /** * @name Ruofan * @surname Zhang * @studentID 1029050 */ public class Client { private static String host; private static int port; public Client() { } public String connectServer(String command, String message) { String response = ServiceResultEnum.TIME_OUT.getResult(); try { Socket request = new Socket(host, port); DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(request.getOutputStream())); DataInputStream dis = new DataInputStream(new BufferedInputStream(request.getInputStream())); dos.writeUTF(command + "," + message); dos.flush(); response = dis.readUTF(); System.out.println("Server response:" + response); request.close(); }catch (IOException e) { e.printStackTrace(); } return response; } public static void main(String[] args) { host = args[0]; try{ port = Integer.parseInt(args[1]); new SelectFrame(); }catch(NumberFormatException e){ new WrongPortFrame(ServiceResultEnum.ILLEGAL_PORT.getResult()); } } }
65d505719571a9e701133938efa3d69d2fa99abd
cbe0e4f69b13fdd2c1555dd71ad2708d2abf4470
/app/src/androidTest/java/android/com/pulltorefreshexample/ApplicationTest.java
f634f65adf901aa0dbe31690c3184434aa67f7a2
[]
no_license
pawankumarbaranwal/PullToRefreshExample
c65b4457b4fd8b7d4d26578130d0a99b98a6e7c6
06ff01df670a48101af01c8db31a9dbf9aef6cdf
refs/heads/master
2021-01-18T13:54:18.481170
2015-08-22T20:00:07
2015-08-22T20:00:07
41,222,405
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package android.com.pulltorefreshexample; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
2339917bb8c25a6d0e0bfa7a99c2592c2d706f58
83c5f04bb516305947dcfee4df9d78934a52b924
/com/tree/BinaryTree.java
7611db20044065c5b0f38ed550b79acb941d054f
[]
no_license
gitScald/Java-Tree-Design
3476fb89e66ae8bd6e6b25be95cd2500df6ad2a4
fb7b94980c3e80a61d1f9482b74494c8e44a0604
refs/heads/master
2020-09-14T05:46:33.691013
2017-06-15T18:50:27
2017-06-15T18:50:27
94,469,204
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package com.tree; /** * Abstract, flexible binary tree ADT for solving both the Huffman coding tree * and the tree selection problems. * @author Benjamin Vial (29590765) * @param <T> Node contents */ public interface BinaryTree<T> { /** * Binary tree Node interface. * @param <T> Node contents */ public interface BinaryNode<T> { } /** * Searches through the tree for a specified value, returning the Node * containing the value. * @param v The value to search for * @return The Node containing the value */ public BinaryNode<T> find(T v); /** * Checks whether the tree is empty (i.e., its root is null). * @return {@code true} if the tree is empty, {@code false} otherwise */ public boolean isEmpty(); }
d163e86bddd3f50f3b7d6364427bc3ab2a06a30e
0627853f21d57fd3a8040218f78a96c8086dacf9
/app/src/main/java/com/xiaoying/bocool/widget/LoadingView.java
ca5664fcd233f6e913e450e414c59e310ce83acf
[]
no_license
joyhooei/BoCool
262f9d3a2a95d2fe2c279a4f69503c3ed99bdf3b
711dcebf47a687a83551613d7209b7134699be56
refs/heads/master
2020-03-30T06:18:35.815333
2016-11-15T04:31:27
2016-11-15T04:31:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,703
java
/* * Copyright (C) 2015. The BoCool Project. * * [email protected] * * 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.xiaoying.bocool.widget; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import com.xiaoying.bocool.R; /** * 加载提示控件 * Created by XIAOYING on 2015/6/7. */ public class LoadingView extends LinearLayout { private ProgressBar mPbProgress; private TextView mTvMessage; public LoadingView(Context context) { super(context); initView(context); } public LoadingView(Context context, AttributeSet attrs) { super(context, attrs); initView(context); } public LoadingView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initView(context); } public void setOnClickListener(View.OnClickListener l) { this.setOnClickListener(l); } public void setMessage(CharSequence text) { this.mTvMessage.setText(text); } public void setMessage(int resId) { this.mTvMessage.setText(resId); } public void setProgressVisibility(int visibility) { mPbProgress.setVisibility(visibility); } /** * 显示 * @param msg */ public void show(CharSequence msg) { mTvMessage.setText(msg); this.setVisibility(View.VISIBLE); } /** * 显示 * @param resid */ public void show(int resid) { mTvMessage.setText(resid); this.setVisibility(View.VISIBLE); } /** * 显示 */ public void show() { this.setVisibility(View.VISIBLE); } /** * 隐藏 */ public void dismiss() { this.setVisibility(View.GONE); } private void initView(Context context) { View.inflate(context, R.layout.layout_loading_view, this); mPbProgress = (ProgressBar) findViewById(R.id.pb_loading_progress); mTvMessage = (TextView) findViewById(R.id.tv_loading_msg); } }
92b82710ebee25355c59355b65e6686e83f3d54c
334a3886a9e0a0a211aeb9b25cf6eaecbb663128
/ProyectoFInalWeb/src/main/java/co/edu/icesi/banco/dao/TransferenciasDAO.java
ff44286bc30ed87eeea30a54da8b44795ed48182
[]
no_license
ana216/computacion
c55007d63442fe7d714f72260fe9328a20695b61
e1d392c250affb6476f674ac606438397821c23a
refs/heads/master
2020-03-18T05:49:37.490211
2018-05-31T20:27:22
2018-05-31T20:27:22
134,363,717
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package co.edu.icesi.banco.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; import co.edu.icesi.banco.modelo.Transferencias; @Repository @Scope("singleton") public class TransferenciasDAO implements ITransferenciasDAO { @PersistenceContext private EntityManager entitymanager; @Override public void save(Transferencias entity) { entitymanager.persist(entity); } @Override public void update(Transferencias entity) { entitymanager.merge(entity); } @Override public void delete(Transferencias entity) { entitymanager.remove(entity); } @Override public Transferencias findById(Long transId) { return entitymanager.find(Transferencias.class, transId); } @Override public List<Transferencias> findAll() { String jpql="Select tran from Transferencias tran"; return entitymanager.createQuery(jpql).getResultList(); } }
[ "ana@ana" ]
ana@ana
f7a82483deed06450cdb0d40d2c95a69c1be8051
f5afb5b12d162149d6b2723d4d0c3c52b1490e65
/Erpoge Server/src/erpoge/core/BodyPartType.java
f9436abac03889875398c163252dc01bf247976d
[]
no_license
Cookson/Ten-Thousand-Journeys
f6195c0acdab06a8641fbd045e2219f5872edd57
18c6bf94e37f01e0c4fc8e5e96bccf72f4a1a13d
refs/heads/master
2021-01-13T02:23:56.829317
2013-01-16T09:38:03
2013-01-16T09:38:03
2,905,119
1
0
null
null
null
null
UTF-8
Java
false
false
1,985
java
package erpoge.core; enum BodyPartType { HEAD(1), TORSO(2), HAND(3), GRIP(4), LEG(5), ARM(6), EAR(7), FOOT(8), FINGER(9), NECK(10), TENTACLE(11), TAIL(12), EYE(13), MOUTH(14), NOSE(15), TEETH(16), TONGUE(17); /** * An exclusive identivication number which is equal in client and server * used to identify a type of body part (but int a particular body part * af a particular character!). */ final int id; BodyPartType(int id) { this.id = id; } public static BodyPartType string2BodyPart(String value) { if (value.equals("head")) { return BodyPartType.HEAD; } else if (value.equals("torso")) { return BodyPartType.TORSO; } else if (value.equals("hand")) { return BodyPartType.HAND; } else if (value.equals("grip")) { return BodyPartType.GRIP; } else if (value.equals("leg")) { return BodyPartType.LEG; } else if (value.equals("arm")) { return BodyPartType.ARM; } else if (value.equals("ear")) { return BodyPartType.EAR; } else if (value.equals("foot")) { return BodyPartType.FOOT; } else if (value.equals("finger")) { return BodyPartType.FINGER; } else if (value.equals("neck")) { return BodyPartType.NECK; } else if (value.equals("tentacle")) { return BodyPartType.TENTACLE; } else if (value.equals("tail")) { return BodyPartType.TAIL; } else if (value.equals("eye")) { return BodyPartType.EYE; } else if (value.equals("mouth")) { return BodyPartType.MOUTH; } else if (value.equals("nose")) { return BodyPartType.NOSE; } else if (value.equals("teeth")) { return BodyPartType.TEETH; } else if (value.equals("tongue")) { return BodyPartType.TONGUE; } else { throw new Error("Wrong body part name `"+value+"`"); } } public String toString() { return super.toString().toLowerCase(); } /** * Returns an id of this body part type. * * @return */ public int getId() { return id; } /** * Gets body tree from XML description of that tree. */ }
[ "suseika@leika.(none)" ]
suseika@leika.(none)
1704c88fce37138c2daabae1aa5b4f820da859c6
a15ff4e0dcf2b99700901dfab0ae4ffa9de8a300
/src/cn/liutils/core/client/render/RenderBullet.java
fda5159791af8483eb66ef00443f71c730b51c4d
[]
no_license
laxcat5/LIUtils
7a1b10b47a29128643b526a3cbd00f21f4df3596
c0afb80593d9c6741206afdbaf3f434f0c8a6f04
refs/heads/master
2021-01-15T12:48:57.655513
2014-08-27T04:39:08
2014-08-27T04:39:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,016
java
/** * Copyright (c) Lambda Innovation Team, 2013 * 版权许可:LambdaCraft 制作小组, 2013. * http://lambdacraft.cn/ * * The mod is open-source. It is distributed under the terms of the * Lambda Innovation Open Source License. It grants rights to read, modify, compile * or run the code. It does *NOT* grant the right to redistribute this software * or its modifications in any form, binary or source, except if expressively * granted by the copyright holder. * * 本Mod是完全开源的,你允许参考、使用、引用其中的任何代码段,但不允许将其用于商业用途,在引用的时候,必须注明原作者。 */ package cn.liutils.core.client.render; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import org.lwjgl.opengl.GL11; import cn.liutils.api.client.util.RenderUtils; import cn.liutils.api.entity.EntityBullet; import cn.liutils.api.util.Motion3D; /** * @author WeAthFolD * */ public class RenderBullet extends Render { protected double LENGTH; protected double HEIGHT; protected String TEXTURE_PATH; protected boolean renderTexture = true; protected float colorR, colorG, colorB; protected boolean ignoreLight = false; public RenderBullet(double l, double h, String texturePath) { LENGTH = l; HEIGHT = h; TEXTURE_PATH = texturePath; } public RenderBullet(double l, double h, float a, float b, float c) { LENGTH = l; HEIGHT = h; setColor3f(a, b, c); } public RenderBullet setColor3f(float a, float b, float c) { renderTexture = false; colorR = a; colorG = b; colorB = c; return this; } public RenderBullet setIgnoreLight(boolean b) { ignoreLight = b; return this; } @Override public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) { Motion3D motion = new Motion3D(entity); Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); Vec3 v1 = newV3(0, HEIGHT, 0), v2 = newV3(0, -HEIGHT, 0), v3 = newV3( LENGTH, -HEIGHT, 0), v4 = newV3(LENGTH, HEIGHT, 0), v5 = newV3(0, 0, -HEIGHT), v6 = newV3(0, 0, HEIGHT), v7 = newV3(LENGTH, 0, HEIGHT), v8 = newV3(LENGTH, 0, -HEIGHT); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if(renderTexture) RenderUtils.loadTexture(TEXTURE_PATH); else { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(colorR, colorG, colorB); } if(ignoreLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glRotatef(270.0F - entity.rotationYaw, 0.0F, -1.0F, 0.0F); // 左右旋转 GL11.glRotatef(entity.rotationPitch, 0.0F, 0.0F, -1.0F); // 上下旋转 if(entity instanceof EntityBullet) { if(((EntityBullet)entity).renderFromLeft) { GL11.glTranslatef(0.0F, 0.0F, 0.3F); } } if(ignoreLight) OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); tessellator.startDrawingQuads(); if(ignoreLight) tessellator.setBrightness(15728880); RenderUtils.addVertex(v1, 0, 1); RenderUtils.addVertex(v2, 1, 1); RenderUtils.addVertex(v3, 1, 0); RenderUtils.addVertex(v4, 0, 0); RenderUtils.addVertex(v5, 0, 1); RenderUtils.addVertex(v6, 1, 1); RenderUtils.addVertex(v7, 1, 0); RenderUtils.addVertex(v8, 0, 0); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } public static Vec3 newV3(double x, double y, double z) { return Vec3.createVectorHelper(x, y, z); } @Override protected ResourceLocation getEntityTexture(Entity entity) { // TODO 自动生成的方法存根 return null; } }
20d78b0639632284e7a8d9af8f94363f9290b88e
ec5d615c624a104cb8809516ded91972a64bd505
/136.Single Number/java_solution.java
ac3c675ed1cea8e0371ffa22cfed6025f742f7d2
[]
no_license
Yeening/LeetCode
822a7a08e402dbb00d570fee3cdb4309045f1f17
d585eb6792085babcddca1bad7f9ac29ee249f57
refs/heads/master
2021-12-21T15:30:00.586741
2021-11-29T21:16:20
2021-11-29T21:16:20
126,449,003
1
1
null
null
null
null
UTF-8
Java
false
false
585
java
class Solution { //Solution1 hash table // public int singleNumber(int[] nums) { // Map<Integer, Integer> hash = new HashMap<> (); // for(int i = 0; i < nums.length; i++){ // if(hash.containsKey(nums[i])) hash.remove(nums[i]); // else hash.put(nums[i], i); // } // return hash.keySet().iterator().next(); // } ///solution2, using xor public int singleNumber(int[] nums) { int res = 0; for(int i = 0; i < nums.length; i++){ res ^= nums[i]; } return res; } }
0c895b00e8521b113d0841b7d127db6a5191faa8
dfea0fc8b598875b8b465ef2c0f6eb9e9b504252
/src/logic/exceptions/ActionException.java
cabc385f723b65d5a064efd192a8eb5db6434d78
[]
no_license
cs2103aug2015-w11-3j/main
41449515406d3c6110e18b421162bb8d1892bbcd
eaa0ea62ad91872567aec48c995bc2c22589f7b3
refs/heads/master
2016-09-07T19:04:35.584749
2015-12-09T12:44:29
2015-12-09T12:44:29
41,022,227
5
2
null
null
null
null
UTF-8
Java
false
false
248
java
//@@author A0125546E package logic.exceptions; public class ActionException extends LogicException { private static final long serialVersionUID = 663428951026655012L; public ActionException(String msg) { super(msg); } }
3a30f264e10a644ab7923617aff6bacee2d2696f
844adf1c3e4928626725637e1304f1f244e61e65
/app/src/main/java/com/programmer/jgallos/ma_i/SubjectRecords.java
cd879ad14153c3fafa3bf009c2a59ade2b4e4439
[]
no_license
jgallos/TILT-ACCT-MA-I
9befe1a5a24574f9bf132c9d55ea967701912019
2131c89c8fc2a44e83129793ce8fa991fbe78c48
refs/heads/master
2020-04-21T11:22:16.980142
2019-05-15T13:51:35
2019-05-15T13:51:35
169,522,758
2
0
null
null
null
null
UTF-8
Java
false
false
561
java
/* TILT-ACCT - Transparency in Learning and Teaching through Android and Cloud Computing Technologies Programmer: Joseph M. Gallos Date: May 2019 Software License: GNU-General Public License */ package com.programmer.jgallos.ma_i; public class SubjectRecords { private String subject; public SubjectRecords(String subject) { this.subject = subject; } public SubjectRecords() { } public void setSubject(String subject) { this.subject=subject; } public String getSubject() { return subject; } }
8caac71854abae58f0d5c3dda3bcd072fada3d6c
918242555693fdd68b19dcb626162f74c4a780d9
/FactorialRecursion/src/Factorial.java
add5af02ce51b3fcb0a6cefed28545b66deac49f
[]
no_license
praveenk0705/JavaDS
10e6fda91a2b4c02bd3e0d9cbecad3a646eef865
e3d28d6d11b61c53c5392acd9b23280496469bc8
refs/heads/master
2021-01-20T06:17:41.052214
2017-08-26T17:03:34
2017-08-26T17:03:34
101,500,202
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
public class Factorial { public static void main(String[] args) { int i = 5; System.out.println(factorial(i)); } private static int factorial(int i) { if (i == 0 ) return 1; return i*factorial(i-1); } }
ae95ca0ba7ee1ef41243db6a5178fab254379cbc
b5f910918f36dc399e2eaa745e43d5b04ad9ec41
/fabric-1.17.1/src/main/java/org/dynmap/fabric_1_17_1/VersionCheck.java
f6b1370018cd4777ea81c1207f2ec5c52662276d
[ "Apache-2.0" ]
permissive
webbukkit/dynmap
ba2c8b04cc52c5b07f68f161717b2fabfff7b310
eed1a2b4440c5ef7f9e45f351c631bf4e573f552
refs/heads/v3.0
2023-08-31T17:57:45.191734
2023-08-30T15:59:46
2023-08-30T15:59:46
1,201,104
1,897
671
Apache-2.0
2023-09-14T00:54:20
2010-12-27T18:47:24
Java
UTF-8
Java
false
false
3,902
java
package org.dynmap.fabric_1_17_1; import org.dynmap.DynmapCore; import org.dynmap.Log; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class VersionCheck { private static final String VERSION_URL = "http://mikeprimm.com/dynmap/releases.php"; public static void runCheck(final DynmapCore core) { new Thread(new Runnable() { public void run() { doCheck(core); } }).start(); } private static int getReleaseVersion(String s) { int index = s.lastIndexOf('-'); if (index < 0) index = s.lastIndexOf('.'); if (index >= 0) s = s.substring(0, index); String[] split = s.split("\\."); int v = 0; try { for (int i = 0; (i < split.length) && (i < 3); i++) { v += Integer.parseInt(split[i]) << (8 * (2 - i)); } } catch (NumberFormatException nfx) { } return v; } private static int getBuildNumber(String s) { int index = s.lastIndexOf('-'); if (index < 0) index = s.lastIndexOf('.'); if (index >= 0) s = s.substring(index + 1); try { return Integer.parseInt(s); } catch (NumberFormatException nfx) { return 99999999; } } private static void doCheck(DynmapCore core) { String pluginver = core.getDynmapPluginVersion(); String platform = core.getDynmapPluginPlatform(); String platver = core.getDynmapPluginPlatformVersion(); if ((pluginver == null) || (platform == null) || (platver == null)) return; HttpURLConnection conn = null; String loc = VERSION_URL; int cur_ver = getReleaseVersion(pluginver); int cur_bn = getBuildNumber(pluginver); try { while ((loc != null) && (!loc.isEmpty())) { URL url = new URL(loc); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", "Dynmap (" + platform + "/" + platver + "/" + pluginver); conn.connect(); loc = conn.getHeaderField("Location"); } BufferedReader rdr = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = null; while ((line = rdr.readLine()) != null) { String[] split = line.split(":"); if (split.length < 4) continue; /* If our platform and version, or wildcard platform version */ if (split[0].equals(platform) && (split[1].equals("*") || split[1].equals(platver))) { int recommended_ver = getReleaseVersion(split[2]); int recommended_bn = getBuildNumber(split[2]); if ((recommended_ver > cur_ver) || ((recommended_ver == cur_ver) && (recommended_bn > cur_bn))) { /* Newer recommended build */ Log.info("Version obsolete: new recommended version " + split[2] + " is available."); } else if (cur_ver > recommended_ver) { /* Running dev or prerelease? */ int prerel_ver = getReleaseVersion(split[3]); int prerel_bn = getBuildNumber(split[3]); if ((prerel_ver > cur_ver) || ((prerel_ver == cur_ver) && (prerel_bn > cur_bn))) { Log.info("Version obsolete: new prerelease version " + split[3] + " is available."); } } } } } catch (Exception x) { Log.info("Error checking for latest version"); } finally { if (conn != null) { conn.disconnect(); } } } }
036ae019b06c12b27ee84813aee68ea9ee77c020
61602d4b976db2084059453edeafe63865f96ec5
/com/xunlei/downloadprovider/homepage/choiceness/ui/items/aj.java
fa0294366ab7acdc2cb30680e91467f47b557a91
[]
no_license
ZoranLi/thunder
9d18fd0a0ec0a5bb3b3f920f9413c1ace2beb4d0
0778679ef03ba1103b1d9d9a626c8449b19be14b
refs/heads/master
2020-03-20T23:29:27.131636
2018-06-19T06:43:26
2018-06-19T06:43:26
137,848,886
12
1
null
null
null
null
UTF-8
Java
false
false
787
java
package com.xunlei.downloadprovider.homepage.choiceness.ui.items; import com.xunlei.downloadprovider.homepage.follow.aa; import java.util.List; /* compiled from: ChoicenessRecommendUserView */ final class aj implements aa { final /* synthetic */ b a; aj(b bVar) { this.a = bVar; } public final void a(boolean z, List<String> list) { if (this.a.e != null) { if (this.a.e.c != null) { String uid = this.a.e.c.getUid(); if (!(list == null || list.isEmpty() || list.contains(uid) == null)) { if (z) { this.a.a((boolean) null); return; } this.a.a(true); } } } } }
15f44244b05860d490f94bdfb5a20bf95eb2ab64
9933ddfaf4e217c7a1f7c1fe4d989ae01002551a
/tokocat73rev2(Update)/src/UI/Master_MutasiBarangAntarGudangBerdasarkanPermintaan.java
36121401fd6fd4927c474261afe028e2566b6900
[]
no_license
4izenvalt/ProjectPKLFix
76199f42759da0a8d39f37bd82c183ff5c18deec
b2fa2f5b9071d44e5c0aff4818940f6c85d8a6ba
refs/heads/master
2020-03-18T13:30:39.870750
2018-06-05T01:48:13
2018-06-05T01:48:13
134,788,255
0
0
null
null
null
null
UTF-8
Java
false
false
37,169
java
/* * 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. */ package UI; import javax.swing.JOptionPane; /** * * @author USER */ public class Master_MutasiBarangAntarGudangBerdasarkanPermintaan extends javax.swing.JFrame { /** * Creates new form Penjualan_penjualan */ public Master_MutasiBarangAntarGudangBerdasarkanPermintaan() { initComponents(); this.setLocationRelativeTo(null); } /** * 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() { jLabel14 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jSeparator2 = new javax.swing.JSeparator(); jLabel19 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jLabel26 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel22 = new javax.swing.JLabel(); jLabel32 = new javax.swing.JLabel(); jSeparator3 = new javax.swing.JSeparator(); jTextField8 = new javax.swing.JTextField(); jLabel34 = new javax.swing.JLabel(); jSeparator4 = new javax.swing.JSeparator(); jSeparator7 = new javax.swing.JSeparator(); jSeparator9 = new javax.swing.JSeparator(); jTextField14 = new javax.swing.JTextField(); jSeparator10 = new javax.swing.JSeparator(); jLabel27 = new javax.swing.JLabel(); jTextField16 = new javax.swing.JTextField(); jTextField17 = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jComboBox4 = new javax.swing.JComboBox<>(); jTextField21 = new javax.swing.JTextField(); jTextField22 = new javax.swing.JTextField(); setDefaultCloseOperation(DISPOSE_ON_CLOSE); jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel14.setForeground(new java.awt.Color(0, 0, 204)); jLabel14.setText("Tanggal"); jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel17.setForeground(new java.awt.Color(0, 0, 204)); jLabel17.setText("Lokasi Asal"); jScrollPane2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.white, java.awt.Color.white)); jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null} }, new String [] { "No", "Kode", "Barang", "Asal", "Satuan (1/2/3)", "Jumlah", "Tujuan" } )); jScrollPane2.setViewportView(jTable2); if (jTable2.getColumnModel().getColumnCount() > 0) { jTable2.getColumnModel().getColumn(0).setResizable(false); jTable2.getColumnModel().getColumn(1).setResizable(false); jTable2.getColumnModel().getColumn(2).setResizable(false); jTable2.getColumnModel().getColumn(3).setResizable(false); jTable2.getColumnModel().getColumn(4).setResizable(false); jTable2.getColumnModel().getColumn(5).setResizable(false); jTable2.getColumnModel().getColumn(6).setResizable(false); } jSeparator2.setForeground(new java.awt.Color(153, 153, 153)); jLabel19.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gambar/if_stock_save_20659.png"))); // NOI18N jLabel19.setText("F12 - Save"); jLabel20.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gambar/Clear-icon.png"))); // NOI18N jLabel20.setText("F9 - Clear"); jLabel21.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gambar/if_document_delete_61766.png"))); // NOI18N jLabel21.setText("F5-Delete"); jLabel21.addAncestorListener(new javax.swing.event.AncestorListener() { public void ancestorMoved(javax.swing.event.AncestorEvent evt) { } public void ancestorAdded(javax.swing.event.AncestorEvent evt) { jLabel21AncestorAdded(evt); } public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { } }); jLabel21.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel21MouseClicked(evt); } }); jLabel26.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gambar/cancel (3).png"))); // NOI18N jLabel26.setText("Esc - Exit"); jSeparator1.setForeground(new java.awt.Color(153, 153, 153)); jLabel22.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel22.setText("Kasir"); jLabel32.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel32.setText("Nama Kasir"); jSeparator3.setForeground(new java.awt.Color(153, 153, 153)); jTextField8.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField8MouseClicked(evt); } }); jLabel34.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel34.setText("Keterangan"); jSeparator4.setForeground(new java.awt.Color(153, 153, 153)); jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL); jSeparator7.setForeground(new java.awt.Color(153, 153, 153)); jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); jSeparator9.setForeground(new java.awt.Color(153, 153, 153)); jSeparator9.setOrientation(javax.swing.SwingConstants.VERTICAL); jTextField14.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField14ActionPerformed(evt); } }); jSeparator10.setForeground(new java.awt.Color(153, 153, 153)); jSeparator10.setOrientation(javax.swing.SwingConstants.VERTICAL); jLabel27.setBackground(new java.awt.Color(255, 153, 102)); jLabel27.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabel27.setText("Load Permintaan"); jLabel27.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel27.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel27MouseClicked(evt); } }); jTextField16.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField16.setEnabled(false); jTextField16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField16ActionPerformed(evt); } }); jTextField17.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField17.setEnabled(false); jTextField17.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField17ActionPerformed(evt); } }); jLabel18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel18.setForeground(new java.awt.Color(0, 0, 204)); jLabel18.setText("No.Permintaan"); jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel15.setForeground(new java.awt.Color(0, 0, 204)); jLabel15.setText("No.Bukti"); jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "TOKO", "PST", "GUD63", "TENGAH", "UTARA" })); jComboBox4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox4ActionPerformed(evt); } }); jTextField21.setBackground(new java.awt.Color(0, 0, 0)); jTextField21.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jTextField21.setForeground(new java.awt.Color(255, 204, 0)); jTextField21.setText("Jumlah Item"); jTextField21.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField21.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField21MouseClicked(evt); } }); jTextField21.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField21ActionPerformed(evt); } }); jTextField22.setBackground(new java.awt.Color(0, 0, 0)); jTextField22.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jTextField22.setForeground(new java.awt.Color(255, 204, 0)); jTextField22.setText("Jumlah Qty"); jTextField22.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.lightGray)); jTextField22.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField22MouseClicked(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 788, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator2) .addComponent(jSeparator1) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel19) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel20) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel21) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator9, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel26) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator10, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel27)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel34) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel17) .addGap(18, 18, 18)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel14) .addGap(32, 32, 32))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jTextField14) .addComponent(jComboBox4, 0, 152, Short.MAX_VALUE)) .addGap(26, 26, 26) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel18) .addGap(20, 20, 20) .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel22) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel32)) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(125, 125, 125)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel19) .addComponent(jLabel26) .addComponent(jLabel21) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel20) .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator9, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator10, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel27)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel14) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel15) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel18) .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel34)) .addGap(8, 8, 8) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 3, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel32, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(0, 0, 0) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField8MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField8MouseClicked private void jLabel21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel21MouseClicked }//GEN-LAST:event_jLabel21MouseClicked private void jLabel21AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jLabel21AncestorAdded // TODO add your handling code here: }//GEN-LAST:event_jLabel21AncestorAdded private void jTextField14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField14ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField14ActionPerformed private void jTextField16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField16ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField16ActionPerformed private void jTextField17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField17ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField17ActionPerformed private void jComboBox4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jComboBox4ActionPerformed private void jTextField21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField21MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField21MouseClicked private void jTextField21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField21ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField21ActionPerformed private void jTextField22MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField22MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField22MouseClicked private void jLabel27MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel27MouseClicked Master_Mutasi_PermintaanMutasiAntarGudang mmp=new Master_Mutasi_PermintaanMutasiAntarGudang(); mmp.setVisible(true); mmp.setFocusable(true); }//GEN-LAST:event_jLabel27MouseClicked /** * @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 ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Master_MutasiBarangAntarGudangBerdasarkanPermintaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Master_MutasiBarangAntarGudangBerdasarkanPermintaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Master_MutasiBarangAntarGudangBerdasarkanPermintaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Master_MutasiBarangAntarGudangBerdasarkanPermintaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Master_MutasiBarangAntarGudangBerdasarkanPermintaan().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox<String> jComboBox4; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel27; private javax.swing.JLabel jLabel32; private javax.swing.JLabel jLabel34; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator10; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator4; private javax.swing.JSeparator jSeparator7; private javax.swing.JSeparator jSeparator9; private javax.swing.JTable jTable2; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField17; private javax.swing.JTextField jTextField21; private javax.swing.JTextField jTextField22; private javax.swing.JTextField jTextField8; // End of variables declaration//GEN-END:variables }
b28b1dee46c140f80cab7ddf38eda8f761a0b08a
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/neo4j--neo4j/e50473ec0ff19786fae997c4f9b09bca368d5bae/after/Step.java
b0517b7563aea9a862da2375babd7682f9b5acee
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
3,327
java
/** * Copyright (c) 2002-2014 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.unsafe.impl.batchimport.staging; import org.neo4j.unsafe.impl.batchimport.stats.StepStats; /** * One step in {@link Stage}, where a {@link Stage} is a sequence of steps. Each step works on batches. * Batches are typically received from an upstream step, or produced in the step itself. If there are more steps * {@link #setDownstream(Step) downstream} then processed batches are passed down. Each step has maximum * "work-ahead" size where it awaits the downstream step to catch up if the queue size goes beyond that number. * * Batches are associated with a ticket, which is simply a long value incremented for each batch. * It's the first step that is responsible for generating these tickets, which will stay unchanged with * each batch all the way through the stage. Steps that have multiple threads processing batches can process * received batches in any order, but must make sure to send batches to its downstream * (i.e. calling {@link #receive(long, Object)} on its downstream step) ordered by ticket. * * @param <T> the type of batch objects received from upstream. */ public interface Step<T> { /** * @return name of this step. */ String name(); /** * Receives a batch from upstream, queues it for processing. * * @param ticket ticket associates with the batch. Tickets are generated by producing steps and must follow * each batch all the way through a stage. * @param batch the batch object to queue for processing. * @return how long it time (millis) was spent waiting for a spot in the queue. */ long receive( long ticket, T batch ); /** * @return statistics about this step at this point in time. */ StepStats stats(); /** * Called by upstream to let this step know that it will not send any more batches. */ void endOfUpstream(); /** * @return {@code true} if this step has received AND processed all batches from upstream, or in * the case of a producer, that this step has produced all batches. */ boolean isCompleted(); /** * Called by the {@link Stage} when setting up the stage. This will form a pipeline of steps, * making up the stage. * @param downstreamStep {@link Step} to send batches to downstream. */ void setDownstream( Step<?> downstreamStep ); /** * Receives a panic, asking to shut down as soon as possible. * @param cause cause for the panic. */ void receivePanic( Throwable cause ); }
b1c5d0ec42019ee594089c802397fa9f499e7050
1d38ce849f26c93b0f7b6faf3ed2a7169c1d52b3
/src/xtbg/main/java/com/chinacreator/xtbg/tjy/detectionsupplies/list/OsupplieTypeList.java
dacbc8dfbeb5bf2d37cfa5d4eae6228159146d57
[]
no_license
zhaoy1992/xtbg-whtjy-new
074f45e589be11d890ce301636f7585542680591
6d5cc068efd597ce8d20944dd7c88ff5aa525e40
refs/heads/master
2020-05-20T04:36:46.145223
2019-05-07T10:01:52
2019-05-07T10:01:52
185,377,218
0
2
null
null
null
null
UTF-8
Java
false
false
2,100
java
/** * [Product] * xtbg-tjy * [Copyright] * Copyright © 2014 ICSS All Rights Reserved. * [FileName] * OsupplieTypeList.java * [History] * Version Date Author Content * -------- --------- ---------- ------------------------ * 1.0.0 2014-2-17 Administrator 最初版本 */ package com.chinacreator.xtbg.tjy.detectionsupplies.list; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.chinacreator.xtbg.core.common.commonlist.DataInfoImpl; import com.chinacreator.xtbg.core.common.commonlist.PagingBean; import com.chinacreator.xtbg.core.common.startup.LoadSpringContext; import com.chinacreator.xtbg.tjy.detectionsupplies.dao.OsupplieTypeDao; import com.chinacreator.xtbg.tjy.detectionsupplies.dao.impl.OsupplieTypeDaoImpl; /** *<p>Title:OsupplieTypeList.java</p> *<p>Description:</p> *<p>Copyright:Copyright (c) 2013</p> *<p>Company:湖南科创</p> *@author 邱炼 *@version 1.0 *2014-2-17 */ public class OsupplieTypeList extends DataInfoImpl { private static final Log LOG=LogFactory.getLog(OsupplieTypeList.class); /** * * <b>Summary: </b> * 复写方法 getDataList * @param parmjson * @param sortName * @param sortOrder * @param offset * @param maxPagesize * @return * @see com.chinacreator.xtbg.core.common.commonlist.DataInfoImpl#getDataList(java.lang.String, java.lang.String, java.lang.String, long, int) */ public PagingBean getDataList(String parmjson, String sortName, String sortOrder, long offset, int maxPagesize) { PagingBean pb=new PagingBean(); OsupplieTypeDao osupplietypedao = new OsupplieTypeDaoImpl(); try { pb=osupplietypedao.selOsupplieTypeList(parmjson, sortName, sortOrder, offset, maxPagesize); } catch (Exception e) { LOG.error(e.getMessage(),e); } return pb; } @Override public PagingBean getDataList(String parmjson, String sortName, String sortOrder) { // TODO Auto-generated method stub return null; } }
[ "creator@creator" ]
creator@creator
015dc43b6d3d9fa6ba118daff2aebf56df617505
3407a5967e1f00974f629862a8fbc810eeb529f0
/src/main/java/com/zaishixiaoyao/crawlerbsbdj/entity/Comment.java
cdaf1c1f41c3005425cedfc9e95d737289db47d1
[]
no_license
zaishixiaoyao/crawler
98964b144b877ddae097dcb7bc2a5e8fc27578cb
be89a548e56335c6943ea49da3853f3c42c5bd79
refs/heads/master
2022-07-02T03:55:59.846938
2020-03-24T15:21:42
2020-03-24T15:21:42
249,213,402
1
0
null
2022-05-20T21:31:23
2020-03-22T15:31:58
TSQL
UTF-8
Java
false
false
973
java
package com.zaishixiaoyao.crawlerbsbdj.entity; public class Comment { private Long commentId; private Long uid; private String passtime; private Long contentId; private String commentText; public Long getCommentId() { return commentId; } public void setCommentId(Long commentId) { this.commentId = commentId; } public Long getUid() { return uid; } public void setUid(Long uid) { this.uid = uid; } public String getPasstime() { return passtime; } public void setPasstime(String passtime) { this.passtime = passtime; } public Long getContentId() { return contentId; } public void setContentId(Long contentId) { this.contentId = contentId; } public String getCommentText() { return commentText; } public void setCommentText(String commentText) { this.commentText = commentText; } }
836a91ebf3ea8fa336920e7aadea44363cb3eb8f
ac28a0ec91e06daaff60e16b99250dfd98be67c0
/src/main/java/application/controller/api/CartProductApiController.java
c4c6f42017bb55693a2a58017314b72791419ec4
[]
no_license
aduthpt/StoreHL
09617ed7239debc5eaa0e97356602147dd1a6c88
602b99d3ac2004c27df3896dae731b83845809a5
refs/heads/master
2020-06-30T14:16:36.531896
2019-08-06T13:11:57
2019-08-06T13:11:57
200,853,708
1
0
null
null
null
null
UTF-8
Java
false
false
4,045
java
package application.controller.api; import application.data.model.Cart; import application.data.model.CartProduct; import application.data.model.Product; import application.data.service.CartProductService; import application.data.service.CartService; import application.data.service.ProductService; import application.model.api.BaseApiResult; import application.model.dto.CartProductDTO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping(path = "/api/cart-product") public class CartProductApiController { private static final Logger logger = LogManager.getLogger(CategoryApiController.class); @Autowired private CartService cartService; @Autowired private CartProductService cartProductService; @Autowired private ProductService productService; @PostMapping("/add") public BaseApiResult addToCart(@RequestBody CartProductDTO dto) { BaseApiResult result = new BaseApiResult(); try { if(dto.getGuid() != null && dto.getAmount() > 0 && dto.getProductId() > 0) { Cart cartEntity = cartService.findFirstCartByGuid(dto.getGuid()); Product productEntity = productService.findOne(dto.getProductId()); if(cartEntity != null && productEntity != null) { CartProduct cartProductEntity = cartProductService.findFirstCartProductByCartIdAndProductId(cartEntity.getId(),productEntity.getId()); if(cartProductEntity != null) { cartProductEntity.setAmount(cartProductEntity.getAmount() + dto.getAmount()); cartProductService.updateCartProduct(cartProductEntity); } else { CartProduct cartProduct = new CartProduct(); cartProduct.setAmount(dto.getAmount()); cartProduct.setCart(cartEntity); cartProduct.setProduct(productEntity); cartProductService.addNewCartProduct(cartProduct); } result.setMessage("Add to cart successfully!"); result.setSuccess(true); return result; } } } catch (Exception e) { logger.error(e.getMessage()); } result.setMessage("Fail!"); result.setSuccess(false); return result; } @PostMapping("/update") public BaseApiResult updateCartProduct(@RequestBody CartProductDTO dto) { BaseApiResult result = new BaseApiResult(); try { if(dto.getId()>0 && dto.getAmount() > 0) { CartProduct cartProductEntity = cartProductService.findOne(dto.getId()); if(cartProductEntity != null) { cartProductEntity.setAmount(dto.getAmount()); cartProductService.updateCartProduct(cartProductEntity); result.setMessage("Update Cart Product success !"); result.setSuccess(true); return result; } } } catch (Exception e) { logger.error(e.getMessage()); } result.setMessage("Fail!"); result.setSuccess(false); return result; } @GetMapping("/delete/{cartProductId}") public BaseApiResult deleteCartProduct(@PathVariable int cartProductId) { BaseApiResult result = new BaseApiResult(); try { if(cartProductService.deleteCartProduct(cartProductId) == true) { result.setMessage("Delete success"); result.setSuccess(true); return result; } } catch (Exception e) { logger.error(e.getMessage()); } result.setSuccess(false); result.setMessage("Fail!"); return result; } }
d46aaba0c501af93c81d34f302b351e433937f2d
82a8f35c86c274cb23279314db60ab687d33a691
/duokan/reader/domain/bookshelf/gb.java
724c9861e9271bb85a32a0d218e406ed33209261
[]
no_license
QMSCount/DReader
42363f6187b907dedde81ab3b9991523cbf2786d
c1537eed7091e32a5e2e52c79360606f622684bc
refs/heads/master
2021-09-14T22:16:45.495176
2018-05-20T14:57:15
2018-05-20T14:57:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package com.duokan.reader.domain.bookshelf; import java.util.HashMap; class gb implements Runnable { final /* synthetic */ HashMap a; final /* synthetic */ ga b; gb(ga gaVar, HashMap hashMap) { this.b = gaVar; this.a = hashMap; } public void run() { if (this.b.b != null) { this.b.b.a(this.a); } } }
b01fc8aaef7fa66df67c27105de8d30d766aeaea
03bccc5b15e5376518e1e591e3fcb47e1d158e73
/IMDemo/src/com/zp/chat/fragment/MeFrag.java
859c810d5ecc0a9b0e183b6da96ea92dadd9b929
[]
no_license
bigbigpeng3/MyApp
0082881b4a837a5004dcadcb877ecd9a8537da06
3162657c51636ed0649417d55fe038e9b33187dc
refs/heads/master
2021-01-22T00:30:14.877856
2016-07-18T01:22:05
2016-07-18T01:22:05
46,348,233
0
1
null
null
null
null
UTF-8
Java
false
false
2,198
java
package com.zp.chat.fragment; import com.zp.chat.Connection; import com.zp.chat.R; import com.zp.chat.base.BaseFragment; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; public class MeFrag extends BaseFragment implements OnClickListener { // private TextView tvName; private TextView tvAccount; // private ImageView ivIcon; private View mAccountView; private View mSettingView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // dao = new AccountDao(getActivity()); // account = dao.getCurrentAccount(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fra_me, container, false); initView(view); initEvent(); return view; } private void initView(View view) { // mTopBar = (NormalTopBar) view.findViewById(R.id.me_top_bar); // tvName = (TextView) view.findViewById(R.id.me_tv_name); tvAccount = (TextView) view.findViewById(R.id.me_tv_account); if (!TextUtils.isEmpty(Connection.account)) { tvAccount.setText(Connection.account); } // ivIcon = (ImageView) view.findViewById(R.id.me_iv_icon); mAccountView = view.findViewById(R.id.me_item_account); mSettingView = view.findViewById(R.id.me_item_setting); // mTopBar.setBackVisibility(false); // mTopBar.setTitle("我"); } private void initEvent() { mAccountView.setOnClickListener(this); mSettingView.setOnClickListener(this); } @Override public void onClick(View v) { if (v == mAccountView) { clickAccount(); } else if (v == mSettingView) { clickSetting(); } } private void clickSetting() { // Intent intent = new Intent(getActivity(), SettingActivity.class); // startActivity(intent); } private void clickAccount() { // Intent intent = new Intent(getActivity(), // PersonalInfoActivity.class); // intent.putExtra(PersonalInfoActivity.KEY_INTENT, account); // startActivityForResult(intent, REQUEST_CODE_PERSONAL); } }
5162ddbc17d7f147e124951032d15e61ca46029f
1c9cef7c233b561a8b23b6684f8c9052abab1901
/DiferentTasks/src/main/java/lesson1/GeometricShapes/Main.java
f5d9d37216ce20aece319c25f612703811bc7344
[]
no_license
AJIuCa/DiferentTasks
f2baa0ce54c8f54bb1e8bb274aa869b244e84493
bb41737741c4946a7f68e4a9ed605120b82f1490
refs/heads/forInspection
2023-07-08T22:45:34.320210
2021-07-30T20:28:58
2021-07-30T20:28:58
384,930,251
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
package lesson1.GeometricShapes; public class Main { public static void main(String[] args) { GeometricShape geometricShape1 = new Circle(23); GeometricShape geometricShape2 = new Triangle(4.0,5.0,6.4); GeometricShape geometricShape3 = new Square(5); System.out.println(geometricShape1.toString()); geometricShape1.printArea(); geometricShape1.printPerimeter(); System.out.println(""); System.out.println(geometricShape2.toString()); geometricShape2.toString(); geometricShape2.printArea(); geometricShape2.printPerimeter(); System.out.println(""); System.out.println(geometricShape3.toString()); geometricShape3.toString(); geometricShape3.printArea(); geometricShape3.printPerimeter(); System.out.println(""); } }
5cdb9b2dfad17e001aec792f87bea593058c3abb
a5367296525d2eb0056171d18cb1382e9d64e7b3
/dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java
174fc2a9e616d6c8a9a15e8f989aea29adaa353c
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
HRHR-project/palestine
b02020e57d09778eed0db228ffc70105aac620de
5035e2ba55a7a403a1058755e4b1b613f3f0ae8f
refs/heads/master
2021-01-13T08:46:06.401275
2017-07-11T12:25:19
2017-07-11T12:26:09
71,972,941
0
0
BSD-3-Clause
2018-01-23T09:25:27
2016-10-26T06:26:18
Java
UTF-8
Java
false
false
11,459
java
package org.hisp.dhis.webapi.controller; /* * Copyright (c) 2004-2016, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted 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 the HISP project 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. */ import com.fasterxml.jackson.dataformat.csv.CsvFactory; import com.fasterxml.jackson.dataformat.csv.CsvGenerator; import com.fasterxml.jackson.dataformat.csv.CsvMapper; import com.fasterxml.jackson.dataformat.csv.CsvSchema; import com.google.common.collect.Lists; import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.Objects; import org.hisp.dhis.dxf2.metadata.ImportSummary; import org.hisp.dhis.i18n.I18n; import org.hisp.dhis.i18n.I18nManager; import org.hisp.dhis.node.NodeUtils; import org.hisp.dhis.node.exception.InvalidTypeException; import org.hisp.dhis.node.types.CollectionNode; import org.hisp.dhis.node.types.RootNode; import org.hisp.dhis.node.types.SimpleNode; import org.hisp.dhis.render.RenderService; import org.hisp.dhis.scheduling.TaskCategory; import org.hisp.dhis.scheduling.TaskId; import org.hisp.dhis.setting.StyleManager; import org.hisp.dhis.setting.StyleObject; import org.hisp.dhis.setting.SystemSettingManager; import org.hisp.dhis.statistics.StatisticsProvider; import org.hisp.dhis.system.SystemInfo; import org.hisp.dhis.system.SystemService; import org.hisp.dhis.system.notification.Notification; import org.hisp.dhis.system.notification.Notifier; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.webapi.mvc.annotation.ApiVersion; import org.hisp.dhis.webapi.mvc.annotation.ApiVersion.Version; import org.hisp.dhis.webapi.utils.ContextUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; /** * @author Morten Olav Hansen <[email protected]> */ @Controller @RequestMapping( value = SystemController.RESOURCE_PATH ) @ApiVersion( { Version.DEFAULT, Version.ALL } ) public class SystemController { public static final String RESOURCE_PATH = "/system"; @Autowired private CurrentUserService currentUserService; @Autowired private SystemService systemService; @Autowired private StyleManager styleManager; @Autowired private SystemSettingManager systemSettingManager; @Autowired private Notifier notifier; @Autowired private RenderService renderService; @Autowired private I18nManager i18nManager; @Autowired private StatisticsProvider statisticsProvider; private static final CsvFactory CSV_FACTORY = new CsvMapper().getFactory(); // ------------------------------------------------------------------------- // UID Generator // ------------------------------------------------------------------------- @RequestMapping( value = { "/uid", "/id" }, method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } ) public @ResponseBody RootNode getUid( @RequestParam( required = false, defaultValue = "1" ) Integer limit ) throws IOException, InvalidTypeException { limit = Math.min( limit, 10000 ); RootNode rootNode = new RootNode( "codes" ); CollectionNode collectionNode = rootNode.addChild( new CollectionNode( "codes" ) ); collectionNode.setWrapping( false ); for ( int i = 0; i < limit; i++ ) { collectionNode.addChild( new SimpleNode( "code", CodeGenerator.generateCode() ) ); } return rootNode; } @RequestMapping( value = { "/uid", "/id" }, method = RequestMethod.GET, produces = { "application/csv" } ) public void getUidCsv( @RequestParam( required = false, defaultValue = "1" ) Integer limit, HttpServletResponse response ) throws IOException, InvalidTypeException { limit = Math.min( limit, 10000 ); CsvGenerator csvGenerator = CSV_FACTORY.createGenerator( response.getOutputStream() ); CsvSchema.Builder schemaBuilder = CsvSchema.builder().setUseHeader( true ); schemaBuilder.addColumn( "uid" ); csvGenerator.setSchema( schemaBuilder.build() ); for ( int i = 0; i < limit; i++ ) { csvGenerator.writeStartObject(); csvGenerator.writeStringField( "uid", CodeGenerator.generateCode() ); csvGenerator.writeEndObject(); } } @RequestMapping( value = "/uuid", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } ) public @ResponseBody RootNode getUuid( @RequestParam( required = false, defaultValue = "1" ) Integer limit ) throws IOException, InvalidTypeException { limit = Math.min( limit, 10000 ); RootNode rootNode = new RootNode( "codes" ); CollectionNode collectionNode = rootNode.addChild( new CollectionNode( "codes" ) ); collectionNode.setWrapping( false ); for ( int i = 0; i < limit; i++ ) { collectionNode.addChild( new SimpleNode( "code", UUID.randomUUID().toString() ) ); } return rootNode; } @RequestMapping( value = "/tasks/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" } ) public void getTaskJson( @PathVariable( "category" ) String category, @RequestParam( required = false ) String lastId, HttpServletResponse response ) throws IOException { List<Notification> notifications = new ArrayList<>(); if ( category != null ) { TaskCategory taskCategory = TaskCategory.valueOf( category.toUpperCase() ); TaskId taskId = new TaskId( taskCategory, currentUserService.getCurrentUser() ); notifications = notifier.getNotifications( taskId, lastId ); } renderService.toJson( response.getOutputStream(), notifications ); } @RequestMapping( value = "/taskSummaries/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" } ) public void getTaskSummaryJson( HttpServletResponse response, @PathVariable( "category" ) String category ) throws IOException { if ( category != null ) { TaskCategory taskCategory = TaskCategory.valueOf( category.toUpperCase() ); TaskId taskId = new TaskId( taskCategory, currentUserService.getCurrentUser() ); if ( taskCategory.equals( TaskCategory.DATAINTEGRITY ) ) //TODO { renderService.toJson( response.getOutputStream(), notifier.getTaskSummary( taskId ) ); return; } else { ImportSummary importSummary = (ImportSummary) notifier.getTaskSummary( taskId ); renderService.toJson( response.getOutputStream(), importSummary ); return; } } renderService.toJson( response.getOutputStream(), new ImportSummary() ); } @RequestMapping( value = "/info", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } ) public @ResponseBody SystemInfo getSystemInfo( Model model, HttpServletRequest request ) { SystemInfo info = systemService.getSystemInfo(); info.setContextPath( ContextUtils.getContextPath( request ) ); info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) ); if ( !currentUserService.currentUserIsSuper() ) { info.clearSensitiveInfo(); } return info; } @RequestMapping( value = "/objectCounts", method = RequestMethod.GET ) public @ResponseBody RootNode getObjectCounts() { Map<Objects, Integer> objectCounts = statisticsProvider.getObjectCounts(); RootNode rootNode = NodeUtils.createRootNode( "objectCounts" ); for ( Objects objects : objectCounts.keySet() ) { rootNode.addChild( new SimpleNode( objects.getValue(), objectCounts.get( objects ) ) ); } return rootNode; } @RequestMapping( value = "/ping", method = RequestMethod.GET, produces = "text/plain" ) @ApiVersion( exclude = { Version.V24, Version.V25 } ) public @ResponseBody String pingLegacy() { return "pong"; } @RequestMapping( value = "/ping", method = RequestMethod.GET ) @ApiVersion( exclude = { Version.DEFAULT, Version.V23 } ) public @ResponseBody String ping() { return "pong"; } @RequestMapping( value = "/flags", method = RequestMethod.GET, produces = { "application/json" } ) public @ResponseBody List<StyleObject> getFlags() { return getFlagObjects(); } @RequestMapping( value = "/styles", method = RequestMethod.GET, produces = { "application/json" } ) public @ResponseBody List<StyleObject> getStyles() { return styleManager.getStyles(); } // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- private List<StyleObject> getFlagObjects() { List<String> flags = systemSettingManager.getFlags(); I18n i18n = i18nManager.getI18n(); List<StyleObject> list = Lists.newArrayList(); for ( String flag : flags ) { String file = flag + ".png"; list.add( new StyleObject( i18n.getString( flag ), flag, file ) ); } return list; } }
e6150e966a511120db4f790f71b9217b4c01fc58
609f5f295f246177f0761dbcc7b11b54c42caa39
/workspace/Java session 4/src/javasession4.java
1f7ba0c84e3b02d80e1d73e5268dd2aebb624bcd
[]
no_license
shreeya10/basicjava
7614c94bba0f630e76215a393567f8d4843d94e2
5f0c82189ec9ab438c5f8c8af65cdeb0690e91de
refs/heads/master
2020-12-02T17:57:20.337658
2017-08-30T02:31:12
2017-08-30T02:31:12
96,452,735
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
public class javasession4 { public static void main(String[] args) { // TODO Auto-generated method stub int age = 13; if( age < 13) { System.out.println("you are kid" ); } else if( age >=13 && age <= 19) { System.out.println("you are teen"); } else if( age >=20 && age <= 60) { System.out.println("you are adult"); } else (age > 60) { System.out.println("you are senior"); } } }
ebb0a24bcff286f48d437a97e3ea3154f56e0a4b
ed5b3d7a355d68dd6c71b6e6a9074a077e64a857
/kodilla-testing/src/main/java/com/kodilla/exception/io/testing/library/LibraryDatabase.java
e466659951aeb1d28a02f1ff43ac552dba535d2f
[]
no_license
mrembelska/marta-rembelska-kodilla-java
9798a321d624635ca4c8e8633d5535b73f0ebdbd
5a8903ab230f0ab8f63d1b97607f63c0e78cf2ce
refs/heads/master
2021-05-12T04:33:54.513551
2018-05-12T23:25:14
2018-05-12T23:25:14
117,166,917
0
0
null
null
null
null
UTF-8
Java
false
false
686
java
package com.kodilla.exception.io.testing.library; import java.util.List; public interface LibraryDatabase { // lists books having title beginning with titleFragment List<Book> listBooksWithCondition(String titleFragment); // list books borrowed by libraryUser List<Book> listBooksInHandsOf(LibraryUser libraryUser); // try to rent a book for libraryUser // returns true when success // and returns false when book is unavailable to rent boolean rentABook(LibraryUser libraryUser, Book book); // return all books borrowed by libraryUser to the library // returns number of books returned back int returnBooks(LibraryUser libraryUser); }
38e7e8345c416af69db7d33c324f2f94d7313565
0770532d01161d59792eb862dd7d18f573cf6f2a
/src/main/java/ru/job4j/inheritance/Dentist.java
3581641f37ce92f7feccbfbe277dd6524fd82bf6
[]
no_license
grum1972/job4j_tracker2021
344ceacc1bd94c79da5a0141c8753dcc2442b5b9
5d90f028cfb080dbcbf1fcefb21822496a393c28
refs/heads/master
2023-08-11T14:27:34.511648
2021-09-26T17:52:44
2021-09-26T17:52:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package ru.job4j.inheritance; public class Dentist extends Doctor { private boolean isMemberAssociationDentist; public Dentist(String name, String surname, String education, String birthday, int workExperience, boolean isMemberAssociationDentist) { super(name, surname, education, birthday, workExperience); this.isMemberAssociationDentist = isMemberAssociationDentist; } public boolean treatChildren() { return true; } }
95122841abe30ef7f8e3dd052baf13f3ae2b77e4
5b6ac8fd4ea45d84da4130a66a5237f2b1b97c12
/src/main/java/com/revature/trms/util/GetBalance.java
db7b4755016231d9b0e0e32c3aac521752a9dfec
[]
no_license
egandunning/trms-2
ca451e6e32bd4242dff654982fef28799f77077a
283c578d59190414d8a31920bd65d0c5ac1a117d
refs/heads/master
2021-08-06T13:36:11.095009
2017-11-06T00:20:49
2017-11-06T00:20:49
108,442,938
1
0
null
2017-11-06T00:20:50
2017-10-26T17:21:44
Java
UTF-8
Java
false
false
798
java
package com.revature.trms.util; import java.sql.SQLException; import java.util.List; import java.util.Map; import com.revature.trms.database.dao.EventTypeDAOImpl; import com.revature.trms.database.dao.RequestDAO; import com.revature.trms.database.dao.RequestDAOImpl; import com.revature.trms.models.Request; import com.revature.trms.database.dao.EmployeeDAO; import com.revature.trms.database.dao.EmployeeDAOImpl; import com.revature.trms.models.Employee; public class GetBalance { public static double getPendingBalance(Employee emp) { return 0; } public static double getApprovedBalance(Employee emp) { return 0; } public static double getTotalBalance(Employee emp) { double total = (1000 - getApprovedBalance(emp) - getPendingBalance(emp)); return total; } }
e6dd51b89f34a59c691e68cc45ea3ac884c17cb5
c8163d2f8a9607666761b7ea85d577ae79bce4c3
/core/src/main/java/io/undertow/client/http2/Http2ClientConnection.java
174219f0259364251580445a3a66aa22857c04c6
[ "Apache-2.0" ]
permissive
NorthFury/undertow
1468c5580234e0ba555661c91a1adbc2907d5a90
3a4a07d443a1777ac4fe325e6c55c0e614b8b850
refs/heads/master
2021-01-20T03:49:57.978645
2017-04-27T02:27:56
2017-04-27T02:27:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,778
java
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * 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 io.undertow.client.http2; import static io.undertow.protocols.http2.Http2Channel.AUTHORITY; import static io.undertow.protocols.http2.Http2Channel.METHOD; import static io.undertow.protocols.http2.Http2Channel.PATH; import static io.undertow.protocols.http2.Http2Channel.SCHEME; import static io.undertow.protocols.http2.Http2Channel.STATUS; import static io.undertow.util.Headers.CONTENT_LENGTH; import static io.undertow.util.Headers.TRANSFER_ENCODING; import java.io.IOException; import java.net.SocketAddress; import java.nio.channels.ClosedChannelException; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import io.undertow.client.ClientStatistics; import io.undertow.protocols.http2.Http2GoAwayStreamSourceChannel; import io.undertow.protocols.http2.Http2PushPromiseStreamSourceChannel; import io.undertow.util.HeaderValues; import io.undertow.util.Methods; import io.undertow.util.NetworkUtils; import io.undertow.util.Protocols; import org.xnio.ChannelExceptionHandler; import org.xnio.ChannelListener; import org.xnio.ChannelListeners; import org.xnio.IoUtils; import org.xnio.Option; import io.undertow.connector.ByteBufferPool; import org.xnio.StreamConnection; import org.xnio.XnioIoThread; import org.xnio.XnioWorker; import org.xnio.channels.Channels; import org.xnio.channels.StreamSinkChannel; import io.undertow.UndertowLogger; import io.undertow.UndertowMessages; import io.undertow.client.ClientCallback; import io.undertow.client.ClientConnection; import io.undertow.client.ClientExchange; import io.undertow.client.ClientRequest; import io.undertow.client.ProxiedRequestAttachments; import io.undertow.protocols.http2.AbstractHttp2StreamSourceChannel; import io.undertow.protocols.http2.Http2Channel; import io.undertow.protocols.http2.Http2HeadersStreamSinkChannel; import io.undertow.protocols.http2.Http2PingStreamSourceChannel; import io.undertow.protocols.http2.Http2RstStreamStreamSourceChannel; import io.undertow.protocols.http2.Http2StreamSourceChannel; import io.undertow.util.Headers; import io.undertow.util.HttpString; /** * @author Stuart Douglas */ public class Http2ClientConnection implements ClientConnection { private final Http2Channel http2Channel; private final ChannelListener.SimpleSetter<ClientConnection> closeSetter = new ChannelListener.SimpleSetter<>(); private final Map<Integer, Http2ClientExchange> currentExchanges = new ConcurrentHashMap<>(); private boolean initialUpgradeRequest; private final String defaultHost; private final ClientStatistics clientStatistics; private final List<ChannelListener<ClientConnection>> closeListeners = new CopyOnWriteArrayList<>(); private final boolean secure; public Http2ClientConnection(Http2Channel http2Channel, boolean initialUpgradeRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) { this.http2Channel = http2Channel; this.defaultHost = defaultHost; this.clientStatistics = clientStatistics; this.secure = secure; http2Channel.getReceiveSetter().set(new Http2ReceiveListener()); http2Channel.resumeReceives(); http2Channel.addCloseTask(new ChannelListener<Http2Channel>() { @Override public void handleEvent(Http2Channel channel) { ChannelListeners.invokeChannelListener(Http2ClientConnection.this, closeSetter.get()); for(ChannelListener<ClientConnection> listener : closeListeners) { listener.handleEvent(Http2ClientConnection.this); } for(Map.Entry<Integer, Http2ClientExchange> entry : currentExchanges.entrySet()) { entry.getValue().failed(new ClosedChannelException()); } currentExchanges.clear(); } }); this.initialUpgradeRequest = initialUpgradeRequest; } public Http2ClientConnection(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) { this.http2Channel = http2Channel; this.defaultHost = defaultHost; this.clientStatistics = clientStatistics; this.secure = secure; http2Channel.getReceiveSetter().set(new Http2ReceiveListener()); http2Channel.resumeReceives(); http2Channel.addCloseTask(new ChannelListener<Http2Channel>() { @Override public void handleEvent(Http2Channel channel) { ChannelListeners.invokeChannelListener(Http2ClientConnection.this, closeSetter.get()); } }); this.initialUpgradeRequest = false; Http2ClientExchange exchange = new Http2ClientExchange(this, null, clientRequest); exchange.setResponseListener(upgradeReadyCallback); currentExchanges.put(1, exchange); } @Override public void sendRequest(ClientRequest request, ClientCallback<ClientExchange> clientCallback) { request.getRequestHeaders().put(METHOD, request.getMethod().toString()); boolean connectRequest = request.getMethod().equals(Methods.CONNECT); if(!connectRequest) { request.getRequestHeaders().put(PATH, request.getPath()); request.getRequestHeaders().put(SCHEME, secure ? "https" : "http"); } final String host = request.getRequestHeaders().getFirst(Headers.HOST); if(host != null) { request.getRequestHeaders().put(AUTHORITY, host); } else { request.getRequestHeaders().put(AUTHORITY, defaultHost); } request.getRequestHeaders().remove(Headers.HOST); boolean hasContent = true; String fixedLengthString = request.getRequestHeaders().getFirst(CONTENT_LENGTH); String transferEncodingString = request.getRequestHeaders().getLast(TRANSFER_ENCODING); if (fixedLengthString != null) { try { long length = Long.parseLong(fixedLengthString); hasContent = length != 0; } catch (NumberFormatException e) { handleError(new IOException(e)); return; } } else if (transferEncodingString == null && !connectRequest) { hasContent = false; } request.getRequestHeaders().remove(Headers.CONNECTION); request.getRequestHeaders().remove(Headers.KEEP_ALIVE); request.getRequestHeaders().remove(Headers.TRANSFER_ENCODING); //setup the X-Forwarded-* headers String peer = request.getAttachment(ProxiedRequestAttachments.REMOTE_HOST); if(peer != null) { request.getRequestHeaders().put(Headers.X_FORWARDED_FOR, peer); } Boolean proto = request.getAttachment(ProxiedRequestAttachments.IS_SSL); if(proto != null) { if (proto) { request.getRequestHeaders().put(Headers.X_FORWARDED_PROTO, "https"); } else { request.getRequestHeaders().put(Headers.X_FORWARDED_PROTO, "http"); } } String hn = request.getAttachment(ProxiedRequestAttachments.SERVER_NAME); if(hn != null) { request.getRequestHeaders().put(Headers.X_FORWARDED_HOST, NetworkUtils.formatPossibleIpv6Address(hn)); } Integer port = request.getAttachment(ProxiedRequestAttachments.SERVER_PORT); if(port != null) { request.getRequestHeaders().put(Headers.X_FORWARDED_PORT, port); } Http2HeadersStreamSinkChannel sinkChannel; try { sinkChannel = http2Channel.createStream(request.getRequestHeaders()); } catch (IOException e) { clientCallback.failed(e); return; } Http2ClientExchange exchange = new Http2ClientExchange(this, sinkChannel, request); currentExchanges.put(sinkChannel.getStreamId(), exchange); if(clientCallback != null) { clientCallback.completed(exchange); } if (!hasContent) { //if there is no content we flush the response channel. //otherwise it is up to the user try { sinkChannel.shutdownWrites(); if (!sinkChannel.flush()) { sinkChannel.getWriteSetter().set(ChannelListeners.flushingChannelListener(null, new ChannelExceptionHandler<StreamSinkChannel>() { @Override public void handleException(StreamSinkChannel channel, IOException exception) { handleError(exception); } })); sinkChannel.resumeWrites(); } } catch (IOException e) { handleError(e); } } } private void handleError(IOException e) { UndertowLogger.REQUEST_IO_LOGGER.ioException(e); IoUtils.safeClose(Http2ClientConnection.this); for (Map.Entry<Integer, Http2ClientExchange> entry : currentExchanges.entrySet()) { try { entry.getValue().failed(e); } catch (Exception ex) { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(ex)); } } } @Override public StreamConnection performUpgrade() throws IOException { throw UndertowMessages.MESSAGES.upgradeNotSupported(); } @Override public ByteBufferPool getBufferPool() { return http2Channel.getBufferPool(); } @Override public SocketAddress getPeerAddress() { return http2Channel.getPeerAddress(); } @Override public <A extends SocketAddress> A getPeerAddress(Class<A> type) { return http2Channel.getPeerAddress(type); } @Override public ChannelListener.Setter<? extends ClientConnection> getCloseSetter() { return closeSetter; } @Override public SocketAddress getLocalAddress() { return http2Channel.getLocalAddress(); } @Override public <A extends SocketAddress> A getLocalAddress(Class<A> type) { return http2Channel.getLocalAddress(type); } @Override public XnioWorker getWorker() { return http2Channel.getWorker(); } @Override public XnioIoThread getIoThread() { return http2Channel.getIoThread(); } @Override public boolean isOpen() { return http2Channel.isOpen() && !http2Channel.isPeerGoneAway() && !http2Channel.isThisGoneAway(); } @Override public void close() throws IOException { try { http2Channel.sendGoAway(0); } finally { for(Map.Entry<Integer, Http2ClientExchange> entry : currentExchanges.entrySet()) { entry.getValue().failed(new ClosedChannelException()); } currentExchanges.clear(); } } @Override public boolean supportsOption(Option<?> option) { return false; } @Override public <T> T getOption(Option<T> option) throws IOException { return null; } @Override public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException { return null; } @Override public boolean isUpgraded() { return false; } @Override public boolean isPushSupported() { return true; } @Override public boolean isMultiplexingSupported() { return true; } @Override public ClientStatistics getStatistics() { return clientStatistics; } @Override public boolean isUpgradeSupported() { return false; } @Override public void addCloseListener(ChannelListener<ClientConnection> listener) { closeListeners.add(listener); } private class Http2ReceiveListener implements ChannelListener<Http2Channel> { @Override public void handleEvent(Http2Channel channel) { try { AbstractHttp2StreamSourceChannel result = channel.receive(); if (result instanceof Http2StreamSourceChannel) { final Http2StreamSourceChannel streamSourceChannel = (Http2StreamSourceChannel) result; int statusCode = Integer.parseInt(streamSourceChannel.getHeaders().getFirst(STATUS)); Http2ClientExchange request = currentExchanges.get(streamSourceChannel.getStreamId()); if(statusCode < 200) { //this is an informational response 1xx response if(statusCode == 100) { //a continue response request.setContinueResponse(request.createResponse(streamSourceChannel)); } Channels.drain(result, Long.MAX_VALUE); return; } result.addCloseTask(new ChannelListener<AbstractHttp2StreamSourceChannel>() { @Override public void handleEvent(AbstractHttp2StreamSourceChannel channel) { currentExchanges.remove(streamSourceChannel.getStreamId()); } }); streamSourceChannel.setCompletionListener(new ChannelListener<Http2StreamSourceChannel>() { @Override public void handleEvent(Http2StreamSourceChannel channel) { currentExchanges.remove(streamSourceChannel.getStreamId()); } }); if (request == null && initialUpgradeRequest) { Channels.drain(result, Long.MAX_VALUE); initialUpgradeRequest = false; return; } else if(request == null) { channel.sendGoAway(Http2Channel.ERROR_PROTOCOL_ERROR); IoUtils.safeClose(Http2ClientConnection.this); return; } request.responseReady(streamSourceChannel); } else if (result instanceof Http2PingStreamSourceChannel) { handlePing((Http2PingStreamSourceChannel) result); } else if (result instanceof Http2RstStreamStreamSourceChannel) { Http2RstStreamStreamSourceChannel rstStream = (Http2RstStreamStreamSourceChannel) result; int stream = rstStream.getStreamId(); UndertowLogger.REQUEST_LOGGER.debugf("Client received RST_STREAM for stream %s", stream); Http2ClientExchange exchange = currentExchanges.get(stream); if(exchange != null) { //if we have not yet received a response we treat this as an error exchange.failed(UndertowMessages.MESSAGES.http2StreamWasReset()); } Channels.drain(result, Long.MAX_VALUE); } else if (result instanceof Http2PushPromiseStreamSourceChannel) { Http2PushPromiseStreamSourceChannel stream = (Http2PushPromiseStreamSourceChannel) result; Http2ClientExchange request = currentExchanges.get(stream.getAssociatedStreamId()); if(request == null) { channel.sendGoAway(Http2Channel.ERROR_PROTOCOL_ERROR); //according to the spec this is a connection error } else if(request.getPushCallback() == null) { channel.sendRstStream(stream.getPushedStreamId(), Http2Channel.ERROR_REFUSED_STREAM); } else { ClientRequest cr = new ClientRequest(); cr.setMethod(new HttpString(stream.getHeaders().getFirst(METHOD))); cr.setPath(stream.getHeaders().getFirst(PATH)); cr.setProtocol(Protocols.HTTP_1_1); for (HeaderValues header : stream.getHeaders()) { cr.getRequestHeaders().putAll(header.getHeaderName(), header); } Http2ClientExchange newExchange = new Http2ClientExchange(Http2ClientConnection.this, null, cr); if(!request.getPushCallback().handlePush(request, newExchange)) { channel.sendRstStream(stream.getPushedStreamId(), Http2Channel.ERROR_REFUSED_STREAM); IoUtils.safeClose(stream); } else { currentExchanges.put(stream.getPushedStreamId(), newExchange); } } Channels.drain(result, Long.MAX_VALUE); } else if (result instanceof Http2GoAwayStreamSourceChannel) { close(); } else if(result != null) { Channels.drain(result, Long.MAX_VALUE); } } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.ioException(e); IoUtils.safeClose(Http2ClientConnection.this); for (Map.Entry<Integer, Http2ClientExchange> entry : currentExchanges.entrySet()) { try { entry.getValue().failed(e); } catch (Exception ex) { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(ex)); } } } } private void handlePing(Http2PingStreamSourceChannel frame) { byte[] id = frame.getData(); if (!frame.isAck()) { //server side ping, return it frame.getHttp2Channel().sendPing(id); } } } }
784aab8646d7803c6f4d4022c5841eca7cfa8413
50ffbe986838bf3d6764df521c8ecee02c135337
/src/nicelee/bilibili/downloaders/Downloader.java
23c82c9bccc49b63f908f40a8ad8c016930ccd54
[ "Apache-2.0", "LGPL-2.1-or-later", "MIT" ]
permissive
nICEnnnnnnnLee/BilibiliDown
3eca463599e5b667717a6fc013935f0d3a280bc7
4d815b4b1f7e5d0808fa25fd0374174b9120c01c
refs/heads/master
2023-09-01T00:25:47.091292
2023-08-13T12:25:51
2023-08-13T12:25:51
167,133,606
1,411
159
Apache-2.0
2023-08-13T12:25:53
2019-01-23T06:56:46
Java
UTF-8
Java
false
false
3,395
java
package nicelee.bilibili.downloaders; import java.io.File; import java.util.ArrayList; import java.util.List; import nicelee.bilibili.PackageScanLoader; import nicelee.bilibili.enums.StatusEnum; import nicelee.bilibili.util.HttpRequestUtil; import nicelee.bilibili.util.Logger; public class Downloader implements IDownloader { private static List<IDownloader> downloaders = null; private IDownloader downloader = null; private HttpRequestUtil util; private StatusEnum status; @Override public boolean matches(String url) { return true; } @Override public void init(HttpRequestUtil util) { status = StatusEnum.NONE; this.util = util; if(downloaders == null) { synchronized (Downloader.class) { if(downloaders == null) { downloaders = new ArrayList<>(); try { for (Class<?> clazz : PackageScanLoader.validDownloaderClasses) { IDownloader downloader = (IDownloader) clazz.newInstance(); downloaders.add(downloader); } } catch (Exception e) { e.printStackTrace(); } } } } } @Override public boolean download(String url, String avId, int qn, int page) { if(downloader == null) { for (IDownloader downloader : downloaders) { if (downloader.matches(url)) { try { this.downloader = downloader.getClass().newInstance(); this.downloader.matches(url); } catch (InstantiationException | IllegalAccessException e) { } } } } if(downloader != null) { status = StatusEnum.DOWNLOADING; downloader.init(util); return downloader.download(url, avId, qn, page); } else { System.out.print("未找到匹配当前url的下载器:"); System.out.println(url); status = StatusEnum.FAIL; return false; } } @Override public void startTask() { if (downloader != null) { status = StatusEnum.DOWNLOADING; downloader.startTask(); } else { Logger.println(StatusEnum.NONE.toString()); status = StatusEnum.NONE; } } @Override public void stopTask() { if (downloader != null) { downloader.stopTask(); } status = StatusEnum.STOP; } @Override public File file() { if (downloader != null) { return downloader.file(); } return null; } @Override public StatusEnum currentStatus() { // 如果有downloader, 以downloader为准 if (downloader != null) { return downloader.currentStatus(); } else { return status; } } @Override public int totalTaskCount() { if (downloader != null) { return downloader.totalTaskCount(); } return 0; } @Override public int currentTask() { if (downloader != null) { return downloader.currentTask(); } return 0; } @Override public long sumTotalFileSize() { if (downloader != null) { return downloader.sumTotalFileSize(); } return 0; } @Override public long sumDownloadedFileSize() { if (downloader != null) { return downloader.sumDownloadedFileSize(); } return 0; } @Override public long currentFileDownloadedSize() { if (downloader != null) { return downloader.currentFileDownloadedSize(); } return 0; } @Override public long currentFileTotalSize() { if (downloader != null) { return downloader.currentFileTotalSize(); } return 0; } }
5e0327cb0ff140b09d3d5b12f60188e41df0bd4d
ee902837b9937f5dc503523056aee49a1b2ca681
/springmvc-velocity-ffmpeg-demo/src/main/java/com/tzq/dao/impl/UserDaoImpl.java
e4c9b3e976649339eca714495bec3733245cf217
[]
no_license
lukeddy/spring_train
4d9f8037069dbe44a0200a478d2ddd12971effef
26ffdba277fef6e6ab95a92575399e53d9d90db0
refs/heads/master
2022-03-28T22:06:26.835464
2017-08-22T16:36:05
2017-08-22T16:36:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
package com.tzq.dao.impl; import com.tzq.common.dao.impl.BaseDao; import com.tzq.dao.UserDAO; import org.springframework.stereotype.Repository; @Repository public class UserDaoImpl extends BaseDao implements UserDAO { }
fdcba3ebe2b82d0f1b9299b1ca26856009a8bb22
3e93c2e26abc33b38b7b4eca3cc3b7ce18fb1c97
/src/day34_Cunstuctors/ArrayListsMethods.java
21a76d06e2317ccb2b67a51b2639d08f4cad0526
[]
no_license
rslcvz/Summer2019_Java
a9a41c4c4c008c49c36744693b3ccaee95041316
af0d0ba3c2736afbab429101f9c80a361ef40401
refs/heads/master
2020-07-23T02:53:43.190018
2019-12-16T14:37:34
2019-12-16T14:37:34
207,424,447
1
0
null
null
null
null
UTF-8
Java
false
false
124
java
package day34_Cunstuctors; public class ArrayListsMethods { public static void main(String[] args) { } }
07466ef0e2b1993bccd8aa65489cd93161873252
228749987bcbd253844be2fcd2aab7ddd23105ca
/ObserverPattern/src/main/java/demo/pull/Observer.java
05f29c261c5633b095f54e832b873efe035f681a
[]
no_license
liuzongzhe/JavaDesignPattern
a7633dadea62475b3ab379516f63fa7133cbbc1f
ad3dc8e610c0fe0b8cf9e424294f9762e32a65df
refs/heads/master
2020-03-22T03:42:30.847293
2018-07-02T13:32:54
2018-07-02T13:32:54
139,447,642
2
0
null
null
null
null
UTF-8
Java
false
false
317
java
package demo.pull; /** * 拉模型--通常都是把主题对象当做参数传递。 * @author lzz * @date 2018/6/7 */ public interface Observer { /** * 更新接口 * @param subject 传入主题对象,方面获取相应的主题对象的状态 */ public void update(Subject subject); }
f6211050ae14d953dcf6eb6209289dbaa70d51c9
5d82f3ced50601af2b804cee3cf967945da5ff97
/execution-monitoring/retrieve-monitoring-data/src/main/java/org/choreos/services/enactchoreography/client/client/Client.java
25dcbdd7c6c8e88d1fd2aec70db2aeefad439548
[ "Apache-2.0" ]
permissive
sesygroup/choreography-synthesis-enactment
7f345fe7a9e0288bbde539fc373b43f1f0bd1eb5
6eb43ea97203853c40f8e447597570f21ea5f52f
refs/heads/master
2022-01-26T13:20:50.701514
2020-03-20T12:18:44
2020-03-20T12:18:44
141,552,936
0
1
Apache-2.0
2022-01-06T19:56:05
2018-07-19T09:04:05
Java
UTF-8
Java
false
false
3,485
java
package org.choreos.services.enactchoreography.client.client; import java.util.List; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.Action; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.8 * Generated source version: 2.2 * */ @WebService(name = "Client", targetNamespace = "http://services.choreos.org/") @XmlSeeAlso({ ObjectFactory.class }) public interface Client { /** * */ @WebMethod @RequestWrapper(localName = "scenarioSetup", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.ScenarioSetup") @ResponseWrapper(localName = "scenarioSetupResponse", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.ScenarioSetupResponse") @Action(input = "http://services.choreos.org/Client/scenarioSetupRequest", output = "http://services.choreos.org/Client/scenarioSetupResponse") public void scenarioSetup(); /** * * @param arg0 */ @WebMethod @RequestWrapper(localName = "setEndpointAddress", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.SetEndpointAddress") @ResponseWrapper(localName = "setEndpointAddressResponse", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.SetEndpointAddressResponse") @Action(input = "http://services.choreos.org/Client/setEndpointAddressRequest", output = "http://services.choreos.org/Client/setEndpointAddressResponse") public void setEndpointAddress( @WebParam(name = "arg0", targetNamespace = "") String arg0); /** * * @param arg0 */ @WebMethod @RequestWrapper(localName = "start", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.Start") @ResponseWrapper(localName = "startResponse", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.StartResponse") @Action(input = "http://services.choreos.org/Client/startRequest", output = "http://services.choreos.org/Client/startResponse") public void start( @WebParam(name = "arg0", targetNamespace = "") String arg0); /** * * @param arg2 * @param arg1 * @param arg0 */ @WebMethod @RequestWrapper(localName = "setInvocationAddress", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.SetInvocationAddress") @ResponseWrapper(localName = "setInvocationAddressResponse", targetNamespace = "http://services.choreos.org/", className = "org.choreos.services.enactchoreography.client.client.SetInvocationAddressResponse") @Action(input = "http://services.choreos.org/Client/setInvocationAddressRequest", output = "http://services.choreos.org/Client/setInvocationAddressResponse") public void setInvocationAddress( @WebParam(name = "arg0", targetNamespace = "") String arg0, @WebParam(name = "arg1", targetNamespace = "") String arg1, @WebParam(name = "arg2", targetNamespace = "") List<String> arg2); }
5aa24597adc4457077953741b17ea7dba7a7dae5
8c2caac3dbe2a63f7ce8f2a9918e12aee515c285
/tg-portal-web/src/main/java/com/tg/fyc/portal/controller/ContentController.java
a65819861e4c94c13ea92c8781c3a356848e32e3
[]
no_license
CurryTao/tg-dubbo
737d65a6c131845fd188f2c4f1da4cc5c79456f8
db9ad837c7a9de6b7e9da1ca5380fe449dde4e79
refs/heads/master
2020-04-01T08:33:08.731610
2018-12-25T08:39:30
2018-12-25T08:39:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
package com.tg.fyc.portal.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.tg.fyc.content.api.ContentApi; import com.tg.fyc.pojo.Content; @Controller @RequestMapping("content") public class ContentController { @Autowired private ContentApi contentApi; @RequestMapping("findByCategoryId") @ResponseBody public List<Content> findByCategoryId(Long categoryId){ return contentApi.findByCategoryId(categoryId); } }
02463ae842dadcea21a0576648a9ae31dd2df344
b456d6dcf42e41da7a831bc1acc3a75d3d18eb91
/src/main/java/fredboat/command/maintenance/VersionCommand.java
e507761fccac6fd37dcfe8bb3a19f232a23b1d4c
[]
no_license
SinSiXX/FredBoat
73f8b7da12b39a4dacc9cf0e8f033e1310dcb231
576c57aacf7de5a572d7ef693a75830e191cd91b
refs/heads/master
2021-01-18T04:22:03.736684
2016-06-02T14:04:29
2016-06-03T05:14:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
package fredboat.command.maintenance; import fredboat.commandmeta.Command; import net.dv8tion.jda.JDAInfo; import net.dv8tion.jda.entities.Guild; import net.dv8tion.jda.entities.Message; import net.dv8tion.jda.entities.TextChannel; import net.dv8tion.jda.entities.User; public class VersionCommand extends Command { @Override public void onInvoke(Guild guild, TextChannel channel, User invoker, Message message, String[] args) { channel.sendMessage("JDA Version: " + JDAInfo.VERSION); } }
26a15f4c93f093857f8b16a884bb5634070ba34b
a19a201152599eae8c5ec84c695ef47242257b8f
/src/main/java/com/eshipper/service/ApPayableCreditNotesTransService.java
f12732b24c20d7c237060d95760c0a5d1bf565c1
[]
no_license
RajasekharAnisetti/eshipper2
278b92d0e1b5b19840bf5ebd37fbbd911928c7d2
19cb5195ff2696b53c3239f288da1787f1171ae6
refs/heads/master
2022-12-27T05:20:42.781472
2019-10-22T10:21:52
2019-10-22T10:21:52
216,559,606
0
0
null
2019-10-21T12:16:51
2019-10-21T12:13:39
Java
UTF-8
Java
false
false
1,054
java
package com.eshipper.service; import com.eshipper.service.dto.ApPayableCreditNotesTransDTO; import java.util.List; import java.util.Optional; /** * Service Interface for managing {@link com.eshipper.domain.ApPayableCreditNotesTrans}. */ public interface ApPayableCreditNotesTransService { /** * Save a apPayableCreditNotesTrans. * * @param apPayableCreditNotesTransDTO the entity to save. * @return the persisted entity. */ ApPayableCreditNotesTransDTO save(ApPayableCreditNotesTransDTO apPayableCreditNotesTransDTO); /** * Get all the apPayableCreditNotesTrans. * * @return the list of entities. */ List<ApPayableCreditNotesTransDTO> findAll(); /** * Get the "id" apPayableCreditNotesTrans. * * @param id the id of the entity. * @return the entity. */ Optional<ApPayableCreditNotesTransDTO> findOne(Long id); /** * Delete the "id" apPayableCreditNotesTrans. * * @param id the id of the entity. */ void delete(Long id); }
f617256b756a1ddd044ff2d3da2c76f42c2c5370
853bcdc74b3f1afff4ac01f3b4dec30f21d69e85
/java_Game/farmer/src/farmer/GameThree.java
1a8121854a29be82120ab56668dbac02a03e9793
[]
no_license
farmertim/java
4abc4509649180e981309598a928104d463a2d2d
b6deb01d99b2b47230d13b8ea62aa7f153cf90a9
refs/heads/master
2020-11-27T09:08:34.043743
2020-10-18T03:29:55
2020-10-18T03:29:55
229,380,515
0
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package farmer; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import javax.swing.ImageIcon; public class GameThree extends BasicGame{ ImageIcon normal; ImageIcon clock; farmer window; public GameThree(farmer jonah, TAG tag) { super(tag); this.window=jonah; System.out.println("GameThree"); this.x = 100; this.y = 100; this.state = 3; } public void logic(){ } public void display(Graphics g){ Color color = new Color(217, 209, 255); g.setColor(color); g.fillRect(0,0,1000,800); color = new Color(53, 237, 148); g.setColor(color); g.fillRect(120,150,750,350); g.setColor(Color.RED); Font font=new Font("Arial",1,50); g.setFont(font); g.drawString("Score:",650,650); g.setColor(Color.LIGHT_GRAY); g.fillRect(120, 230, 750, 100); // normal = new ImageIcon("Animation/nor.jpg"); // clock=new ImageIcon("Animation/tap.jpg"); // g.drawImage(normal.getImage(),120,230,30,30,window); // } }
6e6170d719ae9d3129cadb8cf48a341655bd48ae
fe30d795b5634fb071784ca3e131b5120523238d
/app/src/main/java/com/example/hii/doctorconnect/Doctor/StatusAdapter.java
77f51ac48ef86bf414eb4361f9144b77b69cc515
[]
no_license
5IVMO/Doctor-COnnect
c4e8d70940cc9a6627f264a5cda7cfc55a027acd
b3a7efabd3dd8c3e6b739e137d9e9d9c1d70846c
refs/heads/master
2021-01-22T05:50:27.670673
2017-02-18T05:00:21
2017-02-18T05:00:21
81,711,451
0
0
null
null
null
null
UTF-8
Java
false
false
3,634
java
package com.example.hii.doctorconnect.Doctor; import android.content.Context; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SwitchCompat; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.hii.doctorconnect.R; import java.util.List; /** * Created by hii on 2/16/2017. */ public class StatusAdapter extends RecyclerView.Adapter<StatusAdapter.MyViewHolder> { private Context mContext; private List<Status> statusList; public class MyViewHolder extends RecyclerView.ViewHolder { public TextView doctorName, hospitalName,date,day,time; public TextView title, count; public ImageView thumbnail, overflow; SwitchCompat hsp_switch; Button action,action1; // public ImageView thumbnail, overflow; public MyViewHolder(View view) { super(view); hospitalName=(TextView)itemView.findViewById(R.id.name); hsp_switch=(SwitchCompat)itemView.findViewById(R.id.hsp_switch); } } public StatusAdapter(Context mContext, List<Status> statusList) { this.mContext = mContext; this.statusList =statusList; } @Override public StatusAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.card_status, parent, false); return new StatusAdapter.MyViewHolder(itemView); } @Override public void onBindViewHolder(final StatusAdapter.MyViewHolder holder, final int position) { Status status= statusList.get(position); holder.hospitalName.setText(status.getHospitalName()); holder.hsp_switch.setChecked(status.isStatus()); holder.hsp_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { holder.hsp_switch.setChecked(isChecked); } }); } /** * Showing popup menu when tapping on 3 dots */ private void showPopupMenu(View view) { // inflate menu PopupMenu popup = new PopupMenu(mContext, view); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.menu_album, popup.getMenu()); popup.setOnMenuItemClickListener(new StatusAdapter.MyMenuItemClickListener()); popup.show(); } /** * Click listener for popup menu items */ class MyMenuItemClickListener implements PopupMenu.OnMenuItemClickListener { public MyMenuItemClickListener() { } @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.action_add_favourite: Toast.makeText(mContext, "Add to favourite", Toast.LENGTH_SHORT).show(); return true; case R.id.action_play_next: Toast.makeText(mContext, "Block", Toast.LENGTH_SHORT).show(); return true; default: } return false; } } @Override public int getItemCount() { return statusList.size(); } }
71a0e6732114cebe9dd55e2339f14e6f7eedaf75
280b9c54756cf7eef0358441284c2b4eff8bb0ce
/robolayout-ios/robolayout-ios-core/src/main/java/org/lirazs/robolayout/core/resource/drawable/StateListDrawableItem.java
d0d3101128cae515dbc9fb4750b925efb7c5ca9a
[ "Apache-2.0" ]
permissive
liraz/robolayout
0eefdbe5c2140c78d4d303e753710b34f92cfda7
932f1bf6cd59535ae4e8cc1175b9564d02471633
refs/heads/master
2021-01-10T08:10:05.002833
2016-04-15T14:27:09
2016-04-15T14:27:09
45,928,304
7
1
null
null
null
null
UTF-8
Java
false
false
550
java
package org.lirazs.robolayout.core.resource.drawable; import org.robovm.apple.uikit.UIControlState; /** * Created on 7/30/2015. */ public class StateListDrawableItem { private UIControlState state; private Drawable drawable; public UIControlState getState() { return state; } public void setState(UIControlState state) { this.state = state; } public Drawable getDrawable() { return drawable; } public void setDrawable(Drawable drawable) { this.drawable = drawable; } }
5ec2af62e4999c9d71e5d89a5f65139e6aacb020
096501806e686046a0fc7a33ab075e8d6f2341ac
/src/test/java/com/example/springbootzuulgatwayproxy/SpringBootZuulgatwayproxyApplicationTests.java
7ea992f1e87bafef1af452b686a9f517b29cec8e
[]
no_license
ngohuutientk/apigateway_zuul
6768caccb383e825150ede4a360fac8245619ec3
d1c3336c20a409a1f005d0310c023868f7bb110a
refs/heads/master
2022-09-03T18:19:21.528473
2020-05-30T07:14:50
2020-05-30T07:14:50
268,018,006
0
0
null
2020-05-30T06:58:36
2020-05-30T05:50:27
Java
UTF-8
Java
false
false
407
java
package com.example.springbootzuulgatwayproxy; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringBootZuulgatwayproxyApplicationTests { @Test public void contextLoads() { } @Test public void test2() { } }
da91a69cabf2e42dbb915470e04163205d866aa6
719255bd05ffeb582fc9b8580fb30fb6f8b45d30
/app/src/test/java/org/aplas/basicapp/TestA1BasicUI092.java
38f39525ca340a156f4bf4e7db45d381b2fa8ac4
[]
no_license
SalmaNabella05/BasicApp
4c7caea79714324be757744614e46072bdfda05c
9bd7d1ff29a4c862644c50759b9c4256f8ad6828
refs/heads/master
2021-05-22T13:22:48.616231
2020-04-04T08:17:13
2020-04-04T08:17:13
252,945,180
0
0
null
null
null
null
UTF-8
Java
false
false
6,803
java
package org.aplas.basicapp; import android.graphics.Typeface; import android.view.Gravity; import android.widget.RelativeLayout; import android.widget.TableLayout; import android.widget.TableRow; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import java.util.ArrayList; import java.util.List; @RunWith(RobolectricTestRunner.class) @Config(manifest=Config.NONE) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestA1BasicUI092 extends ViewTest { private MainActivity activity; private RelativeLayout mainLayout; private TableLayout layout; @Before public void initTest() { startActivity(); checkCompletion(); } private void startActivity() throws NullPointerException, ClassCastException { /****** initiation of Test ******/ //Robolectric Pack activity = Robolectric.buildActivity(MainActivity.class).create().get(); //Load layout //Load layout int compId = activity.getResources().getIdentifier(layoutName, "id", activity.getPackageName()); mainLayout = (RelativeLayout) activity.findViewById(compId); layout = (TableLayout) mainLayout.getChildAt(7); } private void checkCompletion() throws NullPointerException, ClassCastException { /******** Check components completion ********/ /** Specified Elements **/ List<Class> elements = new ArrayList<>(); elements.add(TableRow.class); //Element 1 elements.add(TableRow.class); //Element 1 elements.add(TableRow.class); //Element 1 /************************/ //JUnit Test int prevElement = 0; testCompletion(prevElement,elements,layout); int rowSize = elements.size(); int colSize = 4; elements.clear(); for (int i=0;i<4;i++) elements.add(androidx.appcompat.widget.AppCompatTextView.class); for (int i=0; i<rowSize; i++) { TableRow row = (TableRow) layout.getChildAt(i); testCompletion(prevElement,elements,row); } } @Test public void check_01_TableLayout_Properties() { //Check Layout Specification //Component properties value int compIdx = 7; ElementTest comp = new ElementTest(layout); //Test each item comp.testIdName("table"); comp.testWidth(TableLayout.LayoutParams.WRAP_CONTENT); comp.testHeight(TableLayout.LayoutParams.WRAP_CONTENT); comp.testLayoutBelow(mainLayout.getChildAt(compIdx-1).getId()); comp.testLinearHorizontal(true); //comp.testGravity(Gravity.CENTER); comp.testTopMargin(11); comp.testStrectchColumn(true); } @Test public void check_02_TableRow_Properties() { //Check Layout Specification //Component properties value TableRow row = (TableRow) layout.getChildAt(0); String[] itemId = "tv11,tv12,tv13,tv14".split("\\,"); String[] itemVal = "Temperature,0°C,32°F,273.15 K".split("\\,"); //Test first column ElementTest comp = new ElementTest(row.getChildAt(0)); comp.testIdName(itemId[0]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); int[] headColors = {-47872,-47872,-47872}; comp.testBgGradientColor(headColors); comp.testPadding(5); comp.testTextString(itemVal[0]); comp.testTextColor(-1); comp.testTextStyle(Typeface.BOLD); int[] cellColors = {-6987,-6987,-6987}; //Test each column for (int i=1; i<4; i++) { comp = new ElementTest(row.getChildAt(i)); comp.testIdName(itemId[i]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); comp.testBgGradientColor(cellColors); comp.testPadding(5); comp.testTextString(itemVal[i]); } } @Test public void check_03_TableRow_Properties() { //Check Layout Specification //Component properties value TableRow row = (TableRow) layout.getChildAt(1); String[] itemId = "tv21,tv22,tv23,tv24".split("\\,"); String[] itemVal = "Distance,1 Meter,39.3701 Inch,3.2808 feet".split("\\,"); //Test first column ElementTest comp = new ElementTest(row.getChildAt(0)); comp.testIdName(itemId[0]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); int[] headColors = {-47872,-47872,-47872}; comp.testBgGradientColor(headColors); comp.testPadding(5); comp.testTextString(itemVal[0]); comp.testTextColor(-1); comp.testTextStyle(Typeface.BOLD); int[] cellColors = {-6987,-6987,-6987}; //Test each column for (int i=1; i<4; i++) { comp = new ElementTest(row.getChildAt(i)); comp.testIdName(itemId[i]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); comp.testBgGradientColor(cellColors); comp.testPadding(5); comp.testTextString(itemVal[i]); } } @Test public void check_04_TableRow_Properties() { //Check Layout Specification //Component properties value TableRow row = (TableRow) layout.getChildAt(2); String[] itemId = "tv31,tv32,tv33,tv34".split("\\,"); String[] itemVal = "Weight,1 Kg,35.2740 ounce,2.2046 pound".split("\\,"); //Test first column ElementTest comp = new ElementTest(row.getChildAt(0)); comp.testIdName(itemId[0]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); int[] headColors = {-47872,-47872,-47872}; comp.testBgGradientColor(headColors); comp.testPadding(5); comp.testTextString(itemVal[0]); comp.testTextColor(-1); comp.testTextStyle(Typeface.BOLD); int[] cellColors = {-6987,-6987,-6987}; //Test each column for (int i=1; i<4; i++) { comp = new ElementTest(row.getChildAt(i)); comp.testIdName(itemId[i]); comp.testWidth(TableRow.LayoutParams.WRAP_CONTENT); comp.testHeight(TableRow.LayoutParams.WRAP_CONTENT); comp.testBgGradientColor(cellColors); comp.testPadding(5); comp.testTextString(itemVal[i]); } } }
ea41f7c71219cdae290b0c0ec4de9f28b9ff6919
1c5fe9dd466d225d763aa0d6e9939016875bb768
/src/trabajoPractico3/Buscador.java
b5afd8d7e9ebb2f98d77f1675117be20238a8a34
[]
no_license
riclops17/Concurrente
064d894d40c6380bc06840a799be1a35fc8bf94a
51f4517ab1a4262854c215b7214cbacb3fde0a07
refs/heads/master
2021-01-12T05:09:58.920921
2017-01-03T01:53:10
2017-01-03T01:53:10
77,874,158
0
0
null
null
null
null
UTF-8
Java
false
false
964
java
/* * 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. */ package trabajoPractico3; import java.util.concurrent.Semaphore; /** * * @author ricardo */ public class Buscador extends Thread{ private String nombre; private Lista l1; private Semaphore sem1; private Semaphore sem2; private Semaphore sem3; public Buscador(String n, Semaphore s1,Semaphore s2 ,Semaphore s3,Lista l){ this.nombre = n; this.sem1 = s1; this.sem2 = s2; this.sem3 = s3; this.l1 = l; } public void run(){ try{ this.l1.empezarBuscar(); //Thread.sleep(1000); this.l1.buscar(); this.l1.terminarBuscar(); }catch(InterruptedException ex){ } } }
[ "ricardo@vaiorick" ]
ricardo@vaiorick
28eb8692e2636b171197b9f4a15e4821258fe977
5c36a4a1f3203ba4b8f786e05d4ea9ed1c76c0cc
/src/main/java/com/zsoft/web/rest/ConfigResource.java
d237f87ba14d8075eebe7cb14ce19f617c29ee59
[]
no_license
BochraS/SmartHome2
98ceab6b8b6646b98df47fadc5726646dd5ea635
862bfec1eeb7810ad3d08df2723bf2e4f0ba086f
refs/heads/master
2020-04-27T08:24:11.899369
2019-03-06T16:14:53
2019-03-06T16:14:53
174,169,925
0
0
null
null
null
null
UTF-8
Java
false
false
4,989
java
package com.zsoft.web.rest; import com.codahale.metrics.annotation.Timed; import com.zsoft.service.ConfigService; import com.zsoft.web.rest.errors.BadRequestAlertException; import com.zsoft.web.rest.util.HeaderUtil; import com.zsoft.service.dto.ConfigDTO; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; import java.util.stream.StreamSupport; import static org.elasticsearch.index.query.QueryBuilders.*; /** * REST controller for managing Config. */ @RestController @RequestMapping("/api") public class ConfigResource { private final Logger log = LoggerFactory.getLogger(ConfigResource.class); private static final String ENTITY_NAME = "config"; private final ConfigService configService; public ConfigResource(ConfigService configService) { this.configService = configService; } /** * POST /configs : Create a new config. * * @param configDTO the configDTO to create * @return the ResponseEntity with status 201 (Created) and with body the new configDTO, or with status 400 (Bad Request) if the config has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/configs") @Timed public ResponseEntity<ConfigDTO> createConfig(@RequestBody ConfigDTO configDTO) throws URISyntaxException { log.debug("REST request to save Config : {}", configDTO); if (configDTO.getId() != null) { throw new BadRequestAlertException("A new config cannot already have an ID", ENTITY_NAME, "idexists"); } ConfigDTO result = configService.save(configDTO); return ResponseEntity.created(new URI("/api/configs/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /configs : Updates an existing config. * * @param configDTO the configDTO to update * @return the ResponseEntity with status 200 (OK) and with body the updated configDTO, * or with status 400 (Bad Request) if the configDTO is not valid, * or with status 500 (Internal Server Error) if the configDTO couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/configs") @Timed public ResponseEntity<ConfigDTO> updateConfig(@RequestBody ConfigDTO configDTO) throws URISyntaxException { log.debug("REST request to update Config : {}", configDTO); if (configDTO.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } ConfigDTO result = configService.save(configDTO); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, configDTO.getId().toString())) .body(result); } /** * GET /configs : get all the configs. * * @return the ResponseEntity with status 200 (OK) and the list of configs in body */ @GetMapping("/configs") @Timed public List<ConfigDTO> getAllConfigs( long id) { log.debug("REST request to get all Configs"); return configService.findAll( id); } /** * GET /configs/:id : get the "id" config. * * @param id the id of the configDTO to retrieve * @return the ResponseEntity with status 200 (OK) and with body the configDTO, or with status 404 (Not Found) */ @GetMapping("/configs/{id}") @Timed public ResponseEntity<ConfigDTO> getConfig(@PathVariable Long id) { log.debug("REST request to get Config : {}", id); Optional<ConfigDTO> configDTO = configService.findOne(id); return ResponseUtil.wrapOrNotFound(configDTO); } /** * DELETE /configs/:id : delete the "id" config. * * @param id the id of the configDTO to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/configs/{id}") @Timed public ResponseEntity<Void> deleteConfig(@PathVariable Long id) { log.debug("REST request to delete Config : {}", id); configService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } /** * SEARCH /_search/configs?query=:query : search for the config corresponding * to the query. * * @param query the query of the config search * @return the result of the search */ @GetMapping("/_search/configs") @Timed public List<ConfigDTO> searchConfigs(@RequestParam String query) { log.debug("REST request to search Configs for query {}", query); return configService.search(query); } }
5d8ffc078da5640558a57811a41f36f2276ff739
419a853c41ab8c82d811573f33378cd2115ac945
/src/main/java/camely/camelHttp/HttpProducer.java
48ad0eaa70df47e3adb4b6dfe06415795dea288b
[]
no_license
retroryan/camelySample
18830089e9510c152a2b9dc94d2a80832cd5b2ee
7b437a5c4867387cb5620f6e4bca3eecf5afe64c
refs/heads/master
2018-12-31T06:12:06.877716
2013-08-18T03:58:04
2013-08-18T03:58:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package camely.camelHttp; import akka.actor.ActorRef; import akka.actor.Props; import akka.camel.CamelMessage; import akka.camel.javaapi.UntypedProducerActor; import org.apache.camel.Exchange; import java.util.HashSet; import java.util.Set; //#HttpExample public class HttpProducer extends UntypedProducerActor { private ActorRef transformer; public static Props mkProps(ActorRef transformer) { return Props.create(HttpProducer.class, transformer); } public HttpProducer(ActorRef transformer) { this.transformer = transformer; } public String getEndpointUri() { return "jetty://http://akka.io/?bridgeEndpoint=true"; } @Override public Object onTransformOutgoingMessage(Object message) { if (message instanceof CamelMessage) { CamelMessage camelMessage = (CamelMessage) message; Set<String> httpPath = new HashSet<String>(); httpPath.add(Exchange.HTTP_PATH); return camelMessage.withHeaders(camelMessage.getHeaders(httpPath)); } else return super.onTransformOutgoingMessage(message); } @Override public void onRouteResponse(Object message) { transformer.forward(message, getContext()); } } //#HttpExample
af4d1952c2461e00899faccff94dff886f29411f
8aefee1609bb581dabbb972740fed17a91047810
/src/org/zwobble/shed/compiler/modules/Module.java
002992fbef4d385dff31f378950c3b08eed731a2
[]
no_license
mwilliamson/shed
24013de71af53b0238f0bef11296fba0a8d75254
65fef492344f5effd68356a353b760abcda09d1d
refs/heads/master
2020-12-24T15:22:58.130607
2012-02-12T15:50:39
2012-02-12T15:50:39
1,815,372
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package org.zwobble.shed.compiler.modules; import org.zwobble.shed.compiler.naming.FullyQualifiedName; import org.zwobble.shed.compiler.parsing.nodes.Declaration; public interface Module { Declaration getDeclaration(); FullyQualifiedName getName(); }
46bc665cd9ac52d686b201ab1a12f3fde4e50a6d
03390ba6de5053db85daf0a0de09c289cdbe3528
/app/src/main/java/com/sardinecorp/blissapplication/network/APIStatus.java
1e08a268fa180ecef59172e508a4a9a7d5afd6dc
[]
no_license
Vanethos/BlissApplication
12deed4d65eecca301b5b6ea446a83feb6dbc169
ce498c19a52e412c46c728664f12d5ddc5f7b4f2
refs/heads/master
2021-01-01T17:19:19.355046
2017-07-25T22:28:07
2017-07-25T22:28:07
98,041,506
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.sardinecorp.blissapplication.network; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class APIStatus { @SerializedName("status") @Expose private String status; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
635915ac931a65b526c9b6c344fc9e551610d632
0a005adcad4af8958a99396f1a2318e91c1e11c3
/src/main/java/db/entities/Animal.java
58801619b4c083ccb63b625587a165b5643eca90
[]
no_license
MeganDorian/Zoo_DB
151d9255b03b16798f78c7bf383850e86a04e4bf
9adfec1d178924ef1278405be6647306e05dd684
refs/heads/master
2022-11-17T21:54:07.712522
2020-06-24T20:18:27
2020-06-24T20:18:27
274,632,949
0
0
null
null
null
null
UTF-8
Java
false
false
47
java
package db.entities; public class Animal { }
db73cbc19a707e739bebfe7a6291aa5e8bd6c24d
f34ce1f72db83896c1c94de378f04c53d1c08c33
/app/src/main/java/com/example/etoolroom/NoteAdapter.java
22c3ea6be1a3d6922908a5652ebd2fe7ee7d07ba
[]
no_license
dhanuvanth/ds_eToolRoom
1e7809fa090063250c508372e9d8970e9aa8bb14
bbac8fd45f464a1c7be536311f68baed0101bb05
refs/heads/master
2020-09-11T21:34:51.929372
2019-11-17T04:35:24
2019-11-17T04:35:24
222,197,270
0
0
null
null
null
null
UTF-8
Java
false
false
6,821
java
package com.example.etoolroom; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Filter; import android.widget.Filterable; import android.widget.TextView; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.QueryDocumentSnapshot; import com.google.firebase.firestore.QuerySnapshot; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class NoteAdapter extends RecyclerView.Adapter<NoteAdapter.NoteHolder> implements Filterable { private Context mContext; private FirebaseFirestore db = FirebaseFirestore.getInstance(); private String htime; private String hdate; private String cdate; private String ctime; private String tool = null; private String plant = null; private String extr = null; private String size = null; private String radio = null; private String remarks1; private String remarks2; private String docId; private List<CardList> mCardlist; private List<CardList> mCardlistFull; NoteAdapter(List<CardList> cardList, Context context) { mCardlist = cardList; mContext = context; mCardlistFull = new ArrayList<>(cardList); } @NonNull @Override public NoteHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cardview_list, viewGroup, false); return new NoteHolder(v); } @SuppressLint("SetTextI18n") @Override public void onBindViewHolder(@NonNull NoteHolder noteHolder, int i) { final CardList cardList; cardList = mCardlist.get(i); noteHolder.itemID.setText("ID :" + cardList.getID()); noteHolder.itemSize.setText("Size :" + cardList.getSize()); noteHolder.itemPlant.setText("Plant :" + cardList.getPlant()); noteHolder.setItemClickListener(new ItemClickListener() { @Override public void OnClick(View v, int position) { db.collection("toolroomItems").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() { @Override public void onSuccess(QuerySnapshot queryDocumentSnapshots) { for (QueryDocumentSnapshot queryDocument : queryDocumentSnapshots) { Note note = queryDocument.toObject(Note.class); note.setDocumentId(queryDocument.getId()); docId = note.getDocumentId(); if (docId.equals(cardList.getID())) { tool = note.getTool_txt(); plant = note.getPlant_txt(); extr = note.getExtr_txt(); size = note.getSize(); radio = note.getRadio(); hdate = note.getHdate(); htime = note.getHtime(); cdate = note.getCdate(); ctime = note.getCtime(); remarks1 = note.getRemarks1(); remarks2 = note.getRemarks2(); } } AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage("ID : " + cardList.getID() + "\n\n" + "Tool : " + tool + "\n\n" + "Type : " + radio + "\n\n" + "Size : " + size + "\n\n" + "Plant : " + plant + "\n\n" + "Extr : " + extr + "\n\n" + "Handed over Date : " + hdate + "\n\n" + "Handed over Time : " + htime + "\n\n" + "Commitment Date : " + cdate + "\n\n" + "Commitment Time : " + ctime + "\n\n" + "Tool Room Remark : " + remarks1 + "\n\n" + "Manufacturing Remark : " + remarks2 ).setCancelable(true).create().show(); } }); } }); } @Override public int getItemCount() { return mCardlist.size(); } @Override public Filter getFilter() { return filtedList; } private Filter filtedList = new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { List<CardList> filtedItems = new ArrayList<>(); if (constraint == null || constraint.length() == 0) { filtedItems.addAll(mCardlistFull); } else { String filterPattern = constraint.toString().toLowerCase().trim(); for (CardList list : mCardlistFull) { if (list.getSize().toLowerCase().contains(filterPattern) || list.getPlant().toLowerCase().contains(filterPattern)) { filtedItems.add(list); } } } FilterResults results = new FilterResults(); results.values = filtedItems; return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { mCardlist.clear(); mCardlist.addAll((List) results.values); notifyDataSetChanged(); Collections.reverse( mCardlist); } }; class NoteHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView itemID; private TextView itemSize; private TextView itemPlant; private ItemClickListener itemClickListener; NoteHolder(@NonNull View itemView) { super(itemView); itemID = itemView.findViewById(R.id.card_id); itemSize = itemView.findViewById(R.id.card_size); itemPlant = itemView.findViewById(R.id.card_plant); itemView.setOnClickListener(this); } void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } @Override public void onClick(View v) { itemClickListener.OnClick(v, getAdapterPosition()); } } }
a03dfade031fd00fbb90af42713dd67bdc9be9c6
6f5980157d734eb0638b836faf0a7818f59bebde
/cronner-core/src/main/java/cronner/jfaster/org/model/JsonResponse.java
4e44776ec5f2700253e0d60ebb49d84cb558ad5a
[]
no_license
gongzishuye/cronner
f83c8aac550ab293ea5baf90d48d22d533a12b90
1d8db1d7eeebd883984ef97e29a88b0da5aed03d
refs/heads/master
2021-07-03T03:06:34.379878
2017-09-22T10:21:13
2017-09-22T10:21:13
104,467,587
1
0
null
2017-09-22T11:35:20
2017-09-22T11:35:20
null
UTF-8
Java
false
false
2,379
java
package cronner.jfaster.org.model; import java.io.Serializable; /** * json 统一返回 * * @author fangyanpeng */ public class JsonResponse implements Serializable { private static final long serialVersionUID = -4761871227325502579L; public static final Integer OK = 200; public static final Integer REDIRECT = 302; public static final Integer ERR = 500; public static final JsonResponse NEED_LOGIN = JsonResponse.notOk(403, "用户未登录"); public static final JsonResponse AUTH_FAIL = JsonResponse.notOk(401, "认证失败"); public static final JsonResponse PARAM_MISSING = JsonResponse.notOk(400, "参数缺失"); public static final JsonResponse SERVER_ERR = JsonResponse.notOk(ERR, "服务器异常"); /** * 响应码 */ private Integer status; /** * 错误信息 */ private Object err; /** * 响应数据 */ private Object data; public static JsonResponse ok(){ JsonResponse r = new JsonResponse(); r.status = OK; return r; } public static JsonResponse ok(Object data){ JsonResponse r = new JsonResponse(); r.status = OK; r.data = data; return r; } public static JsonResponse notOk(Object err){ JsonResponse r = new JsonResponse(); r.status = ERR; r.err = err; return r; } public static JsonResponse notOk(Integer status, Object err){ JsonResponse r = new JsonResponse(); r.status = status; r.err = err; return r; } public static JsonResponse redirect(String url){ JsonResponse r = new JsonResponse(); r.status = REDIRECT; r.data = url; return r; } public Integer getStatus() { return status; } public Object getErr() { return err; } public void setErr(Object err) { this.err = err; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public Boolean isSuccess(){ return status.intValue() == OK.intValue(); } @Override public String toString() { return "JsonResponse{" + "status=" + status + ", err=" + err + ", data=" + data + '}'; } }
1c524def27c9b6301ab1d118d3cfb698ad7e4c0f
29451e19a421e011c36a2b140893319ddc34f7e1
/新的提交/ui/Frmadmin_add_manjian.java
5e11c567359337cba7eed096721ce262c17d5b4c
[]
no_license
xqdxzs/ttcp
dbd1dee34988ddf0b984ebbd618ca245d318a971
7e721fbc3686c3074824cdb74edaf71a6beed4e0
refs/heads/master
2022-11-15T21:46:37.878127
2020-07-14T01:13:59
2020-07-14T01:13:59
276,770,681
1
0
null
null
null
null
UTF-8
Java
false
false
3,267
java
package cn.edu.zucc.ttcp.ui; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import cn.edu.zucc.ttcp.ttcpUtil; import cn.edu.zucc.ttcp.util.BaseException; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.JButton; public class Frmadmin_add_manjian extends JFrame implements ActionListener{ private JPanel contentPane; private JTextField textField = new JTextField();; private JTextField textField_1 = new JTextField();; private JTextField textField_2 = new JTextField();; private JButton button = new JButton("确认添加"); private JButton button_1 = new JButton("退出"); private JRadioButton rdbtnNewRadioButton = new JRadioButton("可叠加优惠券"); private Object textField_3; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Frmadmin_add_manjian frame = new Frmadmin_add_manjian(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Frmadmin_add_manjian() { //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 375, 295); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel label = new JLabel("输入需要添加满减方案的商家序号:"); label.setBounds(14, 24, 304, 27); contentPane.add(label); textField.setBounds(266, 25, 86, 24); contentPane.add(textField); textField.setColumns(10); JLabel label_1 = new JLabel("满足满减的初始金额:"); label_1.setBounds(14, 64, 153, 24); contentPane.add(label_1); textField_1.setBounds(266, 64, 86, 24); contentPane.add(textField_1); textField_1.setColumns(10); JLabel label_2 = new JLabel("优惠金额:"); label_2.setBounds(14, 109, 153, 18); contentPane.add(label_2); rdbtnNewRadioButton.setBounds(108, 136, 187, 52); contentPane.add(rdbtnNewRadioButton); textField_2.setBounds(266, 101, 86, 24); contentPane.add(textField_2); textField_2.setColumns(10); button.setBounds(14, 197, 113, 27); contentPane.add(button); button.addActionListener(this); button_1.setBounds(206, 197, 113, 27); contentPane.add(button_1); button_1.addActionListener(this); } @Override public void actionPerformed(ActionEvent arg0) { if(arg0.getSource() == this.button) { int diejia=0; if (rdbtnNewRadioButton.isSelected()) diejia=1; try { ttcpUtil.adminshangjiaguanli.addmanjian(Integer.valueOf(this.textField.getText()), Integer.valueOf(this.textField_1.getText()),Integer.valueOf(this.textField_2.getText()),diejia); } catch (NumberFormatException | BaseException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setVisible(false); } else if(arg0.getSource() == this.button_1) { this.setVisible(false); } } }
2ec078e4ab3a3df6abf094eee93b43cb026991c7
85939aea2340dabb85b51e377f75c58ddac19085
/app/src/main/java/cn/dictionary/app/dictionary/view/ResultFragment.java
214d966d4ebb233049e91dc210dd6371f26cd033
[ "Apache-2.0" ]
permissive
LinYaoTian/Dictionary
92d19180ba73c8d00458337193e71d57ca12856d
3b11d697bbd89188eb8f9f5f3d47975f910f6a81
refs/heads/master
2020-03-18T05:54:44.252904
2018-05-22T05:58:23
2018-05-22T05:58:23
134,367,307
1
0
null
null
null
null
UTF-8
Java
false
false
15,356
java
package cn.dictionary.app.dictionary.view; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import cn.dictionary.app.dictionary.R; import cn.dictionary.app.dictionary.config.Broadcast; import cn.dictionary.app.dictionary.service.WordService; import cn.dictionary.app.dictionary.db.SearchRecordDao; import cn.dictionary.app.dictionary.db.WordBookDao; import cn.dictionary.app.dictionary.entity.Words; import cn.dictionary.app.dictionary.ui.RecordAndResultActivity; import cn.dictionary.app.dictionary.utils.NetWorkUtil; import cn.dictionary.app.dictionary.utils.WordUtil; import static cn.dictionary.app.dictionary.service.WordService.sWord; /** * */ public class ResultFragment extends Fragment implements View.OnClickListener { private View view; private Activity activity; private Words mWord = null;//存放单词数据的实例 private ImageButton mAddWord;//添加单词的按钮 private MediaPlayer mUK_MP = null;//播放英式发音 private MediaPlayer mUS_MP = null;//播放美式发音 private WordServiceCompleteReceiver mWordServiceCompleteReceiver;//查询单词完毕的广播 private WordServiceisNullReceiver mWordServiceisNullReceiver;//查询不到输入的词汇 private Intent startIntent;//开启查词后台服务的广播 @Override public void onAttach(Context context) { super.onAttach(context); activity = getCurrentActivity(); IntentFilter mWordServiceCompleteIntent = new IntentFilter(Broadcast.WORDSERVICECOMPLETE); IntentFilter mWordServiceisNullIntent = new IntentFilter(Broadcast.WORDSERVICEISNULL); mWordServiceCompleteReceiver = new WordServiceCompleteReceiver(); mWordServiceisNullReceiver = new WordServiceisNullReceiver(); activity.registerReceiver(mWordServiceCompleteReceiver, mWordServiceCompleteIntent); activity.registerReceiver(mWordServiceisNullReceiver, mWordServiceisNullIntent); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_result, container, false); initView(); initEvent(); return view; } @Override public void onPause() { super.onPause(); if (mUK_MP != null) { mUK_MP.release(); } if (mUS_MP != null) { mUS_MP.release(); } } @Override public void onDestroy() { super.onDestroy(); activity.unregisterReceiver(mWordServiceCompleteReceiver); activity.unregisterReceiver(mWordServiceisNullReceiver); } /** * 获取与碎片相关的Activity * * @return 与碎片相关的Activity */ public Activity getCurrentActivity() { RecordAndResultActivity activity = (RecordAndResultActivity) getActivity(); return activity; } /** * 初始化UI控件 */ private void initView() { mAddWord = (ImageButton) view.findViewById(R.id.im_addWord); } /** * 初始化事件 */ private void initEvent() { mAddWord.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.im_addWord: if (WordBookDao.getInstance().queryWord(mWord.getQuery()) == null) { WordUtil.saveWordToWordBook(mWord); mAddWord.setBackgroundResource(R.drawable.im_addsuccess); } else { WordUtil.deleteWordFromWordBook(mWord); mAddWord.setBackgroundResource(R.drawable.im_addword); } break; } } /** * 对用户输入值进行转码并判断本地是否已有此单词 * 若有,则直接使用本地的数据 * 否则,发送查词请求 * @param input 用户输入的关键词 */ public void handleInput(String input) { input = deleteContinuousSpace(input); //查询记录中是否存在此单词 Words wr = SearchRecordDao.getInstance().queryWord(input); if (wr == null) { //有时候服务器返回查询值的与输入值不相等,例如小写变成大写,这里进行判断处理 wr = SearchRecordDao.getInstance().queryWord(input.toUpperCase()); if (wr == null) { //有时候服务器返回查询值的与输入值不相等,例如小写变成大写,这里进行判断处理 wr = SearchRecordDao.getInstance().queryWord(input.toLowerCase()); } } if (wr != null) { //本地有记录,直接显示 showData(wr); //赋值给mWord,以便用户对它进行加入生词本和从生词本中删除等操作 mWord = wr; return; } //查询单词本中是否存在此单词 Words wwb = WordBookDao.getInstance().queryWord(input); if (wwb == null) { wwb = SearchRecordDao.getInstance().queryWord(input.toUpperCase()); if (wwb == null) { wwb = SearchRecordDao.getInstance().queryWord(input.toLowerCase()); } } if (wwb != null) { //单词本中存在,直接显示 showData(wwb); //赋值给mWord,以便用户对它进行加入生词本和从生词本中删除等操作 mWord = wwb; WordUtil.saveWordToRecord(wwb); return; } //单词本和搜索记录中都不存在,则进行联网查词 if (NetWorkUtil.hasNetwork()) { //对用户输入的数据进行转码 try { input = URLEncoder.encode(input, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } startIntent = new Intent(activity, WordService.class); startIntent.putExtra("input", input); activity.startService(startIntent); } else { Toast.makeText(activity, "网络不可用!", Toast.LENGTH_SHORT).show(); } } /** * 删除字符串中的连续空格 */ private String deleteContinuousSpace(String input) { input=input.trim(); int num = 0;//空格重复的次数 int length = input.length(); for (int i = 0; i < length - 2; i++) { if (input.charAt(i) == ' ' && input.charAt(i) == input.charAt(i + 1)) { int j = i; do { num++; j++; } while (input.charAt(j) == input.charAt(j - 1)); input = input.substring(0, i + 1) + input.substring(j); length -= num; num = 0; } } return input; } /** * 若用户输入第一个字母是否为为英文,若是则显示单词本添加键 * * @param input 用户的输入值 */ private void isShowAddBtn(String input) { for (char c : input.toCharArray()) { if (c >= 0x4E00 && c <= 0x9FA5) { //包含中文,直接不显示添加单词本的按钮 return; } } //进一步判断是否显示添加单词的按钮 isExist(input); } /** * 判断单词本中是否存在该单词 * 若不存在,则显示添加按钮,存在,则更新按钮图片 * * @param input 用户输入的值 */ private void isExist(String input) { if (WordBookDao.getInstance().queryWord(input) != null) { //显示单词本控件 mAddWord.setBackgroundResource(R.drawable.im_addsuccess); mAddWord.setVisibility(View.VISIBLE); } else { mAddWord.setVisibility(View.VISIBLE); } } /** * 显示单词数据 * * @param word 装有数据的单词实例 */ public void showData(Words word) { //判断添加单词按钮的状态 isShowAddBtn(word.getQuery()); //关键字 if (word.getQuery() != null) { TextView query = (TextView) view.findViewById(R.id.tv_query); query.setText(word.getQuery()); } //有道翻译 if (word.getTranslation() != null) { view.findViewById(R.id.layout_translation).setVisibility(View.VISIBLE); TextView translation = (TextView) view.findViewById(R.id.tv_translation); translation.setText(word.getTranslation()); } else { view.findViewById(R.id.layout_translation).setVisibility(View.GONE); } //英式音标 if (word.getUk_phonetic() != null) { view.findViewById(R.id.layout_speech_Phonetic).setVisibility(View.VISIBLE); view.findViewById(R.id.uk).setVisibility(View.VISIBLE); TextView uk_phonetic = (TextView) view.findViewById(R.id.tv_uk_phonetic); uk_phonetic.setVisibility(View.VISIBLE); uk_phonetic.setText(word.getUk_phonetic()); } else { view.findViewById(R.id.uk).setVisibility(View.GONE); view.findViewById(R.id.tv_uk_phonetic).setVisibility(View.GONE); } //英式发音 if (word.getUk_speech() != null) { view.findViewById(R.id.layout_speech_Phonetic).setVisibility(View.VISIBLE); final ImageButton uk_speech = (ImageButton) view.findViewById(R.id.im_uk_speech); uk_speech.setVisibility(View.VISIBLE); mUK_MP = new MediaPlayer(); try { mUK_MP.setDataSource(word.getUk_speech()); mUK_MP.prepare(); } catch (IOException e) { e.printStackTrace(); } uk_speech.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mUK_MP.start(); } }); uk_speech.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: uk_speech.setBackgroundResource(R.drawable.im_voice_pressed); break; case MotionEvent.ACTION_UP: uk_speech.setBackgroundResource(R.drawable.im_voice_normal); break; } return false; } }); } else { view.findViewById(R.id.im_uk_speech).setVisibility(View.GONE); view.findViewById(R.id.layout_speech_Phonetic).setVisibility(View.GONE); } //美式音标 if (word.getUs_phonetic() != null) { view.findViewById(R.id.layout_speech_Phonetic).setVisibility(View.VISIBLE); view.findViewById(R.id.us).setVisibility(View.VISIBLE); TextView us_phonetic = (TextView) view.findViewById(R.id.tv_us_phonetic); us_phonetic.setVisibility(View.VISIBLE); us_phonetic.setText(word.getUs_phonetic()); } else { view.findViewById(R.id.us).setVisibility(View.GONE); view.findViewById(R.id.tv_us_phonetic).setVisibility(View.GONE); } //美式发音 if ((word.getUs_speech() != null) && (word.getUs_phonetic() != null)) { view.findViewById(R.id.layout_speech_Phonetic).setVisibility(View.VISIBLE); final ImageButton us_speech = (ImageButton) view.findViewById(R.id.im_us_speech); us_speech.setVisibility(View.VISIBLE); mUS_MP = new MediaPlayer(); try { mUS_MP.setDataSource(word.getUs_speech()); mUS_MP.prepare(); } catch (IOException e) { e.printStackTrace(); } us_speech.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mUS_MP.start(); } }); us_speech.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: us_speech.setBackgroundResource(R.drawable.im_voice_pressed); break; case MotionEvent.ACTION_UP: us_speech.setBackgroundResource(R.drawable.im_voice_normal); break; } return false; } }); } else { view.findViewById(R.id.im_us_speech).setVisibility(View.GONE); } //基本释义 if (word.getExplainsAfterDeal() != null) { view.findViewById(R.id.layout_explains).setVisibility(View.VISIBLE); TextView explains = (TextView) view.findViewById(R.id.tv_explains); //传入拼接处理后的基本释义 explains.setText(word.getExplainsAfterDeal()); } else { view.findViewById(R.id.layout_explains).setVisibility(View.GONE); } //网络释义 if (word.getWebsAfterDeal() != null) { view.findViewById(R.id.layout_web).setVisibility(View.VISIBLE); TextView webs = (TextView) view.findViewById(R.id.tv_web); //传入拼接处理后的网络释义 webs.setText(word.getWebsAfterDeal()); } else { view.findViewById(R.id.layout_web).setVisibility(View.GONE); } } /** * 查询单词完毕的广播 */ private class WordServiceCompleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { activity.stopService(startIntent); mWord = sWord; showData(mWord); } } /** * 查询不到输入的词汇的广播 */ private class WordServiceisNullReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { activity.stopService(startIntent); TextView tv = (TextView) view.findViewById(R.id.tv_query); tv.setText("找不到该词汇!"); } } }
6632bb530ee274da6ba05285a5117f35bb331a9b
d5580c3e4335956882af312d509af9388daa31fd
/code/src/main/java/com/smtboy/news/pojo/NewsProgram.java
404c2d12f9005c07f8b6fa8ff88eb98fee214188
[]
no_license
76hw/NewsCMS
019bd216ba3611f5a80f26c17ccb16a7823c6f33
96b3a562aaedadeaeabcf3a7b594644f1e01f459
refs/heads/master
2022-07-18T18:49:55.652598
2020-05-24T11:50:19
2020-05-24T11:50:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,062
java
package com.smtboy.news.pojo; import java.util.Date; public class NewsProgram { private Integer id; private String name; private Date createTime; private Date updateTime; public NewsProgram(Integer id, String name, Date createTime, Date updateTime) { this.id = id; this.name = name; this.createTime = createTime; this.updateTime = updateTime; } public NewsProgram() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }