blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
282c00ff180699d43a241406697047b9bf418dce
fbd488cc4e418229c3c8e3f2c26650c7cfb25870
/src/instanceof_use/B.java
d1cffdf359d1766660f9d06461b774468fccea41
[]
no_license
SvenPowerX-Java/J8_013_io_and_applet
828e46a8bdeae06b70358848d853633a8a48424e
d70e1c731e9f7274fe5dae4d80829348a13a6275
refs/heads/master
2021-08-23T05:14:19.190103
2017-12-03T15:18:45
2017-12-03T15:18:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
55
java
package instanceof_use; public class B { int i, j; }
d52ec1a138e6a2af0326104f37456e3fa3dcc91a
017ceb8b046e7bf506ab99c2141a2dac320bbc03
/packages/SettingsLib/tests/robotests/src/com/android/settingslib/notification/EnableZenModeDialogTest.java
ccd2f538c731632be1c0c679ecccd839598662dc
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
MoKee/android_frameworks_base
76e5c49286c410592f61999022afffeb18350bf3
e1938150d35b241ff1b14752a084be74415c06a9
refs/heads/mkp
2023-01-07T00:46:20.820046
2021-07-30T16:00:28
2021-07-30T16:00:28
9,896,797
38
88
NOASSERTION
2020-12-06T18:22:34
2013-05-06T20:59:57
Java
UTF-8
Java
false
false
8,240
java
/* * Copyright (C) 2018 The Android Open Source Project * * 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.android.settingslib.notification; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import android.app.Fragment; import android.app.NotificationManager; import android.content.Context; import android.content.res.Resources; import android.net.Uri; import android.service.notification.Condition; import android.view.LayoutInflater; import com.android.settingslib.SettingsLibRobolectricTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; @RunWith(SettingsLibRobolectricTestRunner.class) public class EnableZenModeDialogTest { private EnableZenModeDialog mController; @Mock private Context mContext; @Mock private Resources mResources; @Mock private Fragment mFragment; @Mock private NotificationManager mNotificationManager; private Context mShadowContext; private LayoutInflater mLayoutInflater; private Condition mCountdownCondition; private Condition mAlarmCondition; @Before public void setup() { MockitoAnnotations.initMocks(this); mShadowContext = RuntimeEnvironment.application; when(mContext.getApplicationContext()).thenReturn(mContext); when(mContext.getResources()).thenReturn(mResources); when(mFragment.getContext()).thenReturn(mShadowContext); mLayoutInflater = LayoutInflater.from(mShadowContext); mController = spy(new EnableZenModeDialog(mContext)); mController.mContext = mContext; mController.mLayoutInflater = mLayoutInflater; mController.mForeverId = Condition.newId(mContext).appendPath("forever").build(); when(mContext.getString(com.android.internal.R.string.zen_mode_forever)) .thenReturn("testSummary"); NotificationManager.Policy alarmsEnabledPolicy = new NotificationManager.Policy( NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS, 0, 0, 0); doReturn(alarmsEnabledPolicy).when(mNotificationManager).getNotificationPolicy(); mController.mNotificationManager = mNotificationManager; mController.getContentView(); // these methods use static calls to ZenModeConfig which would normally fail in robotests, // so instead do nothing: doNothing().when(mController).bindGenericCountdown(); doReturn(null).when(mController).getTimeUntilNextAlarmCondition(); doReturn(0L).when(mController).getNextAlarm(); doNothing().when(mController).bindNextAlarm(any()); // as a result of doing nothing above, must bind manually: Uri alarm = Condition.newId(mContext).appendPath("alarm").build(); mAlarmCondition = new Condition(alarm, "alarm", "", "", 0, 0, 0); Uri countdown = Condition.newId(mContext).appendPath("countdown").build(); mCountdownCondition = new Condition(countdown, "countdown", "", "", 0, 0, 0); mController.bind(mCountdownCondition, mController.mZenRadioGroupContent.getChildAt( EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX), EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX); mController.bind(mAlarmCondition, mController.mZenRadioGroupContent.getChildAt( EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX), EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX); } @Test public void testForeverChecked() { mController.bindConditions(mController.forever()); assertTrue(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt( EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked()); } @Test public void testNoneChecked() { mController.bindConditions(null); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt( EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked()); } @Test public void testAlarmChecked() { doReturn(false).when(mController).isCountdown(mAlarmCondition); doReturn(true).when(mController).isAlarm(mAlarmCondition); mController.bindConditions(mAlarmCondition); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb .isChecked()); assertTrue(mController.getConditionTagAt( EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked()); } @Test public void testCountdownChecked() { doReturn(false).when(mController).isAlarm(mCountdownCondition); doReturn(true).when(mController).isCountdown(mCountdownCondition); mController.bindConditions(mCountdownCondition); assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb .isChecked()); assertTrue(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb .isChecked()); assertFalse(mController.getConditionTagAt( EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked()); } @Test public void testNoAlarmWarning() { // setup alarm long now = System.currentTimeMillis(); doReturn(now + 100000).when(mController).getNextAlarm(); doReturn("").when(mController).getTime(anyLong(), anyLong()); // allow alarms when(mNotificationManager.getNotificationPolicy()).thenReturn( new NotificationManager.Policy( NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS, 0, 0, 0)); // alarm warning should be null assertNull(mController.computeAlarmWarningText(null)); } @Test public void testAlarmWarning() { // setup alarm long now = System.currentTimeMillis(); doReturn(now + 1000000).when(mController).getNextAlarm(); doReturn("").when(mController).getTime(anyLong(), anyLong()); // don't allow alarms to bypass dnd when(mNotificationManager.getNotificationPolicy()).thenReturn( new NotificationManager.Policy(0, 0, 0, 0)); // return a string if mResources is asked to retrieve a string when(mResources.getString(anyInt(), anyString())).thenReturn(""); // alarm warning should NOT be null assertNotNull(mController.computeAlarmWarningText(null)); } }
4b8da17c762badf40151d9ccfa82c4eb1dd99d2b
ec385ccc5b07248b9ae2c3841d49c6fe063889d6
/src/main/java/com/freedy/principles/openClose/AbstractSkin.java
06abca8fb3a86c27e0c28825806e905db8d34d45
[]
no_license
Freedy001/design-pattern
40b7c6d783396edb1c07b023d5a40d250ad97bc9
a45c55ee1705857565e5039cb0e4387684335167
refs/heads/master
2023-05-31T15:08:09.122711
2021-07-13T02:48:20
2021-07-13T02:48:20
378,608,168
1
0
null
null
null
null
UTF-8
Java
false
false
167
java
package com.freedy.principles.openClose; /** * @author Freedy * @date 2021/6/6 22:43 */ public abstract class AbstractSkin { public abstract void display(); }
6481f785615d33efaa0397c5f7ed4beeddffbdbb
5f75fa1ea11752435ae023bf197a30aaef531385
/demo-2/src/test/java/com/gaurav/Demo2ApplicationTests.java
4d7be9082bbed7cd70fa2502ba67770afead88cf
[]
no_license
kesagaurav/spring-boot
4d3acf7fbefaa1318f129b9fb23972c19c7306a4
2981e9353c7191958484a0328ad2ac9ff85eb2f9
refs/heads/master
2023-08-18T09:32:55.533272
2021-10-19T22:25:22
2021-10-19T22:25:22
418,873,324
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package com.gaurav; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class Demo2ApplicationTests { @Test void contextLoads() { } }
8342caaf888e86e86ee4e0e5313621d3bf8c7c0c
f507f6bcf05ebf9ef6aad3f92efacc9044c80f7c
/src/main/java/com/expertzlab/yieldmanagement/fileutils/PriceRandomizer.java
abbd0a9a2e32626312c45b4513271c977356e5c9
[]
no_license
genexpertz/yieldmanagement
915ccd62764faf22e1e5e7d4b4fe1aec40745a31
5fd568246ddd103a7f58ed433fd7f64b9242537d
refs/heads/master
2021-09-07T11:39:36.625578
2018-02-22T12:25:21
2018-02-22T12:25:21
103,485,237
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
package com.expertzlab.yieldmanagement.fileutils; import java.util.Random; /** * Created by gireeshbabu on 26/09/17. */ public class PriceRandomizer { int maxOwnerPrice = 15000; int threshodForCompProp = 2000; Random random = new Random(15000); public PriceRandomizer(){ } public int getOwnerPrice(){ return random.nextInt(maxOwnerPrice); } public int getCompPropPrice(int owerPrice){ int posORneg = (Math.random() < .5) ? -1 : 1; int newprice = owerPrice + posORneg * random.nextInt(threshodForCompProp); if(newprice < 0){ newprice = newprice * -1 + 2000; } return newprice; } }
646699f0ca259facedd2dab4b26ec973aec7f475
ed60b60073048951fd12b2cd77b834f4d84213e4
/app/src/main/java/com/xmyunyou/wcd/photoview/gestures/OnGestureListener.java
b000151967e1f9da7d482269a76e746ca26f36f5
[]
no_license
jimohuishangyin/myproject
3e46612bf1b855278d6f1d582ddb7c237aff3df3
af46ef716b00bec02b6bd9a1fc56a7dd8d701960
refs/heads/master
2021-01-23T15:50:58.448991
2015-04-17T09:39:20
2015-04-17T09:39:20
34,107,049
0
0
null
null
null
null
UTF-8
Java
false
false
1,069
java
/******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * 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.xmyunyou.wcd.photoview.gestures; public interface OnGestureListener { public void onDrag(float dx, float dy); public void onFling(float startX, float startY, float velocityX, float velocityY); public void onScale(float scaleFactor, float focusX, float focusY); }
ba24fec0a1487b8a815cebaff526135b51e98dcd
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14152-5-20-PESA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/hibernate/query/HqlQueryExecutor_ESTest_scaffolding.java
745afea904d5190b4f044c8635fe2f4366837a44
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
3,784
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Apr 02 13:28:31 UTC 2020 */ package com.xpn.xwiki.store.hibernate.query; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import static org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class HqlQueryExecutor_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HqlQueryExecutor_ESTest_scaffolding.class.getClassLoader() , "com.xpn.xwiki.XWikiException", "org.xwiki.security.authorization.Right", "org.xwiki.component.phase.Initializable", "org.xwiki.query.QueryException", "org.xwiki.query.QueryFilter", "org.xwiki.query.Query", "org.xwiki.query.internal.CountDocumentFilter", "org.xwiki.component.annotation.Component", "org.xwiki.model.reference.EntityReference", "org.hibernate.Session", "com.xpn.xwiki.store.XWikiStoreInterface", "org.xwiki.security.authorization.RightDescription", "org.xwiki.component.phase.InitializationException", "org.xwiki.security.authorization.ContextualAuthorizationManager", "com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor", "org.xwiki.query.internal.AbstractQueryFilter", "org.xwiki.component.annotation.Role", "org.xwiki.query.internal.DefaultQuery", "org.hibernate.Query", "org.xwiki.query.SecureQuery", "com.xpn.xwiki.store.XWikiHibernateBaseStore$HibernateCallback", "org.xwiki.context.Execution", "org.xwiki.query.QueryExecutor", "com.xpn.xwiki.store.XWikiHibernateStore", "org.xwiki.security.authorization.AuthorizationException", "com.xpn.xwiki.store.hibernate.HibernateSessionFactory", "org.xwiki.security.authorization.AccessDeniedException", "com.xpn.xwiki.XWikiContext", "com.xpn.xwiki.store.XWikiHibernateBaseStore", "org.xwiki.job.event.status.JobProgressManager" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("org.xwiki.security.authorization.ContextualAuthorizationManager", false, HqlQueryExecutor_ESTest_scaffolding.class.getClassLoader())); } }
cec937cb2c61f403b8be8f71ebbb72f02221de70
56b2c0a62a137e770b4d0f22c294111c71d177a3
/src/com/ugent/eventplanner/models/ConfirmationMessageContainer.java
a0ba6f12b5d3d994b5b0c0b936c7d172a70d030a
[]
no_license
jan-verm/Eventplanner
92e345c9fbecedbc2e9250e772e5ab11298996a7
8201ad7f136ccda97fcfcb4eabd08a025e953e0d
refs/heads/master
2021-06-30T17:59:35.945969
2017-09-20T15:51:41
2017-09-20T15:51:41
104,236,233
0
0
null
null
null
null
UTF-8
Java
false
false
933
java
package com.ugent.eventplanner.models; public class ConfirmationMessageContainer { private Confirmation confirmation = null; private Message message = null; private int type; // confirmation if 0, message if 1 public ConfirmationMessageContainer(int type, Confirmation confirmation, Message message) throws Exception { this.type = type; if (type == 0 ) { this.confirmation = confirmation; } else if(type == 1){ this.message = message; } else { throw new Exception("Parameter type must be 0 or 1!"); } } public String getTitle() { if (type == 0) { return confirmation.getPerson().getName(); } else { return message.getPerson().getName(); } } public String getSubtitle(){ if (type == 0) { return confirmation.getStatus() ? "going" : "not going"; } else { return message.getText()+"\nCreated at: "+message.getCreated_at(); } } public int getType() { return type; } }
645cf2af0256922655674c2ad91cd7f9d02fc94d
93a82eebc89db6e905bb52505870be1cc689566d
/materialdesign/app/src/main/java/top/zcwfeng/materialdesign/drawer/ui/home/HomeFragment.java
618af8f0f193109aea75d07327947e6c1868a916
[]
no_license
zcwfeng/zcw_android_demo
78cdc86633f01babfe99972b9fde52a633f65af9
f990038fd3643478dbf4f65c03a70cd2f076f3a0
refs/heads/master
2022-07-27T05:32:09.421349
2022-03-14T02:56:41
2022-03-14T02:56:41
202,998,648
15
8
null
null
null
null
UTF-8
Java
false
false
1,205
java
package top.zcwfeng.materialdesign.drawer.ui.home; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import top.zcwfeng.materialdesign.R; public class HomeFragment extends Fragment { private HomeViewModel homeViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { homeViewModel = ViewModelProviders.of(this).get(HomeViewModel.class); View root = inflater.inflate(R.layout.fragment_home, container, false); final TextView textView = root.findViewById(R.id.text_home); homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { @Override public void onChanged(@Nullable String s) { textView.setText(s); } }); return root; } }
cefe7fde4fa1b3254b503eaa24b75257c42d9c35
5bd695321a6c6cecb21442562808a1eb3b8dca27
/src/main/java/ru/innopolis/stc9/db/dao/UsersDAO.java
e0eb6196be21dd081109b432227c70150a14f405
[]
no_license
apykac/StudentsSite
2e0f1192dbe65adf5be8d74dc801dac09a48037b
eb5fb023f0db9d2b32fba81bb427ce4b2a53334c
refs/heads/master
2020-03-17T06:53:01.338263
2018-05-23T16:25:08
2018-05-23T16:25:08
133,373,599
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package ru.innopolis.stc9.db.dao; import ru.innopolis.stc9.pojo.User; import java.sql.SQLException; /** * Интерфейс DAO пользователя */ public interface UsersDAO { /** * получить пользователья по логину * @param login логин пользователя * @return возращает пользователя * @throws SQLException */ User getUserByLogin(String login) throws SQLException; }
06c6e33a42f410c456ce989035205d5438274d5f
80c8a6af7f49ad6976336036934265bca52ee85a
/jeeweb-mybatis/src/main/java/cn/jeeweb/core/database/dynamic/dao/DynamicDBDao.java
5c37f4d900478832b5ff9635ea3623c7b0cd5a4a
[ "MIT" ]
permissive
hanksxu2017/teach_go_web
65c382aace1b6cc5d986c483dd528141c3799dbf
986a4e272b19e44cd6bf3d1a04946f9925cfd8a2
refs/heads/master
2020-03-15T04:49:29.963473
2018-11-14T14:03:43
2018-11-14T14:03:43
131,974,551
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
package cn.jeeweb.core.database.dynamic.dao; import java.util.List; import java.util.Map; import org.apache.commons.dbcp.BasicDataSource; import org.apache.commons.lang3.ArrayUtils; import org.springframework.jdbc.core.JdbcTemplate; /** * * All rights Reserved, Designed By www.jeeweb.cn * * @title: DynamicDBDao.java * @package cn.jeeweb.core.database.dynamic.dao * @description: 多数据源到层 * @author: admin * @date: 2017年5月10日 上午11:41:13 * @version V1.0 * @copyright: 2017 www.jeeweb.cn Inc. All rights reserved. * */ public class DynamicDBDao { private JdbcTemplate jdbcTemplate; public DynamicDBDao() { } public DynamicDBDao(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } /** * * @title: getJdbcTemplate * @description:不滿足方便获取操作 * @return * @return: JdbcTemplate */ public JdbcTemplate getJdbcTemplate() { return jdbcTemplate; } public void initJdbcTemplate(BasicDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } public List<Map<String, Object>> queryList(String sql, Object... param) { List<Map<String, Object>> list; if (ArrayUtils.isEmpty(param)) { list = jdbcTemplate.queryForList(sql); } else { list = jdbcTemplate.queryForList(sql, param); } return list; } public <T> List<T> queryList(String sql, Class<T> clazz, Object... param) { List<T> list; if (ArrayUtils.isEmpty(param)) { list = jdbcTemplate.queryForList(sql, clazz); } else { list = jdbcTemplate.queryForList(sql, clazz, param); } return list; } }
4390a1920d06650ebc6c509676816760dcb35cb7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_97d10d0d2582a6b7f1c32448ed254c6bf8f9d8b2/Folder/27_97d10d0d2582a6b7f1c32448ed254c6bf8f9d8b2_Folder_s.java
524f76f0745ab0be55b91b861192d256bb912234
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,508
java
package com.fsck.k9.mail; public abstract class Folder { public enum OpenMode { READ_WRITE, READ_ONLY, } public enum FolderType { HOLDS_FOLDERS, HOLDS_MESSAGES, } /** * Forces an open of the MailProvider. If the provider is already open this * function returns without doing anything. * * @param mode READ_ONLY or READ_WRITE */ public abstract void open(OpenMode mode) throws MessagingException; /** * Forces a close of the MailProvider. Any further access will attempt to * reopen the MailProvider. * * @param expunge If true all deleted messages will be expunged. */ public abstract void close(boolean expunge) throws MessagingException; /** * @return True if further commands are not expected to have to open the * connection. */ public abstract boolean isOpen(); /** * Get the mode the folder was opened with. This may be different than the mode the open * was requested with. * @return */ public abstract OpenMode getMode() throws MessagingException; public abstract boolean create(FolderType type) throws MessagingException; /** * Create a new folder with a specified display limit. Not abstract to allow * remote folders to not override or worry about this call if they don't care to. */ public boolean create(FolderType type, int displayLimit) throws MessagingException { return create(type); } public abstract boolean exists() throws MessagingException; /** * @return A count of the messages in the selected folder. */ public abstract int getMessageCount() throws MessagingException; public abstract int getUnreadMessageCount() throws MessagingException; public abstract Message getMessage(String uid) throws MessagingException; public abstract Message[] getMessages(int start, int end, MessageRetrievalListener listener) throws MessagingException; /** * Fetches the given list of messages. The specified listener is notified as * each fetch completes. Messages are downloaded as (as) lightweight (as * possible) objects to be filled in with later requests. In most cases this * means that only the UID is downloaded. * * @param uids * @param listener */ public abstract Message[] getMessages(MessageRetrievalListener listener) throws MessagingException; public abstract Message[] getMessages(String[] uids, MessageRetrievalListener listener) throws MessagingException; public abstract void appendMessages(Message[] messages) throws MessagingException; public abstract void copyMessages(Message[] msgs, Folder folder) throws MessagingException; public abstract void setFlags(Message[] messages, Flag[] flags, boolean value) throws MessagingException; public abstract Message[] expunge() throws MessagingException; public abstract void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener) throws MessagingException; public abstract void delete(boolean recurse) throws MessagingException; public abstract String getName(); public abstract Flag[] getPermanentFlags() throws MessagingException; @Override public String toString() { return getName(); } }
159a2511a6e37760df1c93ef4fe383363c8152fe
de1699eb5da2a4966c92497d0e363b0ab3f586f3
/mvc-console/src/main/java/com/mvc/console/mapper/RefundApplicationMapper.java
98cb5cd5d45d82fc99506164cd20194a09299d72
[]
no_license
ethands/lock-plat
c9d12d8ea1cad6d76629f5ff579c0feb801be9b6
1e5e1cee8b20192f22669fb5f5006d7216e79eda
refs/heads/master
2021-05-02T14:04:20.181338
2018-01-19T14:29:36
2018-01-19T14:29:36
120,712,425
1
0
null
2018-02-08T04:50:01
2018-02-08T04:50:01
null
UTF-8
Java
false
false
236
java
package com.mvc.console.mapper; import com.mvc.common.biz.BaseBiz; import com.mvc.console.entity.RefundApplication; import tk.mybatis.mapper.common.Mapper; public interface RefundApplicationMapper extends Mapper<RefundApplication>{ }
489c016ff27f387cd6d043acd635b9faed00b06d
c05ea0867a10e0b82c89b61e539f86bc23d827ff
/MMN14 - Generics && Dictionery with GUI/Targil2/AddButton.java
fc56b1a94e84957f8b11d9b6ab06d5e00291003b
[]
no_license
Yuna-Goncharov/-Advanced-Programming-with-Java
fb827cbde7c80981c2b098a45e9c16e719e5d967
f27ad5d9634a966b21f6f8cc1edd48e85a3ffdc3
refs/heads/master
2020-04-15T18:51:09.600573
2019-01-09T19:57:53
2019-01-09T19:57:53
164,928,021
0
0
null
null
null
null
UTF-8
Java
false
false
1,157
java
import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class AddButton extends JButton { // adding buttons to controller public AddButton(Controller controller) { setText("Add"); setVisible(true); // action listeners for buttons addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String description = ""; String newVal = JOptionPane.showInputDialog(getParent(), "Please enter a value:", "New Value", JOptionPane.QUESTION_MESSAGE); if (newVal != null && !newVal.equals("")) description = JOptionPane.showInputDialog(getParent(), "Please enter a Description:", "New Value", JOptionPane.QUESTION_MESSAGE); if (newVal != null && !description.equals("")) { if (controller.addNewEntry(newVal, description)) { JOptionPane.showMessageDialog(getParent(), "New value has been added successfully", "Success", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(getParent(), "Value is already exist", "Error", JOptionPane.ERROR_MESSAGE); } } } }); } }
134761d92dfad93aab537a8476a6b80074f83434
285c22631111bac77f2d29acaa4182cc8b9ff15f
/src/main/java/de/hhu/stups/bsynthesis/prob/GetViolatingVarsFromExamplesCommand.java
e590032324461c876e3e0fb623d8caf371e7331b
[]
no_license
Joshua27/BSynthesis
45f1424ebf4054f4e1c5ebc886d8fe321b05b911
b11dce906588fd772cd7e2482b5634ed0f88130b
refs/heads/master
2021-01-22T10:46:12.217838
2018-10-26T16:00:24
2018-10-26T16:00:24
92,654,236
0
0
null
null
null
null
UTF-8
Java
false
false
2,429
java
package de.hhu.stups.bsynthesis.prob; import static de.hhu.stups.bsynthesis.prob.ExamplesToProlog.getInputOutputExamples; import static de.hhu.stups.bsynthesis.prob.ExamplesToProlog.printList; import de.hhu.stups.bsynthesis.ui.components.nodes.BasicNode; import de.prob.animator.command.AbstractCommand; import de.prob.parser.ISimplifiedROMap; import de.prob.prolog.output.IPrologTermOutput; import de.prob.prolog.term.PrologTerm; import javafx.beans.property.SetProperty; import javafx.beans.property.SimpleSetProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableSet; import java.util.List; import java.util.Set; import java.util.stream.IntStream; public class GetViolatingVarsFromExamplesCommand extends AbstractCommand { private static final String PROLOG_COMMAND_NAME = "get_invariant_violating_vars_from_examples_"; private static final String VIOLATING_VAR_NAMES = "ViolatingVarNames"; private final Set<InputOutputExample> validExamples; private final Set<InputOutputExample> invalidExamples; private final SetProperty<String> violatingVarNamesProperty; /** * Create {@link InputOutputExample}s from the given {@link BasicNode}s and initialize * {@link #violatingVarNamesProperty}. */ public GetViolatingVarsFromExamplesCommand(final List<BasicNode> validExamples, final List<BasicNode> invalidExamples, final Set<String> machineVarNames) { this.validExamples = getInputOutputExamples(validExamples, machineVarNames); this.invalidExamples = getInputOutputExamples(invalidExamples, machineVarNames); violatingVarNamesProperty = new SimpleSetProperty<>(FXCollections.observableSet()); } @Override public void writeCommand(final IPrologTermOutput pto) { pto.openTerm(PROLOG_COMMAND_NAME); printList(pto, validExamples); printList(pto, invalidExamples); pto.printVariable(VIOLATING_VAR_NAMES).closeTerm(); } @Override public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) { final PrologTerm resultTerm = bindings.get(VIOLATING_VAR_NAMES); IntStream.range(1, resultTerm.getArity() + 1).forEach(value -> violatingVarNamesProperty.add(resultTerm.getArgument(value).getFunctor())); } public ObservableSet<String> getViolatingVarNames() { return violatingVarNamesProperty.get(); } }
5fbbdace380138a5c93312f0f88440fb53722292
4a015f5a9b655f027a4d4e04fdc926bb893d093d
/api-gateway/src/main/java/mk/ukim/finki/apigateway/domain/User.java
a7f8df432812cb0d357615592b23d898c6cb492b
[ "MIT" ]
permissive
kirkovg/university-microservices
cd1bfe8f92dba3b422c56903b972a2aa9f0b45c7
2c8db22c3337014e3a8aa5de3e6a1a32d35c9ba0
refs/heads/master
2021-12-26T13:05:05.598702
2018-09-11T18:53:35
2018-09-11T18:53:35
147,234,534
0
0
MIT
2021-08-12T22:16:40
2018-09-03T17:25:19
Java
UTF-8
Java
false
false
5,433
java
package mk.ukim.finki.apigateway.domain; import mk.ukim.finki.apigateway.config.Constants; import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.commons.lang3.StringUtils; import org.hibernate.annotations.BatchSize; import javax.validation.constraints.Email; import javax.persistence.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.HashSet; import java.util.Locale; import java.util.Objects; import java.util.Set; import java.time.Instant; /** * A user. */ @Entity @Table(name = "jhi_user") public class User extends AbstractAuditingEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @Pattern(regexp = Constants.LOGIN_REGEX) @Size(min = 1, max = 50) @Column(length = 50, unique = true, nullable = false) private String login; @JsonIgnore @NotNull @Size(min = 60, max = 60) @Column(name = "password_hash", length = 60, nullable = false) private String password; @Size(max = 50) @Column(name = "first_name", length = 50) private String firstName; @Size(max = 50) @Column(name = "last_name", length = 50) private String lastName; @Email @Size(min = 5, max = 254) @Column(length = 254, unique = true) private String email; @NotNull @Column(nullable = false) private boolean activated = false; @Size(min = 2, max = 6) @Column(name = "lang_key", length = 6) private String langKey; @Size(max = 256) @Column(name = "image_url", length = 256) private String imageUrl; @Size(max = 20) @Column(name = "activation_key", length = 20) @JsonIgnore private String activationKey; @Size(max = 20) @Column(name = "reset_key", length = 20) @JsonIgnore private String resetKey; @Column(name = "reset_date") private Instant resetDate = null; @JsonIgnore @ManyToMany @JoinTable( name = "jhi_user_authority", joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")}) @BatchSize(size = 20) private Set<Authority> authorities = new HashSet<>(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLogin() { return login; } // Lowercase the login before saving it in database public void setLogin(String login) { this.login = StringUtils.lowerCase(login, Locale.ENGLISH); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public boolean getActivated() { return activated; } public void setActivated(boolean activated) { this.activated = activated; } public String getActivationKey() { return activationKey; } public void setActivationKey(String activationKey) { this.activationKey = activationKey; } public String getResetKey() { return resetKey; } public void setResetKey(String resetKey) { this.resetKey = resetKey; } public Instant getResetDate() { return resetDate; } public void setResetDate(Instant resetDate) { this.resetDate = resetDate; } public String getLangKey() { return langKey; } public void setLangKey(String langKey) { this.langKey = langKey; } public Set<Authority> getAuthorities() { return authorities; } public void setAuthorities(Set<Authority> authorities) { this.authorities = authorities; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } User user = (User) o; return !(user.getId() == null || getId() == null) && Objects.equals(getId(), user.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "User{" + "login='" + login + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", imageUrl='" + imageUrl + '\'' + ", activated='" + activated + '\'' + ", langKey='" + langKey + '\'' + ", activationKey='" + activationKey + '\'' + "}"; } }
33708825eefeb1c441d4298b1b598cc088a910aa
472b29c3f160dd08bc7e159281a286e29790298c
/src/model/SimulationSugar.java
28a56466ae04bec87741eee6f9fee5f826f1e6cb
[ "MIT" ]
permissive
tjysdsg/cs308-cellsociety
76734efcd704861f395109ed8f33aca1ab7e01a2
3a3f6c97cd9da16298333ff22504e0e43c5eeca7
refs/heads/master
2023-04-15T05:01:51.919860
2021-02-27T07:36:32
2021-02-27T07:36:32
352,004,927
0
0
null
null
null
null
UTF-8
Java
false
false
4,791
java
package model; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; /** * Simulation model of SugarScape. * <p> * See {@link Simulation#setConfig(String, Object)} for general simulation options * <p> * Configurable options: * <ul> * <li> * TODO: * </li> * </ul> * <p> * See also https://www2.cs.duke.edu/courses/compsci308/spring21/assign/02_simulation/Sugarscape_Leicester.pdf * * @author jt304 */ public class SimulationSugar extends Simulation { private static final String N_AGENTS_KEY = "nAgents"; private int sugarGrowBackRate = 1; private int sugarGrowBackInterval = 1; private int maxSugarPerPatch = 30; private int nAgents = 0; public SimulationSugar(int nRows, int nCols) { grid = new GridSq4(nRows, nCols, new StateSugar(StateEnumSugar.EMPTY, 0, null)); simType = "SugarScape"; } @Override public <T> void setConfig(String name, T value) { super.setConfig(name, value); switch (name) { case "sugarGrowBackRate" -> sugarGrowBackRate = (int) value; case "sugarGrowBackInterval" -> sugarGrowBackInterval = (int) value; case "maxSugarPerPatch" -> maxSugarPerPatch = (int) value; default -> { } } } @Override public Map<String, Object> getStatsMap() { HashMap<String, Object> ret = new HashMap<>(); ret.put(N_AGENTS_KEY, nAgents); return ret; } @Override public List<String> getStatsNames() { ArrayList<String> ret = new ArrayList<>(); ret.add(N_AGENTS_KEY); return ret; } @Override protected void updateNextStates() { for (int r = 0; r < grid.getNumRows(); ++r) { for (int c = 0; c < grid.getNumCols(); ++c) { StateSugar s = (StateSugar) grid.getState(r, c); // grow back sugar int growTime = s.getSugarGrowTime() + 1; int sugar = s.getSugar(); if (growTime >= sugarGrowBackInterval) { sugar += sugarGrowBackRate; if (sugar > maxSugarPerPatch) { sugar = maxSugarPerPatch; } s.setSugar(sugar); s.setSugarGrowTime(0); } else { s.setSugarGrowTime(growTime); } // agent if (s.getStateType() == StateEnumSugar.AGENT) { SugarAgent agent = s.getAgent(); int maxSugar = 0; Vec2D currCoord = new Vec2D(r, c); Vec2D bestCoord = new Vec2D(r, c); // FIXME: don't use hardcoded directions Vec2D[] directions = new Vec2D[]{ new Vec2D(1, 0), new Vec2D(-1, 0), new Vec2D(0, 1), new Vec2D(0, -1), }; for (Vec2D dir : directions) { // check next several tiles in a direction for (int i = 0; i < agent.getVision(); ++i) { Vec2D dest = dir.mul(i + 1).add(currCoord); // wrap coord if wrap is enabled dest = grid.fixCoord(dest); if (!grid.isInside(dest.getX(), dest.getY())) { continue; } StateSugar destState = (StateSugar) grid.getState(dest.getX(), dest.getY()); if ( // make sure this is >, because we want to find the closest patch if // there are patches with the same value destState.getSugar() > maxSugar && destState.getStateType() != StateEnumSugar.AGENT ) { maxSugar = destState.getSugar(); bestCoord = dest; } } } if (!bestCoord.equals(currCoord)) { // remove agent in current patch StateSugar newState = new StateSugar(s); newState.removeAgent(); grid.setState(currCoord.getX(), currCoord.getY(), newState); // move agent to destination s = (StateSugar) grid.getState(bestCoord.getX(), bestCoord.getY()); newState = new StateSugar(s); newState.setAgent(agent); grid.setState(bestCoord.getX(), bestCoord.getY(), newState); // take sugar agent.setSugar(newState.getSugar()); newState.setSugar(0); // metabolism agent.setSugar(agent.getSugar() - agent.getMetabolism()); // starve to death if (agent.getSugar() < 0) { newState.removeAgent(); } } } } } } @Override protected void updateStats() { nAgents = 0; for (int r = 0; r < grid.getNumRows(); ++r) { for (int c = 0; c < grid.getNumCols(); ++c) { if (grid.getState(r, c).getStateType() == StateEnumSugar.AGENT) { ++nAgents; } } } } }
28c168aa7a511d3e34699ae84eeb602f60cc3c84
cb2447fecb371fcc3b21be42187b0d43b103cdd3
/milight/src/main/java/at/rseiler/homeauto/milight/config/MiLightConfigWrapper.java
0471cd9fde79632aab4ab339baa36e591b821b4d
[ "Apache-2.0" ]
permissive
rseiler/homeauto
bf3900627b06dc8e99868e21929ed85d24073de9
89f01b7010b86232c009ffb793f5007e96160fb1
refs/heads/master
2021-01-11T15:13:25.030891
2018-03-04T21:34:36
2018-03-04T21:34:36
80,310,701
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package at.rseiler.homeauto.milight.config; import at.rseiler.homeauto.common.watcher.config.DeviceWatcherConfig; import at.rseiler.homeauto.milight.config.MiLightConfigWrapper.MiLightConfigWrapperBuilder; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import lombok.Builder; import lombok.Value; @Value @Builder @JsonDeserialize(builder = MiLightConfigWrapperBuilder.class) public class MiLightConfigWrapper { @JsonProperty(required = true) private final DeviceWatcherConfig deviceWatcher; @JsonProperty(required = true) private final MiLightConfig miLight; @JsonPOJOBuilder(withPrefix = "") static final class MiLightConfigWrapperBuilder { } }
4fcbe4ff4b59caa4bb19cb2731a94782624e091a
f60471980e66e5b37be95b0db07b19c4de16fee5
/dBrowser/src/org/reldb/relang/filtersorter/SearchAdvanced.java
44ff4d0eac386f02ab2c49671947a76513c3fbb5
[ "Apache-2.0" ]
permissive
kevinmiles/Relang
0cd8ce3a2cf43c3e24ece6d674eaa3842c0970bb
26e8a6b34b9ca4122902b9cfbc34f1fea31e51f8
refs/heads/master
2022-03-12T22:45:10.857261
2019-11-05T21:46:26
2019-11-05T21:46:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,342
java
package org.reldb.relang.filtersorter; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; public class SearchAdvanced extends Composite implements Searcher { private static final String emptyFilterPrompt = "Click here to set filter criteria."; private FilterSorter filterSorter; private SearchAdvancedPanel filterer; private Label filterSpec; private PopupComposite popup; public SearchAdvanced(FilterSorter filterSorter, Composite contentPanel) { super(contentPanel, SWT.NONE); this.filterSorter = filterSorter; GridLayout layout = new GridLayout(2, false); layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; setLayout(layout); filterSpec = new Label(this, SWT.NONE); filterSpec.setText(emptyFilterPrompt); filterSpec.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); filterSpec.addListener(SWT.MouseUp, e -> popup()); ToolBar toolBar = new ToolBar(this, SWT.NONE); ToolItem clear = new ToolItem(toolBar, SWT.PUSH); clear.addListener(SWT.Selection, e -> { filterSpec.setText(emptyFilterPrompt); filterSorter.refresh(); }); clear.setText("Clear"); toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); this.addListener(SWT.Show, e -> { if (filterSpec.getText().equals(emptyFilterPrompt)) popup(); }); constructPopup(); } private void constructPopup() { popup = new PopupComposite(getShell()); popup.setLayout(new GridLayout(1, false)); filterer = new SearchAdvancedPanel(filterSorter.getAttributeNames(), popup); filterer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); Composite buttonPanel = new Composite(popup, SWT.NONE); buttonPanel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); buttonPanel.setLayout(new GridLayout(3, false)); Button okButton = new Button(buttonPanel, SWT.PUSH); okButton.setText("Ok"); okButton.addListener(SWT.Selection, e -> ok()); Button cancelButton = new Button(buttonPanel, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.addListener(SWT.Selection, e -> { filterer.cancel(); popup.hide(); }); Button clearButton = new Button(buttonPanel, SWT.PUSH); clearButton.setText("Clear"); clearButton.addListener(SWT.Selection, e -> { filterer.clear(); filterSpec.setText(emptyFilterPrompt); filterSorter.refresh(); }); popup.pack(); } public void ok() { filterer.ok(); String spec = filterer.getWhereClause().trim(); if (spec.length() == 0) filterSpec.setText(emptyFilterPrompt); else filterSpec.setText(spec); popup.hide(); filterSorter.refresh(); } private void popup() { if (!popup.isDisplayed()) popup.show(toDisplay(0, 0)); } public void clicked() { if (getVisible() == false && !filterSpec.getText().equals(emptyFilterPrompt)) return; popup(); } public String getQuery() { String spec = filterSpec.getText(); return !spec.equals(emptyFilterPrompt) ? " WHERE " + spec : ""; } }
5b9c023f389aa7f52979ac1df6ba51710941c7ba
fa1b7c2da195193fd88214d3254ce5badde61ed3
/test-filters-multipleMDBs/src/org/hornetq/replicator/routing/MDB2.java
dd73837faf0b86ede2ad709f6183325a2da0a4a7
[]
no_license
clebertsuconic/test-repo
ec692bc4c13184d2b9abbd0e55b0703f87878bb0
1f4833a4aab4cce942b2fbc91f8a42182ca3e7d4
refs/heads/master
2020-04-06T04:55:55.173388
2013-03-08T22:47:11
2013-03-08T22:47:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,809
java
package org.hornetq.replicator.routing; import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Resource; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.ejb.MessageDrivenContext; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; @MessageDriven ( activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"), @ActivationConfigProperty(propertyName = "clientId", propertyValue = "MDB2"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/testTopic"), @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "15"), @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "receiver=2") }) @TransactionAttribute(value = TransactionAttributeType.REQUIRED) public class MDB2 implements MessageListener { private static final AtomicInteger counter = new AtomicInteger(0); private @Resource(mappedName = "java:/JmsXA") ConnectionFactory connectionFactory; private @Resource(mappedName = "java:/topic/testTopic") Topic topic; private @Resource MessageDrivenContext sessionContext; @Override public void onMessage(Message msg) { MDBUtil.msgReceived(msg, counter, connectionFactory, sessionContext, topic, getClass()); } }
d3894627b2b0c75525b0f8d78230b9314e74d350
e3780c806fdb6798abf4ad5c3a7cb49e3d05f67a
/src/main/java/com/hankcs/hanlp/dependency/nnparser/util/std.java
5133fe32fa638f6d727e45b2804845be73ddb703
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
AnyListen/HanLP
7e3cf2774f0980d24ecab0568ad59774232a56d6
58e5f6cda0b894cad156b06ac75bd397c9e26de3
refs/heads/master
2021-01-22T04:23:14.514117
2018-12-11T01:27:36
2018-12-11T01:27:36
125,140,795
1
1
Apache-2.0
2018-04-16T16:49:47
2018-03-14T02:04:04
Java
UTF-8
Java
false
false
1,178
java
/* * <summary></summary> * <author>He Han</author> * <email>[email protected]</email> * <create-date>2015/10/31 21:26</create-date> * * <copyright file="std.java" company="��ũ��"> * Copyright (c) 2008-2015, ��ũ��. All Right Reserved, http://www.hankcs.com/ * This source is subject to Hankcs. Please contact Hankcs to get more information. * </copyright> */ package com.hankcs.hanlp.dependency.nnparser.util; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; /** * @author hankcs */ public class std { public static <E> void fill(List<E> list, E value) { if (list == null) return; ListIterator<E> listIterator = list.listIterator(); while (listIterator.hasNext()) listIterator.set(value); } public static <E> List<E> create(int size, E value) { List<E> list = new ArrayList<E>(size); for (int i = 0; i < size; i++) { list.add(value); } return list; } public static <E> E pop_back(List<E> list) { E back = list.get(list.size() - 1); list.remove(list.size() - 1); return back; } }
aa922e20768ec25ae2f6867dcd5745d82e87f849
3e5055ad5d2980aa33afa495b9cf6f39ac90f991
/src/com/mss/msp/location/LocationAction.java
2a09d357c19e801b26bc4932330ec04b84832788
[]
no_license
naveena007/AzureSample123
89a2b513ad37144433dca31e4cc16e1bdba9c999
630ade6f110c0711aaeda95cdddb9ec36a0b5cf4
refs/heads/master
2021-05-08T05:21:15.763365
2017-10-09T20:45:20
2017-10-09T20:45:20
106,333,188
0
0
null
null
null
null
UTF-8
Java
false
false
2,470
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.mss.msp.location; import com.mss.msp.util.ServiceLocator; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import java.util.ArrayList; /** * * @author Kyle Bissell */ public class LocationAction extends ActionSupport{ private String countryName=""; private int countryId; private String stockSymbolString=""; private List<State> states; /** *********************************************************** * * @getStatesForCountry() to get the states for country * * *********************************************************** */ public String getStatesForCountry() { System.out.println("********************LocationAction :: getStatesForCountry Action Start*********************"); states = new ArrayList<State>(); String resultType = SUCCESS; states = ServiceLocator.getLocationService().getStatesByCountry(countryId); System.out.println("********************LocationAction :: getStatesForCountry Action Start*********************"); return resultType; } /** *********************************************************** * * @getStockSymbol() to get the stock symbol * * *********************************************************** */ public String getStockSymbol(){ System.out.println("********************LocationAction :: getStockSymbol Action Start*********************"); String resultType=SUCCESS; stockSymbolString=ServiceLocator.getLocationService().lookupCountryCurrency(countryId); System.out.println("********************LocationAction :: getStockSymbol Action Start*********************"); return resultType; } public String getCountryName() { return countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } public List<State> getStates() { return states; } public void setStates(List<State> states) { this.states = states; } public String getStockSymbolString() { return stockSymbolString; } public void setStockSymbolString(String stockSymbolString) { this.stockSymbolString = stockSymbolString; } public int getCountryId() { return countryId; } public void setCountryId(int countryId) { this.countryId = countryId; } }
3437e604ca5b7eb77d54a5449642eb7473dd6e7d
6e5c37409a53c882bf41ba5bbbf49975d6c1c9aa
/src/org/hl7/v3/XDocumentProcedureMood.java
a6e1fbaa2d9e0945f8754791d20e299cfe359520
[]
no_license
hosflow/fwtopsysdatasus
46fdf8f12ce1fd5628a04a2145757798b622ee9f
2d9a835fcc7fd902bc7fb0b19527075c1260e043
refs/heads/master
2021-09-03T14:39:52.008357
2018-01-09T20:34:19
2018-01-09T20:34:19
116,867,672
0
0
null
null
null
null
IBM852
Java
false
false
1,054
java
package org.hl7.v3; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java de x_DocumentProcedureMood. * * <p>O seguinte fragmento do esquema especifica o conte˙do esperado contido dentro desta classe. * <p> * <pre> * &lt;simpleType name="x_DocumentProcedureMood"> * &lt;restriction base="{urn:hl7-org:v3}cs"> * &lt;enumeration value="APT"/> * &lt;enumeration value="ARQ"/> * &lt;enumeration value="DEF"/> * &lt;enumeration value="EVN"/> * &lt;enumeration value="INT"/> * &lt;enumeration value="PRMS"/> * &lt;enumeration value="PRP"/> * &lt;enumeration value="RQO"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "x_DocumentProcedureMood") @XmlEnum public enum XDocumentProcedureMood { APT, ARQ, DEF, EVN, INT, PRMS, PRP, RQO; public String value() { return name(); } public static XDocumentProcedureMood fromValue(String v) { return valueOf(v); } }
654741e3516a4716c50ccbb384c13219eb4c62ba
9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3
/bazaar8.apk-decompiled/sources/b/B/f/d.java
d4737a285197cce0038ea9146968d5fb962c76e8
[]
no_license
BaseMax/PopularAndroidSource
a395ccac5c0a7334d90c2594db8273aca39550ed
bcae15340907797a91d39f89b9d7266e0292a184
refs/heads/master
2020-08-05T08:19:34.146858
2019-10-06T20:06:31
2019-10-06T20:06:31
212,433,298
2
0
null
null
null
null
UTF-8
Java
false
false
3,059
java
package b.b.f; import android.content.Context; import android.content.ContextWrapper; import android.content.res.AssetManager; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import android.view.LayoutInflater; import b.b.i; /* compiled from: ContextThemeWrapper */ public class d extends ContextWrapper { /* renamed from: a reason: collision with root package name */ public int f1948a; /* renamed from: b reason: collision with root package name */ public Resources.Theme f1949b; /* renamed from: c reason: collision with root package name */ public LayoutInflater f1950c; /* renamed from: d reason: collision with root package name */ public Configuration f1951d; /* renamed from: e reason: collision with root package name */ public Resources f1952e; public d() { super(null); } public final Resources a() { if (this.f1952e == null) { Configuration configuration = this.f1951d; if (configuration == null) { this.f1952e = super.getResources(); } else if (Build.VERSION.SDK_INT >= 17) { this.f1952e = createConfigurationContext(configuration).getResources(); } } return this.f1952e; } public void attachBaseContext(Context context) { super.attachBaseContext(context); } public int b() { return this.f1948a; } public final void c() { boolean z = this.f1949b == null; if (z) { this.f1949b = getResources().newTheme(); Resources.Theme theme = getBaseContext().getTheme(); if (theme != null) { this.f1949b.setTo(theme); } } a(this.f1949b, this.f1948a, z); } public AssetManager getAssets() { return getResources().getAssets(); } public Resources getResources() { return a(); } public Object getSystemService(String str) { if (!"layout_inflater".equals(str)) { return getBaseContext().getSystemService(str); } if (this.f1950c == null) { this.f1950c = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return this.f1950c; } public Resources.Theme getTheme() { Resources.Theme theme = this.f1949b; if (theme != null) { return theme; } if (this.f1948a == 0) { this.f1948a = i.Theme_AppCompat_Light; } c(); return this.f1949b; } public void setTheme(int i2) { if (this.f1948a != i2) { this.f1948a = i2; c(); } } public d(Context context, int i2) { super(context); this.f1948a = i2; } public d(Context context, Resources.Theme theme) { super(context); this.f1949b = theme; } public void a(Resources.Theme theme, int i2, boolean z) { theme.applyStyle(i2, true); } }
b2654e198c954fee8a8b26db39a7951e5a9c8819
f2d658bd36d0157fbb79d05113dbcd1cae7a152c
/zuul-proxy/src/main/java/com/edward1iao/springcloud/zuulproxy/ZuulProxyApplication.java
beac7b147db5d0ede2b3f7d68f57d7ee71bb915e
[]
no_license
edward1iao/springcloud-learning
0f269ec0a9546bc31f8b8b149f1d3b9a945a4773
3c390ac285f9a73f90924e24d208ccc57b922d99
refs/heads/master
2023-01-04T20:14:48.536539
2020-10-26T08:27:32
2020-10-26T08:27:32
295,688,376
0
0
null
null
null
null
UTF-8
Java
false
false
520
java
package com.edward1iao.springcloud.zuulproxy; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication @EnableDiscoveryClient @EnableZuulProxy public class ZuulProxyApplication { public static void main(String[] args) { SpringApplication.run(ZuulProxyApplication.class,args); } }
9ea2967f39ac36f08d68bf43689eb9c5cadec3fa
35618f1debd6b8ebfde45a1e015e88ead284d6b3
/.svn/pristine/42/42d75a834efc3c4c9e7d1ba27c41b58e907fa85e.svn-base
b461bf7377edffa0271893250573a57bb1460595
[]
no_license
Mudhasir/testser
6baf50a93e5377ff9c2b2a9acadb47fae682c499
c6d9ebf0524d52519cee957d7fe8b0a3775cc56b
refs/heads/main
2023-04-23T03:49:46.780770
2021-05-05T05:34:43
2021-05-05T05:34:43
360,869,527
0
0
null
null
null
null
UTF-8
Java
false
false
376
package com.agaram.eln.primary.repository.fileManipulation; import org.springframework.data.mongodb.repository.MongoRepository; import com.agaram.eln.primary.model.fileManipulation.ProfilePicture; public interface ProfilePictureRepository extends MongoRepository<ProfilePicture, String> { public ProfilePicture findById(Integer Id); public Long deleteById(Integer Id); }
363642e8d53aa0ac434a8c60138d264488a7e980
58a078d91896db199e12c6f614914fc31bc2fd9d
/src/main/java/com/example/MStore/dto/MessageAbstract.java
bc475422de4691fc99a752675c6f02014024a6e2
[]
no_license
kasmugerle/store
3be088a0e7101a4d25abc26e17424b567f05251d
f54f200647e2d1a1773a3f096f2c219c6d42809f
refs/heads/main
2023-05-15T20:45:37.674707
2021-06-16T17:04:50
2021-06-16T17:04:50
330,151,019
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.example.MStore.dto; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @AllArgsConstructor @NoArgsConstructor @Getter @Setter public abstract class MessageAbstract { private String message; }
e91859504a48865717cff5d4ae8d6ed04e742bb7
b93b6d3ae39398cb9044b6c76dd5e580344e4848
/src/main/java/com/dessy/penjualan/dao/HdrSuratJalanDaoImpl.java
f299d06fa628f3b35c14ce55ae7c9a9f9e90e251
[]
no_license
saifiahmada/penjualan
d5c0fe582ae1a8a21b751622af264cac8757385f
7d7fefba281a0fb0c37c35059810f922d7be8437
refs/heads/master
2021-01-01T19:51:42.788881
2015-01-17T02:43:02
2015-01-17T02:43:02
29,377,314
0
1
null
null
null
null
UTF-8
Java
false
false
2,212
java
package com.dessy.penjualan.dao; import java.util.Date; import java.util.HashSet; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.dessy.penjualan.bean.DtlPicklist; import com.dessy.penjualan.bean.DtlSuratJalan; import com.dessy.penjualan.bean.DtlSuratJalanPK; import com.dessy.penjualan.bean.HdrPicklist; import com.dessy.penjualan.bean.HdrSuratJalan; import com.dessy.penjualan.bean.MstDealer; import com.dessy.penjualan.common.GenericHibernateDao; import com.dessy.penjualan.util.DateConv; import com.dessy.penjualan.util.StringUtil; import com.dessy.penjualan.viewmodel.SuratJalanVM; @Repository public class HdrSuratJalanDaoImpl extends GenericHibernateDao<HdrSuratJalan, String> implements HdrSuratJalanDao { @Autowired private HdrPicklistDao hdrPicklistDao; @Autowired private MstRunnumDao mstRunnumDao; @Autowired private MstDealerDao mstDealerDao; public String generateSuratJalan(String noPicklist,String kdDlr) { HdrPicklist pick = hdrPicklistDao.get(noPicklist); MstDealer dealer = mstDealerDao.get(kdDlr); String idDoc = "SJ"; String reseter = DateConv.format(new Date(), "yyyyMM"); int no = mstRunnumDao.getRunningNumber(idDoc, reseter); String noSj = StringUtil.getFormattedRunno(idDoc, Integer.valueOf(no)); HdrSuratJalan sj = new HdrSuratJalan(noSj); sj.setAlamatPenerima(dealer.getAlamat()); sj.setKdDlr(kdDlr); sj.setNamaPenerima(dealer.getNamaDealer()); sj.setNoPicklist(noPicklist); sj.setStatus("A"); sj.setTglSj(new Date()); Set<DtlSuratJalan> dtlSjs = new HashSet<DtlSuratJalan>(); for (DtlPicklist dtlPick : pick.getDtlpicklists()) { String noMesin = dtlPick.getDtlPicklistPK().getNoMesin(); String kdItem = dtlPick.getKdItem(); String noRangka = dtlPick.getNoRangka(); DtlSuratJalan dtlSj = new DtlSuratJalan(new DtlSuratJalanPK(noMesin, noSj)); dtlSj.setKdItem(kdItem); dtlSj.setNoRangka(noRangka); dtlSj.setHdrSuratJalan(sj); dtlSjs.add(dtlSj); } sj.setDtlSuratJalans(dtlSjs); pick.setStatus("B"); hdrPicklistDao.update(pick); super.saveOrUpdate(sj); return noSj; } }
6a41d06f95b21a5dc775598a9fec6cac782b7ea0
9ad60c3ccad5dbb83e36c3c667316a63ceab60dd
/app/src/main/java/de/christianspecht/tasko/androidclient/Prefs.java
e82030b96fdf5a2a4266a4d4652f776b466658dd
[ "MIT" ]
permissive
msgpo/tasko-androidclient
eacecb0d14aea47750bc94a9e2957f337d50347b
f9ffb658c1c0f9609635050f7282152dc2a5e1be
refs/heads/master
2022-04-01T17:32:51.670485
2019-12-20T21:59:17
2019-12-20T21:59:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
908
java
package de.christianspecht.tasko.androidclient; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; /** * Load and save preferences */ public class Prefs { private SharedPreferences pref; public Prefs(Context context) { this.pref = PreferenceManager.getDefaultSharedPreferences(context); } /** * Loads auth token from the preferences * @return The token */ public String getAuthToken() { return this.pref.getString("AuthToken", ""); } /** * Saves auth token in the preferences * @param token The token */ public void setAuthToken(String token) { this.pref.edit().putString("AuthToken", token).commit(); } /** * Loads server URL from the preferences * @return The URL */ public String getServerUrl() { return this.pref.getString("settings_url", ""); } }
ee3785b5217155bb39f3445615f4357155911176
1430ac50c1ae1edcae5fe224940fb45454609873
/test/java/TestArticleDAO.java
60cfe4cedfb418d988c056e1ac8e33a91f721c81
[]
no_license
TishukBogdana/Spring-App-Courseproject
0e792d2a819d72ea728202ceb4d20fa913395a41
03096b39a9a049de8fadcfe4f21f38fef4483f16
refs/heads/master
2021-09-16T07:14:00.317611
2018-06-18T11:08:59
2018-06-18T11:08:59
110,644,036
4
0
null
null
null
null
UTF-8
Java
false
false
2,427
java
import ru.ifmo.cs.domain.Article; import ru.ifmo.cs.servimplementations.ArticleServiceImpl; import ru.ifmo.cs.domain.Human; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.context.ApplicationContext; import java.sql.Timestamp; import java.util.List; /** * Created by Богдана on 13.11.2017. */ public class TestArticleDAO extends Assert { ArticleServiceImpl serv; @Before public void init(ApplicationContext context){ serv = context.getBean(ArticleServiceImpl.class); } @Test public void testFindByName(String name, int exp){ List<Article> list = serv.findByName(name); assertNotNull(list); assertEquals(exp,list.size()); } @Test public void testFindByAuthor(Human human, int exp){ List<Article> list = serv.findByAuthor(human); assertNotNull(list); assertEquals(exp, list.size()); } @Test public void testFindByDateIsAfter(Timestamp stamp, int nexp){ List<Article> list = serv.findByDateAddIsAfter(stamp); assertNotEquals(nexp, list.size()); } @Test public void testFindByDateIsBefore(Timestamp stamp, int nexp){ List<Article> list = serv.findByDateAddIsBefore(stamp); assertNotEquals(nexp, list.size()); } @Test public void testFindByNameAndAuthor(String name, Human human, int exp){ List<Article> list = serv.findByNameAndAuthor(name,human); assertEquals(exp,list.size()); } @Test public void testSave(Article article){ serv.save(article); article = serv.findOne(article.getIdArticle()); assertNotNull(article); } @Test public void restRemoveByName(String name){ serv.removeByName(name); List<Article> list = serv.findByName(name); assertEquals(0,list.size()); } @Test public void restRemoveByAuthor(Human author){ serv.removeByAuthor(author); List<Article> list = serv.findByAuthor(author); assertEquals(0,list.size()); } @Test public void testUpdateByNameAndBody(String prev, Human author, String name, String body, Timestamp stamp){ List<Article> before = serv.findByNameAndAuthor(prev,author); serv.updateByNameAndBody(prev,author, name, body,stamp); List<Article>after = serv.findByNameAndAuthor(name,author); assertNotEquals(before,after); } }
2fd195da921783926fb037b6ade50fa7e2608756
c81963cab526c4dc24bee21840f2388caf7ff4cf
/com/google/common/collect/SortedLists.java
1e3b9397204df8dce327236e22e75e5d0f0e030b
[]
no_license
ryank231231/jp.co.penet.gekidanprince
ba2f38e732828a4454402aa7ef93a501f8b7541e
d76db01eeadf228d31006e4e71700739edbf214f
refs/heads/main
2023-02-19T01:38:54.459230
2021-01-16T10:04:22
2021-01-16T10:04:22
329,815,191
0
0
null
null
null
null
UTF-8
Java
false
false
5,987
java
package com.google.common.collect; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; import com.google.common.base.Preconditions; import java.util.Comparator; import java.util.List; import javax.annotation.Nullable; @Beta @GwtCompatible final class SortedLists { public static <E, K extends Comparable> int binarySearch(List<E> paramList, Function<? super E, K> paramFunction, @Nullable K paramK, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) { return binarySearch(paramList, paramFunction, paramK, Ordering.natural(), paramKeyPresentBehavior, paramKeyAbsentBehavior); } public static <E, K> int binarySearch(List<E> paramList, Function<? super E, K> paramFunction, @Nullable K paramK, Comparator<? super K> paramComparator, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) { return binarySearch(Lists.transform(paramList, paramFunction), paramK, paramComparator, paramKeyPresentBehavior, paramKeyAbsentBehavior); } public static <E extends Comparable> int binarySearch(List<? extends E> paramList, E paramE, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) { Preconditions.checkNotNull(paramE); return binarySearch(paramList, paramE, Ordering.natural(), paramKeyPresentBehavior, paramKeyAbsentBehavior); } public static <E> int binarySearch(List<? extends E> paramList, @Nullable E paramE, Comparator<? super E> paramComparator, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) { Preconditions.checkNotNull(paramComparator); Preconditions.checkNotNull(paramList); Preconditions.checkNotNull(paramKeyPresentBehavior); Preconditions.checkNotNull(paramKeyAbsentBehavior); List<? extends E> list = paramList; if (!(paramList instanceof java.util.RandomAccess)) list = Lists.newArrayList(paramList); int i = 0; int j = list.size() - 1; while (i <= j) { int k = i + j >>> 1; int m = paramComparator.compare(paramE, list.get(k)); if (m < 0) { j = k - 1; continue; } if (m > 0) { i = k + 1; continue; } return i + paramKeyPresentBehavior.<E>resultIndex(paramComparator, paramE, list.subList(i, j + 1), k - i); } return paramKeyAbsentBehavior.resultIndex(i); } public enum KeyAbsentBehavior { INVERTED_INSERTION_INDEX, NEXT_HIGHER, NEXT_LOWER { int resultIndex(int param2Int) { return param2Int - 1; } }; static { INVERTED_INSERTION_INDEX = new null("INVERTED_INSERTION_INDEX", 2); $VALUES = new KeyAbsentBehavior[] { NEXT_LOWER, NEXT_HIGHER, INVERTED_INSERTION_INDEX }; } abstract int resultIndex(int param1Int); } enum null { int resultIndex(int param1Int) { return param1Int - 1; } } enum null { public int resultIndex(int param1Int) { return param1Int; } } enum null { public int resultIndex(int param1Int) { return param1Int ^ 0xFFFFFFFF; } } public enum KeyPresentBehavior { ANY_PRESENT { <E> int resultIndex(Comparator<? super E> param2Comparator, E param2E, List<? extends E> param2List, int param2Int) { return param2Int; } }, FIRST_AFTER, FIRST_PRESENT, LAST_BEFORE, LAST_PRESENT { <E> int resultIndex(Comparator<? super E> param2Comparator, E param2E, List<? extends E> param2List, int param2Int) { int i = param2List.size() - 1; while (param2Int < i) { int j = param2Int + i + 1 >>> 1; if (param2Comparator.compare(param2List.get(j), param2E) > 0) { i = j - 1; continue; } param2Int = j; } return param2Int; } }; static { FIRST_AFTER = new null("FIRST_AFTER", 3); LAST_BEFORE = new null("LAST_BEFORE", 4); $VALUES = new KeyPresentBehavior[] { ANY_PRESENT, LAST_PRESENT, FIRST_PRESENT, FIRST_AFTER, LAST_BEFORE }; } abstract <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int); } enum null { <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) { return param1Int; } } enum null { <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) { int i = param1List.size() - 1; while (param1Int < i) { int j = param1Int + i + 1 >>> 1; if (param1Comparator.compare(param1List.get(j), param1E) > 0) { i = j - 1; continue; } param1Int = j; } return param1Int; } } enum null { <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) { int i = 0; while (i < param1Int) { int j = i + param1Int >>> 1; if (param1Comparator.compare(param1List.get(j), param1E) < 0) { i = j + 1; continue; } param1Int = j; } return i; } } enum null { public <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) { return LAST_PRESENT.<E>resultIndex(param1Comparator, param1E, param1List, param1Int) + 1; } } enum null { public <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) { return FIRST_PRESENT.<E>resultIndex(param1Comparator, param1E, param1List, param1Int) - 1; } } } /* Location: Y:\classes-dex2jar.jar!\com\google\common\collect\SortedLists.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
1ab0fca7c6148cd2bbdb4239fcb0ee8a7cc47a37
65e98c214f8512264f5f33ba0f2dec3c0a6b06e5
/transfuse/src/main/java/org/androidtransfuse/adapter/element/ASTTypeBuilderVisitor.java
bacdac1486e4206031037f24430f5221bae09b71
[ "Apache-2.0" ]
permissive
histone/transfuse
46535168651de5fe60745b3557bba3a3b47fca20
d7b642db063cf8d9d64d06a1ea402a7aecbbe994
refs/heads/master
2021-01-15T20:49:04.801629
2013-02-02T03:11:38
2013-02-02T03:11:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,602
java
/** * Copyright 2013 John Ericksen * * 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.androidtransfuse.adapter.element; import com.google.common.base.Function; import org.androidtransfuse.adapter.*; import org.androidtransfuse.analysis.TransfuseAnalysisException; import org.androidtransfuse.processor.TransactionRuntimeException; import javax.inject.Inject; import javax.inject.Provider; import javax.lang.model.element.TypeElement; import javax.lang.model.type.*; import javax.lang.model.util.SimpleTypeVisitor6; /** * Builder of an ASTType from a TypeMirror input * * @author John Ericksen */ public class ASTTypeBuilderVisitor extends SimpleTypeVisitor6<ASTType, Void> implements Function<TypeMirror, ASTType> { private final Provider<ASTElementFactory> astElementFactoryProvider; @Inject public ASTTypeBuilderVisitor(Provider<ASTElementFactory> astElementFactoryProvider) { this.astElementFactoryProvider = astElementFactoryProvider; } @Override public ASTType visitPrimitive(PrimitiveType primitiveType, Void v) { return ASTPrimitiveType.valueOf(primitiveType.getKind().name()); } @Override public ASTType visitNull(NullType nullType, Void v) { throw new TransfuseAnalysisException("Encountered NullType, unable to recover"); } @Override public ASTType visitArray(ArrayType arrayType, Void v) { return new ASTArrayType(arrayType.getComponentType().accept(this, null)); } @Override public ASTType visitDeclared(DeclaredType declaredType, Void v) { return astElementFactoryProvider.get().buildASTElementType(declaredType); } @Override public ASTType visitError(ErrorType errorType, Void v) { throw new TransactionRuntimeException("Encountered ErrorType " + errorType.asElement().getSimpleName() + ", unable to recover"); } @Override public ASTType visitTypeVariable(TypeVariable typeVariable, Void v) { return new ASTEmptyType(typeVariable.toString()); } @Override public ASTType visitWildcard(WildcardType wildcardType, Void v) { throw new TransfuseAnalysisException("Encountered Wildcard Type, unable to represent in graph"); } @Override public ASTType visitExecutable(ExecutableType executableType, Void v) { if (executableType instanceof TypeElement) { return astElementFactoryProvider.get().getType((TypeElement) executableType); } else { throw new TransfuseAnalysisException("Encountered non-TypeElement"); } } @Override public ASTType visitNoType(NoType noType, Void v) { if (noType.getKind().equals(TypeKind.VOID)) { return ASTVoidType.VOID; } return new ASTEmptyType("<NOTYPE>"); } @Override public ASTType visitUnknown(TypeMirror typeMirror, Void v) { throw new TransfuseAnalysisException("Encountered unknown TypeMirror, unable to recover"); } @Override public ASTType apply(TypeMirror input) { return input.accept(this, null); } }
78879db9a5432634e835ed24f2cb15c2978a837b
393f245124f468d96b5c659cf63161711e259e42
/src/main/java/com/homify/homify/HomifyApplication.java
75d8fc1fb38e461a5d88ae1df0ff4bbd41b29d03
[]
no_license
ashishsms/RESTApiService
8596e4a872a702c419e3ae1627042abe3fcabc02
429a933f9b3383ae2ce164ed5414cb7735611137
refs/heads/master
2020-03-23T19:41:22.710555
2018-07-23T10:17:15
2018-07-23T10:17:15
141,996,023
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package com.homify.homify; import com.homify.homify.business.Professional; import com.homify.homify.server.reference.Professional.ProfessionalJDO; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class HomifyApplication { public static void main(String[] args) { SpringApplication.run(HomifyApplication.class, args); } @Bean protected CommandLineRunner init(final ProfessionalJDO userRepository) { return args -> { Professional user = new Professional(); user.setUserName("admin"); user.setPassword("admin"); user.setFirstName("Administrator"); user.setEmail("[email protected]"); userRepository.createProfessional(user); }; } }
007779a0cf6f9afd528368584aeb248e236177ee
5772d8eaaa94430631e74ec2eab8fa376dd92cc1
/msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/ThrottlingCache.java
89e1f3488c05b05311c4faad417416791ba633d0
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
AzureAD/microsoft-authentication-library-for-java
e54059114116285a066ed91046c39d0ff9b4b0c9
4dc7a5e3c29e3995c585648b86cb3a04aef3c39f
refs/heads/dev
2023-09-04T11:06:49.292433
2023-08-09T14:38:51
2023-08-09T14:38:51
138,207,524
249
146
MIT
2023-09-12T16:29:20
2018-06-21T18:24:42
Java
UTF-8
Java
false
false
1,969
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.microsoft.aad.msal4j; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Cache to hold requests to be throttled */ class ThrottlingCache { static final int MAX_THROTTLING_TIME_SEC = 3600; static int DEFAULT_THROTTLING_TIME_SEC = 120; static final int CACHE_SIZE_LIMIT_TO_TRIGGER_EXPIRED_ENTITIES_REMOVAL = 100; // request hash to expiration timestamp static Map<String, Long> requestsToThrottle = new ConcurrentHashMap<>(); static void set(String requestHash, Long expirationTimestamp) { removeInvalidCacheEntities(); requestsToThrottle.put(requestHash, expirationTimestamp); } static long retryInMs(String requestHash) { removeInvalidCacheEntities(); if (requestsToThrottle.containsKey(requestHash)) { long expirationTimestamp = requestsToThrottle.get(requestHash); long currentTimestamp = System.currentTimeMillis(); if (isCacheEntryValid(currentTimestamp, expirationTimestamp)) { return expirationTimestamp - currentTimestamp; } else { requestsToThrottle.remove(requestHash); } } return 0; } private static boolean isCacheEntryValid(long currentTimestamp, long expirationTimestamp) { return currentTimestamp < expirationTimestamp && currentTimestamp >= expirationTimestamp - MAX_THROTTLING_TIME_SEC * 1000; } private static void removeInvalidCacheEntities() { long currentTimestamp = System.currentTimeMillis(); if (requestsToThrottle.size() > CACHE_SIZE_LIMIT_TO_TRIGGER_EXPIRED_ENTITIES_REMOVAL) { requestsToThrottle.values().removeIf(value -> !isCacheEntryValid(value, currentTimestamp)); } } static void clear() { requestsToThrottle.clear(); } }
e9dc0f9fb65874cd5d475438f328b84668e38547
4fbedc43b1a6707f72bb21212fb0fe24d1a522a7
/MeetingRooms.java
05776f7d74f7cfe6eefa4f120d943c2ba0dcab0c
[]
no_license
kastergarta/java_training_leetcode
12471ed4692e68d9f8ea2983939ffd8dea120cb1
dfd9b0390da62244ad35b2ae30908d2dceb7b77d
refs/heads/master
2023-02-12T03:42:36.453342
2021-01-08T03:39:14
2021-01-08T03:39:14
295,906,492
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
public class MeetingRooms { public int minMeetingRooms(Interval[] intervals) { int ans = 0, curr = 0; List<TimePoint> timeline = new ArrayList<>(); for (Interval interval: intervals) { timeline.add(new TimePoint(interval.start, 1)); timeline.add(new TimePoint(interval.end, -1)); } timeline.sort(new Comparator<TimePoint>() { public int compare(TimePoint a, TimePoint b) { if (a.time != b.time) return a.time - b.time; else return a.room - b.room; } }); for (TimePoint t: timeline) { curr += t.room; if (curr >= ans) ans = curr; } return ans; } private class TimePoint { int time; int room; TimePoint(int time, int room) { this.time = time; this.room = room; } } } }
f5f0152c7791589540db87bdedc27b93a446b416
ed03478dc06eb8fea7c98c03392786cd04034b82
/src/com/era/community/assignment/dao/generated/AssignmentsFinderBase.java
9e86e5c2ed8c2a3df207a957577f16448a3b6045
[]
no_license
sumit-kul/cera
264351934be8f274be9ed95460ca01fa9fc23eed
34343e2f5349bab8f5f78b9edf18f2e0319f62d5
refs/heads/master
2020-12-25T05:17:19.207603
2016-09-04T00:02:31
2016-09-04T00:02:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.era.community.assignment.dao.generated; import com.era.community.assignment.dao.Assignments; public interface AssignmentsFinderBase { public Assignments getAssignmentsForId(int id) throws Exception; public Assignments newAssignments() throws Exception; }
b7e4296922d4199fae1a2efdc778a594deeaba3e
c99a2248e2a312a706833cf81c3ae62bf9b1b3b6
/server/moneyxchange-api/src/test/java/com/belatrixsf/ApplicationTests.java
5aa1b0453ccbba8b8deece89d82dc363ba91c9fd
[]
no_license
jaraoscar/moneyxchange
065cdc9948d885b9d340aa82b795083dc4adc3cc
6dbb75cb41047a57fb02900db5eb55a909c22852
refs/heads/master
2021-04-15T04:59:03.047545
2018-03-26T15:37:19
2018-03-26T15:37:19
126,744,193
0
0
null
null
null
null
UTF-8
Java
false
false
1,971
java
package com.belatrixsf; import static org.hamcrest.CoreMatchers.notNullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import com.belatrixsf.model.User; import com.fasterxml.jackson.databind.ObjectMapper; /** * Test cases. */ @RunWith(SpringRunner.class) @SpringBootTest public class ApplicationTests { @Autowired private ObjectMapper objectMapper; @Autowired private WebApplicationContext webApplicationContext; private MockMvc mockMvc; private User loginUser; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); this.loginUser = new User(); } /** * Test user authentication and token generation. * @throws Exception */ @Test public void testAuthenticationAndTokenGeneration() throws Exception { this.loginUser.setUsername("oscar.jara"); this.loginUser.setPassword("admin"); String json = objectMapper.writeValueAsString(this.loginUser); this.mockMvc.perform(post("/token/auth") .contentType(MediaType.APPLICATION_JSON) .content(json)) .andExpect(status().isOk()) .andExpect(jsonPath("$.token", notNullValue())); } }
88e79f880e347b5bcce10bd1b287de6e98b35de9
d01d2f244dfe42b2c0568361273b2b9dedf0c6c2
/src/main/java/org/noorganization/instalist/comm/message/ProductInfo.java
ced9f942599e5ac80a1328614df650baa948a197
[ "Apache-2.0" ]
permissive
InstaList/instalist-comm
59224063370f76028102be9c9fb6a76c6e68bcef
4e68a3a52346de187aa4f4d612a2ca04783e3115
refs/heads/master
2021-01-10T17:50:38.053725
2016-10-12T19:45:29
2016-10-12T19:45:29
52,970,579
1
0
null
null
null
null
UTF-8
Java
false
false
4,574
java
/* * Copyright 2016 Tino Siegmund, Michael Wodniok * * 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.noorganization.instalist.comm.message; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.UUID; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.util.StdDateFormat; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "uuid", "name", "unituuid", "defaultamount", "stepamount", "lastchanged", "deleted" }) public class ProductInfo extends EntityObject { private String mUUID; private String mName; private String mUnitUUID; private Float mDefaultAmount; private Float mStepAmount; private Date mLastChanged; private Boolean mDeleted; private Boolean mRemoveUnit; @JsonProperty("uuid") public String getUUID() { return mUUID; } @JsonProperty("uuid") public void setUUID(String id) { this.mUUID = id; } public void setUUID(UUID _uuid) { setUUID(_uuid != null ? _uuid.toString() : null); } public ProductInfo withUUID(String _uuid) { setUUID(_uuid); return this; } public ProductInfo withUUID(UUID _uuid) { setUUID(_uuid); return this; } @JsonProperty("name") public String getName() { return mName; } @JsonProperty("name") public void setName(String _name) { mName = _name; } public ProductInfo withName(String name) { setName(name); return this; } @JsonProperty("defaultamount") public Float getDefaultAmount() { return mDefaultAmount; } @JsonProperty("defaultamount") public void setDefaultAmount(Float _defaultAmount) { mDefaultAmount = _defaultAmount; } public ProductInfo withDefaultAmount(Float _defaultAmount) { setDefaultAmount(_defaultAmount); return this; } @JsonProperty("stepamount") public Float getStepAmount() { return mStepAmount; } @JsonProperty("stepamount") public void setStepAmount(Float _stepAmount) { mStepAmount = _stepAmount; } public ProductInfo withStepAmount(Float _stepAmount) { setStepAmount(_stepAmount); return this; } @JsonProperty("unituuid") public String getUnitUUID() { return mUnitUUID; } @JsonProperty("unituuid") public void setUnitUUID(String _uuid) { mUnitUUID = _uuid; } public void setUnitUUID(UUID _uuid) { setUnitUUID(_uuid != null ? _uuid.toString() : null); } public ProductInfo withUnitUUID(String _uuid) { setUnitUUID(_uuid); return this; } public ProductInfo withUnitUUID(UUID _uuid) { setUnitUUID(_uuid); return this; } @JsonProperty("removeunit") public Boolean getRemoveUnit() { return mRemoveUnit; } @JsonProperty("removeunit") public void setRemoveUnit(Boolean _removeUnit) { mRemoveUnit = _removeUnit; } public ProductInfo withRemoveUnit(Boolean _removeUnit) { setRemoveUnit(_removeUnit); return this; } @JsonProperty("lastchanged") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = StdDateFormat.DATE_FORMAT_STR_ISO8601) public Date getLastChanged() { return mLastChanged; } @JsonProperty("lastchanged") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = StdDateFormat.DATE_FORMAT_STR_ISO8601) public void setLastChanged(Date _lastChanged) { mLastChanged = _lastChanged; } public ProductInfo withLastChanged(Date _lastChanged) { setLastChanged(_lastChanged); return this; } @JsonProperty("deleted") public Boolean getDeleted() { return mDeleted; } @JsonProperty("deleted") public void setDeleted(Boolean _deleted) { mDeleted = _deleted; } public ProductInfo withDeleted(Boolean _deleted) { setDeleted(_deleted); return this; } }
2d102e6c0b3bd51a1fd8cbba137f1714e297b187
3d4349c88a96505992277c56311e73243130c290
/Preparation/processed-dataset/data-class_3_344/24.java
4c69891eab17c320b1f8fb15fac21884eac6023e
[]
no_license
D-a-r-e-k/Code-Smells-Detection
5270233badf3fb8c2d6034ac4d780e9ce7a8276e
079a02e5037d909114613aedceba1d5dea81c65d
refs/heads/master
2020-05-20T00:03:08.191102
2019-05-15T11:51:51
2019-05-15T11:51:51
185,272,690
7
4
null
null
null
null
UTF-8
Java
false
false
613
java
/** * To support EXSLT extensions, convert names with dash to allowable Java names: * e.g., convert abc-xyz to abcXyz. * Note: dashes only appear in middle of an EXSLT function or element name. */ protected static String replaceDash(String name) { char dash = '-'; StringBuffer buff = new StringBuffer(""); for (int i = 0; i < name.length(); i++) { if (i > 0 && name.charAt(i - 1) == dash) buff.append(Character.toUpperCase(name.charAt(i))); else if (name.charAt(i) != dash) buff.append(name.charAt(i)); } return buff.toString(); }
7f57f3e58ef7cbe54b80351d74f6005e3654b10b
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/p230g/p231a/C37726hi.java
655c4507b93207192f2f0bc6c7badac29a051281
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package com.tencent.p177mm.p230g.p231a; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.p177mm.sdk.p600b.C4883b; /* renamed from: com.tencent.mm.g.a.hi */ public final class C37726hi extends C4883b { public C26154a cCe; /* renamed from: com.tencent.mm.g.a.hi$a */ public static final class C26154a { public boolean cCf = false; } public C37726hi() { this((byte) 0); } private C37726hi(byte b) { AppMethodBeat.m2504i(114425); this.cCe = new C26154a(); this.xxG = false; this.callback = null; AppMethodBeat.m2505o(114425); } }
83572139ca1dcce9ba976f85b532fb82ac68f84e
1af5de52e596f736c70a8d2b505fcbf406e0d1e4
/adapter/src/main/java/com/adaptris/core/services/metadata/xpath/ConfiguredXpathQueryImpl.java
843b2755568c247069824151c10b1d2c03ba3256
[ "Apache-2.0" ]
permissive
williambl/interlok
462970f97b626b6f05d69ae30a43e42d6770dd24
3371e63ede75a53878244d8e44ecc00f36545e74
refs/heads/master
2020-03-28T06:17:23.056266
2018-08-13T13:36:02
2018-08-13T13:36:02
147,825,107
0
0
Apache-2.0
2018-09-07T13:10:38
2018-09-07T13:10:38
null
UTF-8
Java
false
false
1,640
java
/* * Copyright 2015 Adaptris Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.adaptris.core.services.metadata.xpath; import static org.apache.commons.lang.StringUtils.isEmpty; import org.hibernate.validator.constraints.NotBlank; import com.adaptris.core.AdaptrisMessage; import com.adaptris.core.CoreException; import com.adaptris.core.util.Args; /** * Abstract base class for {@linkplain XpathQuery} implementations that are statically configured. * * @author lchan * */ public abstract class ConfiguredXpathQueryImpl extends XpathQueryImpl { @NotBlank private String xpathQuery; public ConfiguredXpathQueryImpl() { } public String getXpathQuery() { return xpathQuery; } /** * Set the xpath. * * @param expr */ public void setXpathQuery(String expr) { xpathQuery = Args.notBlank(expr, "xpath-query"); } @Override public String createXpathQuery(AdaptrisMessage msg) { return xpathQuery; } public void verify() throws CoreException { if (isEmpty(getXpathQuery())) { throw new CoreException("Configured Xpath is null."); } } }
b10b9562ffe57c9384e87ede00da6b1149d1ee84
2f4af1a8e668041c7260179e8f455857b0291855
/app/src/main/java/com/myapplicationdev/android/demoimageview/MainActivity.java
67131d9d1bdde4cfe9fe9eb06b26a4a616038f34
[]
no_license
MINGLINXU/DemoImageView
72d0a2bb705eccd1b7437940daed1c4771babf61
a7937ad95cc79512eb1d1119d33e2669dbffd187
refs/heads/master
2022-06-01T23:35:11.667568
2020-05-04T02:59:42
2020-05-04T02:59:42
261,066,175
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.myapplicationdev.android.demoimageview; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { //Declare the ImageView object called ivDay2 ImageView ivDay2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get the ImageView object and assign to ivDay2 ivDay2 = (ImageView)findViewById(R.id.imageView2); ivDay2.setImageResource(R.drawable.day2); } }
7b3942d397cfdf771bf0d83de4e12ca87ff0ac40
a1eb4a73fdd15c23c5505a6d0b8ce4d63647ae8d
/src/main/java/com/example/travelnote/imagehandle/BitmapCompress.java
8a630d021470e460e304ef866b6605178a557c54
[]
no_license
annio2/Travelnote
a305bf927e2f79f3f0151b5c0a58a1cb138f94df
085e3589132b01c1cbaddc2f0a41daae5607eb51
refs/heads/master
2021-01-22T21:12:49.582180
2017-08-25T06:08:47
2017-08-25T06:08:47
100,679,968
0
0
null
null
null
null
UTF-8
Java
false
false
4,192
java
package com.example.travelnote.imagehandle; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.widget.ImageView; import com.example.travelnote.bean.ImageViewSize; import com.example.travelnote.utils.ImageViewSizeUtils; import com.orhanobut.logger.Logger; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; /** * Created by wuguanglin on 2017/8/9. */ public class BitmapCompress { //bitmap占用内存 = bitmap宽 * bitmap高 * 单个像素点所占字节 private ImageViewSize imageViewSize; // public Bitmap getSmallBitmap(ImageView imageView, byte[] byteBitmap) { imageViewSize = ImageViewSizeUtils.getImageViewSize(imageView); Logger.e("imageview宽高", imageViewSize.getImageHeight()); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options); options.inSampleSize = calculateInSampleSize(options, imageViewSize.getImageWidth(), imageViewSize.getImageHeight()); options.inJustDecodeBounds = false; options.inPreferredConfig = Bitmap.Config.RGB_565;//一个像素点占用2个字节 Bitmap bitmap = BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options); if (bitmap != null) { return bitmap; } return null; } public Bitmap getMartixScaleBitmap(ImageView imageView, byte[] byteBitmap){ imageViewSize = ImageViewSizeUtils.getImageViewSize(imageView); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options); float zootSize = calculateFloatZoomSize(options, imageViewSize.getImageWidth(), imageViewSize.getImageHeight()); options.inJustDecodeBounds = false; Matrix matrix = new Matrix(); matrix.setScale(zootSize, zootSize); Bitmap bitmapSource = BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length); Bitmap bitmap = Bitmap.createBitmap(bitmapSource, 0, 0, bitmapSource.getWidth(), bitmapSource.getHeight(), matrix, true); if (bitmap != null){ return bitmap; } return null; } //根据ImageView的宽和高,网络下载的图片的宽和高计算压缩比例 private int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { int inSampleSize = 1; int w = options.outWidth;//图片宽 int h = options.outHeight;//图片高 if (reqWidth < w || reqHeight < h) { int wratio = Math.round((w * 1.0f) / reqWidth); int hratio = Math.round((h * 1.0f) / reqWidth); inSampleSize = Math.max(wratio, hratio); } return inSampleSize; } //计算缩放比例,返回浮点数,设置Matrix的缩放 private float calculateFloatZoomSize(BitmapFactory.Options options, int reqWidth, int reqHeight){ float rootSize = 1.0f; int w = options.outWidth; int h = options.outHeight;//bitmap的宽和高 if (reqWidth < w || reqHeight < h){ float wratio = (float) w / reqWidth; float hratio = (float) h / reqHeight; rootSize = Math.max(wratio, hratio); } return rootSize; } //质量压缩,不改变内存占用大小,存到文件系统会变小 private Bitmap compressBitmap(Bitmap image) { ByteArrayOutputStream bao = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG, 100, bao); int options = 90; while (bao.toByteArray().length / 1024 > 100) { bao.reset(); image.compress(Bitmap.CompressFormat.JPEG, options, bao); options -= 10; if (options < 0){ options = 90; } } ByteArrayInputStream is = new ByteArrayInputStream(bao.toByteArray()); return BitmapFactory.decodeStream(is);//返回bitmap相当于什么都没做 } }
de1e217028ff70d135a430408d0c27af72741b04
d7687daa6563ff35ebff5a52234ae247b1058a94
/FaceDetection/src/window.java
3b05496523d295f1a3a554f39b1f75509aef1b8b
[]
no_license
sukanth/FaceDetection
5c1c0c8c5717eaf30dc9d63601b5e267958a7f05
8d5f209444efdaa82235d66f32e67813557660cc
refs/heads/master
2021-01-21T09:12:06.902904
2017-05-18T04:34:20
2017-05-18T04:34:20
91,648,913
0
0
null
null
null
null
UTF-8
Java
false
false
1,717
java
import javax.swing.JFrame; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.videoio.VideoCapture; public class window { public static void main(String arg[]){ // Load the native library. System.loadLibrary(Core.NATIVE_LIBRARY_NAME); String window_name = "Capture - Face detection"; JFrame frame = new JFrame(window_name); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400,400); processor my_processor=new processor(); My_Panel my_panel = new My_Panel(); frame.setContentPane(my_panel); frame.setVisible(true); //-- 2. Read the video stream Mat webcam_image=new Mat(); VideoCapture capture =new VideoCapture(-1); if( capture.isOpened()) { while( true ) { capture.read(webcam_image); if( !webcam_image.empty() ) { frame.setSize(2*webcam_image.width()+40,2*webcam_image.height()+60); //-- 3. Apply the classifier to the captured image webcam_image=my_processor.detect(webcam_image); //-- 4. Display the image my_panel.MatToBufferedImage(webcam_image); // We could look at the error... my_panel.repaint(); } else { System.out.println(" --(!) No captured frame -- Break!"); break; } } } return; } }
5b0c513cc88ca4cbad7db34b9f2ae044726ee114
028e41b41e7117d8fff5a2f0375324e08e293231
/src/main/java/pl/edu/agh/edgentandroidwrapper/task/EdgentTask.java
feb6f94048cfd3a637fb50f24a79b3b425fc1cf9
[ "Apache-2.0" ]
permissive
pedrycz/edgent-android-wrapper
bb60ae48a75a532e05cf6cc02f81fc82832793a6
8d59abb71092ea41e608e840932e5aaf1e5a83fa
refs/heads/master
2020-03-14T08:24:55.685214
2018-06-19T18:35:33
2018-06-19T18:35:33
131,524,034
0
0
null
null
null
null
UTF-8
Java
false
false
573
java
package pl.edu.agh.edgentandroidwrapper.task; import android.hardware.SensorManager; import lombok.Builder; import lombok.Singular; import pl.edu.agh.edgentandroidwrapper.collector.SensorDataCollector; import java.util.ArrayList; import java.util.List; @Builder public class EdgentTask { @Singular private List<SensorDataCollector> sensorDataCollectors = new ArrayList<>(); private SensorManager sensorManager; public void start() { sensorDataCollectors .forEach(collector -> collector.startCollecting(sensorManager)); } }
1b3e9656cb8e9d4051d6d94221d022657a15b885
18ac4f06ffc9129367422a6fa9ed40d0a12f8b34
/app/src/main/java/com/example/melody/represent/ZipcodeActivity.java
d3f5c63fa27a29a63e8d5429c7681d248478314a
[]
no_license
melodywei861016/Represent
8af07ab04e3e7eb1f161c440cf9b550169880318
f69b73fc40a9ec46cf4e1a09b14acd4385b57004
refs/heads/master
2020-03-31T15:00:13.286215
2018-10-09T21:27:11
2018-10-09T21:27:11
152,319,436
0
0
null
2018-10-09T21:03:37
2018-10-09T20:50:15
Java
UTF-8
Java
false
false
15,811
java
package com.example.melody.represent; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.CardView; import android.text.Html; import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; public class ZipcodeActivity extends AppCompatActivity { static final String GEOCODIO_API_KEY = "9602550464bcd46a42b50bb5cf2bb5dc8daba5f"; static final String GEOCODIO_API_URL = "https://api.geocod.io/v1.3/"; private String zipcode = ""; private int senator_num = 0; private ArrayList<JSONObject> senators = new ArrayList<JSONObject>(); private ArrayList<JSONObject> reps = new ArrayList<JSONObject>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_legislators_listview); new zipcodeToDistrict().execute(); } class zipcodeToDistrict extends AsyncTask<Void, Void, String> { private Exception exception; private Context mContext = getApplicationContext(); protected String doInBackground(Void... urls) { try { URL url; Bundle bundle = getIntent().getExtras(); if (bundle.getString("zipcode_string") != null) { zipcode = bundle.getString("zipcode_string"); url = new URL(GEOCODIO_API_URL + "geocode?q=" + zipcode + "&fields=cd&api_key=" + GEOCODIO_API_KEY); } else { Log.e("ERROR", "Didn't input valid zipcode"); return null; } HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line).append("\n"); } bufferedReader.close(); return stringBuilder.toString(); } finally { urlConnection.disconnect(); } } catch(Exception e) { Log.e("ERROR", e.getMessage(), e); return null; } } protected void onPostExecute(String response) { if(response == null) { response = "ERROR IN POST EXECUTE"; } Log.i("PostExecute", "Success"); try { JSONObject obj = new JSONObject(response); JSONArray results = obj.getJSONArray("results"); JSONObject fields = results.getJSONObject(0).getJSONObject("fields"); JSONArray congressional_district = fields.getJSONArray("congressional_districts"); for (int i = 0; i < congressional_district.length(); i++) { JSONObject district_array = congressional_district.getJSONObject(i); Log.i("district", district_array.getString("name")); JSONArray legislators = district_array.getJSONArray("current_legislators"); Log.i("legislators", legislators.toString()); for (int j = 0; j < legislators.length(); j++) { JSONObject legislator = legislators.getJSONObject(j); Log.i("type string", legislator.getString("type")); if (legislator.getString("type").equals("senator")) { if (senator_num < 2 && !senators.contains(legislator)) { senator_num++; senators.add(legislator); } } else if (legislator.getString("type").equals("representative") && !reps.contains(legislator)) { reps.add(legislator); } } } TextView search_results_text = findViewById(R.id.search_results_text); search_results_text.setText("Search Results by Zipcode " + zipcode + ":"); LinearLayout linearlayout_senator = findViewById(R.id.linearlayout_senators); //SENATORS for (JSONObject senator: senators) { //CardView CardView legislator_view = new CardView(mContext); linearlayout_senator.addView(legislator_view); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1400, 500); layoutParams.setMargins(0, 30, 0, 30); legislator_view.setLayoutParams(layoutParams); legislator_view.setRadius(50); legislator_view.setCardBackgroundColor(Color.WHITE); //Senator Name LinearLayout.LayoutParams text_name_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); text_name_layout.setMargins(450, 30, 0, 0); TextView senator_name = new TextView(mContext); senator_name.setLayoutParams(text_name_layout); senator_name.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL)); senator_name.setTextColor(Color.BLACK); senator_name.setTextSize(25); JSONObject bio = senator.getJSONObject("bio"); final String nameString = bio.getString("first_name") + " " + bio.getString("last_name"); senator_name.setText(nameString); //Senator Info TextView senator_info = new TextView(mContext); LinearLayout.LayoutParams text_info_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); text_info_layout.setMargins(450, 150, 0, 0); senator_info.setLayoutParams(text_info_layout); JSONObject contact = senator.getJSONObject("contact"); String email_website = ""; String contact_form = contact.getString("contact_form"); String website = contact.getString("url"); if (!contact_form.equals("null")) { email_website += ("<b>Contact Form: </b>" + contact_form + "<br/>"); } if (!website.equals("null")) { email_website += ("<b>Website: </b>" + website); } senator_info.setText(Html.fromHtml(email_website)); //Senator Image LinearLayout.LayoutParams image_layout = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.MATCH_PARENT); ImageView image = new ImageView(mContext); image.setLayoutParams(image_layout); String bioguide_id = senator.getJSONObject("references").getString("bioguide_id"); final String imageUrl = "http://bioguide.congress.gov/bioguide/photo/"+ bioguide_id.substring(0, 1) +"/" + bioguide_id + ".jpg"; //Senator Party TextView party = new TextView(mContext); LinearLayout.LayoutParams senator_party_layout = new LinearLayout.LayoutParams(320, 80); senator_party_layout.setMargins(1050, 400, 0, 0); party.setLayoutParams(senator_party_layout); party.setTextColor(Color.WHITE); party.setGravity(Gravity.CENTER); party.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)); final String partyString = bio.getString("party"); if (partyString.equals("Democrat")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.democrat)); party.setText("Democrat"); } else if (partyString.equals("Republican")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.republican)); party.setText("Republican"); } else if (partyString.equals("Independent")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.independent)); party.setText("Independent"); } //Adding Views to CardView new ImageDownloaderTask(image).execute(imageUrl); legislator_view.addView(senator_name); legislator_view.addView(senator_info); legislator_view.addView(image); legislator_view.addView(party); legislator_view.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ZipcodeActivity.this, DetailActivity.class); intent.putExtra("type", "Senator"); intent.putExtra("party", partyString); intent.putExtra("name", nameString); intent.putExtra("imageURL", imageUrl); startActivity(intent); } }); } //REPRESENTATIVE LinearLayout linearlayout_rep = findViewById(R.id.linearlayout_rep); for (JSONObject rep: reps) { //CardView CardView legislator_view = new CardView(mContext); linearlayout_rep.addView(legislator_view); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1400, 500); layoutParams.setMargins(0, 30, 0, 30); legislator_view.setLayoutParams(layoutParams); legislator_view.setRadius(50); legislator_view.setCardBackgroundColor(Color.WHITE); //Rep Name LinearLayout.LayoutParams text_name_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); text_name_layout.setMargins(450, 30, 0, 0); TextView rep_name = new TextView(mContext); rep_name.setLayoutParams(text_name_layout); rep_name.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL)); rep_name.setTextColor(Color.BLACK); rep_name.setTextSize(25); JSONObject bio = rep.getJSONObject("bio"); final String nameString = bio.getString("first_name") + " " + bio.getString("last_name"); rep_name.setText(nameString); //Rep Info TextView rep_info = new TextView(mContext); LinearLayout.LayoutParams text_info_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); text_info_layout.setMargins(450, 150, 0, 0); rep_info.setLayoutParams(text_info_layout); JSONObject contact = rep.getJSONObject("contact"); String email_website = ""; String contact_form = contact.getString("contact_form"); String website = contact.getString("url"); if (!contact_form.equals("null")) { email_website += ("<b>Contact Form: </b>" + contact_form + "<br/>"); } if (!website.equals("null")) { email_website += ("<b>Website: </b>" + website); } rep_info.setText(Html.fromHtml(email_website)); //Rep Image LinearLayout.LayoutParams image_layout = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.MATCH_PARENT); ImageView image = new ImageView(mContext); image.setLayoutParams(image_layout); String bioguide_id = rep.getJSONObject("references").getString("bioguide_id"); final String imageUrl = "http://bioguide.congress.gov/bioguide/photo/" + bioguide_id.substring(0, 1) + "/" + bioguide_id + ".jpg"; //Rep Party TextView party = new TextView(mContext); LinearLayout.LayoutParams rep_party_layout = new LinearLayout.LayoutParams(320, 80); rep_party_layout.setMargins(1050, 400, 0, 0); party.setLayoutParams(rep_party_layout); party.setTextColor(Color.WHITE); party.setGravity(Gravity.CENTER); party.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)); final String partyString = bio.getString("party"); if (partyString.equals("Democrat")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.democrat)); party.setText("Democrat"); } else if (partyString.equals("Republican")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.republican)); party.setText("Republican"); } else if (partyString.equals("Independent")) { party.setBackgroundDrawable(getResources().getDrawable(R.drawable.independent)); party.setText("Independent"); } //Adding Views to CardView new ImageDownloaderTask(image).execute(imageUrl); legislator_view.addView(rep_name); legislator_view.addView(rep_info); legislator_view.addView(image); legislator_view.addView(party); legislator_view.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ZipcodeActivity.this, DetailActivity.class); intent.putExtra("type", "Representative"); intent.putExtra("party", partyString); intent.putExtra("name", nameString); intent.putExtra("imageURL", imageUrl); startActivity(intent); } }); } } catch (JSONException e) { Log.d("TEST", "exception"); e.printStackTrace(); } } } }
95bf966f6154ad73e5f35c04aa27e68844d0f40d
7d41b9dd344a483e8d3c8a4577984d023a1178ac
/core/src/main/java/com/rbc/stockmarket/util/StockFileParser.java
fa562897383485d8edbe04242e906a92688a68e5
[]
no_license
ZAsadi/stock-market-data
7f0f9f46ed72bc6952fc8f72fa517f68c0f49237
ff36045a66c56e90054d483cd26322c6ba2e602c
refs/heads/master
2022-12-26T03:59:45.039139
2020-10-14T03:57:05
2020-10-14T03:57:05
303,887,125
0
0
null
null
null
null
UTF-8
Java
false
false
4,143
java
package com.rbc.stockmarket.util; import com.rbc.stockmarket.dto.StockDto; import com.rbc.stockmarket.exception.common.ValidatorException; import com.rbc.stockmarket.exception.storage.FileIsEmptyException; import com.rbc.stockmarket.exception.storage.FileNotSupportedException; import com.rbc.stockmarket.model.Stock; import com.rbc.stockmarket.util.validator.Validator; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public class StockFileParser { private static final String EXTENSION = "data"; public static List<Stock> parse(MultipartFile file) { List<Stock> result = new ArrayList<>(); if (file.isEmpty()) { throw new FileIsEmptyException("Empty files not allowed for uploading."); } if (file.getOriginalFilename() != null) { String fileName = StringUtils.cleanPath(file.getOriginalFilename()); String extension = fileName.split("\\.")[1]; if (extension != null && !extension.isEmpty() && extension.equals(EXTENSION)) { try { InputStream inputStream = file.getInputStream(); new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).lines().forEach(new Consumer<String>() { @Override public void accept(String line) { String[] values = line.split(","); try { result.add(StockMapper.toStock(buildStockDto(values))); } catch (ValidatorException ignore) { //ignore corrupted lines } } }); } catch (IOException e) { throw new FileNotSupportedException(e.getMessage()); } } else { throw new FileNotSupportedException("File with extension: '" + extension + "' not supported for uploading"); } } else { throw new FileNotSupportedException("No file has been chosen for uploading."); } return result; } private static StockDto buildStockDto(String[] values) { try { StockDto stockDto = new StockDto(); stockDto.setQuarter(Integer.valueOf(values[0])) .setStock(values[1]) .setDate(values[2]) .setOpen(values[3].isEmpty() ? null : values[3]) .setHigh(values[4].isEmpty() ? null : values[4]) .setLow(values[5].isEmpty() ? null : values[5]) .setClose(values[6].isEmpty() ? null : values[6]) .setVolume(values[7].isEmpty() ? null : Long.valueOf(values[7])) .setPercentChangePrice(values[8].isEmpty() ? null : Float.valueOf(values[8])) .setPercentChangeVolumeOverLastWeek(values[9].isEmpty() ? null : Float.valueOf(values[9])) .setPreviousWeeksVolume(values[10].isEmpty() ? null : Long.valueOf(values[10])) .setNextWeekOpen(values[11].isEmpty() ? null : values[11]) .setNextWeekClose(values[12].isEmpty() ? null : values[12]) .setPercentChangeNextWeeksPrice(values[13].isEmpty() ? null : Float.valueOf(values[13])) .setDaysToNextDividend(values[14].isEmpty() ? null : Integer.valueOf(values[14])) .setPercentReturnNextDividend(values[15].isEmpty() ? null : Float.valueOf(values[15])); Validator.validateStockDto(stockDto); return stockDto; } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { throw new ValidatorException("Some lines in files data is corrupted"); } } }
2fb87c8b59a4a0ec801b0cff2be63e00a5e68972
01a96561592375838183142a2cb9bfeba283f02b
/weallt-service/src/main/java/com/weallt/service/security/RegistrationService.java
9c55f0d8893fab7eb0d358429b3996dc329ba882
[]
no_license
Joncii/weallt
c79505b0eef119b0f3312d58137018bc137448a9
bcc04b0f0b0095be1aa976f845d41acacba8c722
refs/heads/master
2020-12-30T14:33:36.170737
2017-05-17T22:06:00
2017-05-17T22:06:00
91,320,920
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
package com.weallt.service.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.weallt.service.security.dao.DefaultUserDao; import com.weallt.service.security.domain.RegistrationEntry; import com.weallt.service.security.domain.User; import com.weallt.service.security.exception.EmailAlreadyRegisteredException; @Service public class RegistrationService { @Autowired private DefaultUserDao userDao; public void register(RegistrationEntry entry){ if(userDao.containsEmail(entry.getEmail())){ throw new EmailAlreadyRegisteredException(); } userDao.register(entry); } public User findUserByEmail(String email){ return userDao.getByEmail(email); } }
0e781c39e9c3b954841df6314860f0004a38317b
06d5645966b1e8a24e36ffcc04d86d6992624549
/src/main/java/ru/carabi/server/face/injectable/CurrentProduct.java
bff3cb7f81d3890666ec3d8c349af535dee9413e
[ "Apache-2.0" ]
permissive
Carabi/carabiserver
f31bf2d8ff8305c01b458e929c6c17d38b40999f
57591fe3d65d31aef290c883f51aafd4997adbb0
refs/heads/master
2021-01-22T16:05:29.100756
2017-04-13T22:37:20
2017-04-13T22:39:42
45,135,867
0
0
null
2015-11-16T11:23:24
2015-10-28T19:10:18
Java
UTF-8
Java
false
false
2,722
java
package ru.carabi.server.face.injectable; import java.io.IOException; import java.io.Serializable; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; import javax.faces.context.FacesContext; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import ru.carabi.server.CarabiException; import ru.carabi.server.entities.ProductVersion; import ru.carabi.server.entities.SoftwareProduct; import ru.carabi.server.kernel.ProductionBean; /** * Данные о продукте, просматриваемые на портале * @author sasha<[email protected]> */ @Named(value = "currentProduct") @RequestScoped public class CurrentProduct implements Serializable { @Inject private CurrentClient currentClient; @EJB private ProductionBean productionBean; private SoftwareProduct product; private ProductVersion lastVersion; @PostConstruct public void postConstruct() { HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); String productSysname = request.getParameter("product"); product = productionBean.findProduct(productSysname); if (product == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); } } public boolean getExists() { return product != null; } public String getMetatitle() { if (getExists()) { return getName(); } else { return "Not found"; } } public String getName() {return product.getName();} public String getSysname() {return product.getSysname();} public String getDescription() {return product.getDescription();} public String getHomeUrl() {return product.getHomeUrl();} public ProductVersion getLastVersion() throws CarabiException { if (lastVersion == null && product != null) { lastVersion = productionBean.getLastVersion(currentClient.getUserLogon(), product.getSysname(), FormatTool.getDepartment(currentClient), false); FormatTool.correctDownloadUrl(product, lastVersion); } return lastVersion; } public List<ProductVersion> getVersionsList() throws CarabiException { List<ProductVersion> versionsList = productionBean.getVersionsList(currentClient.getUserLogon(), product.getSysname(), FormatTool.getDepartment(currentClient), false, false); for (ProductVersion version: versionsList) { FormatTool.correctDownloadUrl(product, version); } return versionsList; } }
67648078be965740c1ee7bb73285b6aa3b8d6de5
d31d744f62c09cb298022f42bcaf9de03ad9791c
/java/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java
6895cbed39f1eeb430580cfbc89edc94929d1708
[]
no_license
yuhuofei/TensorFlow-1
b2085cb5c061aefe97e2e8f324b01d7d8e3f04a0
36eb6994d36674604973a06159e73187087f51c6
refs/heads/master
2023-02-22T13:57:28.886086
2021-01-26T14:18:18
2021-01-26T14:18:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,797
java
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 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. =======================================================================*/ // This class has been generated, DO NOT EDIT! package org.tensorflow.op.math; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; import org.tensorflow.op.RawOp; import org.tensorflow.op.Scope; import org.tensorflow.op.annotation.Endpoint; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Compute the cumulative sum of the tensor `x` along `axis`. * <p> * By default, this op performs an inclusive cumsum, which means that the first * element of the input is identical to the first element of the output: * <pre>{@code * tf.cumsum([a, b, c]) # => [a, a + b, a + b + c] * }</pre> * By setting the `exclusive` kwarg to `True`, an exclusive cumsum is * performed instead: * <pre>{@code * tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b] * }</pre> * By setting the `reverse` kwarg to `True`, the cumsum is performed in the * opposite direction: * <pre>{@code * tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c] * }</pre> * This is more efficient than using separate `tf.reverse` ops. * <p> * The `reverse` and `exclusive` kwargs can also be combined: * <pre>{@code * tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0] * }</pre> * * * @param <T> data type for {@code out()} output */ @Operator(group = "math") public final class Cumsum<T extends TType> extends RawOp implements Operand<T> { /** * Optional attributes for {@link org.tensorflow.op.math.Cumsum} */ public static class Options { /** * @param exclusive If `True`, perform exclusive cumsum. */ public Options exclusive(Boolean exclusive) { this.exclusive = exclusive; return this; } /** * @param reverse A `bool` (default: False). */ public Options reverse(Boolean reverse) { this.reverse = reverse; return this; } private Boolean exclusive; private Boolean reverse; private Options() { } } /** * Factory method to create a class wrapping a new Cumsum operation. * * @param scope current scope * @param x A `Tensor`. Must be one of the following types: `float32`, `float64`, * `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, * `complex128`, `qint8`, `quint8`, `qint32`, `half`. * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range * `[-rank(x), rank(x))`. * @param options carries optional attributes values * @return a new instance of Cumsum */ @Endpoint(describeByClass = true) public static <T extends TType, U extends TNumber> Cumsum<T> create(Scope scope, Operand<T> x, Operand<U> axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Cumsum", scope.makeOpName("Cumsum")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.exclusive != null) { opBuilder.setAttr("exclusive", opts.exclusive); } if (opts.reverse != null) { opBuilder.setAttr("reverse", opts.reverse); } } } return new Cumsum<T>(opBuilder.build()); } /** * @param exclusive If `True`, perform exclusive cumsum. */ public static Options exclusive(Boolean exclusive) { return new Options().exclusive(exclusive); } /** * @param reverse A `bool` (default: False). */ public static Options reverse(Boolean reverse) { return new Options().reverse(reverse); } /** */ public Output<T> out() { return out; } @Override public Output<T> asOutput() { return out; } /** The name of this op, as known by TensorFlow core engine */ public static final String OP_NAME = "Cumsum"; private Output<T> out; private Cumsum(Operation operation) { super(operation); int outputIdx = 0; out = operation.output(outputIdx++); } }
33eef65bc1ee15366bc92ebb1afc18bbedcc637e
341ccaa07a59857e9f05b2ba65ba04362cca3a3a
/app/src/main/java/app/pbl/hcc/pblapp/Report.java
4fdbb158c392f74403508710776a5b02fd9e5adc
[]
no_license
lemfn64/FinalPBL
5c0ddbb8457a58cf4e5a1e03688f67dd42aba713
44587d9445bedc06298b3b987827bba44ea0f6a8
refs/heads/master
2021-01-22T06:14:42.959376
2017-02-13T02:14:51
2017-02-13T02:14:51
81,750,250
0
0
null
null
null
null
UTF-8
Java
false
false
945
java
package app.pbl.hcc.pblapp; /** * object representation of a error report */ public class Report { private int rate; private String email; private String error; private String name; public Report() { } public Report(int rate, String email, String error, String name) { this.rate = rate; this.email = email; this.error = error; this.name = name; } public int getRate() { return rate; } public void setRate(int rate) { this.rate = rate; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getError() { return error; } public void setError(String error) { this.error = error; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
4892651a7f40208742b8eeead39d8ed7bd5cc865
b8bb6c94e4ba7d95687688fedd54ce33e2c2dd76
/src/test/java/com/bigin/biginapi/controller/recommend/RecommendControllerTest.java
c834910c87b9af9690bbad8d3f4cdbc3fa35a391
[]
no_license
goslim56/bigin-api
06fe61201f0908cae99d75fb58c847c6df7d1a99
58c38a055a07a74a9d2290358ace620960182327
refs/heads/master
2023-07-15T01:32:17.045275
2021-08-10T10:11:34
2021-08-10T10:11:34
393,038,746
0
0
null
null
null
null
UTF-8
Java
false
false
4,264
java
package com.bigin.biginapi.controller.recommend; import com.bigin.biginapi.request.BasicRequestBody; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.hateoas.MediaTypes; import org.springframework.http.MediaType; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc class RecommendControllerTest { @Autowired MockMvc mockMvc; @Autowired ObjectMapper objectMapper; @Test public void 메인페이지_상품_추천_키워드() throws Exception { BasicRequestBody basicRequestBody = BasicRequestBody.builder() .uuid("1234") .productCodes(new String[]{"1","2","3","4"}) .keyword(new String[]{"청바지", "반바지", "pk티셔츠"}) .cartProductCodes(new String[]{"1"}) .purchasedProductCodes(new String[]{"1","2","3","4"}) .build(); mockMvc.perform(post("/recommend/main") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaTypes.HAL_JSON) .content(objectMapper.writeValueAsString(basicRequestBody))) .andDo(print()) .andExpect(status().isOk()); } @Test public void 메인페이지_상품_추천_키워드_X() throws Exception { BasicRequestBody basicRequestBody = BasicRequestBody.builder() .uuid("1234") .productCodes(new String[]{"1","2","3","4"}) .cartProductCodes(new String[]{"1"}) .purchasedProductCodes(new String[]{"1","2","3","4"}) .build(); mockMvc.perform(post("/recommend/main") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaTypes.HAL_JSON) .content(objectMapper.writeValueAsString(basicRequestBody))) .andDo(print()) .andExpect(status().isOk()) .andExpect(content().string("")) ; } @Test public void 상품_상세_페이지_추천() throws Exception { BasicRequestBody basicRequestBody = BasicRequestBody.builder() .uuid("1234") .productCodes(new String[]{"1","2","3","4"}) .keyword(new String[]{"청바지", "반바지", "pk티셔츠"}) .cartProductCodes(new String[]{"1"}) .purchasedProductCodes(new String[]{"1","2","3","4"}) .build(); mockMvc.perform(post("/recommend/product_detail") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaTypes.HAL_JSON) .content(objectMapper.writeValueAsString(basicRequestBody))) .andDo(print()) .andExpect(status().isOk()) ; } @Test public void 장바구니_추천() throws Exception { BasicRequestBody basicRequestBody = BasicRequestBody.builder() .uuid("1234") .productCodes(new String[]{"1","2","3","4"}) .keyword(new String[]{"청바지", "반바지", "pk티셔츠"}) .cartProductCodes(new String[]{"1"}) .purchasedProductCodes(new String[]{"1","2","3","4"}) .build(); mockMvc.perform(post("/recommend/cart") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaTypes.HAL_JSON) .content(objectMapper.writeValueAsString(basicRequestBody))) .andDo(print()) .andExpect(status().isOk()); } }
646984f6779dfda6b3877a90037cd304a0d829e9
14f40e5a7bf97a72a7491f253022f6958c52f5db
/Arquitetura e Design de Projetos Java/loja/src/br/com/alura/loja/desconto/DescontoParaOrcamentoComValorMaiorQueQuinhetos.java
e19c705ee64bc49d6d3e3b701ebc6b4b8340a234
[]
no_license
jmarlonsf/alura
b3be179c231d44b6ec0faa2857d9854fac662d2f
d816c9a2e4b19f36143bef9218ff6b12fbeedc7e
refs/heads/main
2023-06-10T15:35:23.848108
2021-07-04T03:49:55
2021-07-04T03:49:55
368,151,195
0
0
null
null
null
null
UTF-8
Java
false
false
588
java
package br.com.alura.loja.desconto; import br.com.alura.loja.orcamento.Orcamento; import java.math.BigDecimal; public class DescontoParaOrcamentoComValorMaiorQueQuinhetos extends Desconto { public DescontoParaOrcamentoComValorMaiorQueQuinhetos(Desconto proximo) { super(proximo); } public BigDecimal efetuarCalculo(Orcamento orcamento){ return orcamento.getValor().multiply(new BigDecimal("0.1")); } @Override public boolean deveAplicar(Orcamento orcamento) { return orcamento.getValor().compareTo(new BigDecimal("500")) > 0; } }
5d8168b6a4af55bbcc758647beb561acbd0a3ba2
96ef87f9624b72efd48682d314cc9c39a8489a56
/src/main/java/com/bjajmd/mall/admin/common/MySysUser.java
8a7c61d98c4657efa1566ccb99d6e83056c214be
[]
no_license
bjajmd/mall
ce0dbc09357f605963da2497d4b0b6ce2901a808
60c4d55a285c021c7b7189dbae8087ffa4cd2193
refs/heads/master
2022-09-26T13:21:59.486809
2020-04-05T12:06:39
2020-04-05T12:06:39
253,225,142
0
0
null
2022-09-01T23:23:13
2020-04-05T12:04:36
JavaScript
UTF-8
Java
false
false
796
java
package com.bjajmd.mall.admin.common; import org.apache.shiro.SecurityUtils; import com.bjajmd.mall.admin.common.realm.AuthRealm.ShiroUser; /** * Created by wangl on 2017/11/25. * todo: */ public class MySysUser { /** * 取出Shiro中的当前用户LoginName. */ public static String icon() { return ShiroUser().getIcon(); } public static Long id() { return ShiroUser().getId(); } public static String loginName() { return ShiroUser().getloginName(); } public static String nickName(){ return ShiroUser().getNickName(); } public static ShiroUser ShiroUser() { ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal(); return user; } }
84a1d41da5f9a04b94cbd2da759e246be39c39fa
9c7451f2aef4870537fe8be6e8cee4d7239a0e32
/app/src/main/java/com/example/viewpager/OnboardingAdapter.java
c7befaf30176a2b3ab4e2367e03c6c344cd61b89
[]
no_license
samseen/android-viewpager
37e111b26b3e2ca32808dba6b6ecc10367162156
ed094e87dd70ce6d0163433cc74af961abf2f1f7
refs/heads/master
2023-04-11T23:17:13.390376
2021-05-15T20:27:01
2021-05-15T20:27:01
366,519,172
0
0
null
null
null
null
UTF-8
Java
false
false
1,997
java
package com.example.viewpager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class OnboardingAdapter extends RecyclerView.Adapter<OnboardingAdapter.OnboardingViewHolder> { private List<OnboardingItem> onboardingItems; public OnboardingAdapter(List<OnboardingItem> onboardingItems) { this.onboardingItems = onboardingItems; } @NonNull @Override public OnboardingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new OnboardingViewHolder( LayoutInflater.from(parent.getContext()).inflate( R.layout.item_container_onboarding, parent, false ) ); } @Override public void onBindViewHolder(@NonNull OnboardingAdapter.OnboardingViewHolder holder, int position) { holder.setImageOnboarding(onboardingItems.get(position)); } @Override public int getItemCount() { return onboardingItems.size(); } class OnboardingViewHolder extends RecyclerView.ViewHolder { private TextView textTitle; private TextView textDescription; private ImageView imageOnboarding; public OnboardingViewHolder(@NonNull View itemView) { super(itemView); textTitle = itemView.findViewById(R.id.textTitle); textDescription = itemView.findViewById(R.id.textDescription); imageOnboarding = itemView.findViewById(R.id.imageOnboarding); } public void setImageOnboarding(OnboardingItem onboardingItem) { textTitle.setText(onboardingItem.getTitle()); textDescription.setText(onboardingItem.getDescription()); imageOnboarding.setImageResource(onboardingItem.getImage());; } } }
84150db5cb72c0652467d01019485052ec917bd2
d8cc40718b7af0193479a233a21ea2f03c792764
/aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/transform/EvaluationMarshaller.java
ee6e33194b9492876a652879e1b744039fc631ac
[ "Apache-2.0" ]
permissive
chaoweimt/aws-sdk-java
1de8c0aeb9aa52931681268cd250ca2af59a83d9
f11d648b62f2615858e2f0c2e5dd69e77a91abd3
refs/heads/master
2021-01-22T03:18:33.038352
2017-05-24T22:40:24
2017-05-24T22:40:24
92,371,194
1
0
null
2017-05-25T06:13:36
2017-05-25T06:13:35
null
UTF-8
Java
false
false
3,279
java
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.config.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.config.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * EvaluationMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class EvaluationMarshaller { private static final MarshallingInfo<String> COMPLIANCERESOURCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceResourceType").build(); private static final MarshallingInfo<String> COMPLIANCERESOURCEID_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceResourceId").build(); private static final MarshallingInfo<String> COMPLIANCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceType").build(); private static final MarshallingInfo<String> ANNOTATION_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Annotation").build(); private static final MarshallingInfo<java.util.Date> ORDERINGTIMESTAMP_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("OrderingTimestamp").build(); private static final EvaluationMarshaller instance = new EvaluationMarshaller(); public static EvaluationMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(Evaluation evaluation, ProtocolMarshaller protocolMarshaller) { if (evaluation == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(evaluation.getComplianceResourceType(), COMPLIANCERESOURCETYPE_BINDING); protocolMarshaller.marshall(evaluation.getComplianceResourceId(), COMPLIANCERESOURCEID_BINDING); protocolMarshaller.marshall(evaluation.getComplianceType(), COMPLIANCETYPE_BINDING); protocolMarshaller.marshall(evaluation.getAnnotation(), ANNOTATION_BINDING); protocolMarshaller.marshall(evaluation.getOrderingTimestamp(), ORDERINGTIMESTAMP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
301c582f5f831825e55017ab76db598267ccea7a
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/7830/src_0.java
93185159bba0a3f478e87ec8a099decfb38dea27
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
25,301
java
/*BEGIN_COPYRIGHT_BLOCK * * This file is part of DrJava. Download the current version of this project: * http://sourceforge.net/projects/drjava/ or http://www.drjava.org/ * * DrJava Open Source License * * Copyright (C) 2001-2003 JavaPLT group at Rice University ([email protected]) * All rights reserved. * * Developed by: Java Programming Languages Team * Rice University * http://www.cs.rice.edu/~javaplt/ * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal with the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to * whom the Software is furnished to do so, subject to the following * conditions: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimers. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimers in the * documentation and/or other materials provided with the distribution. * - Neither the names of DrJava, the JavaPLT, Rice University, nor the * names of its contributors may be used to endorse or promote products * derived from this Software without specific prior written permission. * - Products derived from this software may not be called "DrJava" nor * use the term "DrJava" as part of their names without prior written * permission from the JavaPLT group. For permission, write to * [email protected]. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS WITH THE SOFTWARE. * END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.model.repl; import java.util.*; import java.io.*; import java.net.URL; import java.net.URLClassLoader; import koala.dynamicjava.interpreter.*; import koala.dynamicjava.interpreter.context.*; import koala.dynamicjava.interpreter.error.*; import koala.dynamicjava.interpreter.throwable.*; import koala.dynamicjava.parser.wrapper.*; import koala.dynamicjava.tree.*; import koala.dynamicjava.tree.visitor.*; import koala.dynamicjava.util.*; import edu.rice.cs.util.classloader.StickyClassLoader; import edu.rice.cs.util.*; import edu.rice.cs.drjava.DrJava; // NOTE: Do NOT import/use the config framework in this class! // (This class runs in a different JVM, and will not share the config object) /** * An implementation of the interpreter for the repl pane. * * This class is loaded in the Interpreter JVM, not the Main JVM. * (Do not use DrJava's config framework here.) * * @version $Id$ */ public class DynamicJavaAdapter implements JavaInterpreter { private koala.dynamicjava.interpreter.Interpreter _djInterpreter; /** * Constructor. */ public DynamicJavaAdapter() { _djInterpreter = new InterpreterExtension(); } /** * Interprets a string as Java source. * @param s the string to interpret * @return the Object generated by the running of s */ public Object interpret(String s) throws ExceptionReturnedException { boolean print = false; /** * trims the whitespace from beginning and end of string * checks the end to see if it is a semicolon * adds a semicolon if necessary */ s = s.trim(); if (!s.endsWith(";")) { s += ";"; print = true; } StringReader reader = new StringReader(s); try { Object result = _djInterpreter.interpret(reader, "DrJava"); if (print) return result; else return JavaInterpreter.NO_RESULT; } catch (InterpreterException ie) { Throwable cause = ie.getException(); if (cause instanceof ThrownException) { cause = ((ThrownException) cause).getException(); } else if (cause instanceof CatchedExceptionError) { cause = ((CatchedExceptionError) cause).getException(); } throw new ExceptionReturnedException(cause); } catch (CatchedExceptionError cee) { throw new ExceptionReturnedException(cee.getException()); } catch (InterpreterInterruptedException iie) { return JavaInterpreter.NO_RESULT; } catch (ExitingNotAllowedException enae) { return JavaInterpreter.NO_RESULT; } catch (Throwable ie) { //System.err.print(new Date() + ": "); //System.err.println(ie); //ie.printStackTrace(); //System.err.println("\n"); //throw new RuntimeException(ie.toString()); throw new ExceptionReturnedException(ie); } } /** * Adds a path to the current classpath. * @param path the path to add */ public void addClassPath(String path) { //DrJava.consoleErr().println("Added class path: " + path); // TODO: Once we move past 1.3, replace this with // _djInterpreter.addClassPath(new File(path).toURI().getRawPath()) // in order to properly accept # and other special characters in paths. _djInterpreter.addClassPath(path); } /** * Set the scope for unqualified names to the given package. * @param packageName Package to assume scope of. */ public void setPackageScope(String packageName) { StringReader reader = new StringReader("package " + packageName + ";"); _djInterpreter.interpret(reader, "DrJava"); } /** * Returns the value of the variable with the given name in * the interpreter. * @param name Name of the variable * @return Value of the variable */ public Object getVariable(String name) { return _djInterpreter.getVariable(name); } /** * Returns the class of the variable with the given name in * the interpreter. * @param name Name of the variable * @return class of the variable */ public Class getVariableClass(String name) { return _djInterpreter.getVariableClass(name); } /** * Assigns the given value to the given name in the interpreter. * If type == null, we assume that the type of this variable * has not been loaded so we set it to Object. * @param name Name of the variable * @param value Value to assign * @param type the type of the variable */ public void defineVariable(String name, Object value, Class type) { if (type == null) { type = java.lang.Object.class; } ((TreeInterpreter)_djInterpreter).defineVariable(name, value, type); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value Value to assign */ public void defineVariable(String name, Object value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value boolean to assign */ public void defineVariable(String name, boolean value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value byte to assign */ public void defineVariable(String name, byte value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value char to assign */ public void defineVariable(String name, char value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value double to assign */ public void defineVariable(String name, double value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value float to assign */ public void defineVariable(String name, float value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value int to assign */ public void defineVariable(String name, int value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value long to assign */ public void defineVariable(String name, long value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value short to assign */ public void defineVariable(String name, short value) { ((TreeInterpreter)_djInterpreter).defineVariable(name, value); } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value Value to assign */ public void defineConstant(String name, Object value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value boolean to assign */ public void defineConstant(String name, boolean value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value byte to assign */ public void defineConstant(String name, byte value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value char to assign */ public void defineConstant(String name, char value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value double to assign */ public void defineConstant(String name, double value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value float to assign */ public void defineConstant(String name, float value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value int to assign */ public void defineConstant(String name, int value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value long to assign */ public void defineConstant(String name, long value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value short to assign */ public void defineConstant(String name, short value) { ((InterpreterExtension)_djInterpreter).defineConstant(name, value); } /** * Sets whether protected and private variables should be accessible in * the interpreter. * @param accessible Whether protected and private variable are accessible */ public void setPrivateAccessible(boolean accessible) { _djInterpreter.setAccessible(accessible); } /** * Factory method to make a new NameVisitor. * @param context the context * @return visitor the visitor */ public NameVisitor makeNameVisitor(Context nameContext, Context typeContext) { return new NameVisitorExtension(nameContext, typeContext); } /** * Factory method to make a new TypeChecker. * @param nameContext Context for the NameVisitor * @param typeContext Context being used for the TypeChecker. This is * necessary because we want to perform a partial type checking for the * right hand side of a VariableDeclaration. * @return visitor the visitor */ public TypeChecker makeTypeChecker(Context context) { // TO DO: move this into its own class if more methods need to be added return new TypeCheckerExtension(context); } /** * Factory method to make a new EvaluationVisitor. * @param context the context * @return visitor the visitor */ public EvaluationVisitor makeEvaluationVisitor(Context context) { return new EvaluationVisitorExtension(context); } /** * Processes the tree before evaluating it, if necessary. * @param node Tree to process */ public Node processTree(Node node) { return node; } public GlobalContext makeGlobalContext(TreeInterpreter i) { return new GlobalContext(i); } /** * An extension of DynamicJava's interpreter that makes sure classes are * not loaded by the system class loader (when possible) so that future * interpreters will be able to reload the classes. This extension also * ensures that classes on "extra.classpath" will be loaded if referenced * by user defined classes. (Without this, classes on "extra.classpath" * can only be referred to directly, and cannot be extended, etc.) * <p> * * We also override the evaluation visitor to allow the interpreter to be * interrupted and to return NO_RESULT if there was no result. */ public class InterpreterExtension extends TreeInterpreter { /** * Constructor. */ public InterpreterExtension() { super(new JavaCCParserFactory()); classLoader = new ClassLoaderExtension(this); // We have to reinitialize these variables because they automatically // fetch pointers to classLoader in their constructors. nameVisitorContext = makeGlobalContext(this); ClassLoaderContainer clc = new ClassLoaderContainer() { public ClassLoader getClassLoader() { return classLoader; } }; nameVisitorContext.setAdditionalClassLoaderContainer(clc); checkVisitorContext = makeGlobalContext(this); checkVisitorContext.setAdditionalClassLoaderContainer(clc); evalVisitorContext = makeGlobalContext(this); evalVisitorContext.setAdditionalClassLoaderContainer(clc); //System.err.println("set loader: " + classLoader); } /** * Extends the interpret method to deal with possible interrupted * exceptions. * Unfortunately we have to copy all of this method to override it. * @param is the reader from which the statements are read * @param fname the name of the parsed stream * @return the result of the evaluation of the last statement */ public Object interpret(Reader r, String fname) throws InterpreterException { try { SourceCodeParser p = parserFactory.createParser(r, fname); List statements = p.parseStream(); ListIterator it = statements.listIterator(); Object result = JavaInterpreter.NO_RESULT; while (it.hasNext()) { Node n = (Node)it.next(); // Process, if necessary n = processTree(n); Visitor v = makeNameVisitor(nameVisitorContext, checkVisitorContext); Object o = n.acceptVisitor(v); if (o != null) { n = (Node)o; } v = makeTypeChecker(checkVisitorContext); n.acceptVisitor(v); evalVisitorContext.defineVariables (checkVisitorContext.getCurrentScopeVariables()); v = makeEvaluationVisitor(evalVisitorContext); result = n.acceptVisitor(v); } if (result instanceof String) { result = "\"" + result + "\""; } else if (result instanceof Character) { result = "'" + result + "'"; } return result; } catch (ExecutionError e) { throw new InterpreterException(e); } catch (ParseError e) { throw new InteractionsException("There was a syntax error in the " + "previous input."); //throw new InterpreterException(e); } } /** * Assigns the given value to the given name in the interpreter. * @param name Name of the variable * @param value Value to assign */ public void defineConstant(String name, Object value) { Class c = (value == null) ? null : value.getClass(); nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, value); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value boolean to assign */ public void defineConstant(String name, boolean value) { Class c = boolean.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Boolean(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value byte to assign */ public void defineConstant(String name, byte value) { Class c = byte.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Byte(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value char to assign */ public void defineConstant(String name, char value) { Class c = char.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Character(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value double to assign */ public void defineConstant(String name, double value) { Class c = double.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Double(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value float to assign */ public void defineConstant(String name, float value) { Class c = float.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Float(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value int to assign */ public void defineConstant(String name, int value) { Class c = int.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Integer(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value long to assign */ public void defineConstant(String name, long value) { Class c = long.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Long(value)); } /** * Assigns the given value to the given name as a constant in the interpreter. * @param name Name of the variable * @param value short to assign */ public void defineConstant(String name, short value) { Class c = short.class; nameVisitorContext.defineConstant(name, c); checkVisitorContext.defineConstant(name, c); evalVisitorContext.defineConstant(name, new Short(value)); } } /** * A class loader for the interpreter. */ public static class ClassLoaderExtension extends TreeClassLoader { private static boolean classLoaderCreated = false; private static StickyClassLoader _stickyLoader; /** * Constructor. * @param Interpreter i */ public ClassLoaderExtension(koala.dynamicjava.interpreter.Interpreter i) { super(i); // The protected variable classLoader contains the class loader to use // to find classes. When a new class path is added to the loader, // it adds on an auxilary classloader and chains the old classLoader // onto the end. // Here we initialize classLoader to be the system class loader. classLoader = getClass().getClassLoader(); // don't load the dynamic java stuff using the sticky loader! // without this, interpreter-defined classes don't work. String[] excludes = { "edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$InterpreterExtension", "edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$ClassLoaderExtension" }; if (!classLoaderCreated) { _stickyLoader = new StickyClassLoader(this, getClass().getClassLoader(), excludes); classLoaderCreated = true; } // we will use this to getResource classes } /** * Adds an URL to the class path. DynamicJava's version of this creates a * new URLClassLoader with the given URL, using the old loader as a parent. * This seems to cause problems for us in certain cases, such as accessing * static fields or methods in a class that extends a superclass which is * loaded by "child" classloader... * * Instead, we'll replace the old URLClassLoader with a new one containing * all the known URLs. * * (I don't know if this really works yet, so I'm not including it in * the current release. CSR, 3-13-2003) * public void addURL(URL url) { if (classLoader == null) { classLoader = new URLClassLoader(new URL[] { url }); } else if (classLoader instanceof URLClassLoader) { URL[] oldURLs = ((URLClassLoader)classLoader).getURLs(); URL[] newURLs = new URL[oldURLs.length + 1]; System.arraycopy(oldURLs, 0, newURLs, 0, oldURLs.length); newURLs[oldURLs.length] = url; // Create a new class loader with all the URLs classLoader = new URLClassLoader(newURLs); } else { classLoader = new URLClassLoader(new URL[] { url }, classLoader); } }*/ /* public Class defineClass(String name, byte[] code) { File file = new File("debug-" + name + ".class"); try { FileOutputStream out = new FileOutputStream(file); out.write(code); out.close(); DrJava.consoleErr().println("debug class " + name + " to " + file.getAbsolutePath()); } catch (Throwable t) {} Class c = super.defineClass(name, code); return c; } */ /** * Delegates all resource requests to {@link #classLoader}. * This method is called by the {@link StickyClassLoader}. */ public URL getResource(String name) { return classLoader.getResource(name); } protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class clazz; // check the cache if (classes.containsKey(name)) { clazz = (Class) classes.get(name); } else { try { clazz = _stickyLoader.loadClass(name); } catch (ClassNotFoundException e) { // If it exceptions, just fall through to here to try the interpreter. // If all else fails, try loading the class through the interpreter. // That's used for classes defined in the interpreter. clazz = interpreter.loadClass(name); } } if (resolve) { resolveClass(clazz); } return clazz; } } }
39ecce34c54f9d6659cbfb93a7b2a542ccad4d5e
5375bc0f58022c610872825450c3b694ffaaff98
/src/main/java/com/tfg/bookmanagerrmh2/repository/AuthorRepository.java
4aa9df946dbfeacc95d970d7f61c012c01b86980
[]
no_license
PabloGitu/bookmanagerRMH2
76f00c5c1294a8908df70f77ad9d6c47ac904709
82ffd416e1f9860280682ce828a35ccbac939e5a
refs/heads/master
2020-04-27T09:57:22.620993
2019-03-21T16:56:53
2019-03-21T16:56:53
174,235,314
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.tfg.bookmanagerrmh2.repository; import com.tfg.bookmanagerrmh2.domain.Author; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data repository for the Author entity. */ @SuppressWarnings("unused") @Repository public interface AuthorRepository extends JpaRepository<Author, Long> { }
0d03f4582461d9bde38d492b448ce7951a2fb3e5
a7daa660551ac31e195b72b0fe5a853b1c486a49
/app/src/androidTest/java/edu_up_cs301/ludo/LudoStateTest.java
0ecc1e8e7c8d55ec4a3b35ead9370bc022429f3f
[]
no_license
OnlyForObjectOrientednayyar19/Ludo_FinalRelease
22c40705df0d766125ddb7b37aeb1c31ecb2b7e6
513f93e40d37780481c5a2e49a499a0f033ca17e
refs/heads/master
2020-03-13T09:40:13.800015
2018-04-25T22:08:01
2018-04-25T22:08:01
131,068,900
0
0
null
null
null
null
UTF-8
Java
false
false
2,540
java
package edu_up_cs301.ludo; import org.junit.Test; import static org.junit.Assert.*; public class LudoStateTest { /** * newRollTest * Tests the functionality of a new roll be seeing if the dice value is greater than 1 * and less than or equal to 6 */ @Test public void newRollTest() { LudoState state = new LudoState(); state.newRoll(); if(state.getDiceVal() <=6 && state.getDiceVal()>0){ assertEquals(1,1); } else{ assertEquals(-1,1); } } /** * incPlayerScoreTest * Tests to see if the player's score is correctly increased */ @Test public void incPlayerScoreTest() { LudoState state = new LudoState(); state.incPlayerScore(0); assertEquals(state.getPlayerScore(0),1); state.incPlayerScore(0); state.incPlayerScore(0); state.incPlayerScore(0); assertEquals(state.getPlayerScore(0),4); } /** * changePlayerTurnTest * This tests to see if the changePlayerTurn methods changes the players turn * As an edge case, if it is player three's turn and the change player turn method * is called, it should wrap around to player 0's turn. */ @Test public void changePlayerTurnTest(){ LudoState state = new LudoState(); assertEquals(state.getWhoseMove(),0); state.changePlayerTurn(); assertEquals(state.getWhoseMove(),1); state.changePlayerTurn(); state.changePlayerTurn(); state.changePlayerTurn(); //It should wrap around back to player 0 assertEquals(state.getWhoseMove(),0); } /** * advanceTokenTest * This tests to see if the advanceToken method advances the specified token */ @Test public void advanceTokenTest() { LudoState state = new LudoState(); state.pieces[0].setIsMovable(true); state.newRoll(); state.advanceToken(0,0); assertEquals(state.pieces[0].getNumSpacesMoved()+state.getDiceVal(),state.getDiceVal()); } /** * getOrderTest * This test to se if the getOrder does indeed return the order in which the player's * pieces are. Whichever piece is in the array order's third index is the furthest player */ @Test public void getOrderTest() { assertEquals(0,0); LudoState state = new LudoState(); state.newRoll(); state.advanceToken(0,0); assertEquals(state.getOrder(0)[3],0); } }
2b253ad383578bc5827a98290087515906b09f1f
d728aafaaedf485accc34250bb8175cbd6e8dd0f
/app/src/main/java/com/dingtai/jinriyongzhou/model/NewsADs.java
1877b3bf277a76d995f4ecc9d5402cfc3b60e643
[]
no_license
skskinsky/JinRiYongZhou
22d0bc922f64c8eb7a32005dd555e849c38f5c84
c3667e1c0443348be2296c8c859a722771e71396
refs/heads/master
2021-05-11T22:00:37.354853
2018-01-15T01:41:25
2018-01-15T01:41:25
117,482,700
0
0
null
null
null
null
UTF-8
Java
false
false
4,640
java
package com.dingtai.jinriyongzhou.model; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; import java.io.Serializable; @DatabaseTable(tableName = "NewsADs") public class NewsADs implements Serializable{ @DatabaseField(id = true) private String ID; @DatabaseField private String CreateTime; @DatabaseField private String ADName; @DatabaseField private String ImgUrl ; @DatabaseField private String LinkUrl; @DatabaseField private String StID ; @DatabaseField private String ChID ; @DatabaseField private String ADType ; @DatabaseField private String ADFor; @DatabaseField private String LinkTo ; @DatabaseField private String BeginDate; @DatabaseField private String EndDate; @DatabaseField private String ADPositionID; @DatabaseField private String RandomNum; @DatabaseField private String Status; @DatabaseField private String ReMark; @DatabaseField private String ADContent; @DatabaseField private String MediaID; @DatabaseField private String IsIndexAD; @DatabaseField private String GoodType; @DatabaseField private String CreateAdmin; @DatabaseField private String ShowOrder; @DatabaseField private String IsChannel; @DatabaseField private String NewsType; @DatabaseField private String ResType; @DatabaseField private String ResUrl; public String getID() { return ID; } public void setID(String iD) { ID = iD; } public String getCreateTime() { return CreateTime; } public void setCreateTime(String createTime) { CreateTime = createTime; } public String getADName() { return ADName; } public void setADName(String aDName) { ADName = aDName; } public String getImgUrl() { return ImgUrl; } public void setImgUrl(String imgUrl) { ImgUrl = imgUrl; } public String getLinkUrl() { return LinkUrl; } public void setLinkUrl(String linkUrl) { LinkUrl = linkUrl; } public String getStID() { return StID; } public void setStID(String stID) { StID = stID; } public String getChID() { return ChID; } public void setChID(String chID) { ChID = chID; } public String getADType() { return ADType; } public void setADType(String aDType) { ADType = aDType; } public String getADFor() { return ADFor; } public void setADFor(String aDFor) { ADFor = aDFor; } public String getLinkTo() { return LinkTo; } public void setLinkTo(String linkTo) { LinkTo = linkTo; } public String getBeginDate() { return BeginDate; } public void setBeginDate(String beginDate) { BeginDate = beginDate; } public String getEndDate() { return EndDate; } public void setEndDate(String endDate) { EndDate = endDate; } public String getADPositionID() { return ADPositionID; } public void setADPositionID(String aDPositionID) { ADPositionID = aDPositionID; } public String getRandomNum() { return RandomNum; } public void setRandomNum(String randomNum) { RandomNum = randomNum; } public String getStatus() { return Status; } public void setStatus(String status) { Status = status; } public String getReMark() { return ReMark; } public void setReMark(String reMark) { ReMark = reMark; } public String getADContent() { return ADContent; } public void setADContent(String aDContent) { ADContent = aDContent; } public String getMediaID() { return MediaID; } public void setMediaID(String mediaID) { MediaID = mediaID; } public String getIsIndexAD() { return IsIndexAD; } public void setIsIndexAD(String isIndexAD) { IsIndexAD = isIndexAD; } public String getGoodType() { return GoodType; } public void setGoodType(String goodType) { GoodType = goodType; } public String getCreateAdmin() { return CreateAdmin; } public void setCreateAdmin(String createAdmin) { CreateAdmin = createAdmin; } public String getShowOrder() { return ShowOrder; } public void setShowOrder(String showOrder) { ShowOrder = showOrder; } public String getIsChannel() { return IsChannel; } public void setIsChannel(String isChannel) { IsChannel = isChannel; } public String getNewsType() { return NewsType; } public void setNewsType(String newsType) { NewsType = newsType; } public String getResType() { return ResType; } public void setResType(String resType) { ResType = resType; } public String getResUrl() { return ResUrl; } public void setResUrl(String resUrl) { ResUrl = resUrl; } }
5eb0f9a09521b71dd1d530bac3aad4ebc0977d6f
36ea7533f779d0daa8d4e0a032f713c2da9e412b
/microservice_order/src/main/java/cn/bd/microservice/properties/OrderProperties.java
45639c92bdcbb926964d3fde4fdf0fa631ca43f3
[]
no_license
iricpan/springcloud1
5c40e38ac15dbe6254835f70d94e8f4a9ed57ad8
699b37cd9ee935e88ca46a0dc09bad68a08743be
refs/heads/master
2020-03-14T22:58:09.671360
2018-05-02T10:09:50
2018-05-02T10:09:50
131,833,291
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
package cn.bd.microservice.properties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "cnn") public class OrderProperties { private ItemProperties item = new ItemProperties (); public ItemProperties getItem() { return item; } public void setItem(ItemProperties item) { this.item = item; } }
b66924f632389921516c65d177743a51ed89d938
d6eab77df59623d67c3ebd8ea61bd8367534db5f
/ch08_io_file/src/Ex05_FileOutputStreamEx.java
84203b12e71ae26d91723ef3fab399284024a5d6
[]
no_license
ricerich/java20210709
b90fb2db3c7167a9bb6efc3fc4970c1ef052f4d4
b9c3c22aea724e7e70592d654051c20c50514fe8
refs/heads/master
2023-07-07T01:07:33.148688
2021-08-11T03:09:13
2021-08-11T03:09:13
384,303,476
0
0
null
null
null
null
UHC
Java
false
false
572
java
import java.io.*; public class Ex05_FileOutputStreamEx { public static void main(String[] args) { byte b[] = {7,51,3,4,-1,24}; try { FileOutputStream fout = new FileOutputStream("./Temp1/test.out"); for(int i=0; i<b.length; i++) fout.write(b[i]); // 배열 b의 바이너리를 그대로 기록 fout.close(); } catch(IOException e) { System.out.println("./Temp/test.out에 저장할 수 없었습니다. 경로명을 확인해 주세요"); return; } System.out.println("./Temp/test.out을 저장하였습니다."); } }
[ "admin@DESKTOP-3PE3QU4" ]
admin@DESKTOP-3PE3QU4
f5810444de0b4ddba5a7dbb2405c2a7834c3d8b8
b647e8d18eb51b8f4f42062f9954970b35d1c09b
/Chapter9/src/main/java/com/ttt/MyHttpclient.java
a23ae80c5a8a2087d6dc42d0207e25c864e9adec
[]
no_license
TTT-824/AutoTest
c9563e9839bff67fccf1a841899ab5b052fd94a0
d04024a12c96491d499da0d6c9eb257c6c66153b
refs/heads/master
2023-01-05T16:27:19.652427
2020-10-27T16:15:30
2020-10-27T16:15:30
305,030,740
0
0
null
null
null
null
UTF-8
Java
false
false
2,063
java
package com.ttt; import com.alibaba.fastjson.JSONObject; import jdk.nashorn.internal.parser.JSONParser; import jdk.nashorn.internal.runtime.JSONListAdapter; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.testng.annotations.Test; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class MyHttpclient { @Test public void Test1() throws IOException { String result; String uri = "http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a"; // HttpGet get = new HttpGet("http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a"); //这个是用来执行get方法的 HttpPost post = new HttpPost("http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a"); HttpClient client = new DefaultHttpClient(); HttpResponse response = client.execute(post); result = EntityUtils.toString(response.getEntity(),"utf-8"); System.out.println(result); JSONObject object = JSONObject.parseObject(result); String msg = object.getString("msg"); int code = object.getIntValue("code"); FileWriter fstream = new FileWriter("D:\\AutoTest\\AutoTest\\Chapter9\\result.csv",true); BufferedWriter out =new BufferedWriter(fstream); // out.write(vars.get("token")+","+ vars.get("userid")+","+ vars.get("phone")); out.write(msg+","+code+","+result+","+uri); out.write(System.getProperty("line.separator")); out.close(); fstream.close(); } }
0d10c93bd6434144f7288023d65a0a919afdeadc
d676d04d522de2b7747e86147c4855c36f885cc3
/sigaenterprise_backend/sigaenterprise_backend_purchase_client/src/main/java/sigaenterprise/backend/purchase/remote/PurchaseOrderFacadeRemote.java
3f676a7a6fc7eddee577a77f61e37326308f011a
[]
no_license
emosquera/sigaenterprise
949c896277032309745a12c9bcb2279317a5b979
91829e60e2e8f1ae72a48f728b134b6f89eae3b1
refs/heads/master
2021-04-15T05:14:58.345172
2017-07-08T14:41:41
2017-07-08T14:41:41
94,562,422
0
1
null
null
null
null
UTF-8
Java
false
false
801
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 sigaenterprise.backend.purchase.remote; import java.util.List; import javax.ejb.Remote; import sigaenterprise.backend.purchase.model.PurchaseOrder; /** * * @author syslife01 */ @Remote public interface PurchaseOrderFacadeRemote { public final String JNDI_REMOTE_NAME = "ejb/purchaseOrderFacadeRemote"; void create(PurchaseOrder purchaseOrder); void edit(PurchaseOrder purchaseOrder); void remove(PurchaseOrder purchaseOrder); PurchaseOrder find(Object id); List<PurchaseOrder> findAll(); List<PurchaseOrder> findRange(int[] range); int count(); }
d00cb7f93bf039930487fbc0a3bfaa905809303b
c16ef4066a0013d2c701eb6e02cbc9ff18d7228c
/src/main/java/ru/company/onetwo33/homework5/Tunnel.java
f9d158b012c7b2521d150be49e172dcdfc7f3e4a
[]
no_license
OneTwo33/GB-JavaLevel3
921c660d9cfab60d711482727267072030583652
81bd0663b7a8cec60a9b8fd5ce96d2fe4ff6038c
refs/heads/master
2023-04-06T13:00:53.478245
2021-03-29T16:35:14
2021-03-29T16:35:14
346,682,264
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package ru.company.onetwo33.homework5; import java.util.concurrent.Semaphore; public class Tunnel extends Stage { private final Semaphore semaphore; public Tunnel(int members) { this.length = 80; this.description = "Тоннель " + length + " метров"; this.semaphore = new Semaphore(members / 2); // только половина участника могут въехать в тоннель } @Override public void go(Car c) { try { try { System.out.println(c.getName() + " готовится к этапу(ждет): " + description); semaphore.acquire(); System.out.println(c.getName() + " начал этап: " + description); Thread.sleep(length / c.getSpeed() * 1000); } catch (InterruptedException e) { e.printStackTrace(); } finally { System.out.println(c.getName() + " закончил этап: " + description); semaphore.release(); } } catch (Exception e) { e.printStackTrace(); } } }
ec9e63a17a28b7c0d174a43775c7cedfe0c61ad7
eb118856796700c92d4ff0ea9f56a37caddb3db4
/showcase/bookstore/src/main/java/org/ocpsoft/rewrite/showcase/bookstore/web/list/YearBean.java
ed91532f9301658b2566d92efa92531d4a5b9a44
[ "Apache-2.0" ]
permissive
ocpsoft/rewrite
b657892cdee10b748435cf50772c4a5f89b4832b
081871aa06d3dd366100b025bc62bfbabadf7457
refs/heads/main
2023-09-05T20:03:04.413656
2023-03-21T15:08:26
2023-03-21T15:10:16
1,946,637
130
86
Apache-2.0
2023-07-25T13:52:28
2011-06-24T08:51:19
Java
UTF-8
Java
false
false
1,362
java
/* * Copyright 2011 <a href="mailto:[email protected]">Lincoln Baxter, III</a> * * 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.ocpsoft.rewrite.showcase.bookstore.web.list; import java.util.List; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; import javax.inject.Named; import org.ocpsoft.rewrite.showcase.bookstore.dao.BookDao; import org.ocpsoft.rewrite.showcase.bookstore.model.Book; @Named @RequestScoped public class YearBean { private Integer year; @EJB private BookDao bookDao; private List<Book> books; public void preRenderView() { books = bookDao.findByYear(year); } public List<Book> getBooks() { return books; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } }
c423cc098fedc8c90e33bd00bb40529c214561a2
87ac0cdcd1700bf9b360914e8e18c7f8cccc9880
/backend/src/main/java/com/knigopoisk/demo/DemoApplication.java
65f873fe30cd663ad8b46021e9d44706d736431e
[]
no_license
qcezwx/knigopoisk
e936cda7aca9451ace9f8113d3ec3f4bf59122e6
d295d3a1d0b3c29eb7627062ca9d82263777f8e1
refs/heads/master
2020-03-23T12:55:30.889519
2018-08-27T09:35:01
2018-08-27T09:35:01
141,590,600
1
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.knigopoisk.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @EnableJpaAuditing @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
db60a346dcefe2b121b8c51bfcc7e7e4eab7c9d7
bfa473bf0b12c5adc830d89c4eece764981eca92
/aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/GetAssessmentReportRequest.java
7d894a5e7f2cc8dc1d744429ebcdcfdfb526073c
[ "Apache-2.0" ]
permissive
nksabertooth/aws-sdk-java
de515f2544cdcf0d16977f06281bd6488e19be96
4734de6fb0f80fe5768a6587aad3b9d0eaec388f
refs/heads/master
2021-09-02T14:09:26.653186
2018-01-03T01:27:36
2018-01-03T01:27:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,351
java
/* * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.inspector.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReport" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetAssessmentReportRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The ARN that specifies the assessment run for which you want to generate a report. * </p> */ private String assessmentRunArn; /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> */ private String reportFileFormat; /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> */ private String reportType; /** * <p> * The ARN that specifies the assessment run for which you want to generate a report. * </p> * * @param assessmentRunArn * The ARN that specifies the assessment run for which you want to generate a report. */ public void setAssessmentRunArn(String assessmentRunArn) { this.assessmentRunArn = assessmentRunArn; } /** * <p> * The ARN that specifies the assessment run for which you want to generate a report. * </p> * * @return The ARN that specifies the assessment run for which you want to generate a report. */ public String getAssessmentRunArn() { return this.assessmentRunArn; } /** * <p> * The ARN that specifies the assessment run for which you want to generate a report. * </p> * * @param assessmentRunArn * The ARN that specifies the assessment run for which you want to generate a report. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAssessmentReportRequest withAssessmentRunArn(String assessmentRunArn) { setAssessmentRunArn(assessmentRunArn); return this; } /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> * * @param reportFileFormat * Specifies the file format (html or pdf) of the assessment report that you want to generate. * @see ReportFileFormat */ public void setReportFileFormat(String reportFileFormat) { this.reportFileFormat = reportFileFormat; } /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> * * @return Specifies the file format (html or pdf) of the assessment report that you want to generate. * @see ReportFileFormat */ public String getReportFileFormat() { return this.reportFileFormat; } /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> * * @param reportFileFormat * Specifies the file format (html or pdf) of the assessment report that you want to generate. * @return Returns a reference to this object so that method calls can be chained together. * @see ReportFileFormat */ public GetAssessmentReportRequest withReportFileFormat(String reportFileFormat) { setReportFileFormat(reportFileFormat); return this; } /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> * * @param reportFileFormat * Specifies the file format (html or pdf) of the assessment report that you want to generate. * @see ReportFileFormat */ public void setReportFileFormat(ReportFileFormat reportFileFormat) { withReportFileFormat(reportFileFormat); } /** * <p> * Specifies the file format (html or pdf) of the assessment report that you want to generate. * </p> * * @param reportFileFormat * Specifies the file format (html or pdf) of the assessment report that you want to generate. * @return Returns a reference to this object so that method calls can be chained together. * @see ReportFileFormat */ public GetAssessmentReportRequest withReportFileFormat(ReportFileFormat reportFileFormat) { this.reportFileFormat = reportFileFormat.toString(); return this; } /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> * * @param reportType * Specifies the type of the assessment report that you want to generate. There are two types of assessment * reports: a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment * Reports</a>. * @see ReportType */ public void setReportType(String reportType) { this.reportType = reportType; } /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> * * @return Specifies the type of the assessment report that you want to generate. There are two types of assessment * reports: a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment * Reports</a>. * @see ReportType */ public String getReportType() { return this.reportType; } /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> * * @param reportType * Specifies the type of the assessment report that you want to generate. There are two types of assessment * reports: a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment * Reports</a>. * @return Returns a reference to this object so that method calls can be chained together. * @see ReportType */ public GetAssessmentReportRequest withReportType(String reportType) { setReportType(reportType); return this; } /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> * * @param reportType * Specifies the type of the assessment report that you want to generate. There are two types of assessment * reports: a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment * Reports</a>. * @see ReportType */ public void setReportType(ReportType reportType) { withReportType(reportType); } /** * <p> * Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: * a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>. * </p> * * @param reportType * Specifies the type of the assessment report that you want to generate. There are two types of assessment * reports: a finding report and a full report. For more information, see <a * href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment * Reports</a>. * @return Returns a reference to this object so that method calls can be chained together. * @see ReportType */ public GetAssessmentReportRequest withReportType(ReportType reportType) { this.reportType = reportType.toString(); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAssessmentRunArn() != null) sb.append("AssessmentRunArn: ").append(getAssessmentRunArn()).append(","); if (getReportFileFormat() != null) sb.append("ReportFileFormat: ").append(getReportFileFormat()).append(","); if (getReportType() != null) sb.append("ReportType: ").append(getReportType()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetAssessmentReportRequest == false) return false; GetAssessmentReportRequest other = (GetAssessmentReportRequest) obj; if (other.getAssessmentRunArn() == null ^ this.getAssessmentRunArn() == null) return false; if (other.getAssessmentRunArn() != null && other.getAssessmentRunArn().equals(this.getAssessmentRunArn()) == false) return false; if (other.getReportFileFormat() == null ^ this.getReportFileFormat() == null) return false; if (other.getReportFileFormat() != null && other.getReportFileFormat().equals(this.getReportFileFormat()) == false) return false; if (other.getReportType() == null ^ this.getReportType() == null) return false; if (other.getReportType() != null && other.getReportType().equals(this.getReportType()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAssessmentRunArn() == null) ? 0 : getAssessmentRunArn().hashCode()); hashCode = prime * hashCode + ((getReportFileFormat() == null) ? 0 : getReportFileFormat().hashCode()); hashCode = prime * hashCode + ((getReportType() == null) ? 0 : getReportType().hashCode()); return hashCode; } @Override public GetAssessmentReportRequest clone() { return (GetAssessmentReportRequest) super.clone(); } }
[ "" ]
3ce0e85d15a19052d5c35111e1c6ed716a66f1d7
559fa0a403051b634f4d0c78a4e1f8b57a4f1733
/src/main/java/bencode/impl/BEncodeListWriter.java
a9cdc8f78551c834898c9611bb7ef8f3a5177bb5
[]
no_license
eshu/bencode-java
00002f2f6d429c60592f0a7a70919abe39e53ee4
efc317e26d384d0ab538bdfc1c4d1763849543a9
refs/heads/master
2016-09-05T11:34:40.221679
2015-03-18T20:45:39
2015-03-18T20:45:39
32,482,082
0
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
package bencode.impl; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.math.BigInteger; import java.util.List; import java.util.Map; import bencode.DictionaryWriter; import bencode.ListWriter; import bencode.exception.BEncodeException; import bencode.util.Blob; import bencode.util.ByteArray; final class BEncodeListWriter extends ContainerChildWriter implements ListWriter { BEncodeListWriter(final BEncodeOutputStream out) { super(out); } @Override public ListWriter list() throws IOException, BEncodeException { assertChildClosed(); out.list(); final BEncodeListWriter list = new BEncodeListWriter(out); child = list; return list; } @Override public DictionaryWriter dictionary() throws IOException { assertChildClosed(); out.dictionary(); final BEncodeDictionaryWriter dictionary = new BEncodeDictionaryWriter(out); child = dictionary; return dictionary; } @Override public OutputStream string(final BigInteger length) throws IOException { assertChildClosed(); final ByteStringOutputStream stream = out.string(length); child = stream; return stream; } @Override public ListWriter write(final BigInteger value) throws IOException { assertChildClosed(); out.write(value); return this; } @Override public ListWriter write(final byte[] string) throws IOException { assertChildClosed(); out.write(string); return this; } @Override public ListWriter write(final String string) throws IOException { assertChildClosed(); out.write(string); return this; } @Override public ListWriter write(final BigInteger length, final InputStream in) throws IOException { assertChildClosed(); out.write(length, in); return this; } @Override public ListWriter write(final Blob blob) throws IOException { assertChildClosed(); out.write(blob); return this; } @Override public ListWriter write(final List<?> list) throws IOException { assertChildClosed(); out.write(list); return this; } @Override public ListWriter write(final Map<ByteArray, ?> map) throws IOException { assertChildClosed(); out.write(map); return this; } }
1d906f31dbc7413e8c590f4a5424cbb3d0611ea8
b7d2c2140033215d554fc5850dbb9ad291bed855
/app/src/main/java/com/example/sqliteapp/BancoDeDados.java
14ad1ac6f5624fc78fcdb7bab0bc30c85d8e7fbb
[]
no_license
alinefbrito/SqliteApp
c60a44f70f3a1102d9dc8a650c1f296d0fa33036
e637c9b290b33c52e73bf9348882bf25bb514301
refs/heads/master
2020-09-05T06:42:13.605940
2019-11-06T14:21:26
2019-11-06T14:21:26
220,015,243
2
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package com.example.sqliteapp; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class BancoDeDados extends SQLiteOpenHelper { public static final String NOME_BANCO = "banco.db"; public static final String TABELA = "livros"; public static final String ID = "_id"; public static final String TITULO = "titulo"; public static final String AUTOR = "autor"; public static final String EDITORA = "editora"; public static final int VERSAO = 1; public BancoDeDados(Context context){ super(context, NOME_BANCO,null,VERSAO); } @Override public void onCreate(SQLiteDatabase db) { String sql = "CREATE TABLE"+TABELA+"(" + ID + " integer primary key autoincrement," + TITULO + " text," + AUTOR + " text," + EDITORA + " text" +")"; } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABELA); onCreate(db); } }
d4f4bb1c0546f186131ef52d97514cbf1d388f35
11c08a5df4cebe41fe4b4665fa5dfd14c8c8eeb7
/src/main/java/algo/MergeTwoLists.java
9c46b87b290636f844ef73b4926401b2bb9e461a
[]
no_license
CloudsDocker/AlgoPA
2530403185b44014bb429d3efafde60da2a56ee4
fc168fcfa55f0c59829391b98b0bc1d7dbff5394
refs/heads/master
2022-12-03T22:31:02.704083
2022-11-05T10:37:19
2022-11-05T10:37:19
234,881,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,457
java
package algo; import java.util.List; public class MergeTwoLists { /* 21. Merge Two Sorted Lists Easy Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4 */ public static void main(String[] args) { ListNode node=mergeTwoLists(ListNode.buildList1(),ListNode.buildList2()); node=mergeTwoListsIte(ListNode.buildList1(),ListNode.buildList2()); System.out.println("===:"+node); } public static ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1==null) return l2; if(l2==null) return l1; if(l1.val<l2.val){ l1.next=mergeTwoLists(l1.next,l2); return l1; }else{ l2.next=mergeTwoLists(l2.next,l1); return l2; } } public static ListNode mergeTwoListsIte(ListNode l1, ListNode l2){ if(l1==null) return l2; else if(l2==null) return l1; ListNode headDummy = new ListNode(0); ListNode curr = headDummy; while(l1 !=null && l2!=null){ if(l1.val<l2.val){ curr.next=l1; l1=l1.next; }else{ curr.next=l2; l2=l2.next; } curr=curr.next; } curr.next=l1==null?l2:l1; return headDummy.next; } }
3abce425d537a42ad9316b685bb0b772768a7c71
2c601ffcd2f89c99ac7acfafe393b3ea8847c463
/src/main/java/org/sejda/commons/collection/CircularLinkedList.java
765d29a7ed40007df376c52ced0034a121a346d8
[ "Apache-2.0" ]
permissive
torakiki/sejda-commons
7c05fcf54dea0e30c1b5a0e82b257b4eb7f0d9c4
cfe02defbafbe6d1abccff454fda90520a1137fc
refs/heads/master
2022-09-17T23:22:55.192766
2022-09-02T07:58:37
2022-09-02T07:58:37
150,710,749
2
0
null
null
null
null
UTF-8
Java
false
false
2,704
java
/* * Copyright 2018 Sober Lemur S.a.s. di Vacondio Andrea and Sejda BV * * 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.sejda.commons.collection; import static org.sejda.commons.util.RequireUtils.requireArg; import java.util.Collection; import java.util.LinkedList; /** * A {@link LinkedList} with size constraints. When at maxCapacity and an element is added, the eldest element is removed. * * @author Andrea Vacondio * */ public class CircularLinkedList<E> extends LinkedList<E> { private int maxCapacity; public CircularLinkedList(int maxCapacity) { setMaxCapacity(maxCapacity); } public void setMaxCapacity(int maxCapacity) { requireArg(maxCapacity > 0, "Max capacity must be a positive value"); this.maxCapacity = maxCapacity; houseKeep(); } public int getMaxCapacity() { return maxCapacity; } public boolean isFull() { return size() >= maxCapacity; } @Override public void addFirst(E e) { makeRoom(); super.addFirst(e); } @Override public void addLast(E e) { makeRoom(); super.addLast(e); } @Override public boolean add(E e) { makeRoom(); return super.add(e); } @Override public boolean addAll(Collection<? extends E> c) { boolean ret = super.addAll(c); houseKeep(); return ret; } @Override public boolean addAll(int index, Collection<? extends E> c) { boolean ret = super.addAll(index, c); houseKeep(); return ret; } @Override public void add(int i, E e) { super.add(i, e); houseKeep(); } /** * Makes a space available if the list is already full. Calling this prior the insertion avoids that the list exceeds its limits. */ private void makeRoom() { while (isFull()) { pollFirst(); } } /** * Makes the list fit its limits by removing last items in cases where the list might have exceeded its limits. */ private void houseKeep() { while (size() > maxCapacity) { pollFirst(); } } }
6320da9c7f62aa72ed9faa3558ad7850c8737be4
829898c1222a9140d158ecd8ba50405be2bcafcb
/app/src/test/java/test/com/animation/ExampleUnitTest.java
b33bf4acf7f1fc1c62f1b034cd9bd38e00c9842f
[]
no_license
tempest1/amin
45ef5d0bf3b2d5318b3e398857c34aa4a84cda5b
1ec9b0ca7d3f4079cda0851d17e5e77cf9b5d28b
refs/heads/master
2020-03-26T21:13:31.114932
2018-08-20T06:27:03
2018-08-20T06:27:03
145,375,447
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package test.com.animation; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
282b9ecc20977f5232e8de5642adfb7c3b7f4cc7
2e45e2f0d8a2125c87894a94fbd6f2047bb92e9a
/src/main/java/com/hxqh/eam/dao/VEntGovTopOneDaoImpl.java
ce12bca3e57318f211c068c4fdc028552ab9aa5f
[]
no_license
zhangddandan/hxqh-app
555d1e603e547cd1bf236c5617e3121d9ffaf9da
1ec9e9188de13c32698a7a6ce7e51a5ea7dfb02b
refs/heads/master
2020-12-02T22:13:02.972575
2017-07-03T02:25:16
2017-07-03T02:25:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.hxqh.eam.dao; import com.hxqh.eam.common.basedao.DaoSupport; import com.hxqh.eam.model.view.VEntGovTopOne; import org.springframework.stereotype.Repository; /** * * @author lh * */ @Repository("vEntGovTopOneDao") public class VEntGovTopOneDaoImpl extends DaoSupport<VEntGovTopOne> implements VEntGovTopOneDao { }
f5f850fcccc516515ec5672f23a3102843e93ab6
faeb59c4bb7427470c63b1bb5163b9d7c4147ba8
/app/src/main/java/com/soulsurfer/android/sample/MainActivity.java
4baac78b3bdabbfc2433b4fa351dead6b643e6e3
[]
no_license
muthukrishnan-suresh/soul-surfer-android
e63eedd2f6423af59831c218c3dce500782f5b35
aa094ec5098941b652b43b1552e2825f1300f00f
refs/heads/master
2023-09-01T07:38:32.585397
2020-10-18T10:04:34
2020-10-18T10:04:34
250,895,220
2
0
null
2023-08-26T08:01:24
2020-03-28T21:16:39
Java
UTF-8
Java
false
false
3,225
java
package com.soulsurfer.android.sample; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private RecyclerView recyclerView; private View progressView; private final List<String> pageUrls = new ArrayList<>(); @Override protected void onStart() { super.onStart(); IntentFilter intentFilter = new IntentFilter("com.soulsurfer.android.CACHE_LOADED"); registerReceiver(receiver, intentFilter); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); recyclerView = findViewById(R.id.recycler_view); progressView = findViewById(R.id.progress_view); pageUrls.add("https://medium.com/androiddevelopers/inline-functions-under-the-hood-12ddcc0b3a56"); pageUrls.add("https://android-developers.googleblog.com/2020/03/meet-finalists-of-google-play-indie.html"); pageUrls.add("https://www.bbc.com/news/technology-48334739"); pageUrls.add("https://qz.com/1819651/local-farms-in-hong-kong-are-thriving-because-of-coronavirus/?utm_source=YPL&yptr=yahoo"); pageUrls.add("https://developers.facebook.com/blog/post/2020/03/25/winners-our-first-facebook-0nline-hackathon-announced/"); pageUrls.add("https://www.digitaltrends.com/cars/what-is-android-auto/"); pageUrls.add("https://www.youtube.com/watch?v=R1CXG4bdWv4"); pageUrls.add("https://flic.kr/p/K4nYLo"); pageUrls.add("https://www.dailymotion.com/video/x7t79a0"); pageUrls.add("https://flickr.com/photos/bees/2362225867/"); pageUrls.add("https://www.instagram.com/p/Bxe_eywh3eV/?utm_source=ig_web_button_share_sheet"); recyclerView.setVisibility(View.INVISIBLE); progressView.setVisibility(View.VISIBLE); } private void loadRecyclerView() { LinearLayoutManager mLayoutManager = new LinearLayoutManager(this); mLayoutManager.setOrientation(RecyclerView.VERTICAL); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); RecyclerViewAdapter adapter = new RecyclerViewAdapter(pageUrls); recyclerView.setAdapter(adapter); recyclerView.setVisibility(View.VISIBLE); progressView.setVisibility(View.GONE); } private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i("SoulSurferSample", "Cache loaded. Loading test data"); loadRecyclerView(); } }; @Override protected void onStop() { super.onStop(); unregisterReceiver(receiver); } }
2d91f732c58c4f0f7ef02ee81434b3969095498e
8ab09621ff26103fa480694a42c3d268683bd0e1
/src/com/jeecms/cms/manager/main/impl/ActivityCommentMngImpl.java
e479daeca99cc971167a628de242571621eb8fc4
[]
no_license
zyhwyl/lewall
4fc75a102817ec913246798d47ef3bb1b4d74f0a
4e3c3623ac98970de10f5724e7d02fcf4a3aaaec
refs/heads/master
2020-05-17T21:28:21.784475
2014-03-10T08:47:34
2014-03-10T08:47:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,302
java
package com.jeecms.cms.manager.main.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.jeecms.cms.dao.main.ActivityCommentDao; import com.jeecms.cms.dao.main.ActivityCountryDao; import com.jeecms.cms.dao.main.ActivityDao; import com.jeecms.cms.dao.main.ChannelExtDao; import com.jeecms.cms.entity.main.Activity; import com.jeecms.cms.entity.main.ActivityComment; import com.jeecms.cms.entity.main.ActivityCountry; import com.jeecms.cms.entity.main.Channel; import com.jeecms.cms.entity.main.ChannelExt; import com.jeecms.cms.manager.main.ActivityCommentMng; import com.jeecms.cms.manager.main.ActivityCountryMng; import com.jeecms.cms.manager.main.ActivityMng; import com.jeecms.cms.manager.main.ChannelExtMng; import com.jeecms.common.hibernate3.Updater; import com.jeecms.common.page.Pagination; @Service @Transactional public class ActivityCommentMngImpl implements ActivityCommentMng { private ActivityCommentDao dao; @Autowired public void setDao(ActivityCommentDao dao) { this.dao = dao; } @Override public ActivityComment save(ActivityComment bean) { return dao.save(bean); } @Override public ActivityComment updateByUpdater(Updater<ActivityComment> updater) { return dao.updateByUpdater(updater); } @Override public ActivityComment deleteById(Integer id) { return dao.deleteById(id); } @Override public Pagination getPaginationByProperities(String[] keys, Object[] values, int pageNo, int pageSize) { return dao.getPaginationByProperities(keys, values, pageNo, pageSize); } @Override public ActivityComment findById(Integer id) { return dao.findById(id); } @Override public List getListByProperities(String[] keys, Object[] values) { return dao.getListByProperities(keys, values); } @Override public Pagination getPaginationByProperities(String[] keys, Object[] values, int pageNo, int pageSize, String order) { return dao.getPaginationByProperities(keys, values, pageNo, pageSize, order); } @Override public List<ActivityComment> getListByProperities(String[] keys, Object[] values, String order) { return dao.getListByProperities(keys, values, order); } }
3fc3e32a551ae1c781074c11f3f00c7f997e30ea
6cc7288a8caf2ef90472b03107720eb006a2f344
/Codigo/Renting/src/control/ControladorReservas.java
f6e43b91878c07441deae1a1ce9ee3d89ad62bb0
[]
no_license
aizaguirreteb/renting-cars-renttu
3db71dcf2184571da9b356174c410d39f40d59ca
7aa59847964775635ae0378b8fe84302aa914236
refs/heads/master
2020-12-13T11:37:34.126049
2019-05-24T07:58:11
2019-05-24T07:58:11
234,405,040
0
0
null
null
null
null
UTF-8
Java
false
false
2,022
java
package control; import java.util.List; import dao.ReservaDAO; import interfaces.InterfazReserva; import interfaces.InterfazReserva.Controlador; import modelos.Reserva; import modelos.Vehiculos; public class ControladorReservas implements Controlador { private InterfazReserva.Vista panelReserva; private ReservaDAO reservaDao; //Constructor public ControladorReservas(InterfazReserva.Vista panel) { this.panelReserva = panel; this.reservaDao = new ReservaDAO(); } @Override public void obtenerReservasAlta() { List<Reserva> listaReservas = reservaDao.obtenerReservasActivas(); panelReserva.mostrarReservas(listaReservas); } @Override public void obtenerReservasBaja() { List<Reserva> listaReservas = reservaDao.obtenerReservasCanceladas(); panelReserva.mostrarReservasHistorial(listaReservas); } @Override public void obtenerReservasTotal() { List<Reserva> listaReservas = reservaDao.obtenerTodasLasReservas(); panelReserva.mostrarReservas(listaReservas); } @Override public void registrarReserva(Reserva reservaARegistrar) { if(reservaARegistrar != null ) { if(!reservaDao.insertarNuevaReserva(reservaARegistrar)) { panelReserva.errorEnRegistroDeReserva(); } else { panelReserva.insercionCorrecta(); obtenerReservasAlta(); } } } @Override public void editarReserva(Reserva reservaAEditar, Reserva nuevaReserva) { if(nuevaReserva != null) { //Cuando se edita una reserva es para darla de baja, tanto si la han recogido como si no. //despues hay que volver a rellenar la tabla del panel de reservas para ver los cambios reservaDao.actualizarEstadoReservaPorDni(reservaAEditar, nuevaReserva); obtenerReservasAlta(); } } @Override public void buscarReserva(String dato) { // TODO Auto-generated method stub List<Reserva> listaEncontrados = reservaDao.buscarReservas(dato); panelReserva.mostrarReservas(listaEncontrados); } }
36c16e010c634af63cbf7f0d093abdd070e24316
366d660f213ed87a3809e142edc53f669a0b4d71
/src/main/java/com/assessment/util/AppJWTTokenProvider.java
dad4948d3225b878c8fd52f634ed4b38123ebf33
[]
no_license
MuraliSeelam2020/assessment-user-service
7a139e31b709d599ac757c3765f3daa93b5a39ca
b6cca4820d74ce42fabf6a3fde4c43de6b5b43af
refs/heads/master
2023-03-13T08:52:45.214665
2021-03-08T08:00:03
2021-03-08T08:00:03
345,533,526
0
0
null
null
null
null
UTF-8
Java
false
false
2,957
java
package com.assessment.util; import java.io.Serializable; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; @Component public class AppJWTTokenProvider implements Serializable { @Value("${jwt.token.validity}") public long tokenValidity; @Value("${jwt.signing.key}") public String signingKey; @Value("${jwt.authorities.key}") public String authoritiesKey; public String getUsernameFromToken(String token) { return getClaimFromToken(token, Claims::getSubject); } public Date getExpirationDateFromToken(String token) { return getClaimFromToken(token, Claims::getExpiration); } public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver) { final Claims claims = getAllClaimsFromToken(token); return claimsResolver.apply(claims); } private Claims getAllClaimsFromToken(String token) { return Jwts.parser().setSigningKey(signingKey).parseClaimsJws(token).getBody(); } private Boolean isTokenExpired(String token) { final Date expiration = getExpirationDateFromToken(token); return expiration.before(new Date()); } public String generateToken(Authentication authentication) { String authorities = authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); return Jwts.builder().setSubject(authentication.getName()).claim(authoritiesKey, authorities) .setIssuedAt(new Date(System.currentTimeMillis())) .setExpiration(new Date(System.currentTimeMillis() + tokenValidity * 1000)) .signWith(SignatureAlgorithm.HS256, signingKey).compact(); } public Boolean validateToken(String token) { return !isTokenExpired(token); } public UsernamePasswordAuthenticationToken getAuthenticationToken(final String token, final UserDetails userDetails) { final JwtParser jwtParser = Jwts.parser().setSigningKey(signingKey); final Jws<Claims> claimsJws = jwtParser.parseClaimsJws(token); final Claims claims = claimsJws.getBody(); final Collection<? extends GrantedAuthority> authorities = Arrays .stream(claims.get(authoritiesKey).toString().split(",")).map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); return new UsernamePasswordAuthenticationToken(userDetails, "", authorities); } }
57f475bddcd2cebefe5d33aa38d19592d5107f87
98a21dba4f8e34f12570d44fa82ac4495f8c488e
/search/search-server/business-entities-module/src/main/java/com/fly/house/model/File.java
2002c725b5b11e271b4afaf4424c0f5dd700fa4f
[]
no_license
rasheedamir/decentralized-search-system
27db95c267b4406316c05f77960b725d13cf7a96
c38b6b8b2dfb1b14d758118924c02d4c7f53c70a
refs/heads/master
2020-02-26T15:48:23.460224
2014-05-05T14:00:00
2014-05-05T14:00:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,709
java
package com.fly.house.model; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.validation.constraints.NotNull; /** * Created by dimon on 5/2/14. */ @Entity public class File extends BasedEntity { private String path; @NotNull @ManyToOne(cascade = CascadeType.PERSIST) private Artifact artifact; @NotNull @OneToOne private Account account; public File(Account account, Artifact artifact, String path) { this.path = path; this.artifact = artifact; this.account = account; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; } public Artifact getArtifact() { return artifact; } public void setArtifact(Artifact artifact) { this.artifact = artifact; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; File file = (File) o; if (!account.equals(file.account)) return false; if (!path.equals(file.path)) return false; return true; } @Override public int hashCode() { int result = path.hashCode(); result = 31 * result + account.hashCode(); return result; } @Override public String toString() { return "File{" + "path='" + path + '\'' + '}'; } }
98930571fde03d221cf46610fb426e9e95d05b94
f8e421f6014567e3fa2795c0594b0c1af1c9cd3a
/backend/src/main/java/com/devsuperior/dsvendas/dto/SaleSucessDTO.java
f0dfeb79ed6fcbf8a1b62912dab60e39039f312b
[]
no_license
georpin/projeto-sds3
474984ee440d31c4bff87170b60010edbbf46eb5
b09e46938cea8755c9aeb36586e75f47d185ec6e
refs/heads/master
2023-04-23T13:32:32.171430
2021-05-09T12:08:49
2021-05-09T12:08:49
364,574,631
0
0
null
null
null
null
UTF-8
Java
false
false
874
java
package com.devsuperior.dsvendas.dto; import java.io.Serializable; import com.devsuperior.dsvendas.entities.Seller; public class SaleSucessDTO implements Serializable { private static final long serialVersionUID = 1L; private String sellerName; private Long visited; private Long deals; public SaleSucessDTO() { } public SaleSucessDTO(Seller seller, Long visited, Long deals ) { super(); this.sellerName = seller.getName(); this.visited = visited; this.deals = deals; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public Long getVisited() { return visited; } public void setVisited(Long visited) { this.visited = visited; } public Long getDeals() { return deals; } public void setDeals(Long deals) { this.deals = deals; } }
cb972beeab9a937f99422bcfde3fa81cb0f44563
0cf5cd0de9562e6ab7f757b8f04e79118dbca7b8
/app/src/main/java/com/trotri/android/rice/view/recycler/decoration/GridItemDecoration.java
bc73f84a4413f0f81db90c4d578a17dbe2d3573d
[]
no_license
trotri/thunder
57cc1c8ae2f88bea67679c727d3506d92bb9b2b4
85adbd90fb4f4dba57e8672977f6993b1fba6e3c
refs/heads/master
2021-04-26T21:54:17.680908
2018-05-09T08:01:10
2018-05-09T08:01:10
130,680,454
1
1
null
null
null
null
UTF-8
Java
false
false
3,208
java
/* * Copyright (C) 2015 The Android Open Source Project * * 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.trotri.android.rice.view.recycler.decoration; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v7.widget.RecyclerView; import android.view.View; /** * GridItemDecoration class file * RecyclerView GridLayout StaggeredGrid ItemDecoration 类 * * @author 宋欢 <[email protected]> * @version $Id: GridItemDecoration.java 1 2016-01-08 10:00:06Z huan.song $ * @since 1.0 */ public class GridItemDecoration extends ItemDecoration { /** * 绘制垂直分隔线 * * @param divider 分隔线 * @param c a Canvas Object * @param parent a RecyclerView Object */ public void drawVerticalDivider(Drawable divider, Canvas c, RecyclerView parent) { int top, bottom, left, right; int count = parent.getChildCount(); for (int i = 0; i < count; i++) { View v = parent.getChildAt(i); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) v.getLayoutParams(); top = v.getTop() - params.topMargin; bottom = v.getBottom() + params.bottomMargin; left = v.getRight() + params.rightMargin; right = left + divider.getIntrinsicWidth(); divider.setBounds(left, top, right, bottom); divider.draw(c); } } /** * 绘制水平分隔线 * * @param divider 分隔线 * @param c a Canvas Object * @param parent a RecyclerView Object */ public void drawHorizontalDivider(Drawable divider, Canvas c, RecyclerView parent) { int top, bottom, left, right; int count = parent.getChildCount(); for (int i = 0; i < count; i++) { View v = parent.getChildAt(i); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) v.getLayoutParams(); left = v.getLeft() - params.leftMargin; right = v.getRight() + params.rightMargin + divider.getIntrinsicWidth(); top = v.getBottom() + params.bottomMargin; bottom = top + divider.getIntrinsicHeight(); divider.setBounds(left, top, right, bottom); divider.draw(c); } } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); } @Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { super.getItemOffsets(outRect, itemPosition, parent); } }
7cc60cafbf0e14ac5c703928bf7d77f061f34582
ea629ab8f1c80a54c67904449b90a2d5ddc9d662
/platform/src/main/java/gov/nasa/arc/mct/gui/actions/RemoveManifestationAction.java
2cd59304361225a79b1487f06ece177b8477e0fa
[]
no_license
dtran320/mct
3f4bb0725796d7cbf5514f8eab7556a3ecff2f27
25803eea2c1de80d17a34ce3944edb4ae996ac9a
refs/heads/master
2021-01-21T01:16:08.891778
2012-05-16T21:17:13
2012-05-16T21:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,090
java
/******************************************************************************* * Mission Control Technologies, Copyright (c) 2009-2012, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * * The MCT platform is 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. * * MCT includes source code licensed under additional open source licenses. See * the MCT Open Source Licenses file included with this distribution or the About * MCT Licenses dialog available at runtime from the MCT Help menu for additional * information. *******************************************************************************/ package gov.nasa.arc.mct.gui.actions; import gov.nasa.arc.mct.components.AbstractComponent; import gov.nasa.arc.mct.gui.ActionContext; import gov.nasa.arc.mct.gui.ActionContextImpl; import gov.nasa.arc.mct.gui.ContextAwareAction; import gov.nasa.arc.mct.gui.MCTMutableTreeNode; import gov.nasa.arc.mct.gui.View; import gov.nasa.arc.mct.gui.dialogs.MCTDialogManager; import gov.nasa.arc.mct.gui.housing.MCTDirectoryArea; import gov.nasa.arc.mct.gui.housing.MCTHousing; import gov.nasa.arc.mct.gui.util.GUIUtil; import gov.nasa.arc.mct.policy.PolicyContext; import gov.nasa.arc.mct.policy.PolicyInfo; import gov.nasa.arc.mct.policymgr.PolicyManagerImpl; import gov.nasa.arc.mct.services.component.ViewInfo; import gov.nasa.arc.mct.services.component.ViewType; import gov.nasa.arc.mct.util.logging.MCTLogger; import java.awt.event.ActionEvent; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; import javax.swing.JTree; import javax.swing.tree.TreePath; /** * This action removes a manifestation in the directory area. Note that * removing a manifestation under "created by me" is not allowed, but * it not part of the composition policy category. * @author [email protected] */ @SuppressWarnings("serial") public class RemoveManifestationAction extends ContextAwareAction { private static String TEXT = "Remove Manifestation"; private TreePath[] selectedTreePaths; private ActionContextImpl actionContext; public RemoveManifestationAction() { super(TEXT); } @Override public boolean canHandle(ActionContext context) { actionContext = (ActionContextImpl) context; MCTHousing activeHousing = actionContext.getTargetHousing(); if (activeHousing == null) return false; Collection<View> selection = activeHousing.getSelectionProvider().getSelectedManifestations(); if (selection.isEmpty()) return false; ViewInfo vi = selection.iterator().next().getInfo(); if (selection.isEmpty() || !(vi != null && vi.getViewType() == ViewType.NODE)){ return false; } if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) { MCTLogger.getLogger(RemoveManifestationAction.class).error("Action only works with MCTDirectoryArea"); return false; } MCTDirectoryArea directory = MCTDirectoryArea.class.cast(activeHousing.getDirectoryArea()); MCTMutableTreeNode firstSelectedNode = directory.getSelectedDirectoryNode(); if (firstSelectedNode == null) return false; JTree tree = firstSelectedNode.getParentTree(); selectedTreePaths = tree.getSelectionPaths(); return selectedTreePaths != null && selectedTreePaths.length > 0; } @Override public boolean isEnabled() { for (TreePath path : selectedTreePaths) { if (!isRemovable(path)) return false; } return true; } @Override public void actionPerformed(ActionEvent e) { Map<String, Set<View>> lockedManifestations = GUIUtil.getLockedManifestations(selectedTreePaths); if (!lockedManifestations.isEmpty()) { MCTMutableTreeNode firstSelectedNode = (MCTMutableTreeNode) selectedTreePaths[0].getLastPathComponent(); if (!MCTDialogManager.showUnlockedConfirmationDialog((View) firstSelectedNode.getUserObject(), lockedManifestations, "Remove", "row and/or associated inspector")) return; } for (TreePath path : selectedTreePaths) { MCTMutableTreeNode selectedNode = (MCTMutableTreeNode) path.getLastPathComponent(); MCTMutableTreeNode parentNode = (MCTMutableTreeNode) selectedNode.getParent(); AbstractComponent parentComponent = ((View) parentNode.getUserObject()).getManifestedComponent(); AbstractComponent selectedComponent = ((View) selectedNode.getUserObject()).getManifestedComponent(); // Remove from component model parentComponent.removeDelegateComponent(selectedComponent); } } private boolean isRemovable(TreePath path) { MCTMutableTreeNode lastPathComponent = (MCTMutableTreeNode) path.getLastPathComponent(); MCTMutableTreeNode parentNode = (MCTMutableTreeNode) lastPathComponent.getParent(); if (parentNode == null) return false; AbstractComponent parentComponent = ((View) parentNode.getUserObject()).getManifestedComponent(); AbstractComponent selectedComponent = View.class.cast(lastPathComponent.getUserObject()).getManifestedComponent(); PolicyContext context = new PolicyContext(); context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), parentComponent); context.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w'); context.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(), Collections.singleton(selectedComponent)); context.setProperty(PolicyContext.PropertyName.VIEW_MANIFESTATION_PROVIDER.getName(), parentNode.getUserObject()); String canRemoveManifestationKey = PolicyInfo.CategoryType.CAN_REMOVE_MANIFESTATION_CATEGORY.getKey(); boolean canRemoveManifestation = PolicyManagerImpl.getInstance().execute(canRemoveManifestationKey, context).getStatus(); if (canRemoveManifestation) { String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey(); return PolicyManagerImpl.getInstance().execute(compositionKey, context).getStatus(); } return canRemoveManifestation; } }
bff28878dd1efc8490cff3f62b4631b98cdea080
94664db5daee6a14cbb88af53ad9f8dbf0937340
/src/Model/Calculator.java
9ab711f7d33d7f4d4f0273e0fb34d8fa319c30db
[]
no_license
sakshamahluwalia/Finance-Assistant
e35f3ee5c4c7d1632b0a05b9c0bfa87fbbea2fdf
b89e3d9456e20f89e3f7e13e07225e9c7406aca5
refs/heads/master
2020-03-22T15:25:25.281819
2018-09-05T02:18:51
2018-09-05T02:18:51
140,251,451
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package Model; import java.util.ArrayList; public class Calculator { double creditLeft(double credit, double expense) { return credit - expense; } /* * This method will add the amount from all the transactions * */ public double creditSpent(ArrayList<Transaction> transactions) { double creditSpent = 0; for (Transaction transaction : transactions) { creditSpent += transaction.getAmount(); } return creditSpent; } }
08fa1189da7f4a01a34dd0b9b8e8033953cc9471
85720de1b78e09c53d0b113e08d91e30b2ce0f0f
/omall/src/com/paySystem/ic/bean/base/DeliveryOrders.java
487f8e2b3e95306200354f592ba47fcdeb625dde
[]
no_license
supermanxkq/projects
4f2696708f15d82d6b8aa8e6d6025163e52d0f76
19925f26935f66bd196abe4831d40a47b92b4e6d
refs/heads/master
2020-06-18T23:48:07.576254
2016-11-28T08:44:15
2016-11-28T08:44:15
74,933,844
0
1
null
null
null
null
UTF-8
Java
false
false
3,658
java
package com.paySystem.ic.bean.base; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * @ClassName:DeliveryOrders.java * @Description:发货信息实体 * @date: 2014-10-10下午03:03:53 * @author: Jacky * @version: V1.0 */ @Entity @Table(name = "O_DeliveryOrders") public class DeliveryOrders implements Serializable { private static final long serialVersionUID = 3970336097852824875L; /** * 自增id */ private long doId; /** * 发货状态 * 0:未发货; 1:发货中; 2:已发货 */ private Integer status; /** * 商户merId */ private String merId; /** * 买家 */ private String memId; /** * 收货人姓名 */ private String memName; /** * 收货人电话 */ private String memTele; /** * 收货地址 */ private String address; /** * 发货地址 */ private String merAddress; /** * 订单号 */ private String orderId; /** * 商品名称 */ private String goodsName; /** * 商品价格 */ private BigDecimal price; /** * 商品数量 */ private Integer qty; /** * 下单时间 */ private Date createTime; /** 备注**/ private String remarks; @Column(length=150,nullable=true) public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY ) public long getDoId() { return doId; } public void setDoId(long doId) { this.doId = doId; } @Column(length=1,nullable=false) public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } @Column(length=15,nullable=false) public String getMerId() { return merId; } public void setMerId(String merId) { this.merId = merId; } @Column(length=10,nullable=false) public String getMemId() { return memId; } public void setMemId(String memId) { this.memId = memId; } @Column(length=15,nullable=false) public String getMemName() { return memName; } public void setMemName(String memName) { this.memName = memName; } @Column(length=11,nullable=false) public String getMemTele() { return memTele; } public void setMemTele(String memTele) { this.memTele = memTele; } @Column(length=255,nullable=false) public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Column(length=255,nullable=false) public String getMerAddress() { return merAddress; } public void setMerAddress(String merAddress) { this.merAddress = merAddress; } @Column(length=16,nullable=false) public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } @Column(length=60,nullable=false) public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } @Column(nullable=false,scale=4,precision=13) public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } @Column(length=5,nullable=false) public Integer getQty() { return qty; } public void setQty(Integer qty) { this.qty = qty; } @Column(nullable=false) public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } }
9e56c8e47de2133a67d774ef8e45e4f13a6a24b8
7fd9a24763387cb3abd8b203f545b8792d17a7a0
/ShowYouAndroid/src/es/ulpgc/eite/showyou/android/screen/view/I_StartPageView.java
a1e2130543bc88946d817f165a9b4dafa9cc0a97
[]
no_license
sarashdez/InProcess_App
2fa920bcee8b5083fad1eb002e0ce56bfa428b77
f60ef4db269b50a002c8c1297230c58bb71ecb59
refs/heads/master
2021-01-21T04:50:27.142839
2016-03-25T12:59:30
2016-03-25T12:59:30
54,139,141
0
0
null
null
null
null
UTF-8
Java
false
false
113
java
package es.ulpgc.eite.showyou.android.screen.view; public interface I_StartPageView { void setLayout(); }
15d2623afbbe2a68ff7dd718fabdc7d99e010f90
9149435dcb42a3847ee51b34c279a37a6819bf57
/src/main/java/com/anakrusis/multiplayertest/TestClient.java
128c85ddf2476283a8c8d20897fa30906e9ba3d3
[]
no_license
anakrusis/multiplayer-test
48cfb803ff4046b09ddada001da8330b9bccdcee
6cb0658dc94030dd6324a5601bdfaeddb0924a37
refs/heads/master
2021-03-27T22:59:19.112464
2020-03-17T01:04:16
2020-03-17T01:04:16
247,815,924
0
0
null
null
null
null
UTF-8
Java
false
false
4,004
java
package com.anakrusis.multiplayertest; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.serialization.ClassResolvers; import io.netty.handler.codec.serialization.ObjectDecoder; import io.netty.handler.codec.serialization.ObjectEncoder; import org.lwjgl.glfw.*; import org.lwjgl.opengl.GL; import static org.lwjgl.glfw.Callbacks.glfwFreeCallbacks; import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.glClearColor; import static org.lwjgl.system.MemoryUtil.NULL; public class TestClient { private long window; public static TestClient testClient = new TestClient(); public static World world; public void run() { init(); loop(); // Free the window callbacks and destroy the window glfwFreeCallbacks(window); glfwDestroyWindow(window); // Terminate GLFW and free the error callback glfwTerminate(); glfwSetErrorCallback(null).free(); } private void init() { // Setup an error callback. The default implementation // will print the error message in System.err. GLFWErrorCallback.createPrint(System.err).set(); // Initialize GLFW. Most GLFW functions will not work before doing this. if ( !glfwInit() ) throw new IllegalStateException("Unable to initialize GLFW"); // Configure GLFW glfwDefaultWindowHints(); // optional, the current window hints are already the default glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // the window will stay hidden after creation glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // the window will be resizable // Create the window window = glfwCreateWindow(600, 400, "Multiplayer Test Client", NULL, NULL); if ( window == NULL ) throw new RuntimeException("Failed to create the GLFW window"); // Make the OpenGL context current glfwMakeContextCurrent(window); // Enable v-sync glfwSwapInterval(1); // Make the window visible glfwShowWindow(window); // This is up here now so it won't go up every tick GL.createCapabilities(); glEnable(GL_TEXTURE_2D); glClearColor(1f,0f,0f,0f); } private void loop() { while ( !glfwWindowShouldClose(window) ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // redner here glfwSwapBuffers(window); glfwPollEvents(); } } public static void main(String[] args) throws Exception { String host = "localhost"; int port = 8080; EventLoopGroup workerGroup = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); // (1) b.group(workerGroup); // (2) b.channel(NioSocketChannel.class); // (3) b.option(ChannelOption.SO_KEEPALIVE, true); // (4) b.handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new ObjectEncoder()); ch.pipeline().addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(null))); ch.pipeline().addLast(new TestClientHandler()); } }); // Start the client. ChannelFuture f = b.connect(host, port).sync(); // (5) testClient.run(); // Wait until the connection is closed. //f.channel().closeFuture().sync(); } finally { workerGroup.shutdownGracefully(); } } }
018e7b5c653fd5ef2bca50e0a1242c908693bca5
8ac0c0eb6f9fc52e6e1baed1cf57133ac48f5e33
/src/main/java/com/kodilla/carrental/dto/CreateEquipmentDto.java
6dc29afd929cef4c62156e588410cb8edd67068d
[]
no_license
pszczepcio/car-rental
3cb4501387715631ef19731d4dd9f00a6a36106f
f398f759d2c5111cb2ad41ca50bfc6d58f9933d6
refs/heads/master
2020-06-16T20:31:20.813531
2019-11-04T12:08:57
2019-11-04T12:08:57
195,695,357
0
0
null
2019-07-07T23:36:58
2019-07-07T20:44:07
Java
UTF-8
Java
false
false
553
java
package com.kodilla.carrental.dto; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import java.util.ArrayList; import java.util.List; @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class CreateEquipmentDto { private Long id; private String equipment; private double prize; private List<Long> carid = new ArrayList<>(); public CreateEquipmentDto(String equipment, double prize) { this.equipment = equipment; this.prize = prize; } }
4edf0f8d3e065071cc4b88de006fcd3933a05348
49d91510adbc40151ab7000b3eb25d0ca3f12ed4
/src/test/java/tests/day08/C03_SoftAssertTest.java
38a4d6f6df7a2c28105f4e30d9b7c63ba3ffced9
[]
no_license
zynpblt/com.GroupWorkMavenTestNG
96ab14aa2c1f9951f0c42039765712e3a44966bd
5c834e06d3ec6cc10771e71c73989509b193f88d
refs/heads/main
2023-09-02T20:33:13.110041
2021-10-22T11:24:42
2021-10-22T11:24:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,539
java
package tests.day08; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.asserts.SoftAssert; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; public class C03_SoftAssertTest { // //Yeni bir Class Olusturun : D10_SoftAssertTest // //1. “http://zero.webappsecurity.com/” Adresine gidin // // 2. Sign in butonuna basin // // 3. Login kutusuna “username” yazin // // 4. Password kutusuna “password.” yazin // // 5. Sign in tusuna basin // // 6. Pay Bills sayfasina gidin // // 7. “Purchase Foreign Currency” tusuna basin // // 8. “Currency” drop down menusunden Eurozone’u secin // // 9. soft assert kullanarak "Eurozone (Euro)" secildigini test edin // // 10. soft assert kullanarak DropDown listesinin su secenekleri oldugunu test edin "Select One", "Australia (dollar)", // // "Canada (dollar)","Switzerland (franc)","China (yuan)","Denmark (krone)","Eurozone (euro)","Great Britain (pound)","Hong Kong (dollar)", // // "Japan (yen)","Mexico (peso)","Norway (krone)","New Zealand (dollar)","Sweden (krona)","Singapore (dollar)","Thailand (baht)" WebDriver driver; @BeforeClass public void setUp(){ WebDriverManager.chromedriver().setup(); driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); } @Test public void test(){ driver.get("http://zero.webappsecurity.com/"); driver.findElement(By.id("signin_button")).click(); driver.findElement(By.id("user_login")).sendKeys("username"); driver.findElement(By.id("user_password")).sendKeys("password"); driver.findElement(By.name("submit")).click(); driver.get("http://zero.webappsecurity.com/"); driver.findElement(By.xpath("//strong[text()='Online Banking']")).click(); driver.findElement(By.id("pay_bills_link")).click(); driver.findElement(By.linkText("Purchase Foreign Currency")).click(); // 8. “Currency” drop down menusunden Eurozone’u secin WebElement dropdown=driver.findElement(By.id("pc_currency")); Select select=new Select(dropdown); select.selectByValue("EUR"); // // 9. soft assert kullanarak "Eurozone (Euro)" secildigini test edin String actualData=select.getFirstSelectedOption().getText(); String expectedData="Eurozone (euro)"; SoftAssert softAssert=new SoftAssert(); softAssert.assertEquals(actualData,expectedData,"secilen option Euro zone degil"); // // 10. soft assert kullanarak DropDown listesinin su secenekleri oldugunu test edin // "Select One", "Australia (dollar)", // "Canada (dollar)","Switzerland (franc)","China (yuan)","Denmark (krone)", // "Eurozone (euro)", // "Great Britain (pound)","Hong Kong (dollar)", // "Japan (yen)","Mexico (peso)","Norway (krone)", // "New Zealand (dollar)","Sweden (krona)","Singapore (dollar)","Thailand (baht)" List<WebElement> allOptions= select.getOptions(); List<String> allOptionsString=new ArrayList<>(); for (WebElement element:allOptions) { allOptionsString.add(element.getText()); } List<String> expectedOptionList= Arrays.asList("Select One", "Australia (dollar)", "Canada (dollar)","Switzerland (franc)","China (yuan)","Denmark (krone)", "Eurozone (euro)", "Great Britain (pound)","Hong Kong (dollar)", "Japan (yen)","Mexico (peso)","Norway (krone)", "New Zealand (dollar)","Sweden (krona)","Singapore (dollar)","Thailand (baht)"); //softAssert.assertEquals(allOptionsString,expectedOptionList,"Liste farkli"); Assert.assertEquals(allOptionsString,expectedOptionList,"liste farkli"); softAssert.assertAll(); } @AfterClass public void tearDown(){ driver.close(); } }
26c1adab843e418e606b1a17eeffceac017bc0b1
f7db152aad119932554b98bad1344a79b7658fc2
/app/src/main/java/com/crowderia/recyclerviewproject/utilities/CheckNetwork.java
008b3db388b681df34150a687eddd1902bef74af
[]
no_license
cagline/retrofit-2-recycler-view
fdcc41d3214e46bbb0e21486f38d7df9f4649a16
4ab39e3322d58963e51b8a534205648b65aa9c29
refs/heads/master
2021-01-20T12:51:46.899325
2017-09-07T06:28:00
2017-09-07T06:28:00
101,727,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,006
java
package com.crowderia.recyclerviewproject.utilities; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; /** * Created by crowderia on 9/1/17. */ public class CheckNetwork { private static final String TAG = CheckNetwork.class.getSimpleName(); public static boolean isInternetAvailable(Context context) { NetworkInfo info = (NetworkInfo) ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo(); if (info == null) { Log.d(TAG,"no internet connection"); return false; } else { if(info.isConnected()) { Log.d(TAG," internet connection available..."); return true; } else { Log.d(TAG," internet connection"); return true; } } } }
9a3c42bbb36cbe9cd79db1e10b39ba9751d0aacf
c1504a609901a2a3ab234fc5dcc1588a14e54d19
/src/Lab1/CodeChallenge3/CC3.java
a7c95a571a6485b62dff7c9549acfa285a5c9b8b
[]
no_license
motoc96/AtelierDigital2020
c77abc8ff00e8e89a0d62b11b8bd9b1411e64286
cb5f2f9ba33512935789eca35b69c4e45c8760d7
refs/heads/master
2023-02-07T02:48:23.722139
2020-07-04T23:55:56
2020-07-04T23:55:56
255,424,780
0
1
null
null
null
null
UTF-8
Java
false
false
1,106
java
package Lab1.CodeChallenge3; public class CC3 { public int Pairof2 (){ int vector[]={5,9,-5,7,-5}; int result=0; for(var i=0; i<vector.length;i++){ System.out.println(vector[i]); for(var j=vector.length-1; j>0;j--){ if(vector[i] + vector[j] == 0 && vector[i] != 0){ System.out.println(vector[j]); vector[i]=0; vector[j]=0; result=+1; } } } return result; } public int Pairof3(){ int vector[]={-1,-1,-1,2}; int result = 0; for(var i=0;i<vector.length;i++){ for(var j=vector.length-1;j>0;j--){ for(var k=1;k<vector.length;k++){ if(vector[i] + vector[j] + vector[k] == 0 && vector[i] !=0 ){ vector[i]=0; vector[j]=0; vector[k]=0; result=+1; } } } } return result; } }
18a4ec3a35d891d58becbbd826acf1e54a3f4814
2b2b5ca18d79c0db8ba5194b83be51d46a614239
/myJavaProject/src/com/yyy/Circle.java
42756eb4d5233452f337cbaae05e650666ab4f96
[]
no_license
mpafit02/cs133---Object-Oriented-Programming---Java
91bdbbc79195959dbb0998803c1153240a491351
969104deb3370feaa14a61754ae36d146eff49dd
refs/heads/master
2020-06-23T03:09:56.883483
2019-07-23T18:37:10
2019-07-23T18:37:10
198,488,208
0
0
null
2019-07-23T19:10:14
2019-07-23T18:35:51
HTML
UTF-8
Java
false
false
358
java
package com.yyy; public class Circle { private double radius; public Circle(double radius) { this.radius = radius; } public double getRadius() { return radius; } public void setRadius(double radius) { this.radius = radius; } public static void main(String[] args) { Circle c = new Circle(1.23); System.out.println(c.getRadius()); } }
cb66f2f01210555e5076400f402637ca381b2366
67bc57757893d650392516a8b5610da932f5ef2e
/common/src/main/java/io/pravega/common/util/CompositeArrayView.java
e8c1026248ab97723d9e32a512e47ff4cbba720d
[ "Apache-2.0" ]
permissive
zwx14700/pravega
56a716964f5a4870b07fd82d9e95a49542016594
cd8d3e258b28d2161b9f3af8d3b5310484bf5734
refs/heads/master
2021-07-13T19:06:11.995596
2020-05-28T11:36:35
2020-05-28T11:36:35
147,433,893
0
0
Apache-2.0
2020-01-20T22:18:32
2018-09-04T23:52:11
Java
UTF-8
Java
false
false
4,493
java
/** * Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved. * * 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 */ package io.pravega.common.util; import java.nio.ByteBuffer; import java.util.List; /** * Defines a generic view of a composite, index-based, array-like structure that is made up of one or more individual * arrays. */ public interface CompositeArrayView extends BufferView { /** * Gets the value at the specified index. * * @param index The index to query. * @return Byte indicating the value at the given index. * @throws ArrayIndexOutOfBoundsException If index is invalid. */ byte get(int index); /** * Sets the value at the specified index. * * @param index The index to set the value at. * @param value The Byte value to set. * @throws ArrayIndexOutOfBoundsException If index is invalid. */ void set(int index, byte value); /** * Copies a specified number of bytes from the given {@link BufferView.Reader} into this {@link CompositeArrayView}. * * @param reader The {@link BufferView.Reader} to copy bytes from. * @param targetOffset The offset within this {@link CompositeArrayView} to start copying at. * @param length The number of bytes to copy. * @throws ArrayIndexOutOfBoundsException If targetOffset or length are invalid. */ void copyFrom(BufferView.Reader reader, int targetOffset, int length); /** * Creates a new {@link CompositeArrayView} that represents a sub-range of this {@link CompositeArrayView} instance. * The new instance will share the same backing part(s) as this one, so a change to one will be reflected in the other. * * @param offset The starting offset to begin the slice at. * @param length The sliced length. * @return A new {@link CompositeArrayView}. */ @Override CompositeArrayView slice(int offset, int length); /** * Iterates through each of the arrays that make up this {@link CompositeArrayView}, in order, and invokes the given * {@link Collector} on each. * * @param collectArray A {@link Collector} function that will be invoked for each array component. The arguments to * this function represent the component array, start offset within the component array and number * of bytes within the array to process. * @param <ExceptionT> Type of exception that the {@link Collector} function throws, if any. * @throws ExceptionT If the {@link Collector} function throws an exception of this type, the iteration will end * and the exception will be bubbled up. */ <ExceptionT extends Exception> void collect(Collector<ExceptionT> collectArray) throws ExceptionT; /** * Gets the number of components in this {@link CompositeArrayView} instance. * * @return The number of components. This is equivalent to retrieving {@link #getContents()}{@link List#size()} and * is the exact number of argument invocations for {@link #collect(Collector)}. */ int getComponentCount(); /** * {@inheritDoc} * Gets a list of {@link ByteBuffer} that represent the contents of this {@link CompositeArrayView}. Since the * {@link CompositeArrayView} is a sparse array implementation, any "gaps" that are not allocated within this object * will be returned as {@link ByteBuffer}s containing zeroes. * * @return A List of {@link ByteBuffer}. */ @Override List<ByteBuffer> getContents(); /** * Defines a collector function that can be applied to a range of an array. * * @param <ExceptionT> Type of exception that this function can throw. */ @FunctionalInterface interface Collector<ExceptionT extends Exception> { /** * Processes an array range. * * @param array The array. * @param arrayOffset The start offset within the array. * @param length The number of bytes, beginning at startOffset, that need to be processed. * @throws ExceptionT (Optional) Any exception to throw. */ void accept(byte[] array, int arrayOffset, int length) throws ExceptionT; } }
d900f4d848aaad878e1a67704045e746a5af79c6
60330e008ab97af9e3dc5237d67332f9e3c1439f
/jsphomme/src/main/java/kr/co/jsphomme/purchaselist/service/PurchaseListviceImpl.java
600a877be5ebb2ec40ed5f95dd9f52263f7bec3a
[]
no_license
hyemijung/SpringTeamProject
dad94283c8397ca4498c4bb6a15286592730f29c
955c8267fe969fb788d121054d39a6ca1a7d53b5
refs/heads/master
2020-05-07T17:23:22.028308
2019-04-12T10:05:56
2019-04-12T10:05:56
180,726,531
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package kr.co.jsphomme.purchaselist.service; import kr.co.jsphomme.purchaselist.vo.PurchaseListVo; public class PurchaseListviceImpl implements PurchaseListService{ @Override public PurchaseListVo purchaseListInsert(PurchaseListVo purchaseListVo) { // TODO Auto-generated method stub return null; } @Override public PurchaseListVo purchaseListView(PurchaseListVo purchaseListVo) { // TODO Auto-generated method stub return null; } @Override public int purchaseListDelete(int no) { // TODO Auto-generated method stub return 0; } }
c5e07efb5354d953d21bce8428a14c698f7c168d
7af846ccf54082cd1832c282ccd3c98eae7ad69a
/ftmap/src/main/java/taxi/nicecode/com/ftmap/generated/package_28/Foo102.java
ac9fbd7cc6835723ec2012d6fbb747cb00d86dc3
[]
no_license
Kadanza/TestModules
821f216be53897d7255b8997b426b359ef53971f
342b7b8930e9491251de972e45b16f85dcf91bd4
refs/heads/master
2020-03-25T08:13:09.316581
2018-08-08T10:47:25
2018-08-08T10:47:25
143,602,647
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package taxi.nicecode.com.ftmap.generated.package_28; public class Foo102 { public void foo0(){ new Foo101().foo5(); } public void foo1(){ foo0(); } public void foo2(){ foo1(); } public void foo3(){ foo2(); } public void foo4(){ foo3(); } public void foo5(){ foo4(); } }
[ "1" ]
1
4ca64467359c2a06d14ff89a09fe7e1b4d98cf06
7abeae5aa8f2374df600b229b851d51b0a2ec025
/FitSDKRelease_21.40.00/java/com/garmin/fit/MesgWithEventListener.java
2f601ec5b83e989199ee3b03677ada71adcfe30b
[ "Apache-2.0" ]
permissive
JoyKuan/ArchitecturalDesign_AI
c66ffe0a98a67b6a36a6ffb60071e9a97de90014
71442dcfdba20564a772a6807e43cbb86dafc14d
refs/heads/main
2023-02-28T07:45:46.378995
2021-02-02T21:54:55
2021-02-02T21:54:55
322,163,300
1
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
//////////////////////////////////////////////////////////////////////////////// // The following FIT Protocol software provided may be used with FIT protocol // devices only and remains the copyrighted property of Garmin Canada Inc. // The software is being provided on an "as-is" basis and as an accommodation, // and therefore all warranties, representations, or guarantees of any kind // (whether express, implied or statutory) including, without limitation, // warranties of merchantability, non-infringement, or fitness for a particular // purpose, are specifically disclaimed. // // Copyright 2020 Garmin Canada Inc. //////////////////////////////////////////////////////////////////////////////// // ****WARNING**** This file is auto-generated! Do NOT edit this file. // Profile Version = 21.40Release // Tag = production/akw/21.40.00-0-g813c158 //////////////////////////////////////////////////////////////////////////////// package com.garmin.fit; public interface MesgWithEventListener { public void onMesg(MesgWithEvent message); }
eab6f86df3fa7381820229e3a2bcd53a60c92e11
3b1cadc9eb3b8f0a14983298a81ca8c91f2a2e11
/T7Ejem_HiloSencillo/app/src/androidTest/java/com/alexiscv/t7ejem_hilosencillo/ExampleInstrumentedTest.java
34fcecd5a46e6584715f5168609cc7c6015a3c90
[ "MIT" ]
permissive
alexiscv/DAM2_PMDM
4d4b1a024dda82db954e2ec8026421b2f7810f19
141ee7791e7e850c57e39c4e53a2222087bc5df7
refs/heads/master
2020-04-03T21:01:25.545064
2018-12-12T10:47:30
2018-12-12T10:47:30
155,560,748
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.alexiscv.t7ejem_hilosencillo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.alexiscv.t7ejem_hilosencillo", appContext.getPackageName()); } }
ddcf6c00a1f580d227e58384e6f89425d93f55c3
e5079314d2f6f2d52e262251e35a4dd8cdbcef3c
/src/main/java/cz/nizam/bjb/rss/TRss.java
d8709108c391580511843bdf211c9c7313dbee40
[]
no_license
nizamsyed/best-java-blogs
bdcba30bee94d436d47fde1d2b33f544b1889816
f8103b8a775ab8ee4c6ec34c42feac0a241a93f2
refs/heads/master
2021-01-23T10:20:35.485923
2017-06-14T19:14:05
2017-06-14T19:14:05
93,051,446
0
0
null
null
null
null
UTF-8
Java
false
false
4,989
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2017.06.11 at 11:28:56 PM IST // package cz.nizam.bjb.rss; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** * <p>Java class for tRss complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="tRss"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="channel" type="{}tRssChannel" maxOccurs="unbounded"/> * &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}decimal" fixed="2.0" /> * &lt;anyAttribute/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "tRss", propOrder = { "channel", "any" }) public class TRss { @XmlElement(required = true) protected List<TRssChannel> channel; @XmlAnyElement(lax = true) protected List<Object> any; @XmlAttribute(required = true) protected BigDecimal version; @XmlAnyAttribute private Map<QName, String> otherAttributes = new HashMap<QName, String>(); /** * Gets the value of the channel property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the channel property. * * <p> * For example, to add a new item, do as follows: * <pre> * getChannel().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TRssChannel } * * */ public List<TRssChannel> getChannel() { if (channel == null) { channel = new ArrayList<TRssChannel>(); } return this.channel; } /** * Gets the value of the any property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the any property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAny().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List<Object> getAny() { if (any == null) { any = new ArrayList<Object>(); } return this.any; } /** * Gets the value of the version property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getVersion() { if (version == null) { return new BigDecimal("2.0"); } else { return version; } } /** * Sets the value of the version property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setVersion(BigDecimal value) { this.version = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * * <p> * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map<QName, String> getOtherAttributes() { return otherAttributes; } }
a115f843468453b1296c6c2a4a9071c70bab3f52
e924221cc30625a6602a3e53dc043cf41c8af336
/LinkedListDequeTest.java
dd6d7efe438fdd0daf21142f0219b5d450d5826c
[ "MIT" ]
permissive
yashgoenka/Double-Ended-Queue
9f617a278586240b75f6c43060fee755942eef90
e40d3861c91eac5ae99959f845caa0b457e34303
refs/heads/master
2020-03-25T13:21:35.242673
2018-08-07T04:57:19
2018-08-07T04:57:19
143,821,080
0
0
null
null
null
null
UTF-8
Java
false
false
2,806
java
/** Performs some basic linked list tests. */ public class LinkedListDequeTest { /* Utility method for printing out empty checks. */ public static boolean checkEmpty(boolean expected, boolean actual) { if (expected != actual) { System.out.println("isEmpty() returned " + actual + ", but expected: " + expected); return false; } return true; } /* Utility method for printing out empty checks. */ public static boolean checkSize(int expected, int actual) { if (expected != actual) { System.out.println("size() returned " + actual + ", but expected: " + expected); return false; } return true; } /* Prints a nice message based on whether a test passed. * The \n means newline. */ public static void printTestStatus(boolean passed) { if (passed) { System.out.println("Test passed!\n"); } else { System.out.println("Test failed!\n"); } } /** Adds a few things to the list, checking isEmpty() and size() are correct, * finally printing the results. * * && is the "and" operation. */ public static void addIsEmptySizeTest() { System.out.println("Running add/isEmpty/Size test."); LinkedListDeque<String> lld1 = new LinkedListDeque<String>(); boolean passed = checkEmpty(true, lld1.isEmpty()); lld1.addFirst("front"); // The && operator is the same as "and" in Python. // It's a binary operator that returns true if both arguments true, and false otherwise. passed = checkSize(1, lld1.size()) && passed; passed = checkEmpty(false, lld1.isEmpty()) && passed; lld1.addLast("middle"); passed = checkSize(2, lld1.size()) && passed; lld1.addLast("back"); passed = checkSize(3, lld1.size()) && passed; System.out.println("Printing out deque: "); lld1.printDeque(); printTestStatus(passed); } /** Adds an item, then removes an item, and ensures that dll is empty afterwards. */ public static void addRemoveTest() { System.out.println("Running add/remove test."); LinkedListDeque<Integer> lld1 = new LinkedListDeque<Integer>(); // should be empty boolean passed = checkEmpty(true, lld1.isEmpty()); lld1.addFirst(10); // should not be empty passed = checkEmpty(false, lld1.isEmpty()) && passed; lld1.removeFirst(); // should be empty passed = checkEmpty(true, lld1.isEmpty()) && passed; printTestStatus(passed); } public static void main(String[] args) { System.out.println("Running tests.\n"); addIsEmptySizeTest(); addRemoveTest(); } }
55d7f557d61eabdd9fb2a639595239eea9dd7072
184e2007b130592a4096017c5b2d51608ad2bf31
/src/com/coolweather/app/db/CoolWeatherDB.java
d2b95761340959af0575bbd25793a36ff93a88c1
[ "Apache-2.0" ]
permissive
tigline/coolweather
5dbbff7262a502b446ff3ee1e84bac7830aea402
c8a8be6dc755b70637fa8b44c5bb453c78f3d519
refs/heads/master
2021-01-10T02:33:05.441042
2015-06-05T07:51:14
2015-06-05T07:51:14
36,794,387
0
0
null
null
null
null
GB18030
Java
false
false
4,101
java
package com.coolweather.app.db; import java.util.ArrayList; import java.util.List; import com.coolweather.app.model.City; import com.coolweather.app.model.County; import com.coolweather.app.model.Province; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class CoolWeatherDB { /** * 数据库名 */ public static final String DB_NAME = "cool_weather"; /** * 数据库版本 */ public static final int VERSION = 1; private static CoolWeatherDB coolWeatherDB; private SQLiteDatabase db; /** * 构造方法私有化 */ private CoolWeatherDB(Context context){ CoolWeatherOpenHelper dbHelper = new CoolWeatherOpenHelper(context, DB_NAME, null, VERSION); db = dbHelper.getWritableDatabase(); } /** * 获取CoolWeatherDB实例 */ public synchronized static CoolWeatherDB getInstance(Context context){ if (coolWeatherDB == null) { coolWeatherDB = new CoolWeatherDB(context); } return coolWeatherDB; } /** * 将Province实例存储到数据库 */ public void saveProvince(Province province){ if (province != null) { ContentValues values = new ContentValues(); values.put("province_name", province.getProvinceName()); values.put("province_code", province.getProvinceCode()); db.insert("Province", null, values); } } /** * 从数据库获取全国所有省份信息 */ public List<Province> loadProvinces(){ List<Province> list = new ArrayList<Province>(); Cursor cursor = db.query("Province", null, null, null, null, null, null); if (cursor.moveToFirst()) { do { Province province = new Province(); province.setId(cursor.getInt(cursor.getColumnIndex("id"))); province.setProvinceName(cursor.getString(cursor.getColumnIndex("province_name"))); province.setProvinceCode(cursor.getString(cursor.getColumnIndex("province_code"))); list.add(province); } while (cursor.moveToNext()); } return list; } /** * 将City实例存储到数据库 */ public void saveCity(City city){ if (city != null) { ContentValues values = new ContentValues(); values.put("city_name", city.getCityName()); values.put("city_code", city.getCityCode()); values.put("province_id", city.getProvinceId()); db.insert("City", null, values); } } /** * 从数据库读取某省下的所有城市信息 */ public List<City> loadCities(int provinceId){ List<City> list = new ArrayList<City>(); Cursor cursor = db.query("City", null, "province_id = ?", new String[] {String.valueOf(provinceId)}, null, null, null); if (cursor.moveToFirst()) { do { City city = new City(); city.setId(cursor.getInt(cursor.getColumnIndex("id"))); city.setCityName(cursor.getString(cursor.getColumnIndex("city_name"))); city.setCityCode(cursor.getString(cursor.getColumnIndex("city_code"))); city.setProvinceId(provinceId); list.add(city); } while (cursor.moveToNext()); } return list; } /** * 将County实例存储到数据库 */ public void saveCounty(County county){ if(county != null){ ContentValues values = new ContentValues(); values.put("county_name", county.getCountyName()); values.put("county_code", county.getCountyCode()); values.put("city_id", county.getCityId()); db.insert("County", null, values); } } /** * 从数据库读取某城市下的所县信息 */ public List<County> loadCounties(int cityId){ List<County> list = new ArrayList<County>(); Cursor cursor = db.query("County", null, "city_id = ?", new String[] {String.valueOf(cityId)}, null, null, null); if (cursor.moveToFirst()) { do { County county = new County(); county.setId(cursor.getInt(cursor.getColumnIndex("id"))); county.setCountyName(cursor.getString(cursor.getColumnIndex("county_name"))); county.setCountyCode(cursor.getString(cursor.getColumnIndex("county_code"))); county.setCityId(cityId); list.add(county); } while (cursor.moveToNext()); } return list; } }
9fb115a1a8e596580507dfcf2303df6bfac8c380
2f26ed6f6dac814ebd04548b2cd274246e8c9326
/WEB-INF/src/com/yhaguy/domain/UsuarioPropiedades.java
568a5e21b98635071e40973ab643a3f760b4f435
[]
no_license
sraul/yhaguy-baterias
ecbac89f922fc88c5268102025affc0a6d07ffb5
7aacfdd3fbca50f9d71c940ba083337a2c80e899
refs/heads/master
2023-08-19T05:21:03.565167
2023-08-18T15:33:08
2023-08-18T15:33:08
144,028,474
0
0
null
null
null
null
UTF-8
Java
false
false
1,101
java
package com.yhaguy.domain; import com.coreweb.domain.Domain; import com.coreweb.domain.Tipo; import com.coreweb.domain.Usuario; @SuppressWarnings("serial") public class UsuarioPropiedades extends Domain { private Usuario usuario = new Usuario(); private Deposito depositoParaFacturar = new Deposito(); private Tipo modoVenta = new Tipo(); private Tipo modoDesarrollador = new Tipo(); @Override public int compareTo(Object o) { return -1; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public Deposito getDepositoParaFacturar() { return depositoParaFacturar; } public void setDepositoParaFacturar(Deposito depositoParaFacturar) { this.depositoParaFacturar = depositoParaFacturar; } public Tipo getModoVenta() { return modoVenta; } public void setModoVenta(Tipo modoVenta) { this.modoVenta = modoVenta; } public Tipo getModoDesarrollador() { return modoDesarrollador; } public void setModoDesarrollador(Tipo modoDesarrollador) { this.modoDesarrollador = modoDesarrollador; } }