blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
7340d8fa2d48aa57113b659fee9d042fe625aaf4
755404232d305ae7d6d1fbe5bda839fcfea75641
/spring-transaction/src/main/java/com/dek/service/UserService.java
fc3d9c6eb8f5574517baab2211945cfe469afc0a
[]
no_license
xiaodongio/tutorials
82dab21bdcbe7d4483f07ee4efdd46db28f56100
4b5439870fa35e938eb8d1cf35782ce0970f0527
refs/heads/master
2022-12-21T22:08:09.064963
2020-07-25T07:57:18
2020-07-25T07:57:18
180,535,638
0
0
null
2022-12-16T03:24:46
2019-04-10T08:20:22
Java
UTF-8
Java
false
false
1,678
java
package com.dek.service; import com.dek.dao.UserDao; import com.dek.transaction.TransactionMonitor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class UserService { @Autowired private UserDao userDao; @Autowired private TransactionMonitor monitor; @Autowired private LogService logService; @Autowired private OtherService otherService; public void add1() { System.out.println(" userService add1..."); TransactionStatus begin = null; try { begin = monitor.begin(); userDao.add("dek", 18); int i = 1/0; monitor.commit(begin); } catch (Exception e) { e.printStackTrace(); monitor.rollback(begin); } } public void add2() { System.out.println(" userService add2..."); userDao.add("dek", 18); int i = 1/0; } public void testData() { userDao.testData(10000); } @Transactional public void add(String name, Integer age) { userDao.add(name, age); } @Transactional(noRollbackFor = {RuntimeException.class, Exception.class}) public void save(String name, Integer age) throws Exception { try { this.add(name, age); handleSms(); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); if (e instanceof RuntimeException) { logService.add2("123"); } } } public void handleSms() { // otherService.test(); logService.saveError("123123123211"); } }
[ "qq282162962@gmail.com" ]
qq282162962@gmail.com
6d0803dd40ba0acfafe9dcd18b381831a9b09ed9
bc51dfc1f63a098012d6d1370dc4ed7ddc11d915
/src/main/java/com/transactions/service/Analysis.java
de72ffa7d4fa9c0f70d2839932a614d19f364ec5
[]
no_license
kajeshkamma/transactions
df65728f3ae6f0e0235b870a3b5da2925394e697
ce13b44dc7592ea70217c1f891e7b85cd84a576a
refs/heads/master
2021-07-18T22:22:14.586622
2019-11-11T13:10:46
2019-11-11T13:10:46
220,979,873
0
0
null
2020-10-13T17:22:18
2019-11-11T12:46:50
Java
UTF-8
Java
false
false
1,387
java
package com.transactions.service; import java.text.ParseException; import java.util.Collection; import java.util.Date; import java.util.DoubleSummaryStatistics; import com.transactions.model.Transaction; public class Analysis { /** * * @param transactions * @param merchant * @param startDateTime * @param endDateTime * @return * @throws ParseException */ public DoubleSummaryStatistics analyzeTransactions(Collection<Transaction> transactions, String merchant, String startDateTime, String endDateTime) throws ParseException { DoubleSummaryStatistics dss = new DoubleSummaryStatistics(); if (transactions != null && merchant != null && startDateTime != null && endDateTime != null) { Date start = CSVLoader.ddMMyyyyhhmmss.parse(startDateTime); long startTime = start.getTime()-1; start.setTime(startTime); Date end = CSVLoader.ddMMyyyyhhmmss.parse(endDateTime); long endTime = end.getTime()+1; end.setTime(endTime); // parallel to take processing advantage of multiple processors. // predicate to filter out only relevant one. // summaryStatistics is terminal method. dss = transactions .stream().parallel().filter(p -> p.getMerchant().equalsIgnoreCase(merchant) && p.getDate().after(start) && p.getDate().before(end)) .mapToDouble(t -> t.getAmount()).summaryStatistics(); } return dss; } }
[ "kajeshkamma@users.noreply.github.com" ]
kajeshkamma@users.noreply.github.com
def2a4fc6f4cd34e67f89df134d931279f3737d3
b531ec4026aeee69b6882f044d616e1f6eca4dfd
/Older versions - 361/SCC.v.1.8/stopCancerCyprus/src/com/example/stopcancercyprus/DietProstate.java
b1a9fd912ff4e447edb794430be18dcb50aaabdd
[]
no_license
mchris23/epl361.winter13.teamC
5280429b5f65e76bb2690b6d16ecc28c76cbc9c4
3a9b18bbefcfb90d7184590f64e8c703e9efeae2
refs/heads/master
2020-04-22T13:52:32.533083
2014-06-04T20:49:30
2014-06-04T20:49:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.example.stopcancercyprus; import android.app.Activity; import android.os.Bundle; public class DietProstate extends Activity{ protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.diet_prostate); } }
[ "aneofy04@cs.ucy.ac.cy" ]
aneofy04@cs.ucy.ac.cy
4622bf25d24658e917a35c3f86e7712ea235bff5
9d161d88a589bf5ab8d784c8dfae27b805c9352d
/app/src/androidTest/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java
a961509f0f5a0f11ab028a99efa9ecb4d7cfeb0a
[]
no_license
haanh764/github2
87f3af2cfa5dd1a69ea49e690c7eec33e791b88f
fb124681e8cc81c5393b2bd32803e84a2e683187
refs/heads/master
2020-06-14T01:42:08.149523
2016-12-05T18:16:34
2016-12-05T18:16:34
75,526,454
0
0
null
null
null
null
UTF-8
Java
false
false
2,632
java
/* * Copyright 2012 GitHub Inc. * * 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.github.mobile.tests.gist; import android.support.v4.view.ViewPager; import com.github.mobile.R; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.gist.GistFilesViewActivity; import com.google.inject.Inject; import java.util.LinkedHashMap; import java.util.Map; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.GistFile; import roboguice.RoboGuice; /** * Tests of {@link GistFilesViewActivity} */ public class GistFilesViewActivityTest extends ActivityTest<GistFilesViewActivity> { @Inject private GistStore store; private Gist gist; /** * Create test */ public GistFilesViewActivityTest() { super(GistFilesViewActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); RoboGuice.injectMembers(getInstrumentation().getTargetContext() .getApplicationContext(), this); gist = new Gist(); gist.setId("abcd"); Map<String, GistFile> files = new LinkedHashMap<String, GistFile>(); files.put("a", new GistFile().setFilename("a").setContent("aa")); files.put("b", new GistFile().setFilename("b").setContent("bb")); gist.setFiles(files); store.addGist(gist); setActivityIntent(GistFilesViewActivity.createIntent(gist, 0)); } /** * Verify changing pages between gist files * * @throws Throwable */ public void testChangingPages() throws Throwable { final ViewPager pager = (ViewPager) getActivity().findViewById(R.id.vp_pages); assertEquals(0, pager.getCurrentItem()); ui(new Runnable() { public void run() { pager.setCurrentItem(1, true); } }); assertEquals(1, pager.getCurrentItem()); ui(new Runnable() { public void run() { pager.setCurrentItem(0, true); } }); assertEquals(0, pager.getCurrentItem()); } }
[ "ngohaanh764@gmail.com" ]
ngohaanh764@gmail.com
ff574c52e336c2d2ec76ae5699fdf6fdde3ccad6
a247e5533ff8133f96842fdb4d369e55d35fdef6
/src/main/java/yuzunyannn/elementalsorcery/container/ContainerDungeonMap.java
3692a42f3c4904d9bb26c9728552ce3a43f75727
[]
no_license
Yuzunyannn/ElementalSorcery
76a4d37319e68fbca64a97cbe9673928008f1a85
1457d81ea41114363a894202ae75ae4ca51e1360
refs/heads/master
2023-08-31T13:21:52.185262
2023-08-19T12:09:52
2023-08-19T12:09:52
183,849,638
13
0
null
null
null
null
UTF-8
Java
false
false
4,223
java
package yuzunyannn.elementalsorcery.container; import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import yuzunyannn.elementalsorcery.api.util.NBTTag; import yuzunyannn.elementalsorcery.dungeon.DungeonArea; import yuzunyannn.elementalsorcery.dungeon.DungeonAreaRoom; import yuzunyannn.elementalsorcery.dungeon.DungeonAreaRoomSpecialThing; import yuzunyannn.elementalsorcery.dungeon.DungeonWorld; import yuzunyannn.elementalsorcery.network.MessageSyncContainer.IContainerNetwork; import yuzunyannn.elementalsorcery.util.helper.NBTHelper; public class ContainerDungeonMap extends Container implements IContainerNetwork { final public EntityPlayer player; final public BlockPos pos; final public boolean isRemote; public Integer dungeonId; public DungeonArea areaCache; protected DungeonAreaRoom currRoom; public Integer currRoomId; public int tick = 0; public Map<Integer, Integer> roomShowMap = new HashMap<>(); public ContainerDungeonMap(EntityPlayer player, BlockPos pos) { this.player = player; this.isRemote = player.world.isRemote; this.pos = pos; DungeonWorld dw = DungeonWorld.getDungeonWorld(player.world); currRoom = dw.getAreaRoom(pos); } @Nullable public DungeonArea getDungeonArea() { if (dungeonId == null) return null; if (areaCache != null) return areaCache; DungeonWorld dw = DungeonWorld.getDungeonWorld(player.world); areaCache = dw.getDungeon(dungeonId); if (areaCache == null) currRoom = null; return areaCache; } @Override public void detectAndSendChanges() { if (currRoom == null) return; if (dungeonId == null) { dungeonId = currRoom.getAreId(); NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("dId", dungeonId); nbt.setInteger("cId", currRoom.getId()); this.sendToClient(nbt, this.listeners); } if (tick++ % 20 != 0) return; DungeonArea area = getDungeonArea(); if (area == null) return; NBTTagList list = new NBTTagList(); Collection<DungeonAreaRoom> rooms = area.getRooms(); for (DungeonAreaRoom room : rooms) { if (room.isBuild() && !Integer.valueOf(room.runtimeChangeFlag).equals(roomShowMap.get(room.getId()))) { roomShowMap.put(room.getId(), room.runtimeChangeFlag); NBTTagCompound showData = new NBTTagCompound(); showData.setInteger("id", room.getId()); showData.setInteger("uflag", room.runtimeChangeFlag); list.appendTag(showData); } } if (!list.isEmpty()) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("rs", list); this.sendToClient(nbt, this.listeners); } } @Override public void recvData(NBTTagCompound nbt, Side side) { if (side == Side.CLIENT) { if (nbt.hasKey("dId")) dungeonId = nbt.getInteger("dId"); if (nbt.hasKey("cId")) currRoomId = nbt.getInteger("cId"); if (nbt.hasKey("rs")) { NBTTagList list = nbt.getTagList("rs", NBTTag.TAG_COMPOUND); for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound showData = list.getCompoundTagAt(i); roomShowMap.put(showData.getInteger("id"), showData.getInteger("uflag")); } } return; } else { if (nbt.hasKey("st_pos")) { BlockPos pos = NBTHelper.getBlockPos(nbt, "st_pos"); DungeonArea area = getDungeonArea(); if (area == null) return; DungeonAreaRoom room = area.findRoom(new Vec3d(pos)); if (room == null) return; DungeonAreaRoomSpecialThing thing = room.getSpecialMap().get(pos); if (thing == null) return; if (thing.getHandler() == null) return; thing.getHandler().executeClick(player.world, pos, player, room, this.pos); } } } @Override public boolean canInteractWith(EntityPlayer playerIn) { return isRemote ? true : (currRoom == null ? false : (playerIn.getDistanceSq(pos) <= 64)); } @SideOnly(Side.CLIENT) public boolean isOpen(int id) { return roomShowMap.get(id) != null; } }
[ "yuzun@DESKTOP-3CITBLH" ]
yuzun@DESKTOP-3CITBLH
f4bd219a6a59c3c39ffcde603e1b0034522392cd
b003210f04e01182cbb2d60622baa49fcffc3b78
/src/com/innouni/health/activity/MainActivity.java
59bd653f1928e3d57cbc729b2eb8e020a86dcb61
[]
no_license
MR-HU/GraspHealth
60aa27eb66660143aa3ef830a80440d6f2cc1a3f
f7e284eb3900287512da96a9b901b10903da602c
refs/heads/master
2020-03-30T16:47:33.616653
2014-02-13T08:19:25
2014-02-13T08:19:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,362
java
package com.innouni.health.activity; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONObject; import android.content.Intent; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.PopupWindow; import android.widget.PopupWindow.OnDismissListener; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.RelativeLayout; import android.widget.TextView; import com.innouni.health.adapter.AdvertisementAdapter; import com.innouni.health.app.MainApplication; import com.innouni.health.base.BaseFragmentActivity; import com.innouni.health.entity.Advertisement; import com.innouni.health.entity.UserInfo; import com.innouni.health.fragment.CaloryFragment; import com.innouni.health.fragment.ChartFragment; import com.innouni.health.net.HttpPostRequest; import com.innouni.health.util.Util; import com.viewpagerindicator.CirclePageIndicator; import com.viewpagerindicator.PageIndicator; /** * 主页 * * @author HuGuojun * @date 2014-1-22 下午3:44:59 * @modify * @version 1.0.0 */ public class MainActivity extends BaseFragmentActivity implements OnClickListener, OnPageChangeListener, OnTouchListener, OnCheckedChangeListener { private static final int LOOPTIME = 5 * 1000; private FrameLayout container; private RadioGroup groupShowType; private List<Advertisement> ads; private AdvertisementAdapter adapter; private PageIndicator indicator; private ViewPager viewPager; private TextView adTitleView; private float downX, upX, distanceX; private GetAdTask task; private Handler handler = new Handler(); private boolean startLoop = false; private int currentIndex = 0; private PopupWindow popupWindow; private boolean isMeasured = false; private int offsetHeight; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); application = MainApplication.getApplication(); application.setActivity(this); application.setInActivity(true); initBar(); initAd(); initView(); } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!isMeasured) { Rect frame = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; // 获取状态栏高度 RelativeLayout titleBar = (RelativeLayout) findViewById(R.id.lay_title_bar); int titleBarHeight = titleBar.getBottom(); // 获取titleBar高度 offsetHeight = statusBarHeight + titleBarHeight; isMeasured = true; } } private void initBar() { titleLeftBtn = (TextView) findViewById(R.id.btn_title_left); titleContentView = (TextView) findViewById(R.id.txt_title_center); titleRightBtn = (TextView) findViewById(R.id.btn_title_right); titleContentView.setText("掌握健康"); titleLeftBtn.setOnClickListener(this); titleRightBtn.setOnClickListener(this); } private void initAd() { ads = new ArrayList<Advertisement>(); adapter = new AdvertisementAdapter(this); adTitleView = (TextView) findViewById(R.id.txt_ad_title); viewPager = (ViewPager) findViewById(R.id.view_pager_main); viewPager.setAdapter(adapter); viewPager.setOnTouchListener(this); viewPager.setCurrentItem(0); indicator = (CirclePageIndicator) findViewById(R.id.page_indicator_main); indicator.setViewPager(viewPager); indicator.setOnPageChangeListener(this); ((CirclePageIndicator) indicator).setSnap(true); if (task != null) { task.cancel(true); } task = new GetAdTask(); task.execute(); } private void initView() { container = (FrameLayout) findViewById(R.id.lay_fragment_container); if (container != null) { Fragment caloryFragment = new CaloryFragment(); FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.add(R.id.lay_fragment_container, caloryFragment); transaction.commit(); } groupShowType = (RadioGroup) findViewById(R.id.group_energy_show_type); groupShowType.setOnCheckedChangeListener(this); } private Runnable looper = new Runnable() { @Override public void run() { if (ads != null && ads.size() > 0 && startLoop) { currentIndex++; if (currentIndex > (ads.size() - 1)) { currentIndex = 0; } viewPager.setCurrentItem(currentIndex); handler.postDelayed(looper, LOOPTIME); } } }; private void showPopupWindow() { LinearLayout layout = (LinearLayout) LayoutInflater.from( MainActivity.this).inflate(R.layout.pop_main, null); popupWindow = new PopupWindow(layout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, false); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); popupWindow.showAtLocation(findViewById(R.id.lay_title_bar), Gravity.RIGHT | Gravity.TOP, 0, offsetHeight); layout.findViewById(R.id.txt_main_user_center).setOnClickListener(this); layout.findViewById(R.id.txt_main_food_track).setOnClickListener(this); layout.findViewById(R.id.txt_main_sport_fri).setOnClickListener(this); layout.findViewById(R.id.txt_main_my_friend).setOnClickListener(this); layout.findViewById(R.id.txt_main_set).setOnClickListener(this); layout.findViewById(R.id.txt_main_health_center).setOnClickListener( this); WindowManager.LayoutParams attribute = getWindow().getAttributes(); attribute.gravity = Gravity.TOP; attribute.alpha = 0.5f; getWindow().setAttributes(attribute); popupWindow.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { WindowManager.LayoutParams attribute = getWindow() .getAttributes(); attribute.gravity = Gravity.TOP; attribute.alpha = 1.0f; getWindow().setAttributes(attribute); } }); } private class GetAdTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { startLoop = false; if (ads != null && ads.size() > 0) { ads.clear(); } } @Override protected Void doInBackground(Void... params) { UserInfo user = application.getUserInfo(); List<NameValuePair> pairs = new ArrayList<NameValuePair>(); pairs.add(new BasicNameValuePair("token", user.getToken())); pairs.add(new BasicNameValuePair("mId", user.getId())); String json = HttpPostRequest.getDataFromWebServer( MainActivity.this, "getPushFoods", pairs); System.out.println("首页广告图返回: " + json); try { JSONObject jsonObject = new JSONObject(json); int status = jsonObject.optInt("status"); if (status == 0) { JSONArray array = jsonObject.optJSONArray("Foods"); String screma = getResources().getString(R.string.app_url) + "files/advmap/"; for (int i = 0; i < array.length(); i++) { Advertisement advertisement = new Advertisement(); JSONObject object = array.optJSONObject(i); advertisement.setId(object.optString("id")); advertisement.setTitle(object.optString("name")); advertisement.setImageUrl(screma + object.optString("logo")); ads.add(advertisement); } } } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { task = null; adapter.setData(ads); if (ads.size() > 0) { adTitleView.setText(ads.get(0).getTitle().toString()); } if (!startLoop) { startLoop = true; handler.postDelayed(looper, LOOPTIME); } } } @Override public void onClick(View v) { Intent intent; switch (v.getId()) { case R.id.btn_title_left: finish(); break; case R.id.btn_title_right: showPopupWindow(); break; // 个人中心 case R.id.txt_main_user_center: intent = new Intent(MainActivity.this, UserCenterActivity.class); startActivity(intent); popupWindow.dismiss(); break; // 食物追踪 case R.id.txt_main_food_track: intent = new Intent(MainActivity.this, FoodTrackActivity.class); startActivity(intent); popupWindow.dismiss(); break; // 运动伙伴 case R.id.txt_main_sport_fri: intent = new Intent(MainActivity.this, SportFriendActivity.class); startActivity(intent); popupWindow.dismiss(); break; // 我的好友 case R.id.txt_main_my_friend: break; // 健康中心 case R.id.txt_main_health_center: intent = new Intent(MainActivity.this, HealthCenterActivity.class); startActivity(intent); popupWindow.dismiss(); break; // 设置 case R.id.txt_main_set: intent = new Intent(MainActivity.this, SettingActivity.class); startActivity(intent); popupWindow.dismiss(); break; } } @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: downX = event.getX(); break; case MotionEvent.ACTION_UP: upX = event.getX(); distanceX = Math.abs(upX - downX); // 当滑动的距离小于10时 执行跳转动作 if (distanceX < 10) { Advertisement advertisement = ads.get(currentIndex); Intent intent = new Intent(MainActivity.this, DishDetailActivity.class); intent.putExtra("foodId", advertisement.getId().toString()); startActivity(intent); } break; default: break; } return false; } @Override public void onPageScrollStateChanged(int position) { } @Override public void onPageScrolled(int position, float index, int id) { } @Override public void onPageSelected(int position) { currentIndex = position; if (ads != null && ads.size() > 0) { adTitleView.setText(ads.get(position).getTitle().toString()); } } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radio_type_calory: if (container != null) { Fragment caloryFragment = new CaloryFragment(); FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction .replace(R.id.lay_fragment_container, caloryFragment); transaction.commit(); } break; case R.id.radio_type_chart: if (container != null) { Fragment chartFragment = new ChartFragment(); FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.replace(R.id.lay_fragment_container, chartFragment); transaction.commit(); } break; } } private class GetUserInfoTask extends AsyncTask<Void, Void, Integer> { @Override protected Integer doInBackground(Void... params) { UserInfo user = application.getUserInfo(); String token = user.getToken(); String id = user.getId(); List<NameValuePair> pairs = new ArrayList<NameValuePair>(); pairs.add(new BasicNameValuePair("token", token)); pairs.add(new BasicNameValuePair("mId", id)); String json = HttpPostRequest.getDataFromWebServer( MainActivity.this, "getMemberInfo", pairs); System.out.println("APP主页获取用户信息返回 " + json); try { JSONObject object = new JSONObject(json); int status = object.optInt("status"); if (status == 0) { String avatar = object.optString("logo"); if (Util.isEmpty(avatar) || avatar.equalsIgnoreCase("null")) { avatar = ""; } else { avatar = getResources().getString(R.string.app_url) + "files/m_logo/" + avatar; } user.setAvatar(avatar); user.setName(object.optString("userName")); user.setGender(object.optInt("sex")); String signature = object.optString("signature"); if (Util.isEmpty(signature) || signature.equalsIgnoreCase("null")) { signature = "暂无签名"; } user.setSign(signature); user.setEmail(object.optString("email")); user.setPhone(object.optString("mobileNo")); user.setProvince(object.optString("province")); user.setCity(object.optString("city")); user.setBirthday(object.optString("birthday")); user.setHeight(object.optInt("height")); user.setWeight(object.optInt("weight")); } return status; } catch (Exception e) { e.printStackTrace(); return null; } } } @Override protected void onPause() { super.onPause(); if (task != null) { task.cancel(true); } } @Override protected void onResume() { super.onResume(); if (application.getUserInfo() != null) { new GetUserInfoTask().execute(); } } @Override protected void onDestroy() { super.onDestroy(); if (viewPager != null) { viewPager.removeAllViews(); viewPager.destroyDrawingCache(); } handler.removeCallbacks(looper); } }
[ "270296401@qq.com" ]
270296401@qq.com
6ccbab4e8d52d27683e494153b6a539dc1f2d850
ffebddcd50fc445feff937b522ab8b2a5c93eac0
/app/src/test/java/com/example/mishkat_world/allhistory/ExampleUnitTest.java
c48112798db69449c69d87913d7b07b19dd2d6c4
[]
no_license
Mishkat786/All-History
16f7468fa80f1cac11eee0064fde1e6683fcaa05
16dea0570d5e0068f3bd7f0f3334eef583c5301f
refs/heads/master
2020-12-13T11:59:58.149865
2020-01-16T20:53:39
2020-01-16T20:53:39
200,388,098
1
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.example.mishkat_world.allhistory; 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() { assertEquals(4, 2 + 2); } }
[ "mohmmadmishkat@gmail.com" ]
mohmmadmishkat@gmail.com
8ead098e3cff0fcd3e81909a7c51d1f5498d6156
951eb16659b5afb62506754a89d71c3f7fd08f16
/src/main/java/cn/jsprun/vo/otherset/AdvVO.java
742a17f636f331eff52fbe84fd8f6d626467170b
[]
no_license
git1024/bbs
a0e319dcf7803d4f67ad9733fb7282b9f009f43a
009958b03cbf41068fce2d5d524066dfb8411a1a
refs/heads/master
2021-01-20T17:14:50.949665
2016-06-20T10:07:09
2016-06-20T10:07:09
61,537,042
0
0
null
null
null
null
UTF-8
Java
false
false
1,811
java
package cn.jsprun.vo.otherset; public class AdvVO { private String selectContent = null; private String style = null; private String title = null; private String type = null; private Integer postperpage = null; private String starttime = null; public String getExplain() { if(type==null){ return ""; }else if(type.equals("intercat")){ return "advertisements_type_intercat_tips"; }else if(type.equals("couplebanner")){ return "advertisements_type_couplebanner_tips"; }else if(type.equals("float")){ return "advertisements_type_float_tips"; }else if(type.equals("interthread")){ return "advertisements_type_interthread_tips"; }else if(type.equals("thread")){ return "advertisements_type_thread_tips"; }else if(type.equals("text")){ return "advertisements_type_text_tips"; }else if(type.equals("footerbanner")){ return "advertisements_type_footerbanner_tips"; }else if(type.equals("headerbanner")){ return "advertisements_type_headerbanner_tips"; }else{ return ""; } } public String getStarttime() { return starttime; } public void setStarttime(String starttime) { this.starttime = starttime; } public Integer getPostperpage() { return postperpage; } public void setPostperpage(Integer postperpage) { this.postperpage = postperpage; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getSelectContent() { return selectContent; } public void setSelectContent(String selectContent) { this.selectContent = selectContent; } }
[ "yaoyuanliang@jk.cn" ]
yaoyuanliang@jk.cn
a064c531e14e5c34d0f5e793066e4f7815593b28
10c3a4df917ca4f492e77056e86ece34d4a35ae3
/app/src/main/java/com/example/shourya/weatherapp/EditProfile.java
c9acd826ce3b9329ec160e38ea9dbdee64f77d83
[]
no_license
thakur13118/Weather-Android
b2e7378e839c78d3ae4a5adff948e322471f5be8
8dad18ea884b0623010bb7415428f8749bf666ba
refs/heads/master
2021-09-08T03:02:35.902962
2018-03-06T11:39:10
2018-03-06T11:39:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,995
java
package com.example.shourya.weatherapp; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import de.hdodenhof.circleimageview.CircleImageView; public class EditProfile extends AppCompatActivity implements View.OnClickListener { //for changing pic private static final int SELECT_PICTURE = 100; Button edit_btn; Button save; CircleImageView image; Button change_btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_profile); //change dp findViewById(R.id.change_dp).setOnClickListener(this); edit_btn=(Button)findViewById(R.id.edit_btn); save=(Button)findViewById(R.id.save); final TextView Text_name=(TextView)findViewById(R.id.Text_name); final TextView Text_home=(TextView)findViewById(R.id.Text_home); final TextView Text_work=(TextView)findViewById(R.id.Text_work); final TextView Text_pass=(TextView)findViewById(R.id.Text_pass); final TextView Text_DOB=(TextView)findViewById(R.id.Text_DOB); final EditText Edit_name=(EditText)findViewById(R.id.Edit_name); Edit_name.setVisibility(View.GONE); final EditText Edit_home=(EditText)findViewById(R.id.Edit_home); Edit_home.setVisibility(View.GONE); final EditText Edit_work=(EditText)findViewById(R.id.Edit_work); Edit_work.setVisibility(View.GONE); final EditText Edit_pass=(EditText)findViewById(R.id.Edit_pass); Edit_pass.setVisibility(View.GONE); final EditText Edit_DOB=(EditText)findViewById(R.id.Edit_DOB); Edit_DOB.setVisibility(View.GONE); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Edit_name.setVisibility(View.GONE); Edit_home.setVisibility(View.GONE); Edit_work.setVisibility(View.GONE); Edit_pass.setVisibility(View.GONE); Edit_DOB.setVisibility(View.GONE); Text_name.setVisibility(View.VISIBLE); Text_home.setVisibility(View.VISIBLE); Text_work.setVisibility(View.VISIBLE); Text_pass.setVisibility(View.VISIBLE); Text_DOB.setVisibility(View.VISIBLE); } }); edit_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Text_name.setVisibility(View.GONE); Text_home.setVisibility(View.GONE); Text_work.setVisibility(View.GONE); Text_pass.setVisibility(View.GONE); Text_DOB.setVisibility(View.GONE); Edit_name.setVisibility(View.VISIBLE); Edit_home.setVisibility(View.VISIBLE); Edit_work.setVisibility(View.VISIBLE); Edit_pass.setVisibility(View.VISIBLE); Edit_DOB.setVisibility(View.VISIBLE); } }); } /* Choose an image from Gallery */ void openImageChooser() { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { // Get the url from data Uri selectedImageUri = data.getData(); if (null != selectedImageUri) { // Get the path from the Uri String path = getPathFromURI(selectedImageUri); //Log.i(TAG, "Image Path : " + path); // Set the image in ImageView ((ImageView) findViewById(R.id.image)).setImageURI(selectedImageUri); } } } } /* Get the real path from the URI */ public String getPathFromURI(Uri contentUri) { String res = null; String[] proj = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(contentUri, proj, null, null, null); if (cursor.moveToFirst()) { int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); res = cursor.getString(column_index); } cursor.close(); return res; } @Override public void onClick(View v) { openImageChooser(); } }
[ "thakur.vishalthakur.vishal81@gmail.com" ]
thakur.vishalthakur.vishal81@gmail.com
416007974c19b20f4873b0b18e9ae9eadaea6f1b
5e6dc96cefa87ab5dd25f2bbd1489d9aa1b21370
/src/test/java/retaliation/game/rules/LasersDamageShipsRuleTest.java
59497b8615a775fa84e6d400b50a77e140f4f55c
[]
no_license
phss/space-retaliation
636953abd2ed60816d2dddad817520507e0e27ca
4fd080509c2054e6b24a97c15c7b7b4fcc4a45f4
refs/heads/master
2016-08-03T12:36:05.822458
2013-06-09T10:35:26
2013-06-09T10:35:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,323
java
package retaliation.game.rules; import org.junit.Test; import retaliation.game.entities.*; import retaliation.game.entities.listener.EntityListener; import retaliation.game.geometry.Dimension; import retaliation.game.geometry.Position; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import static retaliation.game.entities.Entity.State.Alive; import static retaliation.game.entities.Entity.State.Destroyed; import static retaliation.game.entities.EntityType.Enemy; import static retaliation.game.entities.EntityType.Player; import static retaliation.game.entities.Laser.Direction.Downwards; import static retaliation.game.entities.Laser.Direction.Upwards; import static retaliation.game.geometry.Dimension.size; import static retaliation.game.geometry.Position.at; public class LasersDamageShipsRuleTest { private final Entities entities = new Entities(EntityListener.NULL_LISTENER); @Test public void laserHitsAShip() { Entity laser = laser(at(20, 20), Upwards); Spaceship ship = ship(Enemy, at(10, 10), size(50, 50)); new LasersDamageShipsRule().apply(entities); assertThat(ship.state(), is(Destroyed)); assertThat(laser.state(), is(Destroyed)); } @Test public void laserMissesAShip() { Entity laser = laser(at(20, 20), Upwards); Spaceship ship = ship(Enemy, at(30, 30), size(50, 50)); new LasersDamageShipsRule().apply(entities); assertThat(ship.state(), is(Alive)); assertThat(laser.state(), is(Alive)); } @Test public void aFewShipsHitAndMissed() { laser(at(10, 10), Upwards); laser(at(20, 24), Upwards); laser(at(50, 55), Upwards); Spaceship hit = ship(Enemy, at(10, 15), size(30, 30)); Spaceship alsoHit = ship(Enemy, at(43, 10), size(100, 100)); Spaceship missed = ship(Enemy, at(100, 105), size(30, 30)); new LasersDamageShipsRule().apply(entities); assertThat(hit.state(), is(Destroyed)); assertThat(alsoHit.state(), is(Destroyed)); assertThat(missed.state(), is(Alive)); } @Test public void onlyUpwardLasersDestroyEnemiesAndDownwardLasersDestroyPlayer() { laser(at(10, 10), Upwards); laser(at(50, 10), Downwards); Spaceship enemyDestroyed = ship(Enemy, at(0, 0), size(20, 20)); Spaceship enemyAlive = ship(Enemy, at(40, 0), size(20, 20)); laser(at(10, 80), Downwards); laser(at(50, 80), Upwards); Spaceship playerDestroyed = ship(Player, at(0, 70), size(20, 20)); Spaceship playerAlive = ship(Player, at(40, 70), size(20, 20)); new LasersDamageShipsRule().apply(entities); assertThat(enemyDestroyed.state(), is(Destroyed)); assertThat(enemyAlive.state(), is(Alive)); assertThat(playerDestroyed.state(), is(Destroyed)); assertThat(playerAlive.state(), is(Alive)); } private Laser laser(Position position, Laser.Direction direction) { Laser laser = new Laser(position, direction); entities.add(laser); return laser; } private Spaceship ship(EntityType type, Position position, Dimension dimension) { Spaceship spaceship = new Spaceship(type, position, dimension); entities.add(spaceship); return spaceship; } }
[ "paulo.schneider@gmail.com" ]
paulo.schneider@gmail.com
4fca8728d39bbc4ee5a1a8f9de0ac31ba9109ede
e91913d3b6bb49a1c3429915a35fadcc4266a554
/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/reactivation/SimpleCaseReactivationTest.java
267a16624b713b42360a432271d55a698eec3a81
[ "Apache-2.0" ]
permissive
ycy2017/flowable-engine
bec2a9408ff7f62a7e5067b00117edb8418123e5
852ce56d561dd7ebe2cabcb608e7e2af83073c16
refs/heads/master
2023-03-30T18:44:43.054075
2021-04-03T16:52:21
2021-04-04T14:09:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,323
java
/* 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.flowable.cmmn.test.reactivation; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.flowable.cmmn.api.runtime.PlanItemInstanceState.ACTIVE; import java.util.HashMap; import java.util.List; import java.util.Map; import org.flowable.cmmn.api.history.HistoricCaseInstance; import org.flowable.cmmn.api.history.HistoricPlanItemInstance; import org.flowable.cmmn.api.runtime.CaseInstance; import org.flowable.cmmn.api.runtime.PlanItemInstance; import org.flowable.cmmn.api.runtime.PlanItemInstanceState; import org.flowable.cmmn.converter.CmmnXMLException; import org.flowable.cmmn.engine.test.CmmnDeployment; import org.flowable.cmmn.engine.test.FlowableCmmnTestCase; import org.flowable.common.engine.api.FlowableIllegalArgumentException; import org.flowable.common.engine.api.FlowableIllegalStateException; import org.flowable.common.engine.api.FlowableObjectNotFoundException; import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.variable.api.history.HistoricVariableInstance; import org.flowable.variable.api.persistence.entity.VariableInstance; import org.junit.Test; public class SimpleCaseReactivationTest extends FlowableCmmnTestCase { @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case_No_Event.cmmn.xml") public void simpleCaseReactivationMissingCaseFailureTest() { CaseInstance caze = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("simpleReactivationTestCaseNoEvent") .start(); assertThatThrownBy(() -> cmmnHistoryService.reactivateHistoricCaseInstance("nonexistentCaseId", null)) .isExactlyInstanceOf(FlowableObjectNotFoundException.class) .hasMessageContaining("No historic case instance to be reactivated found with id: nonexistentCaseId"); } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case_No_Event.cmmn.xml") public void simpleCaseReactivationActiveCaseFailureTest() { CaseInstance caze = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("simpleReactivationTestCaseNoEvent") .start(); assertThatThrownBy(() -> cmmnHistoryService.reactivateHistoricCaseInstance(caze.getId(), null)) .isExactlyInstanceOf(FlowableIllegalStateException.class) .hasMessageContaining("Case instance is still running, cannot reactivate historic case instance: " + caze.getId()); } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case_No_Event.cmmn.xml") public void simpleCaseReactivationNoReactivationEventFailureTest() { final HistoricCaseInstance caze = createAndFinishSimpleCase("simpleReactivationTestCaseNoEvent"); assertThatThrownBy(() -> cmmnHistoryService.reactivateHistoricCaseInstance(caze.getId(), null)) .isExactlyInstanceOf(FlowableIllegalStateException.class) .hasMessageContaining("The historic case instance " + caze.getId() + " cannot be reactivated as there is no reactivation event in its CMMN model. You need to explicitly model the reactivation event in order to support case reactivation."); } @Test public void simpleCaseReactivationMultiReactivationEventFailureTest() { assertThatThrownBy(() -> addDeploymentForAutoCleanup(cmmnRepositoryService.createDeployment() .addClasspathResource("org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case_Multi_Reactivation_Elements.cmmn.xml") .deploy() )) .isExactlyInstanceOf(CmmnXMLException.class) .hasRootCauseInstanceOf(FlowableIllegalArgumentException.class) .getRootCause() .hasMessageContaining("There can only be one reactivation listener on a case model, not multiple ones. Use a start form on the listener, " + "if there are several options on how to reactivate a case and use conditions to handle the different options on reactivation."); } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case.cmmn.xml") public void reactivationListenerNotAvailableAtCaseRuntime() { String previousUserId = Authentication.getAuthenticatedUserId(); try { Authentication.setAuthenticatedUserId("JohnDoe"); CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("simpleReactivationTestCase") .start(); assertThat(caseInstance).isNotNull(); List<PlanItemInstance> planItemInstances = getAllPlanItemInstances(caseInstance.getId()); assertThat(planItemInstances).isNotNull().hasSize(5); assertPlanItemInstanceState(caseInstance, "Reactivate case", PlanItemInstanceState.UNAVAILABLE); } finally { Authentication.setAuthenticatedUserId(previousUserId); } } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case.cmmn.xml") public void reactivationListenerHavingNoImpactAtCaseCompletion() { String previousUserId = Authentication.getAuthenticatedUserId(); try { Authentication.setAuthenticatedUserId("JohnDoe"); CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("simpleReactivationTestCase") .start(); List<PlanItemInstance> planItemInstances = getPlanItemInstances(caseInstance.getId()); cmmnRuntimeService.triggerPlanItemInstance(getPlanItemInstanceIdByName(planItemInstances, "Task A")); planItemInstances = getPlanItemInstances(caseInstance.getId()); cmmnRuntimeService.triggerPlanItemInstance(getPlanItemInstanceIdByName(planItemInstances, "Task B")); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().count()).isZero(); assertThat(cmmnRuntimeService.createCaseInstanceQuery().count()).isZero(); assertCaseInstanceEnded(caseInstance); } finally { Authentication.setAuthenticatedUserId(previousUserId); } } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case.cmmn.xml") public void simpleCaseReactivationTest() { String previousUserId = Authentication.getAuthenticatedUserId(); try { Authentication.setAuthenticatedUserId("JohnDoe"); final HistoricCaseInstance caze = createAndFinishSimpleCase("simpleReactivationTestCase"); CaseInstance reactivatedCaze = cmmnHistoryService.reactivateHistoricCaseInstance(caze.getId(), null); assertThat(reactivatedCaze).isNotNull(); List<PlanItemInstance> planItemInstances = getAllPlanItemInstances(reactivatedCaze.getId()); assertThat(planItemInstances).isNotNull().hasSize(6); assertPlanItemInstanceState(planItemInstances, "Task C", ACTIVE); assertCaseInstanceNotEnded(reactivatedCaze); // the plan items must be equal for both the runtime as well as the history as of now assertSamePlanItemState(caze, reactivatedCaze); // make sure we have exactly the same variables as the historic case assertSameVariables(caze, reactivatedCaze); } finally { Authentication.setAuthenticatedUserId(previousUserId); } } @Test @CmmnDeployment(resources = "org/flowable/cmmn/test/reactivation/Simple_Reactivation_Test_Case.cmmn.xml") public void simpleCaseReactivationHistoryTest() { String previousUserId = Authentication.getAuthenticatedUserId(); try { Authentication.setAuthenticatedUserId("JohnDoe"); final HistoricCaseInstance caze = createAndFinishSimpleCase("simpleReactivationTestCase"); CaseInstance reactivatedCaze = cmmnHistoryService.reactivateHistoricCaseInstance(caze.getId(), null); assertThat(reactivatedCaze).isNotNull(); HistoricCaseInstance historicCaseInstance = cmmnHistoryService.createHistoricCaseInstanceQuery().caseInstanceId(caze.getId()).singleResult(); assertThat(historicCaseInstance).isNotNull(); assertThat(historicCaseInstance.getState()).isEqualTo(reactivatedCaze.getState()); assertThat(historicCaseInstance.getEndTime()).isNull(); } finally { Authentication.setAuthenticatedUserId(previousUserId); } } protected HistoricCaseInstance createAndFinishSimpleCase(String caseDefinitionKey) { CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey(caseDefinitionKey) .variable("foo", "fooValue") .variable("bar", "barValue") .start(); List<PlanItemInstance> planItemInstances = getPlanItemInstances(caseInstance.getId()); assertPlanItemInstanceState(planItemInstances, "Task A", ACTIVE); cmmnRuntimeService.triggerPlanItemInstance(getPlanItemInstanceIdByName(planItemInstances, "Task A")); planItemInstances = getPlanItemInstances(caseInstance.getId()); assertPlanItemInstanceState(planItemInstances, "Task B", ACTIVE); cmmnRuntimeService.triggerPlanItemInstance(getPlanItemInstanceIdByName(planItemInstances, "Task B")); return cmmnHistoryService.createHistoricCaseInstanceQuery().finished().singleResult(); } protected void assertSameVariables(HistoricCaseInstance c1, CaseInstance c2) { List<HistoricVariableInstance> originalVars = cmmnEngineConfiguration.getCmmnHistoryService().createHistoricVariableInstanceQuery() .caseInstanceId(c1.getId()) .list(); Map<String, VariableInstance> reactivatedVars = cmmnEngineConfiguration.getCmmnRuntimeService().getVariableInstances(c2.getId()); for (HistoricVariableInstance originalVar : originalVars) { VariableInstance reactivatedVar = reactivatedVars.remove(originalVar.getVariableName()); assertThat(reactivatedVar).isNotNull(); assertThat(reactivatedVar.getValue()).isEqualTo(originalVar.getValue()); } assertThat(reactivatedVars).hasSize(0); } protected void assertSamePlanItemState(HistoricCaseInstance c1, CaseInstance c2) { List<PlanItemInstance> runtimePlanItems = getAllPlanItemInstances(c2.getId()); List<HistoricPlanItemInstance> historicPlanItems = cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceCaseInstanceId(c1.getId()).list(); assertThat(runtimePlanItems).isNotNull(); assertThat(historicPlanItems).isNotNull(); assertThat(runtimePlanItems).hasSize(historicPlanItems.size()); Map<String, HistoricPlanItemInstance> historyMap = new HashMap<>(historicPlanItems.size()); for (HistoricPlanItemInstance historicPlanItem : historicPlanItems) { historyMap.put(historicPlanItem.getId(), historicPlanItem); } for (PlanItemInstance runtimePlanItem : runtimePlanItems) { HistoricPlanItemInstance historicPlanItemInstance = historyMap.remove(runtimePlanItem.getId()); assertThat(historicPlanItemInstance).isNotNull(); assertThat(runtimePlanItem.getState()).isEqualTo(historicPlanItemInstance.getState()); } assertThat(historyMap).hasSize(0); } }
[ "jbarrez@users.noreply.github.com" ]
jbarrez@users.noreply.github.com
9697ae2ff11054f6d37a5cd2a591f52fb8d63e35
795d6fa8adeffd4e6413c3aadeeaa260890abc10
/de.dwslab.T2K.utils/src/main/java/de/dwslab/T2K/utils/concurrent/TimeoutOperation.java
050799affb68a09793f329d9c9cdc8b0d6b68454
[]
no_license
T2KFramework/T2K
e5e981c0efd7e8414add8b06ae360a753fdee273
78e7a9c7c21317f38e6eb3308178aacfd75a0bd1
refs/heads/master
2021-05-04T10:29:49.265375
2015-06-05T13:58:35
2015-06-05T13:58:35
36,918,245
5
3
null
null
null
null
UTF-8
Java
false
false
2,098
java
/** * Copyright (C) 2015 T2K-Team, Data and Web Science Group, University of Mannheim (t2k@dwslab.de) * * 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 de.dwslab.T2K.utils.concurrent; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; public abstract class TimeoutOperation<T> { public abstract T doOperation(); public T run(long timeoutMillis) { ExecutorService executor = Executors.newSingleThreadExecutor(); Future<T> future = executor.submit(new Callable<T>() { public T call() throws Exception { return doOperation(); } }); T result = null; try { result = future.get(timeoutMillis, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } executor.shutdownNow(); return result; } public static void main(String[] args) { TimeoutOperation<String> t = new TimeoutOperation<String>() { @Override public String doOperation() { try { Thread.sleep(10000); } catch (InterruptedException e) { //e.printStackTrace(); } return "hello"; } }; System.out.println(t.run(100)); } }
[ "dominique@informatik.uni-mannheim.de" ]
dominique@informatik.uni-mannheim.de
f7a9ac0b45287784a4977b5ff31ed15f80861a15
2d5e54e4dd6612aeb19904fcdf8757680c5bfd79
/metamodel.emfapi/src/org/modelio/metamodel/uml/behavior/activityModel/ControlNode.java
714201ef96c824da69a472a465a913449ea2f772
[]
no_license
mondo-project/hawk-modelio
1ef504dde30ce4e43b5db8d7936adbc04851e058
4da0f70dfeddb0451eec8b2f361586e07ad3dab9
refs/heads/master
2021-01-10T06:09:58.281311
2015-11-06T11:08:15
2015-11-06T11:08:15
45,675,632
1
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
/* * Copyright 2013 Modeliosoft * * This file is part of Modelio. * * Modelio is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Modelio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Modelio. If not, see <http://www.gnu.org/licenses/>. * */ /* WARNING: GENERATED FILE - DO NOT EDIT */ /* Metamodel version: 9022 */ /* SemGen version : 2.0.07.9012 */ package org.modelio.metamodel.uml.behavior.activityModel; import com.modeliosoft.modelio.javadesigner.annotations.objid; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; @objid ("002e8592-c4bf-1fd8-97fe-001ec947cd2a") public interface ControlNode extends ActivityNode { }
[ "antonio.garcia-dominguez@york.ac.uk" ]
antonio.garcia-dominguez@york.ac.uk
39167b98499ad18cb0aab968d351a789b78de019
ad489f408f17e5e7533fb0610dae217cc94a6c3c
/src/main/java/com/pd/api/security/CustomUserDetailsService.java
d877253413e40ddc8ce8e55209c97fc921a0aa8e
[]
no_license
jscasca/pdta_rest_api
108f27843ec1b0cd3a7daa839eeb9078d17c588c
d1283d912e9eeb4c465a421fc289ac2df5e6462f
refs/heads/master
2022-12-22T15:01:45.286697
2019-10-30T22:01:34
2019-10-30T22:01:34
24,352,584
0
0
null
2022-12-16T03:57:23
2014-09-23T01:43:13
Java
UTF-8
Java
false
false
2,273
java
package com.pd.api.security; import java.util.ArrayList; import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import com.pd.api.db.DAO; import com.pd.api.entity.Credential; import com.pd.api.entity.Role; public class CustomUserDetailsService implements UserDetailsService { public UserDetails loadUserByUsername(String authentication) throws UsernameNotFoundException { //CustomUserData customUserData = new CustomUserData(); // You can talk to any of your user details service and get the // authentication data and return as CustomUserData object then spring // framework will take care of the authentication //TODO: try storing the user id from here to save the user in cache Credential credential = DAO.getUniqueByUsername(Credential.class, authentication); if(credential == null) return null; /*customUserData.setAuthentication(true); customUserData.setUsername(authentication); customUserData.setPassword(credential.getPassword()); customUserData.setAuthorities(getCredentialRoles(credential));*/ CustomUserData user = new CustomUserData(authentication, credential.getPassword(), getCredentialRoles(credential)); return user; } private Collection<CustomRole> getCredentialRoles(Credential credential) { Collection<CustomRole> roles = new ArrayList<CustomRole>(); for(Role role : credential.getRoles()) { roles.add(new CustomRole(role.getAuthority())); } return roles; } /** * Custom Role class to manage the authorities * * @author tin * */ private class CustomRole implements GrantedAuthority { String role = null; public CustomRole(String roleName) { this.role = roleName; } public String getAuthority() { return role; } public void setAuthority(String roleName) { this.role = roleName; } } }
[ "jscasca@gmail.com" ]
jscasca@gmail.com
fc9deaf1edebae1235542958363046ca15829c91
eb5f5353f49ee558e497e5caded1f60f32f536b5
/com/sun/xml/internal/stream/buffer/XMLStreamBufferMark.java
63e7f51bbb7399c49ced166064d0bea961c0ef85
[]
no_license
mohitrajvardhan17/java1.8.0_151
6fc53e15354d88b53bd248c260c954807d612118
6eeab0c0fd20be34db653f4778f8828068c50c92
refs/heads/master
2020-03-18T09:44:14.769133
2018-05-23T14:28:24
2018-05-23T14:28:24
134,578,186
0
2
null
null
null
null
UTF-8
Java
false
false
974
java
package com.sun.xml.internal.stream.buffer; import java.util.Map; public class XMLStreamBufferMark extends XMLStreamBuffer { public XMLStreamBufferMark(Map<String, String> paramMap, AbstractCreatorProcessor paramAbstractCreatorProcessor) { if (paramMap != null) { _inscopeNamespaces = paramMap; } _structure = _currentStructureFragment; _structurePtr = _structurePtr; _structureStrings = _currentStructureStringFragment; _structureStringsPtr = _structureStringsPtr; _contentCharactersBuffer = _currentContentCharactersBufferFragment; _contentCharactersBufferPtr = _contentCharactersBufferPtr; _contentObjects = _currentContentObjectFragment; _contentObjectsPtr = _contentObjectsPtr; treeCount = 1; } } /* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\com\sun\xml\internal\stream\buffer\XMLStreamBufferMark.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
[ "mohit.rajvardhan@ericsson.com" ]
mohit.rajvardhan@ericsson.com
49cc053245d73e979d7324fb2447d31a3a523c74
738172e924a45763b260c2acf2cea35e02cb112d
/bukkit/src/main/java/com/github/stefvanschie/quickskript/bukkit/psi/literal/PsiPlayerLiteralImpl.java
9c42403c958024cdc628d01fda098cdb4cbc69e7
[ "MIT" ]
permissive
stefvanschie/QuickSkript
8b2b2022794b9187da88c8b230e53222cb7bf34c
3533a045d6ccd4e3d3a8b797839c950c27dab909
refs/heads/master
2023-08-08T17:29:44.856006
2023-07-27T19:21:21
2023-07-27T19:21:21
142,689,934
14
5
MIT
2022-05-21T18:52:20
2018-07-28T15:50:47
Java
UTF-8
Java
false
false
1,744
java
package com.github.stefvanschie.quickskript.bukkit.psi.literal; import com.github.stefvanschie.quickskript.bukkit.context.ContextImpl; import com.github.stefvanschie.quickskript.core.context.Context; import com.github.stefvanschie.quickskript.core.skript.SkriptRunEnvironment; import com.github.stefvanschie.quickskript.core.psi.exception.ExecutionException; import com.github.stefvanschie.quickskript.core.psi.literal.PsiPlayerLiteral; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Returns the player from the given context. Can never be pre computed since it relies completely on context. * * @since 0.1.0 */ public class PsiPlayerLiteralImpl extends PsiPlayerLiteral { private PsiPlayerLiteralImpl(int lineNumber) { super(lineNumber); } @NotNull @Override protected Player executeImpl(@Nullable SkriptRunEnvironment environment, @Nullable Context context) { if (context == null) { throw new ExecutionException("Cannot find a player without a context", lineNumber); } CommandSender sender = ((ContextImpl) context).getCommandSender(); if (!(sender instanceof Player)) { throw new ExecutionException("Command wasn't executed by a player", lineNumber); } return (Player) sender; } /** * A factory for creating player literals * * @since 0.1.0 */ public static class Factory extends PsiPlayerLiteral.Factory { @NotNull @Override public PsiPlayerLiteralImpl create(int lineNumber) { return new PsiPlayerLiteralImpl(lineNumber); } } }
[ "stefvanschiedev@gmail.com" ]
stefvanschiedev@gmail.com
8f1968ceec6a0be295368189d7c57df9c742d809
10186b7d128e5e61f6baf491e0947db76b0dadbc
/jp/cssj/f/a/c.java
23385bcc1438307cf6b78bacf29e94d34925bfbf
[ "SMLNJ", "Apache-1.1", "Apache-2.0", "BSD-2-Clause" ]
permissive
MewX/contendo-viewer-v1.6.3
7aa1021e8290378315a480ede6640fd1ef5fdfd7
69fba3cea4f9a43e48f43148774cfa61b388e7de
refs/heads/main
2022-07-30T04:51:40.637912
2021-03-28T05:06:26
2021-03-28T05:06:26
351,630,911
2
0
Apache-2.0
2021-10-12T22:24:53
2021-03-26T01:53:24
Java
UTF-8
Java
false
false
3,495
java
/* */ package jp.cssj.f.a; /* */ /* */ import java.io.IOException; /* */ import java.util.ArrayList; /* */ import java.util.List; /* */ import jp.cssj.f.a; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class c /* */ extends d /* */ implements a /* */ { /* 20 */ private List<a> d = new ArrayList<>(); /* */ /* 22 */ private a e = null; private a f = null; /* */ private static final boolean b = false; /* */ /* */ private class a { /* */ public final int a; /* 27 */ public a b = null; public a c = null; /* */ /* 29 */ public long d = 0L; /* */ /* */ public a(c this$0, int id) { /* 32 */ this.a = id; /* */ } /* */ } /* */ /* */ public c(a builder) { /* 37 */ super(builder); /* 38 */ if (!a && builder.c()) throw new AssertionError(); /* */ } /* */ /* */ protected int f() { /* 42 */ return this.d.size(); /* */ } /* */ /* */ protected a c(int id) { /* 46 */ return this.d.get(id); /* */ } /* */ /* */ protected void a(int id, a frg) { /* 50 */ if (!a && id != this.d.size()) throw new AssertionError(); /* 51 */ this.d.add(frg); /* */ } /* */ /* */ public a.a d() { /* 55 */ long[] idToPosition = new long[this.d.size()]; /* 56 */ long position = 0L; /* 57 */ a frg = this.e; /* 58 */ while (frg != null) { /* */ /* 60 */ idToPosition[frg.a] = position; /* 61 */ position += frg.d; /* 62 */ frg = frg.c; /* */ } /* 64 */ return new a.a(this, idToPosition) { /* */ public long a(int id) { /* 66 */ long position = this.a[id]; /* 67 */ return position; /* */ } /* */ }; /* */ } /* */ /* */ public void b() throws IOException { /* 73 */ int id = f(); /* 74 */ a frg = new a(this, id); /* 75 */ if (this.e == null) { /* 76 */ this.e = frg; /* */ } else { /* 78 */ this.f.c = frg; /* 79 */ frg.b = this.f; /* */ } /* 81 */ a(id, frg); /* 82 */ this.f = frg; /* 83 */ super.b(); /* */ } /* */ /* */ public void a(int anchorId) throws IOException { /* 87 */ int id = f(); /* 88 */ a anchor = c(anchorId); /* 89 */ a frg = new a(this, id); /* 90 */ a(id, frg); /* 91 */ frg.b = anchor.b; /* 92 */ frg.c = anchor; /* 93 */ anchor.b.c = frg; /* 94 */ anchor.b = frg; /* 95 */ if (this.e == anchor) { /* 96 */ this.e = frg; /* */ } /* 98 */ super.a(anchorId); /* */ } /* */ /* */ public void a(int id, byte[] b, int off, int len) throws IOException { /* 102 */ a frg = c(id); /* 103 */ frg.d += len; /* 104 */ super.a(id, b, off, len); /* */ } /* */ /* */ public void b(int id) throws IOException { /* 108 */ super.b(id); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void a() throws IOException { /* 116 */ this.e = null; /* 117 */ this.f = null; /* 118 */ this.d.clear(); /* 119 */ super.a(); /* */ } /* */ } /* Location: /mnt/r/ConTenDoViewer.jar!/jp/cssj/f/a/c.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "xiayuanzhong+gpg2020@gmail.com" ]
xiayuanzhong+gpg2020@gmail.com
859cbf88bf8f32e5b2b407f7ebbfac85a9377ed3
512f4ddaa85ab2f5b41a4a8c3a082ffa438c974a
/src/main/java/org/openlmis/rearchpoc/reference/domain/CsaVestAttribute.java
92805238d3f9e096aedb8119f969f74eaef55695
[]
no_license
chunky56/ol-rearch-poc
f6c07cf24b4c7757e46a2e9b98b9bc27da025c79
a5d0220809d94c44bd55d3c99fe3b8618f4547fe
refs/heads/master
2020-12-31T04:55:44.856914
2016-04-26T22:41:27
2016-04-26T22:41:27
56,273,385
0
1
null
2016-05-03T18:26:07
2016-04-14T22:16:21
Java
UTF-8
Java
false
false
510
java
package org.openlmis.rearchpoc.reference.domain; import lombok.Data; import javax.persistence.*; @Data @Entity @Table(name="csa_vest_attributes") public class CsaVestAttribute { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String code; @ManyToOne @JoinColumn(name = "csavestid") private CsaVest csaVest; @ManyToOne @JoinColumn(name = "csavestattributetypeid") private CsaVestAttributeType type; private String value; }
[ "cahn922@yahoo.com" ]
cahn922@yahoo.com
d85e0b60b4c3c31ba20032af44a18dfd08c9c99d
6cae40d0d2861898eaa57b662ccf0f89e6cc7dca
/super&this/src/B.java
45f999cdefee2b21dd06359ebe7a1cfd70f24488
[]
no_license
aashaanX/java
788bb140d73a94d42196271b5837476b05fb7ef5
ee6ccdf437a3fcc5797f86dd22b8711f994e549f
refs/heads/develop
2020-12-18T22:33:28.412462
2016-08-09T18:02:10
2016-08-09T18:02:10
58,110,421
0
0
null
2016-05-17T19:00:57
2016-05-05T06:46:56
Java
UTF-8
Java
false
false
241
java
public class B { B(){ System.out.println("No args"); } B(int i){ this(); } public static void main(String[] args) { B a = new B(100); } } // example for 'this' in constructors. // 'this' is the first statement in constructor.
[ "arjunprahladan@gmail.com" ]
arjunprahladan@gmail.com
472902be57a68e80d01447a6b78c9dbead662974
e9adf9227baee96486bb61bfc78fca99660a6bfc
/cat-job/src/main/java/com/dianping/cat/job/joblet/LocationJoblet.java
c48df62471c24238179d2573ec2a1b92e6533a82
[]
no_license
lietou/insight
b1cacc2902c755982a71ea4659311a75ed4acb86
4757005689201327eed6e5dd62740a88e84658f0
refs/heads/master
2021-01-22T12:17:01.291886
2013-04-20T01:38:29
2013-04-20T01:38:29
8,964,847
1
0
null
null
null
null
UTF-8
Java
false
false
8,158
java
package com.dianping.cat.job.joblet; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.codehaus.plexus.logging.LogEnabled; import org.codehaus.plexus.logging.Logger; import com.dianping.cat.job.joblet.LocationJoblet.Location; import com.dianping.cat.job.joblet.LocationJoblet.LocationStat; import com.dianping.cat.job.spi.JobCmdLine; import com.dianping.cat.job.spi.joblet.Joblet; import com.dianping.cat.job.spi.joblet.JobletContext; import com.dianping.cat.job.spi.joblet.JobletMeta; import com.dianping.cat.job.spi.mapreduce.MessageTreeWritable; import com.dianping.cat.job.spi.mapreduce.PojoWritable; import com.dianping.cat.job.sql.dal.LocationRecord; import com.dianping.cat.job.sql.dal.LocationRecordDao; import com.dianping.cat.message.Event; import com.dianping.cat.message.Message; import com.dianping.cat.message.Transaction; import com.dianping.cat.message.spi.MessageTree; import org.unidal.dal.jdbc.DalException; import org.unidal.lookup.ContainerHolder; import org.unidal.lookup.annotation.Inject; @JobletMeta(name = "location", description = "Location analysis", keyClass = Location.class, valueClass = LocationStat.class, combine = true, reducerNum = 1) public class LocationJoblet extends ContainerHolder implements Joblet<Location, LocationStat> { private static final MessageFormat m_format = new MessageFormat("{2}?lat={0,number}&lng={1,number}&{3}"); @Inject private LocationOutputter m_outputter; private Location getLocation(Transaction root) { List<Message> children = root.getChildren(); for (Message child : children) { if (child instanceof Event && child.getType().equals("URL") && child.getName().equals("Payload")) { // URL:Payload // /location.bin?lat=31.20334&lng=121.58017&accuracy=1385 String data = child.getData().toString(); try { Object[] parts = m_format.parse(data); Number lat = (Number) parts[0]; Number lng = (Number) parts[1]; return new Location(convertForPrecision(lat.doubleValue()), convertForPrecision(lng.doubleValue()), root.getTimestamp()); } catch (Exception e) { // ignore it } break; } } return null; } private double convertForPrecision(double value) { final double precise = 100000d; return ((long) (value * precise)) / precise; } @Override public boolean initialize(JobCmdLine cmdLine) { String inputPath = cmdLine.getArg("inputPath", 0, null); String outputPath = cmdLine.getArg("outputPath", 1, null); if (inputPath != null) { cmdLine.setProperty("inputPath", inputPath); } if (outputPath != null) { cmdLine.setProperty("outputPath", outputPath); } String outputter = cmdLine.getProperty("outputter", null); if (outputter != null) { m_outputter = lookup(LocationOutputter.class, outputter); } return true; } @Override public void map(JobletContext context, MessageTreeWritable treeWritable) throws IOException, InterruptedException { MessageTree tree = treeWritable.get(); Message root = tree.getMessage(); final String type = root.getType(); final String name = root.getName(); if (root instanceof Transaction && type.equals("URL") && (name.equals("/location.bin") || name.equals("/locationhd.bin"))) { Location location = getLocation((Transaction) root); if (location != null) { context.write(location, LocationStat.ONCE); } } } @Override public void reduce(JobletContext context, Location location, Iterable<LocationStat> stats) throws IOException, InterruptedException { LocationStat all = new LocationStat(); for (LocationStat stat : stats) { all.add(stat.getCount()); } if (context.isInCombiner()) { context.write(location, all); } else { m_outputter.out(context, location, all); } } @Override public void summary() { System.out.println(m_outputter); } public static class Location extends PojoWritable { private double m_lat; private double m_lng; private long m_transactionDate; public Location() { } public Location(double lat, double lng, long transactionDate) { m_lat = lat; m_lng = lng; m_transactionDate = transactionDate; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof Location)) return false; Location other = (Location) obj; if (Double.doubleToLongBits(m_lat) != Double.doubleToLongBits(other.m_lat)) return false; if (Double.doubleToLongBits(m_lng) != Double.doubleToLongBits(other.m_lng)) return false; if (m_transactionDate != other.m_transactionDate) return false; return true; } public double getLat() { return m_lat; } public double getLng() { return m_lng; } public long getTransactionDate() { return m_transactionDate; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); long temp; temp = Double.doubleToLongBits(m_lat); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(m_lng); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + (int) (m_transactionDate ^ (m_transactionDate >>> 32)); return result; } } public static class LocationDatabaseDumper implements LocationOutputter, LogEnabled { @Inject private LocationRecordDao m_dao; private List<LocationRecord> m_records = new ArrayList<LocationRecord>(); private int m_count; private Logger m_logger; @Override public void enableLogging(Logger logger) { m_logger = logger; } private void flushToDatabase() { if (m_records.size() > 0) { try { final LocationRecord[] batch = m_records.toArray(new LocationRecord[0]); m_dao.insert(batch); m_records.clear(); m_count += batch.length; m_logger.info(String.format("%s records inserted.", m_count)); } catch (DalException e) { m_logger.error("Error when batch inserting data to database.", e); } } } @Override public void out(JobletContext context, Location location, LocationStat stat) throws IOException, InterruptedException { if (m_records.size() >= 200) { flushToDatabase(); } LocationRecord record = m_dao.createLocal(); record.setLat(location.getLat()); record.setLng(location.getLng()); record.setTransactionDate(new Date(location.getTransactionDate())); record.setTotal(stat.getCount()); m_records.add(record); } @Override public String toString() { flushToDatabase(); return ""; } } public static interface LocationOutputter { public void out(JobletContext context, Location location, LocationStat all) throws IOException, InterruptedException; } public static class LocationReporter implements LocationOutputter { private Map<Location, LocationStat> m_stats = new TreeMap<Location, LocationStat>(); @Override public void out(JobletContext context, Location location, LocationStat stat) throws IOException, InterruptedException { m_stats.put(location, stat); } @Override public String toString() { StringBuilder sb = new StringBuilder(8192); boolean first = true; sb.append('['); for (Map.Entry<Location, LocationStat> e : m_stats.entrySet()) { Location location = e.getKey(); LocationStat stat = e.getValue(); if (first) { first = false; } else { sb.append(','); sb.append('\n'); } sb.append('['); sb.append(location.getLat()).append(',').append(location.getLng()).append(',').append(stat.getCount()); sb.append(']'); } sb.append(']'); return sb.toString(); } } public static class LocationStat extends PojoWritable { public static final LocationStat ONCE = new LocationStat().add(1); private int m_count; public LocationStat add(int count) { m_count += count; return this; } public int getCount() { return m_count; } @Override public int hashCode() { return m_count; } } }
[ "qmwu2000@gmail.com" ]
qmwu2000@gmail.com
ce6de0e4619cdbea7260ff6b9392831b0a1d2b25
ec58b9b8b43bc75b8bee2f2e079e55af9da0dcae
/SRMdesign/src/SRM/Activity.java
f7c10fb10a27e5f6e952be02397ab655551b2e7a
[]
no_license
kouvelas/ASEME
b31b4a37f21ed20840393b309612eacda92b608b
996acaaf5209fb6ec1dfbc2762d6baeff58b751d
refs/heads/master
2021-03-12T23:12:15.441118
2013-06-13T19:22:09
2013-06-13T19:22:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,164
java
/** * <copyright> * </copyright> * * $Id$ */ package SRM; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Activity</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link SRM.Activity#getName <em>Name</em>}</li> * <li>{@link SRM.Activity#getFunctionality <em>Functionality</em>}</li> * </ul> * </p> * * @see SRM.SRMPackage#getActivity() * @model * @generated */ public interface Activity extends EObject { /** * Returns the value of the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Name</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Name</em>' attribute. * @see #setName(String) * @see SRM.SRMPackage#getActivity_Name() * @model unique="false" required="true" ordered="false" * @generated */ String getName(); /** * Sets the value of the '{@link SRM.Activity#getName <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Name</em>' attribute. * @see #getName() * @generated */ void setName(String value); /** * Returns the value of the '<em><b>Functionality</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Functionality</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Functionality</em>' attribute. * @see #setFunctionality(String) * @see SRM.SRMPackage#getActivity_Functionality() * @model unique="false" ordered="false" * @generated */ String getFunctionality(); /** * Sets the value of the '{@link SRM.Activity#getFunctionality <em>Functionality</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Functionality</em>' attribute. * @see #getFunctionality() * @generated */ void setFunctionality(String value); } // Activity
[ "nikos@science.tuc.gr" ]
nikos@science.tuc.gr
705aafd26d0da68959246c96edeb453378647538
0ea50fcd952f7cd7ea542ae9f6b4bf814019a432
/practice/src/algorithm/Aleetcode3_树/JZoffer72_leetcode110/Solution.java
166fb575fbf4c25b298aee532ce5668c9ac7a2c1
[]
no_license
LimLeeSpirit/practice
308331aad0f454d12350f2d6021ca5199792b4c9
9abf13f0fed13cec8d1cff3235383c4b6945af7e
refs/heads/master
2022-12-27T08:16:40.043290
2020-05-24T14:55:43
2020-05-24T14:55:43
266,118,988
0
0
null
2020-10-13T22:12:48
2020-05-22T13:36:05
Java
UTF-8
Java
false
false
891
java
package algorithm.Aleetcode3_树.JZoffer72_leetcode110; import algorithm.Aleetcode3_树.TreeNode; /** * 给定一个二叉树,判断它是否是高度平衡的二叉树。 * * 本题中,一棵高度平衡二叉树定义为: * * 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。 * * 所以在针对某个节点求最大深度的时候,需要先判断其左子树的最大深度 和 右子树的最大深度之差,来看是不是满足平衡 */ public class Solution { boolean ret = true; public boolean isBalanced(TreeNode root) { dfs(root); return ret; } private int dfs(TreeNode root) { if (root == null) return 0; int left = dfs(root.left); int right = dfs(root.right); if (Math.abs(left - right) > 1) ret = false; return Math.max(left, right) + 1; } }
[ "lzz@woyouyizhiyixingdeMacBook-Pro.local" ]
lzz@woyouyizhiyixingdeMacBook-Pro.local
ed2957dc20b1aa946fd98ad35dffb75e6cb2ce95
ff9501f65d7e0a124ff09648a05f3e5dc30e7b00
/freedom-fw1/src/org/freedom/library/business/object/Historico.java
59c27db8994d452bc8a18477c9f6cbb4a3aca3a3
[]
no_license
train7719/red
927563cb244547547cc84ad431b675982bca5cd4
7308f986e2018daa5ef6f2f26067de6c7ba413d3
refs/heads/master
2021-01-12T13:55:34.427827
2016-09-26T11:55:10
2016-09-26T11:55:10
68,921,569
0
0
null
null
null
null
UTF-8
Java
false
false
3,335
java
package org.freedom.library.business.object; import java.math.BigDecimal; import org.freedom.infra.model.jdbc.DbConnection; import org.freedom.library.functions.Funcoes; import org.freedom.library.persistence.ListaCampos; import org.freedom.library.swing.frame.Aplicativo; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Date; public class Historico { private String historicocodificado; private String documento; private String portador; private String historicoant; private BigDecimal valor; // private String serie; private Date data; private String historicodecodificado; private boolean isDecoded = false; public Historico() { super(); } public String getHistoricoant() { return historicoant; } public void setHistoricoant(String historicoant) { this.historicoant = historicoant; } public Historico(final Integer codhist, DbConnection con) { super(); PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement("SELECT TXAHISTPAD FROM FNHISTPAD WHERE CODEMP=? AND CODFILIAL=? AND CODHIST=?"); ps.setInt(1, Aplicativo.iCodEmp); ps.setInt(2, ListaCampos.getMasterFilial("FNHISTPAD")); ps.setInt(3, codhist); rs = ps.executeQuery(); if (rs.next()) { setHistoricocodificado(rs.getString(1)); } rs.close(); ps.close(); con.commit(); } catch (Exception e) { e.printStackTrace(); } } protected void decodeHistorico() { String decoded = null; if (historicocodificado != null) { try { String tmp = historicocodificado; String vlr = "0,00"; if (getValor() != null) { vlr = Funcoes.bdToStr(getValor()).toString(); } tmp = tmp.replaceAll("<HISTORICO>", getHistoricoant() != null ? getHistoricoant() : ""); tmp = tmp.replaceAll("<DOCUMENTO>", getDocumento() != null ? getDocumento() : ""); tmp = tmp.replaceAll("<VALOR>", vlr); tmp = tmp.replaceAll("<DATA>", getData() != null ? Funcoes.dateToStrDate(getData()) : ""); tmp = tmp.replaceAll("<PORTADOR>", getPortador() != null ? getPortador() : ""); decoded = tmp; isDecoded = true; } catch (Exception e) { e.printStackTrace(); } } setHistoricodecodificado(decoded); } public Date getData() { return data; } public void setData(Date data) { this.data = data; } public String getDocumento() { return documento; } public void setDocumento(String documento) { this.documento = documento; } /* * public String getSerie() { * * return serie; } * * * public void setSerie( String serie ) { * * this.serie = serie; } */ public BigDecimal getValor() { return valor; } public void setValor(BigDecimal valor) { this.valor = valor; } public String getHistoricocodificado() { return historicocodificado; } public void setHistoricocodificado(String historicocodificado) { this.historicocodificado = historicocodificado; } public String getHistoricodecodificado() { if (!isDecoded) { decodeHistorico(); } return historicodecodificado; } public void setHistoricodecodificado(String historicodecodificado) { this.historicodecodificado = historicodecodificado; } public String getPortador() { return portador; } public void setPortador(String portador) { this.portador = portador; } }
[ "train7730@gmail.com" ]
train7730@gmail.com
3028e4822b8a835237c097f0f8ff056a639af37f
b66a7df08711d7c3fbedc4f3ebbbd55373482e9a
/src/cn/mcandroid/pojo/ThematicContentExample.java
c9dc4ddd3147cac05e8d4df8cc180ec98c63ff66
[]
no_license
LCQ622/Post-Bar
5536c5943c1c1b46655e85c01102e74751dec887
c06d4e629ca24ca61f17edecf6d00b22a735b3c8
refs/heads/master
2020-05-30T14:40:24.097126
2019-06-02T02:33:57
2019-06-02T02:33:57
189,796,617
0
1
null
null
null
null
UTF-8
Java
false
false
19,633
java
package cn.mcandroid.pojo; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ThematicContentExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public ThematicContentExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andContentIdIsNull() { addCriterion("content_id is null"); return (Criteria) this; } public Criteria andContentIdIsNotNull() { addCriterion("content_id is not null"); return (Criteria) this; } public Criteria andContentIdEqualTo(Integer value) { addCriterion("content_id =", value, "contentId"); return (Criteria) this; } public Criteria andContentIdNotEqualTo(Integer value) { addCriterion("content_id <>", value, "contentId"); return (Criteria) this; } public Criteria andContentIdGreaterThan(Integer value) { addCriterion("content_id >", value, "contentId"); return (Criteria) this; } public Criteria andContentIdGreaterThanOrEqualTo(Integer value) { addCriterion("content_id >=", value, "contentId"); return (Criteria) this; } public Criteria andContentIdLessThan(Integer value) { addCriterion("content_id <", value, "contentId"); return (Criteria) this; } public Criteria andContentIdLessThanOrEqualTo(Integer value) { addCriterion("content_id <=", value, "contentId"); return (Criteria) this; } public Criteria andContentIdIn(List<Integer> values) { addCriterion("content_id in", values, "contentId"); return (Criteria) this; } public Criteria andContentIdNotIn(List<Integer> values) { addCriterion("content_id not in", values, "contentId"); return (Criteria) this; } public Criteria andContentIdBetween(Integer value1, Integer value2) { addCriterion("content_id between", value1, value2, "contentId"); return (Criteria) this; } public Criteria andContentIdNotBetween(Integer value1, Integer value2) { addCriterion("content_id not between", value1, value2, "contentId"); return (Criteria) this; } public Criteria andColumnIdIsNull() { addCriterion("column_id is null"); return (Criteria) this; } public Criteria andColumnIdIsNotNull() { addCriterion("column_id is not null"); return (Criteria) this; } public Criteria andColumnIdEqualTo(Integer value) { addCriterion("column_id =", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdNotEqualTo(Integer value) { addCriterion("column_id <>", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdGreaterThan(Integer value) { addCriterion("column_id >", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdGreaterThanOrEqualTo(Integer value) { addCriterion("column_id >=", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdLessThan(Integer value) { addCriterion("column_id <", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdLessThanOrEqualTo(Integer value) { addCriterion("column_id <=", value, "columnId"); return (Criteria) this; } public Criteria andColumnIdIn(List<Integer> values) { addCriterion("column_id in", values, "columnId"); return (Criteria) this; } public Criteria andColumnIdNotIn(List<Integer> values) { addCriterion("column_id not in", values, "columnId"); return (Criteria) this; } public Criteria andColumnIdBetween(Integer value1, Integer value2) { addCriterion("column_id between", value1, value2, "columnId"); return (Criteria) this; } public Criteria andColumnIdNotBetween(Integer value1, Integer value2) { addCriterion("column_id not between", value1, value2, "columnId"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andContentCreatedateIsNull() { addCriterion("content_createdate is null"); return (Criteria) this; } public Criteria andContentCreatedateIsNotNull() { addCriterion("content_createdate is not null"); return (Criteria) this; } public Criteria andContentCreatedateEqualTo(Date value) { addCriterion("content_createdate =", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateNotEqualTo(Date value) { addCriterion("content_createdate <>", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateGreaterThan(Date value) { addCriterion("content_createdate >", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateGreaterThanOrEqualTo(Date value) { addCriterion("content_createdate >=", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateLessThan(Date value) { addCriterion("content_createdate <", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateLessThanOrEqualTo(Date value) { addCriterion("content_createdate <=", value, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateIn(List<Date> values) { addCriterion("content_createdate in", values, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateNotIn(List<Date> values) { addCriterion("content_createdate not in", values, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateBetween(Date value1, Date value2) { addCriterion("content_createdate between", value1, value2, "contentCreatedate"); return (Criteria) this; } public Criteria andContentCreatedateNotBetween(Date value1, Date value2) { addCriterion("content_createdate not between", value1, value2, "contentCreatedate"); return (Criteria) this; } public Criteria andContentTitleIsNull() { addCriterion("content_title is null"); return (Criteria) this; } public Criteria andContentTitleIsNotNull() { addCriterion("content_title is not null"); return (Criteria) this; } public Criteria andContentTitleEqualTo(String value) { addCriterion("content_title =", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleNotEqualTo(String value) { addCriterion("content_title <>", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleGreaterThan(String value) { addCriterion("content_title >", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleGreaterThanOrEqualTo(String value) { addCriterion("content_title >=", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleLessThan(String value) { addCriterion("content_title <", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleLessThanOrEqualTo(String value) { addCriterion("content_title <=", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleLike(String value) { addCriterion("content_title like", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleNotLike(String value) { addCriterion("content_title not like", value, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleIn(List<String> values) { addCriterion("content_title in", values, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleNotIn(List<String> values) { addCriterion("content_title not in", values, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleBetween(String value1, String value2) { addCriterion("content_title between", value1, value2, "contentTitle"); return (Criteria) this; } public Criteria andContentTitleNotBetween(String value1, String value2) { addCriterion("content_title not between", value1, value2, "contentTitle"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table thematic_content * * @mbg.generated do_not_delete_during_merge Tue Nov 27 09:47:32 CST 2018 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table thematic_content * * @mbg.generated Tue Nov 27 09:47:32 CST 2018 */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "1780082826@qq.com" ]
1780082826@qq.com
9b0c75cc2d66295eb3227be70b09c63f3431c171
8cb0aa692456057a5c7738c48b0d4e0aef6ea936
/src/main/java/com/example/grpc/GrpcRunner.java
a5c99696484f6063eb1c35a5d21df29af4753392
[]
no_license
bong-a/grpc-server
ba8c2378d0adf2709edd6fd34e08f36093982baa
4cf5e33da5df57acde1aea20cf4d34e576275bb2
refs/heads/main
2023-07-19T16:52:26.235587
2021-09-21T09:50:28
2021-09-21T09:50:28
408,765,606
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package com.example.grpc; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import io.grpc.Server; import io.grpc.ServerBuilder; @Component public class GrpcRunner implements ApplicationRunner { private static final int PORT = 3030; private static final Server SERVER = ServerBuilder.forPort(PORT) .addService(new SampleService()) .build(); @Override public void run(ApplicationArguments args) throws Exception { SERVER.start(); } }
[ "devbonga@gmail.com" ]
devbonga@gmail.com
fbf6fbfda59d73a28cc412c3deef6c02b88c8715
a2c86d209528cf958af0a47fec333e2a2a1678aa
/practica-2/ClienteNIO.java
6630ad3bdd3e97082dc4356edcb96667bca2d9a1
[]
no_license
edoomm/Redes2
fdc5d8a11179fe660d5e9e65b51a220c9cf4c5b1
453ff01022fdfcab1480dfd0e79b1c2004dab56e
refs/heads/master
2023-06-02T21:16:06.369170
2021-06-21T01:27:59
2021-06-21T01:27:59
344,846,193
0
0
null
null
null
null
UTF-8
Java
false
false
7,380
java
import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Scanner; public class ClienteNIO { private Scanner scanner; private boolean jugando; private Cronometro cronometro; private String host = "127.0.0.1"; private int PORT = 9999; private boolean firstTime; private BufferedReader bufferedReader; private SocketChannel client; private Selector selector; private String tiempoFinal; public ClienteNIO() throws IOException { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); client = SocketChannel.open(); selector = Selector.open(); client.configureBlocking(false); client.connect(new InetSocketAddress(host,PORT)); client.register(selector, SelectionKey.OP_CONNECT); scanner = new Scanner(System.in); jugando = true; cronometro = new Cronometro(); firstTime = true; tiempoFinal = ""; } public String elegirTematica() { String opcion = ""; Scanner scanner = new Scanner(System.in); System.out.println("Escoja su temática:\n----------\n0) Redes\n1) Geografia\n2) Mascotas\n-1) Salir"); System.out.println("Opcion: "); opcion = scanner.nextLine(); return opcion; } public void conectarse(SelectionKey k) throws ClosedChannelException { SocketChannel ch = (SocketChannel)k.channel(); if(ch.isConnectionPending()){ try{ ch.finishConnect(); System.out.println("Conexion establecida.. Escribe un mensaje <ENTER> para enviar \"SALIR\" para teminar"); }catch(Exception e){ e.printStackTrace(); } } ch.register(selector, SelectionKey.OP_READ|SelectionKey.OP_WRITE); } public void iniciarCliente() throws IOException, ClassNotFoundException { while(true){ selector.select(); Iterator<SelectionKey>it =selector.selectedKeys().iterator(); while(it.hasNext()){ SelectionKey k = (SelectionKey)it.next(); it.remove(); if(k.isConnectable()){ conectarse(k); } else if(k.isWritable()) { System.out.println("WRITEABLE"); SocketChannel ch2 = (SocketChannel)k.channel(); if (firstTime) { String tematica = elegirTematica(); if (tematica.equalsIgnoreCase("SALIR")) { System.out.println("Saliendo"); ByteBuffer b = ByteBuffer.wrap(tematica.getBytes()); ch2.write(b); ch2.close(); return; } ByteBuffer b = ByteBuffer.wrap(tematica.getBytes()); ch2.write(b); firstTime = false; } else if (tiempoFinal.equalsIgnoreCase("SALIR")){ System.out.println("Saliendo del juego"); ByteBuffer b = ByteBuffer.wrap(("SALIR").getBytes()); ch2.write(b); return; } else { System.out.println("Enviando tiempo del jugador"); ByteBuffer b = ByteBuffer.wrap(("Tiempo: " + tiempoFinal).getBytes()); ch2.write(b); return; } k.interestOps(SelectionKey.OP_READ); } else if(k.isReadable()){ System.out.println("READABLE"); SocketChannel ch2 = (SocketChannel)k.channel(); ByteBuffer b = ByteBuffer.allocate(50000); b.clear(); int n = ch2.read(b); b.flip(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(b.array())); Tablero tablero = (Tablero)ois.readObject(); System.out.println("Se recibió el tablero"); iniciarJuego(tablero); k.interestOps(SelectionKey.OP_WRITE); } } } } private Posicion leerPosicion () { try { int fila = scanner.nextInt(), columna = scanner.nextInt(); return new Posicion ( fila, columna); } catch (Exception e) { System.out.println("Entrada inválida"); return null; } } public void iniciarJuego(Tablero tablero) { try { jugando = true; while ( jugando ) { cronometro.iniciar(); System.out.println(tablero); System.out.println("Ingresa fila y columna de inicio"); Posicion inicio = leerPosicion(); if (inicio == null) break; System.out.println("Ingresa fila y columna de fin"); Posicion fin = leerPosicion(); if (inicio == null) break; if ( tablero.descubrirPalabra(inicio, fin) ) { if ( tablero.palabrasFaltantes() > 0 ) System.out.println("Yuju! \nDescubriste una palabra!\nRestan: " + tablero.palabrasFaltantes() + " palabras"); else { System.out.println("Felicidades! \nGanaste!"); cronometro.detener(); tiempoFinal = cronometro.getHorasTranscurridas() + " hrs. " + cronometro.getMinutosTranscurridos() + " mins. " + cronometro.getSegundosTranscurridos() + " segs."; System.out.println("Tu tiempo: " + tiempoFinal); cronometro.reiniciar(); jugando = false; break; } } else { System.out.println("No es una palabra correcta :(\nIntenta de nuevo"); } } if (tiempoFinal.length() == 0) { tiempoFinal = "Salir"; } } catch (Exception e) { System.err.println("Error al iniciar el juego"); e.printStackTrace(); } } public static void main(String[] args){ try { ClienteNIO cliente = new ClienteNIO(); cliente.iniciarCliente(); } catch (Exception e) { e.printStackTrace(); } } }
[ "ayala.segoviano.donaldo@gmail.com" ]
ayala.segoviano.donaldo@gmail.com
61501a957368647f6735ee5e4c61ec80840c0355
183d2c93e731c8b927b9404d908fed6f5d9220ec
/src/fr/pip/soma/model/ShapeComputer.java
e8e2e1636140c80c3de45dd84e89b6d145b06713
[]
no_license
philippepeter/Soma
c1f7f2ab3e4d241a30466b345156454940d95b4d
014e82fb6a85a78bf4765339acf50921960e3237
refs/heads/master
2016-09-09T17:39:34.815936
2013-04-07T20:02:18
2013-04-07T20:02:18
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
7,698
java
/** * Copyright ©2009 Philippe PETER. * Les sources qui constituent ce projet Soma de même que la documentation associée * sont la propriété de leur auteur. * Je donne mon accord au site developpez.com pour l'utilisation de tout ou partie * des sources et de la documentation de ce projet dans les pages developpez.com */ package fr.pip.soma.model; import java.util.ArrayList; import java.util.List; /** * Classe utilitaire pour le calcul de figures avec rotations et translations. * * @author Philippe PETER */ public final class ShapeComputer { /** * Cette méthode calcule toutes les rotations possibles à partir d'une * figure donnée. * * @param originalShape * La figure d'origine. * @return Une liste de figures contenant toutes les rotations possibles. */ public final static List<Shape> getAllPossibleRotatedShapes( Shape originalShape) { ArrayList<Shape> shapes = new ArrayList<Shape>(); Shape xShape = originalShape; Shape yShape = null; Shape zShape = null; xShape = originalShape; // Sur chaque axe 4 rotations sont possibles: 0, Pi/2, Pi, 3Pi/2 for (int i = 0; i < 4; i++) { xShape = createXRotatedShape(xShape); // Test si la figure existe deja. boolean alreadyContained = alreadyContained(shapes, xShape); if (!alreadyContained) { shapes.add(xShape); yShape = xShape; } if (yShape != null) { for (int j = 0; j < 4; j++) { yShape = createYRotatedShape(yShape); // Test si la figure existe deja. alreadyContained = alreadyContained(shapes, yShape); if (!alreadyContained) { shapes.add(yShape); zShape = yShape; } if (zShape != null) { for (int z = 0; z < 4; z++) { zShape = createZRotatedShape(zShape); // Test si la figure existe deja. alreadyContained = alreadyContained(shapes, zShape); if (!alreadyContained) { shapes.add(zShape); } } } zShape = null; } } yShape = null; } return shapes; } /** * Calcul toutes les translations valides (sans points sortant du puzzle) * d'une figure dans le puzzle. * * @param soma * Le puzzle * @param shapes * La liste des figures à translater. * @return Une liste contenant toutes les translations de toutes les figures * passées en paramètres. */ public static List<Shape> getAllTranslatedPossibilitiesInSoma(Soma soma, List<Shape> shapes) { ArrayList<Shape> toReturn = new ArrayList<Shape>(); // Pour chaque figure on calcule les translations en chaque point du puzzle. for (Shape shape : shapes) { for (Point3D point : soma.getPoints()) { Shape translatedShape = shape.getTranslatedShape(point); if (soma.shapeIsInSoma(translatedShape)) { toReturn.add(translatedShape); } } } return toReturn; } /** * Test si une figure est deja contenue dans une liste de figures. Cette * méthode marche aussi si les points ne sont pas dans le même ordre, d'ou * la non utilisation de Shape.equals(). */ private static boolean alreadyContained(List<Shape> shapes, Shape shape) { for (Shape shapeToTest : shapes) { if (pointsEquals(shapeToTest, shape)) { return true; } } return false; } /** * Test si deux figures contiennent les meme points meme dans un ordre * différent. */ private static boolean pointsEquals(Shape shape1, Shape shape2) { int size = shape1.getPoints().size(); List<Point3D> s1Points = shape1.getPoints(); List<Point3D> s2Points = shape2.getPoints(); for (int i = 0; i < size; i++) { boolean contained = false; for (int j = 0; j < size; j++) { // Pour tout point de shape1, shape2 contient elle ce point if (s1Points.get(i).equals(s2Points.get(j))) { contained = true; } } // Si un des points de shape1 n'est pas dans shape2 on retourne // false. if (!contained) { return false; } } // Chaque point de shape1 est contenu dans shape2 return true; } /** * Calcul une rotation de figure sur l'axe des X : x->x y->-z z->y * * @param originalShape * @return */ public static Shape createXRotatedShape(Shape originalShape) { List<Point3D> points = originalShape.getPoints(); List<Point3D> newPoints = new ArrayList<Point3D>(); for (Point3D point : points) { int x = point.getX(); int y = -point.getZ(); int z = point.getY(); newPoints.add(new Point3D(x, y, z)); } Shape rotatedShape = new Shape(newPoints); return rotatedShape; } /** * Calcul une rotation de figure sur l'axe des Y : x->-z y->y z->x * * @param originalShape * @return */ public static Shape createYRotatedShape(Shape originalShape) { List<Point3D> points = originalShape.getPoints(); List<Point3D> newPoints = new ArrayList<Point3D>(); for (Point3D point : points) { int x = -point.getZ(); int y = point.getY(); int z = point.getX(); newPoints.add(new Point3D(x, y, z)); } Shape rotatedShape = new Shape(newPoints); return rotatedShape; } /** * Calcul une rotation de figure sur l'axe des Z : x->-y y->x z->z * * @param originalShape * @return */ public static Shape createZRotatedShape(Shape originalShape) { List<Point3D> points = originalShape.getPoints(); List<Point3D> newPoints = new ArrayList<Point3D>(); for (Point3D point : points) { int x = -point.getY(); int y = point.getX(); int z = point.getZ(); newPoints.add(new Point3D(x, y, z)); } Shape rotatedShape = new Shape(newPoints); return rotatedShape; } /** * Supprime d'une liste les figures qui sont identiques en translation. * * @param shapes */ public static void removeSameShapesAccordingToTranslation(List<Shape> shapes) { // pour chaque piece, on translate la piece sur chacun de ses points et // on vérifie qu'elle n'est pas egale a une autre piece. boolean doublonFound = true; // Tant qu'on a trouvé un double on le supprime et on recommence. while (doublonFound) { doublonFound = false; // Pour chaque figure for (int i = 0; i < shapes.size(); i++) { Shape shape = shapes.get(i); // Pour chaque point de la figure for (int j = 0; j < shape.getPoints().size(); j++) { // Création d'un figure en translation sur le point. Shape translatedShape = shape .getTranslatedShape(invertCoords(shape.getPoints() .get(j))); // Cette nouvelle figure est elle dans la liste? if (alreadyContained(shapes, translatedShape, i)) { doublonFound = true; } } // Si un doublon est trouvé on le supprime et on arrete la // boucle car la liste a changé. if (doublonFound) { shapes.remove(i); break; } } } } /** * Inversion des coordonnées d'un point, utilisé pour la translation. * * @param point3d * @return */ private static Point3D invertCoords(Point3D point3d) { return new Point3D(-point3d.getX(), -point3d.getY(), -point3d.getZ()); } /** * Test si une figure est en double dans une liste. * * @param shapes * @param translatedShape * @param indexNotToTest * @return */ private static boolean alreadyContained(List<Shape> shapes, Shape translatedShape, int indexNotToTest) { for (int i = 0; i < shapes.size(); i++) { if (i != indexNotToTest && pointsEquals(translatedShape, shapes.get(i))) { return true; } } return false; } }
[ "philippe.peter@gmail.com" ]
philippe.peter@gmail.com
aeb893666aec77de638f6bccf2d62d2de6186128
bcf03d43318239f6242e53e0bdd3c4753c08fc79
/java/defpackage/apd.java
4c6ba905549c04494cbca1f5a9ad7bee942d35da
[]
no_license
morristech/Candid
24699d45f9efb08787316154d05ad5e6a7a181a5
102dd9504cac407326b67ca7a36df8adf6a8b450
refs/heads/master
2021-01-22T21:07:12.067146
2016-12-22T18:40:30
2016-12-22T18:40:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,546
java
package defpackage; import java.util.concurrent.TimeUnit; import rx.internal.operators.OperatorMerge; import rx.internal.operators.OperatorZip; import rx.internal.util.ScalarSynchronousObservable; import rx.schedulers.Schedulers; /* compiled from: Observable */ public class apd<T> { static final asa b = asc.a().c(); final apd$a<T> a; public apd(apd$a<T> f) { this.a = f; } public static <T> apd<T> a(apd$a<T> f) { return new apd(b.a((apd$a) f)); } public final <R> apd<R> a(apd$b<? extends R, ? super T> operator) { return new apd(new apd$2(this, operator)); } public aph<T> a() { return new aph(apz.a(this)); } public static <T> apd<T> a(Throwable exception) { return new apd$c(exception); } public static <T> apd<T> a(T value) { return ScalarSynchronousObservable.b(value); } public static <T> apd<T> a(apd<? extends apd<? extends T>> source) { if (source.getClass() == ScalarSynchronousObservable.class) { return ((ScalarSynchronousObservable) source).e(aqt.a()); } return source.a(OperatorMerge.a(false)); } public static apd<Long> a(long delay, TimeUnit unit) { return apd.a(delay, unit, Schedulers.computation()); } public static apd<Long> a(long delay, TimeUnit unit, apg scheduler) { return apd.a(new aqa(delay, unit, scheduler)); } public static <T1, T2, R> apd<R> a(apd<? extends T1> o1, apd<? extends T2> o2, apv<? super T1, ? super T2, ? extends R> zipFunction) { return apd.a(new apd[]{o1, o2}).a(new OperatorZip(zipFunction)); } public final apd<T> a(apr<Throwable> onError) { return a(new aqb(new apd$1(this, onError))); } public final apd<T> a(apu<? super T, Boolean> predicate) { return a(new aqc(predicate)); } public final <R> apd<R> b(apu<? super T, ? extends apd<? extends R>> func) { if (getClass() == ScalarSynchronousObservable.class) { return ((ScalarSynchronousObservable) this).e(func); } return apd.a(c(func)); } public final <R> apd<R> c(apu<? super T, ? extends R> func) { return a(new aqd(func)); } public final apd<T> a(apg scheduler) { if (this instanceof ScalarSynchronousObservable) { return ((ScalarSynchronousObservable) this).c(scheduler); } return a(new aqe(scheduler, false)); } public final apd<T> a(long capacity) { return a(new aqf(capacity)); } public final apd<T> d(apu<Throwable, ? extends T> resumeFunction) { return a(aqg.a((apu) resumeFunction)); } public final apk b(apr<? super T> onNext) { if (onNext != null) { return b(new apd$3(this, onNext)); } throw new IllegalArgumentException("onNext can not be null"); } public final apk a(apj<? super T> subscriber) { try { subscriber.onStart(); b.a(this, this.a).call(subscriber); return b.a((apk) subscriber); } catch (Throwable e2) { app.a(e2); b.a(new RuntimeException("Error occurred attempting to subscribe [" + e.getMessage() + "] and then again while trying to pass to onError.", e2)); } } public final apk b(apj<? super T> subscriber) { return apd.a((apj) subscriber, this); } private static <T> apk a(apj<? super T> subscriber, apd<T> observable) { apk subscriber2; if (subscriber == null) { throw new IllegalArgumentException("observer can not be null"); } else if (observable.a == null) { throw new IllegalStateException("onSubscribe function can not be null."); } else { subscriber.onStart(); if (!(subscriber instanceof arw)) { subscriber2 = new arw(subscriber); } try { b.a(observable, observable.a).call(subscriber2); return b.a(subscriber2); } catch (Throwable e2) { app.a(e2); b.a(new RuntimeException("Error occurred attempting to subscribe [" + e.getMessage() + "] and then again while trying to pass to onError.", e2)); } } } public final apd<T> b(apg scheduler) { if (this instanceof ScalarSynchronousObservable) { return ((ScalarSynchronousObservable) this).c(scheduler); } return apd.a(new aqh(this, scheduler)); } }
[ "admin@timo.de.vc" ]
admin@timo.de.vc
52863beabc985cdff79db2eed1c47b3746eb4ab1
da892de8fc7a93cd7cff3f50e1f76113e2722967
/app/src/main/java/com/example/cook/API/ApiService.java
5c01d2876c765ae2b9afd1c6d65e5868a9bb9dac
[]
no_license
Rezapratama10118055/Cooking
79e3bbee152d6a901e13d429d037a8ae29dc4e40
f106cb3f6f6810be8a5ce605fe7d586cbb6b6627
refs/heads/master
2023-07-03T21:21:26.569836
2021-08-04T22:26:14
2021-08-04T22:26:14
382,263,207
0
0
null
null
null
null
UTF-8
Java
false
false
994
java
package com.example.cook.API; import com.example.cook.Model.pencarian.Example; import java.util.List; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; public interface ApiService { @GET("api/recipes/:page") Call<com.example.cook.Model.Example> getDataResepTerbaru(); @GET("/api/categorys/recipes/") Call<com.example.cook.Model.katagori.Example> getkatagori(); @GET("/api/categorys/recipes/{key}") Call<com.example.cook.Model.KatagoriList.Example>getkatagoricari(@Path(value = "key", encoded = true) String key); @GET("/api/recipe/{key}") Call<com.example.cook.Model.bahan.Example> getDataResepDetail(@Path(value = "key", encoded = true) String key); @GET("api/search/") Call<Example> getDataCariResep(@Query("q") String query); @GET("api/search/?q=parameter") Call<List<Example>> getDataCari(); @GET("/api/recipes") Call<com.example.cook.Model.Example>getdata(); }
[ "reza.10118055@mahasiswa.unikom.ac.id" ]
reza.10118055@mahasiswa.unikom.ac.id
dfea578b0e6209a7e90eec884299ee936311bcc1
754acca536134b49837787982226b5c9d903645e
/app/src/main/java/freeman/rx/gxj/com/freeman/drag/LinearDragActivity.java
cf67c5e75ccea57c4c5c3dd2b6b75b7f3e55e2df
[]
no_license
guoxiaojun001/FreeMan
7a9d4067cf8741692b0fa4b0211087cbd62dd626
210203c7348deca834d4db7982c188b54f02a891
refs/heads/master
2021-01-17T12:53:35.103036
2016-07-21T02:19:48
2016-07-21T02:19:48
59,624,504
1
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package freeman.rx.gxj.com.freeman.drag; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import com.ldzs.recyclerlibrary.DragRecyclerView; import com.ldzs.recyclerlibrary.anim.SlideInLeftAnimator; import freeman.rx.gxj.com.freeman.activity.R; import freeman.rx.gxj.com.freeman.adapter.SimpleAdapter; import freeman.rx.gxj.com.freeman.data.Date; /** * Created by cz on 16/1/27. */ public class LinearDragActivity extends AppCompatActivity { private DragRecyclerView mRecyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drag); setTitle(getIntent().getStringExtra("title")); mRecyclerView = (DragRecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setItemAnimator(new SlideInLeftAnimator()); mRecyclerView.getItemAnimator().setAddDuration(300); mRecyclerView.getItemAnimator().setRemoveDuration(300); LinearLayoutManager layoutManager = new LinearLayoutManager(this); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setAdapter(new SimpleAdapter(this, Date.createItems(this, 100))); mRecyclerView.setLongPressDrawEnable(true); mRecyclerView.setOnDragItemEnableListener(position -> true); } }
[ "guoxiaojun8804@126.com" ]
guoxiaojun8804@126.com
b0f4a254bd5179347b39368fb5003312fbbfc23d
9c45759f25a1257edf1b351b67449c14ae386a0a
/trainingstorefront/web/src/org/training/storefront/breadcrumb/impl/ContentPageBreadcrumbBuilder.java
4f83e93acc3dd3cea52bb125a4a5655fbf0624b9
[]
no_license
rpalacgi/hybristraining
0c63739d02c41e4f469712f9d2da31355f39507f
0aae769567305f46e3d171cab6b565cfeaf81136
refs/heads/master
2021-05-29T06:22:20.817263
2015-10-06T14:08:15
2015-10-06T14:08:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,206
java
/* * [y] hybris Platform * * Copyright (c) 2000-2013 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ package org.training.storefront.breadcrumb.impl; import de.hybris.platform.cms2.model.pages.ContentPageModel; import org.training.storefront.breadcrumb.Breadcrumb; import java.util.Collections; import java.util.List; /** * Breadcrumb builder that uses page title in breadcrumb or page name as fallback when title is missing. */ public class ContentPageBreadcrumbBuilder { private static final String LAST_LINK_CLASS = "active"; /** * @param page - page to build up breadcrumb for * @return breadcrumb for given page */ public List<Breadcrumb> getBreadcrumbs(final ContentPageModel page) { String title = page.getTitle(); if (title == null) { title = page.getName(); } return Collections.singletonList(new Breadcrumb("#", title, LAST_LINK_CLASS)); } }
[ "501200i903@INSCOLT20004311.ap.sony.com" ]
501200i903@INSCOLT20004311.ap.sony.com
8c7a2dfcb9c4dece1587477a6e971b139cb9c343
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project33/src/main/java/org/gradle/test/performance33_5/Production33_428.java
4f6800dcd5ed9feb3a8b09831c9f35c5058b6902
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
305
java
package org.gradle.test.performance33_5; public class Production33_428 extends org.gradle.test.performance13_5.Production13_428 { private final String property; public Production33_428() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
e44b07760d84c6bb66232939c6e866cbf0a946a3
78ff626069e6fe4f21b51a536397fa83e5d99ba7
/app/src/main/java/com/example/myfleetcall/Notification/NotificationApp.java
b8cb2493f0a721579b58b4aded7018c7949166d8
[]
no_license
zingworks-kuldeep/MyFleetCall
c4a4d88ba23d859328a888adcf79bc1ed08ee451
7a9564342420141889abf87795792d832a30137f
refs/heads/master
2022-12-18T12:40:54.983655
2020-09-04T12:17:26
2020-09-04T12:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,322
java
package com.example.myfleetcall.Notification; import android.app.Application; import android.app.NotificationChannel; import android.app.NotificationManager; import android.os.Build; public class NotificationApp extends Application { public static final String CHANNEL_1_ID = "channel1"; public static final String CHANNEL_2_ID = "channel2"; @Override public void onCreate() { super.onCreate(); createNotificationChannels(); } private void createNotificationChannels() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = new NotificationChannel( CHANNEL_1_ID, "channel 1", NotificationManager.IMPORTANCE_HIGH ); channel.setDescription("This is channel 1"); NotificationChannel channe2 = new NotificationChannel( CHANNEL_2_ID, "channel 2", NotificationManager.IMPORTANCE_HIGH ); channe2.setDescription("This is channel 2"); NotificationManager manager = getSystemService(NotificationManager.class); manager.createNotificationChannel(channel); manager.createNotificationChannel(channe2); } } }
[ "kuldip.r@appstute.in" ]
kuldip.r@appstute.in
0483674274cb5f967dd23ca0abd451522842b3ff
3cda4a32b9b1b5f60d73e9171238a655bbbd46fe
/ArithmeticSlice.java
d3264b0250ea462fea6ceff7abf0519a01f7cda0
[]
no_license
jimmylee9107/leetcode
fc4cb24281cfab68d67c6e88da6e2bc0618ea7cc
77e61662706c96aa42d8f17ec632f88c83fc84ef
refs/heads/master
2021-01-25T00:11:19.329626
2015-12-31T06:50:37
2015-12-31T06:50:37
30,538,670
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
class ArithmeticSlice { public int countArithmeticSlices(int[] array) { if (array == null || array.length <= 2) { return 0; } int gap = array[1] - array[0]; int len = 2; int res = 0; for (int i = 1; i < array.length - 1; i++) { if (array[i + 1] - array[i] == gap) { len++; } else { res += (len - 1) * (len - 2) / 2; if (res > 1000000000) { return -1; } gap = array[i + 1] - array[i]; len = 2; } } if (len >= 3) { res += (len - 1) * (len - 2) / 2; } return res > 1000000000 ? -1 : res; } }
[ "jl578@duke.edu" ]
jl578@duke.edu
4caa43491c12d982be31449c0c3ac1333da3ca7d
4215e15226693f1862f3378b31039bc14c09a9ff
/CS12120 Java Hunter Game/src/game/PlayAgainTest.java
050e9101e2c97e216e8e0a5792278e582475bf00
[]
no_license
craighep/PastWork
6194a2268f2491890cd1e33c405dd5cc98b5b939
f45caba09f61881cd0e64017ee7ecaa57de29561
refs/heads/master
2016-09-01T22:02:15.822839
2013-02-07T10:48:16
2013-02-07T10:48:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package game; /** * * @author Craig's */ public class PlayAgainTest { public static void main(String [] args){ PlayAgain play = new PlayAgain(); String choice; //choice = play.playagain(""); } }
[ "crh13@aber.ac.uk" ]
crh13@aber.ac.uk
de9f5cc0a89d748581ce507a9eae77e8c241a591
bd61c8ac9e26afe4b3dbcd4d26a8a708b8c6e851
/web-learn/src/main/java/com/weblearn/jaxp/TestDOMParsing.java
958e05f2e0fe89c8e325fe3abb86289fed62e655
[]
no_license
rkzhang/web-learn
07a83922c422309b661e7b1f0679b13027f123f3
541e8b968237ea850e52da1da305bdffb9d94846
refs/heads/master
2022-05-27T23:47:28.959854
2020-12-02T02:37:09
2020-12-02T02:37:09
28,958,834
0
0
null
2022-05-25T06:03:45
2015-01-08T09:31:31
Java
UTF-8
Java
false
false
3,945
java
package com.weblearn.jaxp; import java.io.ByteArrayInputStream; import java.io.InputStream; // JAXP import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; // DOM import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class TestDOMParsing { public static void main(String[] args) { try { String xml = "<xml><ToUserName><![CDATA[gh_6f5696b8e59c]]></ToUserName><FromUserName><![CDATA[oGJiy1V-SqouozZgaR8DefwU2zF0]]></FromUserName><CreateTime>1507788921</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[VIEW]]></Event><EventKey><![CDATA[https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx18bf22642e20c429&redirect_uri=http://www.tongyaosh.com/wechat/entrance?redirectUrl=http://www.tongyaosh.com/html/index.html&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect]]></EventKey><MenuId>417858339</MenuId></xml>"; // Get Document Builder Factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Leave off validation, and turn off namespaces factory.setValidating(false); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8")); Document doc = builder.parse(is); // Print the document from the DOM tree and // feed it an initial indentation of nothing //printNode(doc, ""); NodeList nl = doc.getElementsByTagName("Event"); System.out.println(nl.item(0).getTextContent()); } catch (ParserConfigurationException e) { System.out.println("The underlying parser does not support the requested features."); } catch (FactoryConfigurationError e) { System.out.println("Error occurred obtaining Document Builder Factory."); } catch (Exception e) { e.printStackTrace(); } } private static void printNode(Node node, String indent) { switch (node.getNodeType()) { case Node.DOCUMENT_NODE: System.out.println("<xml version=\"1.0\">\n"); // recurse on each child NodeList nodes = node.getChildNodes(); if (nodes != null) { for (int i=0; i<nodes.getLength(); i++) { printNode(nodes.item(i), ""); } } break; case Node.ELEMENT_NODE: String name = node.getNodeName(); System.out.print(indent + "<" + name); NamedNodeMap attributes = node.getAttributes(); for (int i=0; i<attributes.getLength(); i++) { Node current = attributes.item(i); System.out.print(" " + current.getNodeName() + "=\"" + current.getNodeValue() + "\""); } System.out.print(">"); // recurse on each child NodeList children = node.getChildNodes(); if (children != null) { for (int i=0; i<children.getLength(); i++) { printNode(children.item(i), indent + " "); } } System.out.print("</" + name + ">"); break; case Node.TEXT_NODE: System.out.print(node.getNodeValue()); break; } } }
[ "Richard@@g-town.com.cn" ]
Richard@@g-town.com.cn
483bd5c4ae85714bde9d5d8ff9c0ab02b7ae7f2e
928bdfb9b0f4b6db0043526e095fe1aa822b8e64
/src/main/java/com/taobao/api/response/TmallItemSizemappingTemplatesListResponse.java
f4254265aba7c38097e39909329ed644df071e52
[]
no_license
yu199195/jsb
de4f4874fb516d3e51eb3badb48d89be822e00f7
591ad717121dd8da547348aeac551fc71da1b8bd
refs/heads/master
2021-09-07T22:25:09.457212
2018-03-02T04:54:18
2018-03-02T04:54:18
102,316,111
4
3
null
null
null
null
UTF-8
Java
false
false
824
java
package com.taobao.api.response; import com.taobao.api.TaobaoResponse; import com.taobao.api.domain.SizeMappingTemplate; import com.taobao.api.internal.mapping.ApiField; import com.taobao.api.internal.mapping.ApiListField; import java.util.List; public class TmallItemSizemappingTemplatesListResponse extends TaobaoResponse { private static final long serialVersionUID = 8646298876483452882L; @ApiListField("size_mapping_templates") @ApiField("size_mapping_template") private List<SizeMappingTemplate> sizeMappingTemplates; public void setSizeMappingTemplates(List<SizeMappingTemplate> sizeMappingTemplates) { this.sizeMappingTemplates = sizeMappingTemplates; } public List<SizeMappingTemplate> getSizeMappingTemplates() { return this.sizeMappingTemplates; } }
[ "yu.xiao@happylifeplat.com" ]
yu.xiao@happylifeplat.com
b82db5f6f47749c8d303642ea956fe5bddaefb0a
2bd7643730a0048e0ba1e7bb663a97166c54dc54
/EBPSv2/src/main/java/com/model/processing/Manjurinama.java
0ad863c597407a1a5c3fe83db90528847059547f
[]
no_license
bkings/BuildingPermitDynamic
3f8b4d7fa8aaff45b43f05fc16fcb1ea54da3ad7
bb7322f6e04b2017854a5ceebcf4b37d755d000b
refs/heads/master
2023-02-16T20:46:37.209422
2021-01-17T06:40:25
2021-01-17T06:40:25
299,945,567
1
0
null
2020-10-21T13:30:47
2020-09-30T14:25:30
Java
UTF-8
Java
false
false
7,377
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 com.model.processing; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "manjurinama") public class Manjurinama implements Serializable { @Id @Column(name = "application_no") private Long applicationNo; @Column(name = "json_data",columnDefinition = "varchar") private String jsonData; @Column(name = "enter_by") private String enterBy; @Column(name = "enter_date") @Temporal(TemporalType.DATE) private java.util.Date enterDate; @Column(name = "amini_name") private String aminiName; @Column(name = "amini_date") @Temporal(TemporalType.DATE) private java.util.Date aminiDate; @Column(name = "AMINI_STATUS", updatable = false, columnDefinition = "VARCHAR(1) DEFAULT 'P'") private String aminiStatus; @Column(name = "ser_date") @Temporal(TemporalType.DATE) private java.util.Date serDate; @Column(name = "ser_name") private String serName; @Column(name = "er_name") private String erName; @Column(name = "er_date") @Temporal(TemporalType.DATE) private java.util.Date erDate; @Column(name = "er_status") private String erStatus; @Column(name = "ser_status") private String serStatus; @Column(name = "chief_name") private String chiefName; @Column(name = "chief_date") @Temporal(TemporalType.DATE) private java.util.Date chiefDate; @Column(name = "chief_status") private String chiefStatus; @Column(name = "RW_NAME", updatable = false) private String rwName; @Column(name = "RW_DATE", updatable = false) @Temporal(TemporalType.DATE) private java.util.Date rwDate; @Column(name = "RW_STATUS", updatable = false, columnDefinition = "VARCHAR(1) DEFAULT 'P'") private String rwStatus; public Long getApplicationNo() { return applicationNo; } public void setApplicationNo(Long applicationNo) { this.applicationNo = applicationNo; } public String getJsonData() { return jsonData; } public void setJsonData(String jsonData) { this.jsonData = jsonData; } public String getEnterBy() { return enterBy; } public void setEnterBy(String enterBy) { this.enterBy = enterBy; } public java.util.Date getEnterDate() { return enterDate; } public void setEnterDate(java.util.Date enterDate) { this.enterDate = enterDate; } public String getAminiName() { return aminiName; } public void setAminiName(String aminiName) { this.aminiName = aminiName; } public Date getAminiDate() { return aminiDate; } public void setAminiDate(Date aminiDate) { this.aminiDate = aminiDate; } public String getAminiStatus() { return aminiStatus; } public void setAminiStatus(String aminiStatus) { this.aminiStatus = aminiStatus; } public java.util.Date getSerDate() { return serDate; } public void setSerDate(java.util.Date serDate) { this.serDate = serDate; } public String getSerName() { return serName; } public void setSerName(String serName) { this.serName = serName; } public String getErName() { return erName; } public void setErName(String erName) { this.erName = erName; } public java.util.Date getErDate() { return erDate; } public void setErDate(java.util.Date erDate) { this.erDate = erDate; } public String getErStatus() { return erStatus; } public void setErStatus(String erStatus) { this.erStatus = erStatus; } public String getSerStatus() { return serStatus; } public void setSerStatus(String serStatus) { this.serStatus = serStatus; } public String getchiefName() { return chiefName; } public void setchiefName(String chiefName) { this.chiefName = chiefName; } public Date getchiefDate() { return chiefDate; } public void setchiefDate(Date chiefDate) { this.chiefDate = chiefDate; } public String getchiefStatus() { return chiefStatus; } public void setchiefStatus(String chiefStatus) { this.chiefStatus = chiefStatus; } public String getRwName() { return rwName; } public void setRwName(String rwName) { this.rwName = rwName; } public Date getRwDate() { return rwDate; } public void setRwDate(Date rwDate) { this.rwDate = rwDate; } public String getRwStatus() { return rwStatus; } public void setRwStatus(String rwStatus) { this.rwStatus = rwStatus; } @Override public String toString() { return "DosrocharanAbedan{" + "applicationNo=" + applicationNo + ", jsonData=" + jsonData + ", enterBy=" + enterBy + ", enterDate=" + enterDate + ", aminiName=" + aminiName + ", aminiDate=" + aminiDate + ", aminiStatus=" + aminiStatus + ", serDate=" + serDate + ", serName=" + serName + ", erName=" + erName + ", erDate=" + erDate + ", erStatus=" + erStatus + ", serStatus=" + serStatus + ", chiefName=" + chiefName + ", chiefDate=" + chiefDate + ", chiefStatus=" + chiefStatus + ", rwName=" + rwName + ", rwDate=" + rwDate + ", rwStatus=" + rwStatus + '}'; } @Column(name = "E_NAME", updatable = false) private String eName; @Column(name = "E_DATE", updatable = false) @Temporal(TemporalType.DATE) private java.util.Date eDate; @Column(name = "E_STATUS", updatable = false, columnDefinition = "VARCHAR(1000) DEFAULT 'P'") private String eStatus; @Column(name = "F_NAME", updatable = false) private String fName; @Column(name = "F_DATE", updatable = false) @Temporal(TemporalType.DATE) private java.util.Date fDate; @Column(name = "F_STATUS", updatable = false, columnDefinition = "VARCHAR(1000) DEFAULT 'P'") private String fStatus; @Column(name = "G_NAME", updatable = false) private String gName; @Column(name = "G_DATE", updatable = false) @Temporal(TemporalType.DATE) private java.util.Date gDate; @Column(name = "G_STATUS", updatable = false, columnDefinition = "VARCHAR(1000) DEFAULT 'P'") private String gStatus; public String geteName() { return eName; } public void seteName(String eName) { this.eName = eName; } public Date geteDate() { return eDate; } public void seteDate(Date eDate) { this.eDate = eDate; } public String geteStatus() { return eStatus; } public void seteStatus(String eStatus) { this.eStatus = eStatus; } public String getfName() { return fName; } public void setfName(String fName) { this.fName = fName; } public Date getfDate() { return fDate; } public void setfDate(Date fDate) { this.fDate = fDate; } public String getfStatus() { return fStatus; } public void setfStatus(String fStatus) { this.fStatus = fStatus; } public String getgName() { return gName; } public void setgName(String gName) { this.gName = gName; } public Date getgDate() { return gDate; } public void setgDate(Date gDate) { this.gDate = gDate; } public String getgStatus() { return gStatus; } public void setgStatus(String gStatus) { this.gStatus = gStatus; } }
[ "bbikings@yahoo.com" ]
bbikings@yahoo.com
bef814c9ee1686bc9e8d179a2fc49328f9798423
f1bd8e25d0218bd5db1f0d72715acf01ae0ffbe2
/src/main/components/network/models/MoNeuron.java
ed94a79e80b21b9d55bf221da320a9a5edc5e500
[ "Apache-2.0" ]
permissive
mohyghb/Neuroevolution-FlappyBird
4b42cdcab446f9a232b9fae3e989d18f93a0a3de
fa45a5fa4f182d50239c5067001a7eca65db019f
refs/heads/master
2022-04-27T00:16:24.931954
2020-05-01T03:01:42
2020-05-01T03:01:42
260,367,542
0
0
null
null
null
null
UTF-8
Java
false
false
5,262
java
package components.network.models; import constants.MoFunctions; public class MoNeuron { public static final String SEP_KEY = ","; /** * Neurons can be either: * - input * - hidden * - output */ private float value; private float bias; private float[] weights; private float[] savedWeights; private float gradient; /** * if this neuron is an [input] * it does not have any weights to it * @param v * v is the value of the input neuron */ // MODIFIES: this // EFFECTS: constructor for input neurons public MoNeuron(float v) { this.value = v; this.weights = null; this.savedWeights = null; this.bias = -1; this.gradient = -1; } /** * if this neuron is [hidden/output] * then the value is = 0; * and bias and ws are set accordingly * @param ws * weights provided * @param b * bias provided */ // MODIFIES: this // EFFECTS: constructor for hidden/output neuron public MoNeuron(float[] ws, float b) { this.weights = ws; this.savedWeights = ws; this.bias = b; this.value = 0; this.gradient = 1; } // for reading from a file public MoNeuron(String data) { this.readNeuron(data); } // MODIFIES: this // EFFECTS: updates the weights to the savedWeights public void updateWeights() { this.weights = this.savedWeights; } // EFFECTS: returns the neuron's value public float getValue() { return value; } // MODIFIES: this // EFFECTS: sets the value of this neuron to value public void setValue(float value) { this.value = value; } // EFFECTS: returns the neuron's bias public float getBias() { return bias; } // // MODIFIES: this // // EFFECTS: sets the bias of this neuron to bias // public void setBias(float bias) { // this.bias = bias; // } // EFFECTS: returns the neuron's weights public float[] getWeights() { return weights; } // MODIFIES: this // EFFECTS: sets the weights of this neuron to weights // public void setWeights(float[] weights) { // this.weights = weights; // } // EFFECTS: returns the neuron's gradient public float getGradient() { return gradient; } // MODIFIES: this // EFFECTS: sets the gradient of this neuron to gradient public void setGradient(float gradient) { this.gradient = gradient; } // EFFECTS: returns the neuron's savedWeights public float[] getSavedWeights() { return savedWeights; } // MODIFIES: this // EFFECTS: sets the savedWeights of this neuron to savedWeights public void setSavedWeights(float[] savedWeights) { this.savedWeights = savedWeights; } /** * * @param number * number of random weights * @return * returns an array of float of random weights */ // EFFECTS: returns an array of float of random weights used to // initialize the first weights for the neuron public static float[] getRandomWeights(int number, float max, float min) { float[] randomWeights = new float[number]; for (int i = 0; i < randomWeights.length; i++) { randomWeights[i] = MoFunctions.getRandom(max,min); } return randomWeights; } // randomly adds an amount to each weight public void mutateWeights() { if (this.weights != null) { for (int i = 0; i < weights.length; i++) { double chance = MoFunctions.getRandom(1.0,0.0); if (chance >= 0.5) { float randomMutation = MoFunctions.getRandom(0.02f,-0.02f); if (Math.abs(weights[i] + randomMutation) <= 1) { weights[i] += randomMutation; } else { weights[i] -= randomMutation; } break; } } } } public String downloadNeuron() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("["); stringBuilder.append(this.value).append(SEP_KEY); stringBuilder.append(this.gradient).append(SEP_KEY); stringBuilder.append(this.bias).append(SEP_KEY); for (int i = 0; i < this.weights.length; i++) { stringBuilder.append(weights[i]); if (i < this.weights.length - 1) { stringBuilder.append(SEP_KEY); } else { stringBuilder.append("]"); } } return stringBuilder.toString(); } public void readNeuron(String line) { float[] values = MoFunctions.getFloatVersion(line); if (values.length > 3) { this.value = values[0]; this.gradient = values[1]; this.bias = values[2]; this.weights = new float[values.length - 3]; for (int i = 0; i < this.weights.length; i++) { this.weights[i] = values[i + 3]; } this.savedWeights = this.weights; } } }
[ "moh10moh78@gmail.com" ]
moh10moh78@gmail.com
7d9a4039235aad87941f7ade1f3d605bc8e1a317
e5c7c02675b43da0a0a1aa53d4b9074755714e54
/app/src/main/java/com/ying/administrator/masterappdemo/entity/Chat.java
598091afa4fc3df7a5ad83cf72019f301e7ee058
[]
no_license
brmnh666/MasterApp
bde7b40c62ac17b733ddf9aebb0603a0f650feb2
5e1c6cf9276f7e03d0810bf34538f2b23163d50d
refs/heads/master
2021-06-25T01:37:13.758503
2020-01-14T07:34:04
2020-01-14T07:34:04
164,409,217
1
2
null
null
null
null
UTF-8
Java
false
false
558
java
package com.ying.administrator.masterappdemo.entity; import java.io.Serializable; public class Chat implements Serializable { private String question; private String answer; public Chat(String question) { this.question = question; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public String getAnswer() { return answer; } public void setAnswer(String answer) { this.answer = answer; } }
[ "765316930@qq.com" ]
765316930@qq.com
ec7bdfbcda816c18ef5900fc90980b98ab5d6633
7df40f6ea2209b7d48979465fd8081ec2ad198cc
/TOOLS/server/org/fourthline/cling/support/model/dlna/types/NormalPlayTime.java
e1246ed4c946eafb47052fdf11e6f590996d967d
[ "IJG" ]
permissive
warchiefmarkus/WurmServerModLauncher-0.43
d513810045c7f9aebbf2ec3ee38fc94ccdadd6db
3e9d624577178cd4a5c159e8f61a1dd33d9463f6
refs/heads/master
2021-09-27T10:11:56.037815
2021-09-19T16:23:45
2021-09-19T16:23:45
252,689,028
0
0
null
2021-09-19T16:53:10
2020-04-03T09:33:50
Java
UTF-8
Java
false
false
5,097
java
/* */ package org.fourthline.cling.support.model.dlna.types; /* */ /* */ import java.util.Locale; /* */ import java.util.concurrent.TimeUnit; /* */ import java.util.regex.Matcher; /* */ import java.util.regex.Pattern; /* */ import org.fourthline.cling.model.types.InvalidValueException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class NormalPlayTime /* */ { /* */ public enum Format /* */ { /* 30 */ SECONDS, /* 31 */ TIME; /* */ } /* 33 */ static final Pattern pattern = Pattern.compile("^(\\d+):(\\d{1,2}):(\\d{1,2})(\\.(\\d{1,3}))?|(\\d+)(\\.(\\d{1,3}))?$", 2); /* */ private long milliseconds; /* */ /* */ public NormalPlayTime(long milliseconds) { /* 37 */ if (milliseconds < 0L) { /* 38 */ throw new InvalidValueException("Invalid parameter milliseconds: " + milliseconds); /* */ } /* */ /* 41 */ this.milliseconds = milliseconds; /* */ } /* */ /* */ public NormalPlayTime(long hours, long minutes, long seconds, long milliseconds) throws InvalidValueException { /* 45 */ if (hours < 0L) { /* 46 */ throw new InvalidValueException("Invalid parameter hours: " + hours); /* */ } /* */ /* 49 */ if (minutes < 0L || minutes > 59L) { /* 50 */ throw new InvalidValueException("Invalid parameter minutes: " + hours); /* */ } /* */ /* 53 */ if (seconds < 0L || seconds > 59L) { /* 54 */ throw new InvalidValueException("Invalid parameter seconds: " + hours); /* */ } /* 56 */ if (milliseconds < 0L || milliseconds > 999L) { /* 57 */ throw new InvalidValueException("Invalid parameter milliseconds: " + milliseconds); /* */ } /* */ /* 60 */ this.milliseconds = (hours * 60L * 60L + minutes * 60L + seconds) * 1000L + milliseconds; /* */ } /* */ /* */ /* */ /* */ /* */ public long getMilliseconds() { /* 67 */ return this.milliseconds; /* */ } /* */ /* */ /* */ /* */ /* */ public void setMilliseconds(long milliseconds) { /* 74 */ if (milliseconds < 0L) { /* 75 */ throw new InvalidValueException("Invalid parameter milliseconds: " + milliseconds); /* */ } /* */ /* 78 */ this.milliseconds = milliseconds; /* */ } /* */ /* */ public String getString() { /* 82 */ return getString(Format.SECONDS); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public String getString(Format format) { /* 90 */ long hours, minutes, seconds = TimeUnit.MILLISECONDS.toSeconds(this.milliseconds); /* 91 */ long ms = this.milliseconds % 1000L; /* 92 */ switch (format) { /* */ case TIME: /* 94 */ seconds = TimeUnit.MILLISECONDS.toSeconds(this.milliseconds) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(this.milliseconds)); /* 95 */ hours = TimeUnit.MILLISECONDS.toHours(this.milliseconds); /* 96 */ minutes = TimeUnit.MILLISECONDS.toMinutes(this.milliseconds) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(this.milliseconds)); /* 97 */ return String.format(Locale.ROOT, "%d:%02d:%02d.%03d", new Object[] { Long.valueOf(hours), Long.valueOf(minutes), Long.valueOf(seconds), Long.valueOf(ms) }); /* */ } /* 99 */ return String.format(Locale.ROOT, "%d.%03d", new Object[] { Long.valueOf(seconds), Long.valueOf(ms) }); /* */ } /* */ /* */ /* */ public static NormalPlayTime valueOf(String s) throws InvalidValueException { /* 104 */ Matcher matcher = pattern.matcher(s); /* 105 */ if (matcher.matches()) { /* 106 */ int msMultiplier = 0; /* */ try { /* 108 */ if (matcher.group(1) != null) { /* 109 */ msMultiplier = (int)Math.pow(10.0D, (3 - matcher.group(5).length())); /* 110 */ return new NormalPlayTime( /* 111 */ Long.parseLong(matcher.group(1)), /* 112 */ Long.parseLong(matcher.group(2)), /* 113 */ Long.parseLong(matcher.group(3)), /* 114 */ Long.parseLong(matcher.group(5)) * msMultiplier); /* */ } /* 116 */ msMultiplier = (int)Math.pow(10.0D, (3 - matcher.group(8).length())); /* 117 */ return new NormalPlayTime( /* 118 */ Long.parseLong(matcher.group(6)) * 1000L + Long.parseLong(matcher.group(8)) * msMultiplier); /* */ } /* 120 */ catch (NumberFormatException numberFormatException) {} /* */ } /* */ /* 123 */ throw new InvalidValueException("Can't parse NormalPlayTime: " + s); /* */ } /* */ } /* Location: C:\Users\leo\Desktop\server.jar!\org\fourthline\cling\support\model\dlna\types\NormalPlayTime.class * Java compiler version: 7 (51.0) * JD-Core Version: 1.1.3 */
[ "warchiefmarkus@gmail.com" ]
warchiefmarkus@gmail.com
d6629ff3d69e194835ce9382bde54720466dc754
61e03b39bb9f59a5669c8cce9b3c9a0af8458ead
/src/main/java/com/instapop/model/Comment.java
7b42a39f147a38a40422e58bb24d492a471abcfe
[]
no_license
genrou2004/instapop
fcd7d7523c72518d51af6854f7069c419fa3bc42
44051f732133f57847e558063cef41b7136b370b
refs/heads/master
2021-01-01T04:54:48.429908
2017-07-14T21:54:01
2017-07-14T21:54:01
97,274,893
0
0
null
null
null
null
UTF-8
Java
false
false
1,115
java
package com.instapop.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.util.Date; /** * Created by raya on 7/13/17. */ @Entity public class Comment { @Id @GeneratedValue(strategy= GenerationType.AUTO) private int id; private int imageId; private String username; private Date date; private String body; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getImageId() { return imageId; } public void setImageId(int imageId) { this.imageId = imageId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } }
[ "rayameha@gmail.com" ]
rayameha@gmail.com
31a50ad5efa8c7ad8aefa91dee9faec24e9481c7
2425c3729a495db2e20738eef0317d1691ba1391
/common/src/main/java/com/ekfet/common/thread/fork/countedcompleter/CountedCompleterExample.java
21850d9efd5bd22035cfdbd7857c44ce35c3cf5b
[]
no_license
AlexKai1/ekfet-java-parent
83b3cb38bbf8541bc76554ae912577841c015cec
7744cfb1466ec412ee3d1ee611f8391d697b3fb0
refs/heads/master
2022-02-26T12:12:54.152882
2019-09-26T09:44:03
2019-09-26T09:44:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,471
java
package com.ekfet.common.thread.fork.countedcompleter; import com.ekfet.common.thread.fork.utils.CalcUtil; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountedCompleter; import java.util.concurrent.ForkJoinPool; public class CountedCompleterExample { public static void main (String[] args) { List<BigInteger> list = new ArrayList<>(); for (int i = 3; i < 20; i++) { list.add(new BigInteger(Integer.toString(i))); } ForkJoinPool.commonPool().invoke( new FactorialTask(null, list)); } private static class FactorialTask extends CountedCompleter<Void> { private static int SEQUENTIAL_THRESHOLD = 5; private List<BigInteger> integerList; private int numberCalculated; private FactorialTask (CountedCompleter<Void> parent, List<BigInteger> integerList) { super(parent); this.integerList = integerList; } @Override public void compute () { if (integerList.size() <= SEQUENTIAL_THRESHOLD) { showFactorial(); } else { int middle = integerList.size() / 2; List<BigInteger> rightList = integerList.subList(middle, integerList.size()); List<BigInteger> leftList = integerList.subList(0, middle); addToPendingCount(2); FactorialTask taskRight = new FactorialTask(this, rightList); FactorialTask taskLeft = new FactorialTask(this, leftList); taskLeft.fork(); taskRight.fork(); } tryComplete(); } @Override public void onCompletion (CountedCompleter<?> caller) { if (caller == this) { System.out.printf("completed thread : %s numberCalculated=%s%n", Thread .currentThread().getName(), numberCalculated); } } private void showFactorial () { for (BigInteger i : integerList) { BigInteger factorial = CalcUtil.calculateFactorial(i); System.out.printf("%s! = %s, thread = %s%n", i, factorial, Thread .currentThread().getName()); numberCalculated++; } } } }
[ "lxfeif123@126.com" ]
lxfeif123@126.com
f2688ac3dd8f253342c163186cbcd482d62c174f
428b41a759481f849c87e49c17faba16c2bd99f2
/src/uk/org/freedonia/jfreewhois/result/ResultSegment.java
1df0bf6195878a618fe2070cd14fbc4343705dcf
[]
no_license
chendz/SuperMinijoe
0dada6341d075f1df7c3fe5012b03b6bef79882f
d0d3a4fbcc6711689f5ef39fc18e5e2814618323
refs/heads/master
2020-05-19T08:48:10.670946
2015-06-02T10:51:37
2015-06-02T10:51:37
35,651,150
2
2
null
null
null
null
UTF-8
Java
false
false
4,194
java
/******************************************************************************* * Copyright (c) 2013 Joe Beeton. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Joe Beeton - initial API and implementation ******************************************************************************/ package uk.org.freedonia.jfreewhois.result; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * ResultSegment contains information about a segment of the whois response. The ResultSegment contains both a * a title and value. E.g Domain Name:BBC.MOBI . * In this case the heading would be Domain Name and the value would be BBC.MOBI * @author Joe Beeton * */ public class ResultSegment { private String heading = null; private List<String> values = new ArrayList<String>(); private ResultSegment segment = null; private int indent = 0; /** * Constructs a new ResultSegment. * @param heading the name of the heading. * @param indent The level of indentation. * @param value the value(s). */ public ResultSegment( final String heading, final int indent, final String ...value ) { this.setHeading(heading); this.setIndent(indent); this.values.addAll( Arrays.asList( value ) ); } /** * Constructs a new ResultSegment. * @param heading the name of the heading. * @param indent The level of indentation. */ public ResultSegment( final String heading, final int indent ) { this.setHeading(heading); this.setIndent(indent); } /** * Constructs a new ResultSegment. * @param heading the name of the heading. * @param indent The level of indentation. * @param segment the sub ResultSegment. */ public ResultSegment( final String heading, final int indent, final ResultSegment segment ) { this.setHeading(heading); this.setIndent(indent); this.setSegment(segment); } /** * Constructs a new ResultSegment. * @param heading the name of the heading. * @param indent The level of indentation. * @param segment the sub ResultSegment * @param value the value(s). */ public ResultSegment( final String heading, final int indent, final ResultSegment segment, final String ...value ) { this.setHeading(heading); this.values.addAll( Arrays.asList( value ) ); this.setSegment(segment); this.setIndent(indent); } /** * Returns the Heading. * @return the Heading. */ public String getHeading() { if( heading != null ) { return heading.trim(); } else { return heading; } } /** * Sets the Heading. * @param heading the value the heading will be set to. */ public void setHeading( final String heading ) { if( heading != null ) { this.heading = heading.trim(); } else { this.heading = heading; } } /** * Returns the values. * @return the values. */ public List<String> getValue() { return values; } /** * Adds a line to the List of Values. * @param value the value to be added to the List of values. */ public void addLine( final String value ) { if( value != null ) { this.values.add( value.trim() ); } else { this.values.add( value ); } } /** * Returns the child ResultSegment. * @return the child ResultSegment. */ public ResultSegment getSegment() { return segment; } /** * Sets the child ResultSegment * @param segment the value the child ResultSegment to be set to. */ public void setSegment( final ResultSegment segment ) { this.segment = segment; } /** * Returns the Indent. * @return the level of indentation. */ public int getIndent() { return indent; } /** * Sets the level of indentation * @param indent the value the indent to be set to. */ public void setIndent( final int indent ) { this.indent = indent; } @Override public String toString() { StringBuilder msg = new StringBuilder(); msg.append(getHeading()+" "); for( String line : getValue() ) { msg.append(line+"\r"); } return msg.toString(); } }
[ "chendz@ucweb.com" ]
chendz@ucweb.com
c73d497a73129dea3e57ce1f5e6a47d3ab182551
7f368213c2c6d9c397319eb994ab4532600468bc
/src/main/java/com/etech/system/utils/MessageUtils.java
209c49e022bdcf4411329a0357c7e941a3ee9378
[]
no_license
changer2000/ha
40499c3c5342417332ef656e0503ee6e1881bc03
9cc73307be88d19b289c6ed763e9698e807e447f
refs/heads/master
2020-12-24T17:45:15.711458
2014-05-19T13:44:21
2014-05-19T13:44:21
11,441,505
0
1
null
null
null
null
UTF-8
Java
false
false
119
java
package com.etech.system.utils; import com.etech.system.bean.MessagesBean; public class MessageUtils { }
[ "changer20001@sohu.com" ]
changer20001@sohu.com
51172117f048bea25e9000324f6482b715bb44ec
fa123e7abe87528567b54740f6ae559ae7dcc0f6
/Kaos/src/KAOSModel/impl/InputLinkImpl.java
05e3d6ee6817b17042a629d26f723e8b751b0ccc
[]
no_license
eduardoafs/mkaos
3720ddd2b6b33ed07dd47f86cac41a1b3a6026ad
5c4f51de6e0b915c78f1515781f376e35f3a6764
refs/heads/master
2021-03-24T12:06:14.901863
2018-02-14T16:53:19
2018-02-14T16:53:19
108,117,728
0
0
null
2019-04-02T17:38:15
2017-10-24T11:31:42
Java
UTF-8
Java
false
false
2,907
java
/** */ package KAOSModel.impl; import KAOSModel.InputLink; import KAOSModel.KAOSModelPackage; import KAOSModel.Operation; import java.util.Collection; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EObjectResolvingEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Input Link</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link KAOSModel.impl.InputLinkImpl#getObjectInputOn <em>Object Input On</em>}</li> * </ul> * * @generated */ public class InputLinkImpl extends LinkImpl implements InputLink { /** * The cached value of the '{@link #getObjectInputOn() <em>Object Input On</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getObjectInputOn() * @generated * @ordered */ protected EList<Operation> objectInputOn; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InputLinkImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return KAOSModelPackage.Literals.INPUT_LINK; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Operation> getObjectInputOn() { if (objectInputOn == null) { objectInputOn = new EObjectResolvingEList<Operation>(Operation.class, this, KAOSModelPackage.INPUT_LINK__OBJECT_INPUT_ON); } return objectInputOn; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case KAOSModelPackage.INPUT_LINK__OBJECT_INPUT_ON: return getObjectInputOn(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case KAOSModelPackage.INPUT_LINK__OBJECT_INPUT_ON: getObjectInputOn().clear(); getObjectInputOn().addAll((Collection<? extends Operation>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case KAOSModelPackage.INPUT_LINK__OBJECT_INPUT_ON: getObjectInputOn().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case KAOSModelPackage.INPUT_LINK__OBJECT_INPUT_ON: return objectInputOn != null && !objectInputOn.isEmpty(); } return super.eIsSet(featureID); } } //InputLinkImpl
[ "eduafsilva@gmail.com" ]
eduafsilva@gmail.com
d3fe82f566afa6f27ac24fddc6f0a6cda0efc0a7
c95c03f659007f347cc02e293faeb339eff85a59
/Corpus/hbase-rel-2.1.2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/RefreshPeerProcedure.java
6fe7662bdd9e9e4de2b662852e5fe9c7f8dfdf71
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-protobuf", "CC-BY-3.0", "Apache-2.0" ]
permissive
dormaayan/TestsReposirotry
e2bf6c247d933b278fcc47082afa7282dd916baa
75520c8fbbbd5f721f4c216ae7f142ec861e2c67
refs/heads/master
2020-04-11T21:34:56.287920
2019-02-06T13:34:31
2019-02-06T13:34:31
162,110,352
0
2
null
null
null
null
UTF-8
Java
false
false
7,820
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hbase.master.replication; import java.io.IOException; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; import org.apache.hadoop.hbase.master.procedure.PeerProcedureInterface; import org.apache.hadoop.hbase.master.procedure.RSProcedureDispatcher.ServerOperation; import org.apache.hadoop.hbase.procedure2.FailedRemoteDispatchException; import org.apache.hadoop.hbase.procedure2.Procedure; import org.apache.hadoop.hbase.procedure2.ProcedureEvent; import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer; import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException; import org.apache.hadoop.hbase.procedure2.ProcedureYieldException; import org.apache.hadoop.hbase.procedure2.RemoteProcedureDispatcher.RemoteOperation; import org.apache.hadoop.hbase.procedure2.RemoteProcedureDispatcher.RemoteProcedure; import org.apache.hadoop.hbase.procedure2.RemoteProcedureException; import org.apache.hadoop.hbase.replication.regionserver.RefreshPeerCallable; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationType; import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RefreshPeerParameter; import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RefreshPeerStateData; @InterfaceAudience.Private public class RefreshPeerProcedure extends Procedure<MasterProcedureEnv> implements PeerProcedureInterface, RemoteProcedure<MasterProcedureEnv, ServerName> { private static final Logger LOG = LoggerFactory.getLogger(RefreshPeerProcedure.class); private String peerId; private PeerOperationType type; @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "IS2_INCONSISTENT_SYNC", justification = "Will never change after construction") private ServerName targetServer; private boolean dispatched; private ProcedureEvent<?> event; private boolean succ; public RefreshPeerProcedure() { } public RefreshPeerProcedure(String peerId, PeerOperationType type, ServerName targetServer) { this.peerId = peerId; this.type = type; this.targetServer = targetServer; } @Override public String getPeerId() { return peerId; } @Override public PeerOperationType getPeerOperationType() { return PeerOperationType.REFRESH; } private static PeerModificationType toPeerModificationType(PeerOperationType type) { switch (type) { case ADD: return PeerModificationType.ADD_PEER; case REMOVE: return PeerModificationType.REMOVE_PEER; case ENABLE: return PeerModificationType.ENABLE_PEER; case DISABLE: return PeerModificationType.DISABLE_PEER; case UPDATE_CONFIG: return PeerModificationType.UPDATE_PEER_CONFIG; default: throw new IllegalArgumentException("Unknown type: " + type); } } private static PeerOperationType toPeerOperationType(PeerModificationType type) { switch (type) { case ADD_PEER: return PeerOperationType.ADD; case REMOVE_PEER: return PeerOperationType.REMOVE; case ENABLE_PEER: return PeerOperationType.ENABLE; case DISABLE_PEER: return PeerOperationType.DISABLE; case UPDATE_PEER_CONFIG: return PeerOperationType.UPDATE_CONFIG; default: throw new IllegalArgumentException("Unknown type: " + type); } } @Override public RemoteOperation remoteCallBuild(MasterProcedureEnv env, ServerName remote) { assert targetServer.equals(remote); return new ServerOperation(this, getProcId(), RefreshPeerCallable.class, RefreshPeerParameter.newBuilder().setPeerId(peerId).setType(toPeerModificationType(type)) .setTargetServer(ProtobufUtil.toServerName(remote)).build().toByteArray()); } private void complete(MasterProcedureEnv env, Throwable error) { if (event == null) { LOG.warn("procedure event for {} is null, maybe the procedure is created when recovery", getProcId()); return; } if (error != null) { LOG.warn("Refresh peer {} for {} on {} failed", peerId, type, targetServer, error); this.succ = false; } else { LOG.info("Refresh peer {} for {} on {} suceeded", peerId, type, targetServer); this.succ = true; } event.wake(env.getProcedureScheduler()); event = null; } @Override public synchronized boolean remoteCallFailed(MasterProcedureEnv env, ServerName remote, IOException exception) { complete(env, exception); return true; } @Override public synchronized void remoteOperationCompleted(MasterProcedureEnv env) { complete(env, null); } @Override public synchronized void remoteOperationFailed(MasterProcedureEnv env, RemoteProcedureException error) { complete(env, error); } @Override protected synchronized Procedure<MasterProcedureEnv>[] execute(MasterProcedureEnv env) throws ProcedureYieldException, ProcedureSuspendedException, InterruptedException { if (dispatched) { if (succ) { return null; } // retry dispatched = false; } try { env.getRemoteDispatcher().addOperationToNode(targetServer, this); } catch (FailedRemoteDispatchException frde) { LOG.info("Can not add remote operation for refreshing peer {} for {} to {}, " + "this is usually because the server is already dead, " + "give up and mark the procedure as complete", peerId, type, targetServer, frde); return null; } dispatched = true; event = new ProcedureEvent<>(this); event.suspendIfNotReady(this); throw new ProcedureSuspendedException(); } @Override protected void rollback(MasterProcedureEnv env) throws IOException, InterruptedException { throw new UnsupportedOperationException(); } @Override protected boolean abort(MasterProcedureEnv env) { // TODO: no correctness problem if we just ignore this, implement later. return false; } @Override protected boolean waitInitialized(MasterProcedureEnv env) { return env.waitInitialized(this); } @Override protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException { serializer.serialize( RefreshPeerStateData.newBuilder().setPeerId(peerId).setType(toPeerModificationType(type)) .setTargetServer(ProtobufUtil.toServerName(targetServer)).build()); } @Override protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException { RefreshPeerStateData data = serializer.deserialize(RefreshPeerStateData.class); peerId = data.getPeerId(); type = toPeerOperationType(data.getType()); targetServer = ProtobufUtil.toServerName(data.getTargetServer()); } }
[ "dor.d.ma@gmail.com" ]
dor.d.ma@gmail.com
464f89187f616321f91f5f1bc74cf90aaea38701
1386450bec4eac42ad60e154b20bb2f574a3ccea
/lesson-06-hibernate-02/src/main/java/ru/geekbrains/entity/Order.java
5b9e8b7cfc3438cb7dba4f9d4fe6569a3abb86c7
[]
no_license
ramprox/spring-part-one-15
24ba9c5978c5bfe616cf8788b87a94c1ab877f18
4a3f73d73eacb36d6dccc9798fd6ff2f60226d28
refs/heads/master
2023-07-02T03:37:20.665861
2021-08-02T14:41:19
2021-08-02T14:41:19
377,959,188
0
0
null
2021-08-05T12:44:20
2021-06-17T20:58:39
Java
UTF-8
Java
false
false
2,007
java
package ru.geekbrains.entity; import javax.persistence.*; import java.math.BigDecimal; import java.time.LocalDateTime; @Entity @Table(name = "orders") public class Order { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne private Customer customer; @ManyToOne private Product product; @Column(name = "cost") private BigDecimal cost; @Column(name = "datetime") private LocalDateTime localDateTime; public Order() { } public Order(Long id, Customer customer, Product product) { this.id = id; this.customer = customer; this.product = product; } public Order(Long id, Customer customer, Product product, BigDecimal cost, LocalDateTime localDateTime) { this.id = id; this.customer = customer; this.product = product; this.cost = cost; this.localDateTime = localDateTime; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public BigDecimal getCost() { return cost; } public void setCost(BigDecimal cost) { this.cost = cost; } public LocalDateTime getLocalDateTime() { return localDateTime; } public void setLocalDateTime(LocalDateTime localDateTime) { this.localDateTime = localDateTime; } @Override public String toString() { return String.format("Order: { id = %d, customer = %s, product = %s, cost = %.2f, " + "date_time = %5$td-%5$tm-%5$tY %5$tH:%5$tM:%5$tS }", id, customer.getName(), product.getName(), cost, localDateTime); } }
[ "ram-kur@mail.ru" ]
ram-kur@mail.ru
dc2dd98559377f6a00f25ed903225a2790f893d1
cd4f50b4a5898888a8adfbd4e2ec28cddbd7f277
/timss-pf/timss-pf/src/main/java/com/timss/pf/service/TrainingPersonService.java
154d590133a9cdfe3fe950e06768cf470d2786ca
[]
no_license
lpq169128/rp4
8d1c66a15368bc5f6f2a51ce00aee13fe2673c19
8472d0e7a07c614f36cb59666e155b0128320e4b
refs/heads/master
2020-04-22T02:46:38.078654
2019-02-11T12:05:54
2019-02-11T12:05:59
170,062,504
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package com.timss.pf.service; import com.timss.pf.bean.TrainingPerson; import com.yudean.mvc.service.abstr.AbstractService; import java.util.List; public interface TrainingPersonService extends AbstractService<TrainingPerson> { int deleteTrainingPersonByTrainingId(String id); List<TrainingPerson> getTrainingPersonList(String trainingId); List<TrainingPerson> querTrainingPersonByTrainingId(String id); }
[ "542245193@qq.com" ]
542245193@qq.com
8fe266d69067a892584576b3785811e63de71a61
b88dedd8086d5b2e802ab6c25de38d83ce6173c8
/src/com/msi/tough/model/gi/ImageMetadataBean.java
578a4de420774d124f477c1bdbd580ec2f3f8306
[ "Apache-2.0" ]
permissive
TranscendComputing/TopStackCore
92b3f24f1e60f15507ead6715412bb2657c34b1e
71760c895cef7314b10f5fcfbcaf9bea2a0bbce7
refs/heads/master
2021-01-15T23:35:12.138661
2013-10-28T19:33:45
2013-10-28T19:33:45
12,146,242
0
0
null
null
null
null
UTF-8
Java
false
false
3,530
java
/* * TopStack (c) Copyright 2012-2013 Transcend Computing, Inc. * * 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.msi.tough.model.gi; import javax.persistence.*; import java.util.Set; import com.msi.tough.model.gi.enums.*; @Entity @Table( name = "gi_image_metadata") public class ImageMetadataBean { @Id @Column( name = "long_id") @GeneratedValue (strategy = GenerationType.IDENTITY) private long id; @Column( name = "image_id") private String image_id; @Column( name = "type") @Enumerated(EnumType.STRING) private ImageType type; @Column( name = "platform") private String platform; @Column( name = "os") private String os; @Column( name = "architecture") private String architecture; @ElementCollection @Column( name = "associations") private Set<String> associations; @Column( name = "GoldenStatus") @Enumerated(EnumType.STRING) private GoldenStatus status; @Column( name = "cloud") private String cloud; public ImageMetadataBean(){ } public ImageMetadataBean(String image, String givenOS, String givenArch){ image_id = image; if(image_id.contains("emi")) type = ImageType.machine; if(image_id.contains("eki")) type = ImageType.kernel; if(image_id.contains("eri")) type = ImageType.ramdisk; os = givenOS; architecture = givenArch; } public ImageMetadataBean(String image, String givenOS, Set<String> assoc, GoldenStatus stamp){ image_id = image; if(image_id.contains("emi")) type = ImageType.machine; if(image_id.contains("eki")) type = ImageType.kernel; if(image_id.contains("eri")) type = ImageType.ramdisk; os = givenOS; associations = assoc; status = stamp; } public long getId(){ return id; } public void setId(long givenId){ id = givenId; } public String getImage_id(){ return image_id; } public void setImage_id(String img){ image_id = img; } public ImageType getType(){ return type; } public void setType(ImageType givenType){ type = givenType; } public String getPlatform() { return platform; } public void setPlatform(String platform) { this.platform = platform; } public String getOs(){ return os; } public void setOs(String os_name){ os = os_name; } public String getArchitecture() { return architecture; } public void setArchitecture(String givenArch) { architecture = givenArch; } public Set<String> getAssociations(){ return associations; } public void setAssociations(Set<String> assoc){ associations = assoc; } public GoldenStatus getStatus(){ return status; } public void setStatus(GoldenStatus newStatus){ status = newStatus; } public boolean isGolden(){ return status == GoldenStatus.accepted; } public void addAssociation(String newAssoc){ associations.add(newAssoc); } public void deleteAssociation(String delAssoc){ associations.remove(delAssoc); } public String getCloud() { return cloud; } public void setCloud(String cloud) { this.cloud = cloud; } }
[ "jgardner@transcendcomputing.com" ]
jgardner@transcendcomputing.com
fb8f0efea48afe7c509aef7b180eee31b4d5fd3c
55e5c2a4b0fc91be3623308404fabb300dcdace9
/app/src/main/java/cn/xylink/mting/widget/HDividerItemDecoration.java
b2528b548e78622a3a575d8dd303f5d52a95d6da
[]
no_license
dooqu/mting3
e002ae46386fd163be0987b132fa793a3f93ce7c
a1e71957391a39b3ed7576ea2592d43845fa58f5
refs/heads/master
2022-12-25T15:37:08.678278
2020-05-14T08:10:54
2020-05-14T08:10:54
304,654,192
0
0
null
null
null
null
UTF-8
Java
false
false
1,939
java
package cn.xylink.mting.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import cn.xylink.mting.utils.DensityUtil; /** * ----------------------------------------------------------------- * 2019/11/28 17:42 : Create HDividerItemDecoration.java (JoDragon); * ----------------------------------------------------------------- */ public class HDividerItemDecoration extends RecyclerView.ItemDecoration { private final Drawable mLine; private Context mContext; public HDividerItemDecoration(Context context) { mContext = context; int[] attrs = new int[]{android.R.attr.listDivider}; TypedArray a = context.obtainStyledAttributes(attrs); mLine = a.getDrawable(0); a.recycle(); } @Override public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.onDraw(c, parent, state); int childCount = parent.getChildCount(); for (int i = 0; i < childCount-1; i++) { View child = parent.getChildAt(i); int left = child.getLeft(); int top = child.getBottom(); int right = child.getRight(); int bottom = top + mLine.getIntrinsicHeight(); mLine.setBounds(left+DensityUtil.dip2pxComm(mContext,16), top, right-DensityUtil.dip2pxComm(mContext,16), bottom); mLine.draw(c); } } @Override public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); outRect.set(0, 0, 0, DensityUtil.dip2pxComm(mContext,1)); } }
[ "zhaoxiaolong@xylink.cn" ]
zhaoxiaolong@xylink.cn
e642a87c7786e1fc4016064f8dda8293eae918fc
d49e3ff34467c71630681df5a791cb3e4bd72ab7
/src/android/support/v4/media/MediaBrowserCompat$MediaItem$1.java
df85b43c5bc59a28dd53ceca21136cd7a32fac20
[]
no_license
reverseengineeringer/com.gogoair.ife
124691cf49e832f5dd8009ceb590894a7a058dfa
e88a26eec5640274844e6cdafcd706be727e8ae3
refs/heads/master
2020-09-15T19:45:27.094286
2016-09-01T13:32:34
2016-09-01T13:32:34
67,133,682
0
0
null
null
null
null
UTF-8
Java
false
false
612
java
package android.support.v4.media; import android.os.Parcel; import android.os.Parcelable.Creator; final class MediaBrowserCompat$MediaItem$1 implements Parcelable.Creator { public MediaBrowserCompat.MediaItem createFromParcel(Parcel paramParcel) { return new MediaBrowserCompat.MediaItem(paramParcel, null); } public MediaBrowserCompat.MediaItem[] newArray(int paramInt) { return new MediaBrowserCompat.MediaItem[paramInt]; } } /* Location: * Qualified Name: android.support.v4.media.MediaBrowserCompat.MediaItem.1 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
891886f84c0287d3e39b3a0915ffd05ffcaff27d
9cd159eab5e83574673a029b1b7409b5acf7a922
/src/chess/Color.java
be0dac4a528f095aeaf4a37f0efc57f83b93372c
[]
no_license
Andreferraz20/Chess
9bbe290cf8fb07ec1190e2fca1004daa51af9cfe
a0f8579a4551b2c0eb604c31cbf350f9cf33eaf2
refs/heads/master
2020-08-16T18:51:18.255063
2019-11-26T17:00:36
2019-11-26T17:00:36
215,539,371
1
0
null
null
null
null
UTF-8
Java
false
false
61
java
package chess; public enum Color { BLACK, WHITE; }
[ "luizlopesferraz22@gmail.com" ]
luizlopesferraz22@gmail.com
d55bda583947f28c123ad2de7d4c9bef40085862
8ab971eb9262233ca3fb288e651ea9b0139b992c
/AndroidStudioProjects/Datacar/app/src/main/java/com/polimi/datacar/callbacks/UpdateOnResult.java
7839249969b7a4421d4ad33145bd603ae5a1092c
[]
no_license
AndyShoeshim/DataCar_APP
bca645425c239ba26e493173b8b629a4b3b8de7b
2f39ed3c8628ac779add6de34b6df4c0819952e4
refs/heads/master
2023-01-20T22:28:44.794028
2020-11-20T14:17:02
2020-11-20T14:17:02
290,242,026
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package com.polimi.datacar.callbacks; public interface UpdateOnResult { void updateClientResult(boolean result); }
[ "andrea.scarpiello.98@gmail.com" ]
andrea.scarpiello.98@gmail.com
43bf1b22277d7881ad6982234f2f6288afcb5cc8
3ce89c5251ad72e964dac3f35bf2fc61442e5ea4
/1.3/Stats.java
7e9dc5f42a527e5f18be4e436b6194b124cbd794
[]
no_license
Wenfeng-GAO/algo
0986add75c7ac7297df51d243dd563f53879de78
d28f8f5ffe74ceec07111b170a539216242404f3
refs/heads/master
2021-01-19T04:52:21.325768
2016-10-05T16:42:51
2016-10-05T16:42:51
29,405,284
0
0
null
2016-10-05T16:42:51
2015-01-17T20:53:29
Java
UTF-8
Java
false
false
616
java
public class Stats { public static void main(String[] args) { Bag<Double> numbers = new Bag<Double>(); while(!StdIn.isEmpty()) { numbers.add(StdIn.readDouble()); } int n = numbers.size(); double sum = .0; for (double x : numbers) { sum += x; } double mean = sum / n; sum = .0; for (double x : numbers) { sum += (mean - x) * (mean - x); } double std = Math.sqrt(sum/(n-1)); StdOut.printf("Mean: %.2f\n", mean); StdOut.printf("Std dev: %.2f\n", std); } }
[ "elricfeng@gmail.com" ]
elricfeng@gmail.com
6b94ecf8abfbbe9b1d894e94df447cc3a440fe29
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/transform/CreateTypedLinkFacetResultJsonUnmarshaller.java
253844c7358108348492607a21275fbad178198c
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
1,692
java
/* * Copyright 2015-2020 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.clouddirectory.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.clouddirectory.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import static com.fasterxml.jackson.core.JsonToken.*; /** * CreateTypedLinkFacetResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateTypedLinkFacetResultJsonUnmarshaller implements Unmarshaller<CreateTypedLinkFacetResult, JsonUnmarshallerContext> { public CreateTypedLinkFacetResult unmarshall(JsonUnmarshallerContext context) throws Exception { CreateTypedLinkFacetResult createTypedLinkFacetResult = new CreateTypedLinkFacetResult(); return createTypedLinkFacetResult; } private static CreateTypedLinkFacetResultJsonUnmarshaller instance; public static CreateTypedLinkFacetResultJsonUnmarshaller getInstance() { if (instance == null) instance = new CreateTypedLinkFacetResultJsonUnmarshaller(); return instance; } }
[ "" ]
80e59fb60be0c40e5236d074326bbe8fd93d1ca9
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project89/src/test/java/org/gradle/test/performance/largejavamultiproject/project89/p445/Test8907.java
e0011e768dd376887000135864fb5268acd7861d
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,171
java
package org.gradle.test.performance.largejavamultiproject.project89.p445; import org.junit.Test; import static org.junit.Assert.*; public class Test8907 { Production8907 objectUnderTest = new Production8907(); @Test public void testProperty0() { Production8904 value = new Production8904(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production8905 value = new Production8905(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production8906 value = new Production8906(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
76ad6583582d109a2bc69c5b19bf2a8c3418b661
5b017733124aa996caf80be7157d993d7da0aac0
/clink-serversdk/src/main/java/com/tinet/clink/openapi/model/IvrNodeModel.java
16fea39a7bef8181b21b4d1b08db41e2fd918bda
[ "Apache-2.0" ]
permissive
Dougxian/clink-sdk
3bd00e02f4f7418f7ed498b891fb4e13f3852125
e1b3c79f550f563b0c9a0af3b7e9ca0a108f08e8
refs/heads/master
2023-07-02T21:30:28.003597
2021-07-30T08:05:28
2021-07-30T08:05:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package com.tinet.clink.openapi.model; /** * ivr节点对象 * @author huwk * @date 2018/11/05 */ public class IvrNodeModel { /** * 主键id */ private Integer id; /** * 节点 */ private String endpoint; /** * 节点名称 */ private String name; /** * 常用节点 */ private String frequentlyPath; /** * 是否开启节点统计,0:关闭、1:开启 */ private Integer statistic; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFrequentlyPath() { return frequentlyPath; } public void setFrequentlyPath(String frequentlyPath) { this.frequentlyPath = frequentlyPath; } public Integer getStatistic() { return statistic; } public void setStatistic(Integer statistic) { this.statistic = statistic; } }
[ "wangzb@ti-net.com" ]
wangzb@ti-net.com
921fae45cc5f9343ce404ced8f0d543f873563e0
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-docdbelastic/src/main/java/com/amazonaws/services/docdbelastic/AmazonDocDBElasticAsyncClientBuilder.java
39595dfbc28734cb656d4c3ede87de863da77243
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,482
java
/* * Copyright 2018-2023 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.docdbelastic; import javax.annotation.Generated; import com.amazonaws.ClientConfigurationFactory; import com.amazonaws.annotation.NotThreadSafe; import com.amazonaws.client.builder.AwsAsyncClientBuilder; import com.amazonaws.client.AwsAsyncClientParams; /** * Fluent builder for {@link com.amazonaws.services.docdbelastic.AmazonDocDBElasticAsync}. Use of the builder is * preferred over using constructors of the client class. **/ @NotThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public final class AmazonDocDBElasticAsyncClientBuilder extends AwsAsyncClientBuilder<AmazonDocDBElasticAsyncClientBuilder, AmazonDocDBElasticAsync> { private static final ClientConfigurationFactory CLIENT_CONFIG_FACTORY = new ClientConfigurationFactory();; /** * @return Create new instance of builder with all defaults set. */ public static AmazonDocDBElasticAsyncClientBuilder standard() { return new AmazonDocDBElasticAsyncClientBuilder(); } /** * @return Default async client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AmazonDocDBElasticAsync defaultClient() { return standard().build(); } private AmazonDocDBElasticAsyncClientBuilder() { super(CLIENT_CONFIG_FACTORY); } /** * Construct an asynchronous implementation of AmazonDocDBElasticAsync using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AmazonDocDBElasticAsync. */ @Override protected AmazonDocDBElasticAsync build(AwsAsyncClientParams params) { return new AmazonDocDBElasticAsyncClient(params); } }
[ "" ]
e770c3f043e345e3ac1eecdd1c0e7c2e74df07df
71083c3372a567c85fc685233ec7693d1c952ed3
/src/main/java/com/cykj/housewifery/service/EmployeeService.java
bea8197cfec0e572001e99579fbae0872ec2c4a3
[]
no_license
LengKing/Housewifery
ca85f33a9d83486a049f33d7f35e0f479c7b0183
5977947265b479d13e450ab05d43c98de260d1ba
refs/heads/master
2022-12-26T17:19:32.922389
2020-09-27T02:11:59
2020-09-27T02:11:59
293,440,627
1
2
null
null
null
null
UTF-8
Java
false
false
540
java
package com.cykj.housewifery.service; import com.cykj.housewifery.bean.Employee; import java.util.List; public interface EmployeeService { Object isExistsEmployee(String employeeId); int getEmployeesCount(String companyId, String name); List<Employee> getEmployeesByCompanyId(Integer pageNum, String limit, String companyId, String name); String addEmployee(Employee employee); String updateEmployee(Employee employee); String deleteEmployeeById(String number); String updateSkill(Employee employee); }
[ "1336882098@qq.com" ]
1336882098@qq.com
891e9a0d574230ecd1f61cc3bfc2ccb601dd19da
148ff53822b41fa8fe94e455cd7a473dd6a644bd
/GENTON_Emilie_ProjetJava_TP2/Cluedo/src/IHM/Plateau/ToutesLesCases/Classique27.java
e0b061cd8d6efa92198fb1e8dab6bab5be37d360
[]
no_license
Milieuuh/Projet_JAVA_Cluedo
41ed489c9bac6274c88295a16743fbdbce156258
3c096617eaeabf89ded220db5044db5e56592fb7
refs/heads/master
2022-11-09T12:33:54.689097
2020-06-21T14:31:39
2020-06-21T14:31:39
273,920,486
0
0
null
null
null
null
UTF-8
Java
false
false
474
java
package IHM.Plateau.ToutesLesCases; import IHM.Plateau.VueCase; import Metier.Automate; import Metier.Cases.Case; public class Classique27 extends Classique { public Classique27(Case caseMetier, Automate automate) { super(caseMetier, automate); this.setLayoutX(687); this.setLayoutY(285); this.getChildren().add(this.getImage_view_classique()); } @Override public String getType() { return "Classique27"; } }
[ "35493286+Milieuuh@users.noreply.github.com" ]
35493286+Milieuuh@users.noreply.github.com
d5fe83cd79b5af855c0eba948a924e2faf7c60fa
958f2aac0d2f75aa58bffb75b288f2d03de9c819
/src/java/anhnt/controller/TagSearchServlet.java
4d7b8d6f7385d011a7cca03f5ab74b3f3dd40072
[]
no_license
yukiakira269/e622
fb3653733968df313bce66a1d2f54c914ba465ec
fd456c597fed0e4e0db4b4d771b77a974b527cd5
refs/heads/main
2023-06-15T16:15:16.507131
2021-07-12T03:15:12
2021-07-12T03:15:12
347,566,921
0
0
null
null
null
null
UTF-8
Java
false
false
4,136
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 anhnt.controller; import anhnt.product.ProductDAO; import anhnt.product.ProductDTO; import java.io.IOException; import java.io.PrintWriter; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.SQLException; import java.util.List; import javax.servlet.RequestDispatcher; /** * * @author DELL */ public class TagSearchServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String urlRewrite = "error"; try { request.setCharacterEncoding("UTF-8"); String Description = request.getParameter("txtTag"); String txtAdmin = request.getParameter("txtAdmin"); if (!Description.trim().isEmpty()) { ProductDAO dao = new ProductDAO(); List<ProductDTO> bookList = dao.searchByTagAndDesc(Description); request.setAttribute("TAG_SEARCH", bookList); } else { request.setAttribute("EMPTY_ERROR", "Note: Fill this box to look" + " for specific entry!"); } //Redirect to the correct page urlRewrite = "SHOP_PAGE?txtTag=" + Description; if (txtAdmin != null) { urlRewrite = "MANAGE_SHOP_PAGE?txtTag=" + Description; } } catch (SQLException ex) { log("TagSearchServlet SQL: " + ex.toString()); request.setAttribute("OMNI_ERROR", ex.toString()); } catch (NamingException ex) { log("TagSearchServlet Naming: " + ex.toString()); request.setAttribute("OMNI_ERROR", ex.toString()); } catch (Exception ex) { log("TagSearchServlet Exception: " + ex.toString()); request.setAttribute("OMNI_ERROR", ex.toString()); } finally { RequestDispatcher rd = request.getRequestDispatcher(urlRewrite); rd.forward(request, response); out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "yukiakira259@gmail.com" ]
yukiakira259@gmail.com
f0bc0362ff99f5a9e3fb67fd13022cde27c9ba86
f7900a54545c5afc8e5920844c69bdb909ac1ec5
/socialMediaAggregator-Daemon/src/main/java/com/ar/redbee/socialMediaAggregator_Daemon/queue/MessageConsumer.java
0b3920b267e2be7b4cfe6ee4e262afe3c37decc9
[]
no_license
ldvalido/SocialMediaAggregator
fd3e56d9b96b7f99f862e309793672cdc748210d
c8fa4530f529ee10a805326fccda6624e4267498
refs/heads/master
2020-03-19T03:22:35.785336
2018-06-01T13:41:55
2018-06-01T13:41:55
135,722,313
1
0
null
null
null
null
UTF-8
Java
false
false
937
java
package com.ar.redbee.socialMediaAggregator_Daemon.queue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.connection.MessageListener; import org.springframework.stereotype.Service; import com.ar.redbee.socialMediaAggregator_Daemon.service.TopicService; import com.ar.redbee.socialMediaAggregator_Foundation.dto.TopicDto; import com.ar.redbee.socialMediaAggregator_Foundation.utils.JsonHelper; @Service public class MessageConsumer implements MessageListener { TopicService topicService; @Autowired public MessageConsumer(TopicService topicService) { this.topicService = topicService; } @Override public void onMessage(Message message, byte[] pattern) { String rawMessage = new String(message.getBody()); TopicDto dto = JsonHelper.desearilize(rawMessage, TopicDto.class); topicService.process(dto); } }
[ "lvalido@mailexternos.com.ar" ]
lvalido@mailexternos.com.ar
cebe55889591bbadde9d3c119de088c9cbae1f11
a1efec95f35474a68b3334e81dac502b04166a06
/src/test/java/rubtsov/revolut/controller/AccountsControllerTest.java
971696504af587c015ae4e5baa0a56cdd3bef6d0
[]
no_license
RubtsovMichael/revolut-coding-task
295b246f13cb6aabb61456f9a2572564a639650e
043fb9e41329f9984bbd764cba2fed8d14f4cbde
refs/heads/master
2020-08-01T23:56:08.270683
2019-09-28T20:43:03
2019-09-28T20:43:03
211,165,925
0
0
null
null
null
null
UTF-8
Java
false
false
3,888
java
package rubtsov.revolut.controller; import io.restassured.RestAssured; import org.glassfish.grizzly.http.server.HttpServer; import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import rubtsov.revolut.application.App; import rubtsov.revolut.application.AppConfig; import rubtsov.revolut.logics.AccountsService; import rubtsov.revolut.logics.InMemoryAccountsRepository; import rubtsov.revolut.model.Account; import rubtsov.revolut.model.TransferOrder; import java.math.BigDecimal; import static io.restassured.RestAssured.*; import static io.restassured.config.JsonConfig.jsonConfig; import static io.restassured.http.ContentType.JSON; import static io.restassured.path.json.config.JsonPathConfig.NumberReturnType.BIG_DECIMAL; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; class AccountsControllerTest { private static HttpServer httpServer; private static final InMemoryAccountsRepository repository = new InMemoryAccountsRepository(); @BeforeAll static void setUp() { repository.create(new Account("111", new BigDecimal("123.12"))); repository.create(new Account("222", new BigDecimal("123.12"))); repository.create(new Account("333", BigDecimal.ZERO)); repository.create(new Account("444", BigDecimal.ZERO)); httpServer = App.startServer(new AppConfig(new AccountsService(repository))); RestAssured.baseURI = App.BASE_URI; RestAssured.config = RestAssured.config().jsonConfig(jsonConfig().numberReturnType(BIG_DECIMAL)); } @AfterAll static void tearDown() { httpServer.shutdownNow(); } @Test void badRequestForAbsentAccount() { when() .get("/accounts/123456") .then() .statusCode(400) .body(Matchers.equalTo("Account not found")); } @Test void findsAccountByNumber() { when() .get("/accounts/111") .then() .statusCode(200) .body("number", equalTo("111")) .body("amount", is(new BigDecimal("123.12"))); } @Test void transferWorks() { given() .contentType(JSON) .body(TransferOrder.builder().from("222").to("333").amount(new BigDecimal("12.56")).build()) .when() .post("/makeTransfer") .then() .statusCode(200); get("/accounts/222").then().body("amount", is(new BigDecimal("110.56"))); get("/accounts/333").then().body("amount", is(new BigDecimal("12.56"))); } @Test void transferFailsIfNotEnoughFunds() { given() .contentType(JSON) .body(TransferOrder.builder().from("444").to("222").amount(BigDecimal.ONE).build()) .when() .post("/makeTransfer") .then() .statusCode(400) .body(Matchers.equalTo("Not enough funds <0.00> for requested transfer of 1.00")); } @Test void transferFailsIfAccountNotFound() { given() .contentType(JSON) .body(TransferOrder.builder().from("555").to("222").amount(BigDecimal.ONE).build()) .when() .post("/makeTransfer") .then() .statusCode(400) .body(Matchers.equalTo("Account 555 not found")); } @Test void listsAccounts() { when() .get("/accounts") .then() .statusCode(200) .body("", Matchers.containsInAnyOrder("111", "222", "333", "444")); } }
[ "rubtsov.michael@gmail.com" ]
rubtsov.michael@gmail.com
8b590b142b0ba7ee8ba2d88e068e41f117a93333
9f10ae2158d4cbefc58e96fd1671eedde88e2b94
/common-http/src/test/java/com/lingdonge/http/webmagic/webmagic/selector/LinksSelectorTest.java
ee3befef64c6e9c478c67c04c6ff91291f58a9ef
[]
no_license
shimaomao/java-utility
f8e322397938d83fcf3bde4f7f60bb157ee146f7
8fe3b197c6e94aacfcea8f6eebe9bd327b70d7b3
refs/heads/master
2020-06-19T22:44:54.139947
2019-06-12T06:34:03
2019-06-12T06:34:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package com.lingdonge.http.webmagic.webmagic.selector; import com.lingdonge.http.webmagic.selector.LinksSelector; import org.jsoup.Jsoup; import org.testng.annotations.Test; import java.util.List; /** * @author code4crafter@gmail.com * Date: 17/4/8 * Time: 下午9:41 */ public class LinksSelectorTest { private String html = "<div><a href='http://whatever.com/aaa'></a></div><div><a href='http://whatever.com/bbb'></a></div>"; @Test public void testLinks() throws Exception { LinksSelector linksSelector = new LinksSelector(); List<String> links = linksSelector.selectList(html); System.out.println(links); html = "<div><a href='aaa'></a></div><div><a href='http://whatever.com/bbb'></a></div><div><a href='http://other.com/bbb'></a></div>"; links = linksSelector.selectList(Jsoup.parse(html, "http://whatever.com/")); System.out.println(links); } }
[ "hackerpayne@gmail.com" ]
hackerpayne@gmail.com
948467257c29bfa636f17db9298bec892c11a08a
08c21baa7f7a9ab577c83764d564b71217ab1958
/src/main/java/gag/sasu/repository/CommentRepository.java
edfc7a7d1f68fee1ffff59521188e97f62a5e9c8
[]
no_license
AleksandarRachev/SasuGag-Java
04b65dd1f87cfa3cd638eac0948ee5a86736afd5
fce1e0d2a72e0d6b6d8c9daccad41a6b2204e143
refs/heads/master
2022-03-17T11:47:17.382678
2019-12-14T22:22:22
2019-12-14T22:22:22
219,180,336
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package gag.sasu.repository; import gag.sasu.entity.Comment; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface CommentRepository extends JpaRepository<Comment, String> { List<Comment> findAllByPostUidOrderByCreatedOnDesc(String postId); }
[ "rachev.96@abv.bg" ]
rachev.96@abv.bg
e95646e9c64a2942699aea2f88d362448c4a738d
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE190_Integer_Overflow/s06/CWE190_Integer_Overflow__short_max_postinc_52c.java
5d819bb98b124216556ebebf592871ef5884bc5e
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
1,845
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__short_max_postinc_52c.java Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-52c.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: max Set data to the max value for short * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: increment * GoodSink: Ensure there will not be an overflow before incrementing data * BadSink : Increment data, which can cause an overflow * Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package * * */ package testcases.CWE190_Integer_Overflow.s06; import testcasesupport.*; import javax.servlet.http.*; public class CWE190_Integer_Overflow__short_max_postinc_52c { public void badSink(short data ) throws Throwable { /* POTENTIAL FLAW: if data == Short.MAX_VALUE, this will overflow */ data++; short result = (short)(data); IO.writeLine("result: " + result); } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(short data ) throws Throwable { /* POTENTIAL FLAW: if data == Short.MAX_VALUE, this will overflow */ data++; short result = (short)(data); IO.writeLine("result: " + result); } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(short data ) throws Throwable { /* FIX: Add a check to prevent an overflow from occurring */ if (data < Short.MAX_VALUE) { data++; short result = (short)(data); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to increment."); } } }
[ "you@example.com" ]
you@example.com
1b0c978230973e944393d248dfd135f2d537c9d0
ce1c3bc10a3628545496c31653064022ecbc49b4
/socketclient141/src/main/java/com/lolkt/socketclient/server/SocketServerClient.java
4b3020939b2e10ea0dc47e8043699afe6ec302b2
[ "Apache-2.0" ]
permissive
lolkt/AndroidSocketClient
bb5ca950d5653f086684b8c4f5006ba37a1f03d6
417870a125026d1ec7d5df28fdfa42e846dd82fe
refs/heads/master
2020-03-18T22:56:53.280625
2018-06-04T01:53:58
2018-06-04T01:53:58
135,374,125
1
1
null
2018-05-30T01:58:03
2018-05-30T01:58:03
null
UTF-8
Java
false
false
896
java
package com.lolkt.socketclient.server; import android.support.annotation.NonNull; import com.lolkt.socketclient.SocketClient; import java.net.Socket; /** * SocketServerClient * AndroidSocketClient * Created by vilyever on 2016/3/23. * Feature: */ public class SocketServerClient extends SocketClient { final SocketServerClient self = this; /* Constructors */ public SocketServerClient(@NonNull Socket socket) { super(socket.getLocalAddress().toString().substring(1), socket.getLocalPort()); setRunningSocket(socket); // 此构造通常于后台线程调用,通过UIHandler确保onConnected在主线程调用 getUiHandler().sendEmptyMessage(UIHandler.MessageType.Connected.what()); } /* Public Methods */ /* Properties */ /* Overrides */ /* Delegates */ /* Private Methods */ }
[ "969070578@qq.com" ]
969070578@qq.com
5634c571107e631c05d2df6c3aec9f320b9dfa60
5e0867f20ddf100031cfb815825f87267c135db4
/TUT_PRG1/src/ExerciseSheet05/Date.java
49a14a1880fe7ecd78bde08d270b23167e0f31af
[]
no_license
BANANASY/TUT_BWI1VZ_WS1718
dff7d85030d31377300aa4b00fd69213cd4fb82b
42eaa5eed7de853fc648b9a584ec112d97b8ae21
refs/heads/master
2021-09-03T19:22:26.655902
2018-01-11T11:06:01
2018-01-11T11:06:01
111,821,158
0
0
null
null
null
null
UTF-8
Java
false
false
72
java
package ExerciseSheet05; public class Date { int year, month, day; }
[ "wi15b189@technikum-wien.at" ]
wi15b189@technikum-wien.at
d6d80928e8cfa24b170ddc4c0fb063bc702ad2d7
176c1f9b86e6bd360edc8430b962e9c25fa852cb
/src/main/java/org/jacop/examples/stochastic/StochasticTSP.java
2e822439289c6540959860728ab4d697efc70054
[]
no_license
velarm/jacop
71b780f5ddb94e5211fae5a967573b4458829ff1
7e7b1d54bdfd475bbbd3327150bbc926997f617d
refs/heads/master
2020-12-14T09:02:41.053788
2013-10-28T10:24:11
2013-10-28T10:24:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,427
java
package org.jacop.examples.stochastic; import java.util.ArrayList; import java.util.Arrays; import org.jacop.constraints.Circuit; import org.jacop.constraints.Sum; import org.jacop.constraints.XplusYeqC; import org.jacop.core.IntVar; import org.jacop.core.Store; import org.jacop.examples.fd.ExampleFD; import org.jacop.search.DepthFirstSearch; import org.jacop.search.IndomainMin; import org.jacop.search.SelectChoicePoint; import org.jacop.search.SimpleSelect; import org.jacop.search.PrintOutListener; import org.jacop.stochastic.constraints.Element; import org.jacop.stochastic.constraints.Expectation; import org.jacop.stochastic.constraints.PrOfElement; import org.jacop.stochastic.core.StochasticVar; /** * Implements a Stochastic Travelling Salesman Problem where * the weights (travelling times) between the cities (nodes) * are stochastic variables. */ public class StochasticTSP extends ExampleFD{ /** * Generates a StochasticTSP instance. */ public void model() { store = new Store(); vars = new ArrayList<IntVar>(); int noCities = 5; int res = 1000; StochasticVar[][] distance = new StochasticVar[noCities][noCities]; for (int i = 0; i < noCities; i++) { for (int j = 0; j < noCities; j++){ if (i == j) distance[i][j] = new StochasticVar(store, "distance["+ i + "][" + j + "]", true, 1, 1000, 1000); else distance[i][j] = new StochasticVar(store, "distance["+ i + "][" + j + "]", true, 3, 10, 150); //System.out.println(distance[i][j]); } } IntVar[] cities = new IntVar[noCities]; IntVar[] Ecosts = new IntVar[noCities]; for (int i = 0; i < cities.length; i++) { cities[i] = new IntVar(store, "cities" + i, 1, cities.length); Ecosts[i] = new IntVar(store, "Ecosts" + i, 0 , 1000000); vars.add(cities[i]); //vars.add(Ecosts[i]); } IntVar[][] Ps = new IntVar[cities.length][]; StochasticVar[] costs = new StochasticVar[noCities]; for (int i = 0; i < cities.length; i++){ costs[i] = new StochasticVar(store, "costs"+i, distance); Ps[i] = new IntVar[costs[i].getSize()]; for (int j=0; j < costs[i].getSize(); j++){ Ps[i][j] = new IntVar(store, "PEl"+ i + "_" + costs[i].dom().values[j], 0, res); //vars.add(Ps[i][j]); } store.impose(new PrOfElement(costs[i], costs[i].dom().values, Ps[i], res)); } store.impose(new Circuit(cities)); for (int i = 0; i < cities.length; i++) { //System.out.println("Element)"+cities[i]+", "+ Arrays.asList(distance[i]) + ", "+ costs[i]+")"); store.impose(new Element(cities[i], distance[i], costs[i], 1)); store.imposeDecomposition(new Expectation(Ps[i], costs[i].dom().values, Ecosts[i])); } IntVar goal = new IntVar(store, "goal", 0, 1000000); vars.add(goal); store.impose(new Sum(Ecosts, goal)); IntVar goalNegation= new IntVar(store, "goalNegation", -1000000, 0); store.impose(new XplusYeqC(goal, goalNegation, 0)); cost = goalNegation; } /** * It executes the program to solve this Travelling Salesman Problem. * @param args no argument is used. */ public static void main(String args[]) { StochasticTSP example = new StochasticTSP(); example.model(); if (example.searchAllAtOnce()) { System.out.println("Solution(s) found"); } //example.search.printAllSolutions(); } /** * It specifies simple search method based on most constrained static and lexigraphical * ordering of values. It searches for all solutions. * * @return true if there is a solution, false otherwise. */ @Override public boolean searchAllAtOnce() { long T1, T2; T1 = System.currentTimeMillis(); SelectChoicePoint<IntVar> select = new SimpleSelect<IntVar>(vars.toArray(new IntVar[1]), null, new IndomainMin<IntVar>()); search = new DepthFirstSearch<IntVar>(); search.setSolutionListener(new PrintOutListener<IntVar>()); search.getSolutionListener().searchAll(true); search.getSolutionListener().recordSolutions(true); search.setAssignSolution(true); boolean result = search.labeling(store, select); T2 = System.currentTimeMillis(); if (result) { System.out.println("Number of solutions " + search.getSolutionListener().solutionsNo()); //search.printAllSolutions(); } else System.out.println("Failed to find any solution"); System.out.println("\n\t*** Execution time = " + (T2 - T1) + " ms"); return result; } }
[ "radoslaw.szymanek@gmail.com" ]
radoslaw.szymanek@gmail.com
4315874473260dce59d2e457b628530896f929c1
37af4fa993a86b4cbc00486acc72adb4eff1225f
/iorx/src/main/java/ubiquisense/iorx/comm/TRANSPORT_PROTOCOL.java
5735b3bb35a9526e309683a9ba492605a030353c
[]
no_license
lucascraft/iorx
3880a6cfb990d61bf4e506424f5ea1a59f3085e3
d94fcbe57677b420b49e968c859aa766c014e9b9
refs/heads/master
2021-07-22T18:58:13.396550
2019-12-02T22:42:35
2019-12-02T22:42:35
119,903,510
0
0
null
2021-06-04T01:01:22
2018-02-01T22:52:37
HTML
UTF-8
Java
false
false
2,498
java
package ubiquisense.iorx.comm; import java.util.Arrays; import java.util.Collections; import java.util.List; public enum TRANSPORT_PROTOCOL { USB(0, "USB", "usb://"), TCP(1, "TCP", "tcp://"), UDP(2, "UDP", "udp://"), HTTP(3, "HTTP", "http://"), BLUETOOTH(4, "BLUETOOTH", "bt://"), XBEE(5, "XBEE", "xbee://"), MIDI(6, "MIDI", "midi://"); public static final int USB_VALUE = 0; public static final int TCP_VALUE = 1; public static final int UDP_VALUE = 2; public static final int HTTP_VALUE = 3; public static final int BLUETOOTH_VALUE = 4; public static final int XBEE_VALUE = 5; public static final int MIDI_VALUE = 6; private static final TRANSPORT_PROTOCOL[] VALUES_ARRAY = new TRANSPORT_PROTOCOL[] { USB, TCP, UDP, HTTP, BLUETOOTH, XBEE, MIDI, }; public static final List<TRANSPORT_PROTOCOL> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); public static TRANSPORT_PROTOCOL get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { TRANSPORT_PROTOCOL result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } public static TRANSPORT_PROTOCOL getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { TRANSPORT_PROTOCOL result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } public static TRANSPORT_PROTOCOL get(int value) { switch (value) { case USB_VALUE: return USB; case TCP_VALUE: return TCP; case UDP_VALUE: return UDP; case HTTP_VALUE: return HTTP; case BLUETOOTH_VALUE: return BLUETOOTH; case XBEE_VALUE: return XBEE; case MIDI_VALUE: return MIDI; } return null; } private final int value; private final String name; private final String literal; private TRANSPORT_PROTOCOL(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } public int getValue() { return value; } public String getName() { return name; } public String getLiteral() { return literal; } @Override public String toString() { return literal; } } //TRANSPORT_PROTOCOL
[ "machi@H3-R0N" ]
machi@H3-R0N
837d45ae2e1c4bf1f8bda90b82d14927631a2f76
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-quicksight/src/main/java/com/amazonaws/services/quicksight/model/AnalysisFilterAttribute.java
8e6cf92a8e30df2cdbecaf14d98fb630a5de0270
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,164
java
/* * Copyright 2018-2023 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.quicksight.model; import javax.annotation.Generated; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public enum AnalysisFilterAttribute { QUICKSIGHT_USER("QUICKSIGHT_USER"), QUICKSIGHT_VIEWER_OR_OWNER("QUICKSIGHT_VIEWER_OR_OWNER"), DIRECT_QUICKSIGHT_VIEWER_OR_OWNER("DIRECT_QUICKSIGHT_VIEWER_OR_OWNER"), QUICKSIGHT_OWNER("QUICKSIGHT_OWNER"), DIRECT_QUICKSIGHT_OWNER("DIRECT_QUICKSIGHT_OWNER"), DIRECT_QUICKSIGHT_SOLE_OWNER("DIRECT_QUICKSIGHT_SOLE_OWNER"), ANALYSIS_NAME("ANALYSIS_NAME"); private String value; private AnalysisFilterAttribute(String value) { this.value = value; } @Override public String toString() { return this.value; } /** * Use this in place of valueOf. * * @param value * real value * @return AnalysisFilterAttribute corresponding to the value * * @throws IllegalArgumentException * If the specified value does not map to one of the known values in this enum. */ public static AnalysisFilterAttribute fromValue(String value) { if (value == null || "".equals(value)) { throw new IllegalArgumentException("Value cannot be null or empty!"); } for (AnalysisFilterAttribute enumEntry : AnalysisFilterAttribute.values()) { if (enumEntry.toString().equals(value)) { return enumEntry; } } throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); } }
[ "" ]
0e696873a5a26cfcfe7e50137a97f30b0676de57
653bd81e4886bd75bb672dadc60c9c998f3c1ab1
/takin-web-biz-service/src/main/java/io/shulie/takin/cloud/biz/notify/processor/sla/SlaNotifyProcessor.java
282c6089731f607e425cea8c5e4dc8c2aeb360ab
[]
no_license
shulieTech/Takin-web
f7fc06b4e5bcab366a60f64934cc3de495b9917e
f00bcd31e6fea795d8d718e59011b0c05fd6daf7
refs/heads/main
2023-08-31T07:38:15.352626
2023-07-03T03:03:47
2023-07-03T03:03:47
398,989,630
18
60
null
2023-08-22T09:50:23
2021-08-23T05:58:15
Java
UTF-8
Java
false
false
1,072
java
package io.shulie.takin.cloud.biz.notify.processor.sla; import io.shulie.takin.cloud.biz.notify.CloudNotifyProcessor; import io.shulie.takin.cloud.biz.service.sla.SlaService; import io.shulie.takin.cloud.constant.enums.CallbackType; import io.shulie.takin.cloud.model.callback.Sla.SlaInfo; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component public class SlaNotifyProcessor implements CloudNotifyProcessor<SlaNotifyParam> { @Autowired private SlaService slaService; @Override public CallbackType type() { return CallbackType.SLA; } @Override public String process(SlaNotifyParam param) { List<SlaInfo> data = param.getData(); String resourceId = ""; if (CollectionUtils.isNotEmpty(data)) { slaService.detection(param.getData()); resourceId = String.valueOf(data.get(0).getResourceId()); } return resourceId; } }
[ "wuchunjing@shulie.io" ]
wuchunjing@shulie.io
743895da92149fdca9a99b897e2f0989a77c8e22
353e726aca7dfd76d65d25abe7a2aa23136237e2
/DesafioSegundaSemana/GerenciadorTimesFutebol/src/br/com/codenation/desafio/annotation/Desafio.java
911d3df3c0d6609664f2e5f78e378695f63629d6
[]
no_license
GuilhermeMelkor/DesafiosJava
077ae7d27ba7724f61a672ec9d81d03814f447b2
0c3179869fdad495e800b9181b9cb4ec100109e4
refs/heads/master
2022-11-06T14:37:10.785929
2020-06-17T00:17:02
2020-06-17T00:17:02
272,834,721
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package br.com.codenation.desafio.annotation; public abstract @interface Desafio { public abstract java.lang.String value(); }
[ "guilherme.gms.93@gmail.com" ]
guilherme.gms.93@gmail.com
ca8973b15498a8adfa1c6fd3b11fe10b4231b94a
6669f3ac84e228ecb5b75113d8ac60538785725e
/src/Servlet/AddMoney.java
43d26b0c6b8eb9b7b37409799693b17c7469e552
[]
no_license
jiangxiaozhou/IFTTTWEB
f88acd4a5a1b874be580c4fa28652b9735d465e4
776636f31c7b1f5aea8b702e4b6c2eca1d6bee67
refs/heads/master
2021-01-10T09:08:32.252102
2016-03-10T11:35:56
2016-03-10T11:35:56
53,579,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package Servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import Database.DatabaseAccount; @WebServlet("/AddMoney") public class AddMoney extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AddMoney() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session1 = request.getSession(); String username = (String) session1.getAttribute("username"); String money = request.getParameter("money"); int add = Integer.parseInt(money); DatabaseAccount.addMoney(username, add); response.sendRedirect("PersonalInfo.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "842764685@qq.com" ]
842764685@qq.com
8efdd216bc8f6f2456436267512092b9e153c9d2
dd604245dfc1dc869a9a4737e477b327f579bb70
/src/com/deltaxml/core/DXPConfigurationException.java
42183a78d92abd18551d03fda2e00fa6a4a00752
[]
no_license
sharwell/xmlcalabash-stubs
0158be37305fb55437f10c9ae879c28d58c478af
f3ef37748ca929ecdf5f7caf7a06438df4c747cf
refs/heads/master
2021-01-01T05:49:44.140434
2013-09-24T03:50:50
2013-09-24T03:50:50
13,046,264
0
1
null
null
null
null
UTF-8
Java
false
false
969
java
package com.deltaxml.core; /** * Indicates an error condition in the {@link DXPConfiguration}. * * <p> * This class is the super-class of most of the <em>checked</em> exceptions * thrown by the {@link DXPConfiguration} methods. As such it could be used for * simplified, coarse-grain catch or throws clauses.</p> * * @see <a href="http://docs.deltaxml.com/core/current/docs/api/com/deltaxml/core/DXPConfigurationException.html"> * Class DXPConfigurationException</a> */ public class DXPConfigurationException extends DeltaXMLException { public DXPConfigurationException(String message) { super(message); throw new UnsupportedOperationException(); } public DXPConfigurationException(Throwable t) { super(t); throw new UnsupportedOperationException(); } public DXPConfigurationException(String message, Throwable t) { super(message, t); throw new UnsupportedOperationException(); } }
[ "sam.harwell@rackspace.com" ]
sam.harwell@rackspace.com
fdac5a48845e197f1138fc7e29bec146c1e82ba2
a4724c64fef0feb5db66388668c33262248cc388
/Spectrum-based_FaultLoc_MT/SpecBased_FaultLoc_MT/src/jointPackage_CPL2SPL/SrcSwitchedPriority.java
4045fd05d899a5239c9a6d9cf1345755d1cac7b7
[]
no_license
tigerqiu712/SBFL_MT
10ba85e255dd53e7d3664d1a3de5508f06b55f9a
6f623acab0d4b673314feca58d72cac705dc0967
refs/heads/master
2020-03-26T22:47:52.458481
2017-10-10T07:30:59
2017-10-10T07:30:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,213
java
/** */ package jointPackage_CPL2SPL; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Src Switched Priority</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getLess <em>Less</em>}</li> * <li>{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getGreater <em>Greater</em>}</li> * <li>{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getEqual <em>Equal</em>}</li> * </ul> * * @see jointPackage_CPL2SPL.JointPackage_CPL2SPLPackage#getSrcSwitchedPriority() * @model * @generated */ public interface SrcSwitchedPriority extends SrcNodeContainer { /** * Returns the value of the '<em><b>Less</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Less</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Less</em>' attribute. * @see #setLess(String) * @see jointPackage_CPL2SPL.JointPackage_CPL2SPLPackage#getSrcSwitchedPriority_Less() * @model unique="false" ordered="false" * @generated */ String getLess(); /** * Sets the value of the '{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getLess <em>Less</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Less</em>' attribute. * @see #getLess() * @generated */ void setLess(String value); /** * Returns the value of the '<em><b>Greater</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Greater</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Greater</em>' attribute. * @see #setGreater(String) * @see jointPackage_CPL2SPL.JointPackage_CPL2SPLPackage#getSrcSwitchedPriority_Greater() * @model unique="false" ordered="false" * @generated */ String getGreater(); /** * Sets the value of the '{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getGreater <em>Greater</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Greater</em>' attribute. * @see #getGreater() * @generated */ void setGreater(String value); /** * Returns the value of the '<em><b>Equal</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Equal</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Equal</em>' attribute. * @see #setEqual(String) * @see jointPackage_CPL2SPL.JointPackage_CPL2SPLPackage#getSrcSwitchedPriority_Equal() * @model unique="false" ordered="false" * @generated */ String getEqual(); /** * Sets the value of the '{@link jointPackage_CPL2SPL.SrcSwitchedPriority#getEqual <em>Equal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Equal</em>' attribute. * @see #getEqual() * @generated */ void setEqual(String value); } // SrcSwitchedPriority
[ "jtroya@us.es" ]
jtroya@us.es
fb248c67a778104b6a70497e78841013d4119271
11dab8e39a9b25680423d202392093ded6f61192
/MediathekBlatt01_2016/MediathekVorlage_Blatt01/src/KundenstammService.java
79a59cdaefa48d30a9b8fe0833b5b56a99a4c830
[]
no_license
AbdulBasit2094/Praktikum2
cab388e9a9c3d1f1658c6bf626b1f812b9a95c74
6611d98e2150f1906ff2a203056e9deb0b235096
refs/heads/master
2016-09-01T15:12:41.524606
2016-04-21T09:20:24
2016-04-21T09:20:24
55,067,424
0
0
null
null
null
null
UTF-8
Java
false
false
1,935
java
import java.util.List; /** * Ein Kundenstamm ist ein Service, der die Menge von Kunden verwaltet. Auf * Kunden kann über ihre Kundennummer zugegriffen werden. * * KundenstammService ist ein ObservableService, als solcher bietet er die * Möglichkeit über Änderungen am Kundenstamm zu informieren. Beobachter müssen * das Interface ServiceObserver implementieren. * * @author SE2-Team, PM2-Team * @version SoSe 2016 */ interface KundenstammService extends ObservableService { /** * Entfernt einen Kunden aus dem Kundenbestand. * * @param kunde Ein zu entfernender Kunde. * * @require enthaeltKunden(kunde) * @ensure !enthaeltKunden(kunde) */ void entferneKunden(Kunde kunde); /** * Gibt Auskunft, ob ein Kunde im Kundenbestand enthalten ist. * * @param kunde Ein Kunde * @return true, wenn Kunde im Kundenbestand enthalten ist, andernfalls * false. * * @require kunde != null */ boolean enthaeltKunden(Kunde kunde); /** * Fügt einen weiteren Kunden in den Kundenbestand ein. * * @param neuerKunde Ein neuer Kunde. * * @require !enthaeltKunden(neuerKunde) * @ensure enthaeltKunden(neuerKunde) */ void fuegeKundenEin(Kunde neuerKunde); /** * Liefert alle vorhandenen Kunden. Wenn es keine Kunden gibt, wird eine * leere Liste zurückgegeben. * * @return Eine Kopie der Liste mit allen vorhandenen Kunden. * * @ensure result != null */ List<Kunde> getKunden(); /** * Liefert zur übergebenen Kundennummer einen Kunden, wenn es einen * passenden Eintrag im Kundenstamm gibt. * * @param kundennummer Eine Kundennummer * @return Einen Kunden oder null, wenn es keinen passenden Eintrag gibt. * * @require kundennummer != null */ Kunde getKunden(Kundennummer kundennummer); }
[ "Abdul-Basit.Andar@haw-hamburg.de" ]
Abdul-Basit.Andar@haw-hamburg.de
89de70e25883ccc20d135d637f890494d918cb0f
d5c5cfe894ae5833918bd396c5bd01fc8a1a8ffa
/orig/fitlibrary/fitlibrary-2.0-cloned-from-sourceforge/src/fitlibrary/runner/CopyFiles.java
b042fa1b256a25ba561694c34ebd2567181ee8b7
[]
no_license
afamee/DbFit-deps
80db2fc3919c30b900c01012788d293ea5e1c07c
2610dfc6f4573e3eda3a8c68369d23b4571547da
refs/heads/master
2020-04-02T18:28:37.519147
2015-07-11T13:55:42
2015-07-11T13:55:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,521
java
/* * Copyright (c) 2006 Rick Mugridge, www.RimuResearch.com * Released under the terms of the GNU General Public License version 2 or later. */ package fitlibrary.runner; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class CopyFiles { public static void copyFilesRecursively(File sourceFiles, File targetFiles, String diryName) throws IOException, SecurityException { if (!targetFiles.exists()) targetFiles.mkdir(); File targetDiry = new File(targetFiles,diryName); targetDiry.mkdir(); copyFilesRecursively(new File(sourceFiles,diryName),targetDiry); } private static void copyFilesRecursively(File sourceDiry, File targetDiry) throws IOException, SecurityException { File[] files = sourceDiry.listFiles(); for (int i = 0; i < files.length; i++) { File file = files[i]; File target = new File(targetDiry,file.getName()); if (file.isDirectory()) { target.mkdir(); copyFilesRecursively(file,target); } else copyFile(file,target); } } private static void copyFile(File source, File target) throws IOException { BufferedInputStream reader = new BufferedInputStream(new FileInputStream(source)); BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream(target)); while (true) { int in = reader.read(); if (in < 0) break; writer.write(in); } reader.close(); writer.close(); } }
[ "mark_matten@hotmail.com" ]
mark_matten@hotmail.com
be59279b13764aff2633b2df06d32a660300cd0c
91a972d9bba73e69511a01e598adcccce5d076ae
/src/main/java/org/wikimedia/search/querystring/elasticsearch/ElasticsearchFieldResolver.java
7a6e5bc52a0f481e7902fa53c1c78e78c97ef213
[]
no_license
ericjohnston1989/query_string_plus_plus_plus
571ea5d34560cd4a07a58c82f4027e4ac698c8e5
35befad0a920eda8fcc3dc9ff4e642d66385cffe
refs/heads/master
2021-01-21T16:38:24.910312
2015-06-25T19:00:55
2015-06-25T19:00:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package org.wikimedia.search.querystring.elasticsearch; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.query.QueryParseContext; import org.wikimedia.search.querystring.FieldResolver; public class ElasticsearchFieldResolver implements FieldResolver { private final QueryParseContext context; public ElasticsearchFieldResolver(QueryParseContext context) { this.context = context; } @Override public Tuple<String, Analyzer> resolve(String field) { if (field == null) { return null; } MapperService.SmartNameFieldMappers smart = context.smartFieldMappers(field); /* * Just finding the smart mapping is good enough to know that field was * defined in the mapping - meaning its ok to infer that there are * probably useful things in there. */ if (smart != null && smart.hasMapper()) { // TODO when is this different from field? String name = smart.mapper().names().indexName(); return new Tuple<>(name, smart.searchAnalyzer()); } return null; } @Override public Analyzer defaultStandardSearchAnalyzer() { return context.mapperService().searchAnalyzer(); } @Override public Analyzer defaultPreciseSearchAnalyzer() { return context.mapperService().searchQuoteAnalyzer(); } }
[ "neverett@wikimedia.org" ]
neverett@wikimedia.org
a283cf9f6fe5583273e2eae2abc7134d4a3757de
52716ce98cf4cd57c96e5a9549c12782536bf874
/src/repositories/VehicleRepository.java
189affe7a167e27ab8e32377182274ecba0f3262
[]
no_license
qasimhbti/masterclass_parkingLot
9804b241bd03022c80dd2d482479a040c286796f
4bf7d06e29cf0954a5ae04fa06975b1e8f2a35b9
refs/heads/master
2023-09-01T22:55:53.779155
2021-11-13T15:17:25
2021-11-13T15:17:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package repositories; import models.Vehicle; public class VehicleRepository { // ORM layes: we don't have to write the queries. Framework writes it for us // Object Relational Mapping // Java : Hibernate // Python: SQLAlchemy Vehicle save() { String query = "INSERT INTO vehicles ()"; return null; } Vehicle getByID() { String query = "SELECT * from vehicles where id = "; return null; } } // Head First Design Patterns // refactoriing.guru
[ "namanbhalla1998@gmail.com" ]
namanbhalla1998@gmail.com
1bef155ed97cd8972aa510e0bce55435c24c1fd9
41b881ec52060c693fc3f48b1e1c5b9d056d974b
/ThreadDemo1/src/com/syf/study/ThreadDemo002Extends.java
0b94049facf5cc847b8824c1db2af71730ef0bac
[]
no_license
shaly/code
259f7af43d107cce89342f8c1262de9a028d6a3f
2a5a92a5bef6d71894ac191bdf55f4ad3d2a34e5
refs/heads/master
2020-06-23T15:16:10.788771
2019-07-24T16:49:36
2019-07-24T16:49:36
198,660,822
0
0
null
null
null
null
GB18030
Java
false
false
2,697
java
package com.syf.study; class CreateThread extends Thread{ public void run() { for(int i=0;i<20;i++) { System.out.println("run () i:"+i); } } } /** * 继承Thread类创建多线程 * @author Administrator * */ public class ThreadDemo002Extends { public static void main(String[] args) { System.out.println("创建线程开始 main"); CreateThread c=new CreateThread(); //启动一个线程是调用start方法而不是run方法 //1.run方法是在主线程进行执行的,没有启动多线程 //2.start启动了多线程 c.start(); System.out.println("创建线程已经启动 main"); for (int i = 0; i < 20; i++) { System.out.println("main () i:"+i); int a=1/0; } //1.run执行结果,单任务执行(单线程从上往下执行) /*创建线程开始 main run () i:0 run () i:1 run () i:2 run () i:3 run () i:4 run () i:5 run () i:6 run () i:7 run () i:8 run () i:9 run () i:10 run () i:11 run () i:12 run () i:13 run () i:14 run () i:15 run () i:16 run () i:17 run () i:18 run () i:19 创建线程已经启动 main main () i:0 main () i:1 main () i:2 main () i:3 main () i:4 main () i:5 main () i:6 main () i:7 main () i:8 main () i:9 main () i:10 main () i:11 main () i:12 main () i:13 main () i:14 main () i:15 main () i:16 main () i:17 main () i:18 main () i:19 */ //2.start执行结果,交叉执行(多线程状态) /*创建线程开始 main 创建线程已经启动 main main () i:0 main () i:1 run () i:0 main () i:2 run () i:1 main () i:3 run () i:2 main () i:4 run () i:3 main () i:5 main () i:6 main () i:7 main () i:8 main () i:9 run () i:4 main () i:10 run () i:5 run () i:6 run () i:7 run () i:8 run () i:9 run () i:10 main () i:11 main () i:12 main () i:13 main () i:14 main () i:15 main () i:16 run () i:11 main () i:17 main () i:18 main () i:19 run () i:12 run () i:13 run () i:14 run () i:15 run () i:16 run () i:17 run () i:18 run () i:19 */ //3.注意:各个线程中互不影响,主线程报错,不影响子线程执行 /*创建线程开始 main 创建线程已经启动 main main () i:0 run () i:0 run () i:1 run () i:2 run () i:3 run () i:4 run () i:5 run () i:6 run () i:7 run () i:8 run () i:9 run () i:10 run () i:11 Exception in thread "main" run () i:12java.lang.ArithmeticException: / by zero run () i:13 run () i:14 run () i:15 run () i:16 run () i:17 run () i:18 run () i:19 at com.syf.study.ThreadDemo002Extends.main(ThreadDemo002Extends.java:27) */ } }
[ "283199611@qq.com" ]
283199611@qq.com
b31aeda290b8e4d2c378687dab9e41ccccf1b787
aae5d57096e6371dbab907e324d83a48afe3643e
/src/main/java/com/alizon/alizonmarket/domain/Purchase.java
0693a1c90f75414d11b5bec0de3854a51b0c6f2f
[]
no_license
adrianta/alizon-market
78bfc083676487dbc9d4fc095c8ad58fab6e4c5d
38f0351a93db537f4fda919166e7d5f710a9035d
refs/heads/main
2023-02-27T01:35:26.634424
2021-02-07T03:48:02
2021-02-07T03:48:02
335,040,707
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package com.alizon.alizonmarket.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor public class Purchase implements Serializable { private int purchaseId; private String customerId; private LocalDateTime date; private String paymentMethod; private String comment; private String state; private List<PurchaseItem> items; }
[ "adrianta86@hotmail.com" ]
adrianta86@hotmail.com
b663ffc5df028994634172b40f8ce68c6c26af26
ae075c2312d5fbcf8919ff55c0ad867887f9505c
/bst-merge-tool/src/main/java/com/comptel/bst/tools/mergetool/cli/DiffOperation.java
51aadeeda92f8db820f71ecf803aaa807f6c1ffd
[]
no_license
vjrasane/bst-merge
930313f6196242319606d95e08142206316daeb2
10643be04d08042be7836081941bdbd7c4d99457
refs/heads/master
2021-01-21T14:48:12.796860
2017-07-11T15:44:21
2017-07-11T15:44:21
95,445,362
0
0
null
null
null
null
UTF-8
Java
false
false
2,261
java
package com.comptel.bst.tools.mergetool.cli; import java.io.IOException; import java.util.List; import java.util.Map; import com.beust.jcommander.Parameters; import com.beust.jcommander.ParametersDelegate; import com.comptel.bst.tools.common.CommonUtils; import com.comptel.bst.tools.diff.comparison.OutputTree; import com.comptel.bst.tools.diff.comparison.differences.Difference; import com.comptel.bst.tools.diff.comparison.differences.Difference.Branch; import com.comptel.bst.tools.diff.utils.DiffConstants; import com.comptel.bst.tools.mergetool.cli.CommandLineTool.Operation; import com.comptel.bst.tools.mergetool.merger.BSTMerger; import com.comptel.bst.tools.mergetool.utils.MergeUtils; import com.comptel.bst.tools.mergetool.utils.Timer; /* * This operation displays the differences of the two derived files to their base file as an output tree. * It doesn't perform any merge operations. */ @Parameters(commandDescription = "Print differences between the base, local and remote BST logics") public class DiffOperation implements Operation { // Common merge tool CLI parameters @ParametersDelegate private CommonParams params = new CommonParams(); @Override public void execute() throws IOException { Timer.PRINT = params.printDuration; // Set duration output on/off OutputTree.setOutputCharset(params.charset); /* * Here we call the common utility method in MergeUtils that parses the files and * expects a function that takes those files as parameters */ MergeUtils.parseFiles(params.base, params.local, params.remote, // An anonymous function that takes the (b)ase, (l)ocal and (r)emote files and calculates their differences (b, l, r) -> { Map<Branch, List<Difference>> diffs = BSTMerger.getDifferences(b, l, r); OutputTree tree = new OutputTree(); diffs.forEach((br, d) -> tree.add(br, d)); // Add each diff to the output tree and mark the correct branch CommonUtils.printPhase(DiffConstants.DIFF_DETECT_PHASE); // Print the phase message System.out.println(tree); // Output the difference tree }); } }
[ "ville.rasanen@aalto.fi" ]
ville.rasanen@aalto.fi
8e19fa85c43bff46f9037d92e69b5c83cfb996b7
4f28d9d3c09187a41343a72cc3980143c49e506b
/a3/Settings.java
d92a167a769d26a435cb9b358bd22f58055db0aa
[]
no_license
HeliWang/cs349
52ea6a904bb022d845bf1b882692fdf61cc1e212
0b5d146e20d5a64e312a582af57b13664bb9f231
refs/heads/master
2021-01-20T17:55:07.614922
2014-05-19T17:45:23
2014-05-19T17:45:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
import java.awt.Color; public class Settings { public static int fps = 35; /* Window Settings */ public static int width = 800-105; public static int height = 500; /* fruits per second */ public static double fruitps = .7;//fruit per second public static Color colorOrange = Color.orange; public static Color colorApple = Color.red; public static Color colorWatermelon = Color.green; public static Color colorGrape = Color.blue; public static Color colorStrike = Color.black; public static Color colorSuccess = Color.lightGray; /* Don't touch! */ public static double accelX = 0; public static double accelY = (-9.8*fps/1500); public static double displayFor = .1*fps; //display slice for public static Color colorSliceDraw = new Color((float)92/255,(float)92/255,(float)92/255); public static Color colorSliceFill = new Color((float)175/255,(float)175/255,(float)175/255); public static int screen = 1; public static int nummissed = 5; }
[ "jh.edwardyang@gmail.com" ]
jh.edwardyang@gmail.com
e1baae5e9a0da4e69f49dc550c903b2b0dc8bd36
1cb80b1431ae42dc305483b5f5fcff5abb2eb9f0
/images/overlappy_resources/sources/GameStage.java
ddc40ffd673cba09e30140b54a24bfdf1f2830fa
[]
no_license
BaldurTr/wepoas4
bc3c2d075e53fe60fbafcd5dc607d6e764833462
bf378c996a8df681c4de44fbe2242b0691d4c89c
refs/heads/master
2021-01-13T00:56:54.086849
2016-04-07T10:11:02
2016-04-07T10:11:02
54,558,945
0
0
null
null
null
null
UTF-8
Java
false
false
2,641
java
package com.underwater.demo.overflappy; import java.io.File; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.scenes.scene2d.Stage; import com.uwsoft.editor.renderer.DefaultAssetManager; import com.uwsoft.editor.renderer.SceneLoader; /* * GameStage */ public class GameStage extends Stage { // Speed of pixels per second of how fast things move left (required both for menu and the game, thus put here) public float gameSpeed = 200; // Overlap2D provides this easy asset manager that loads things as they are provided by default when exporting from overlap private DefaultAssetManager assetManager; public GameStage() { super(); // Set this is input processor so all actors would be able to listen to touch events Gdx.input.setInputProcessor(this); // Initializing asset manager assetManager = new DefaultAssetManager(); // providing the list of sprite animations which is one in this case, to avoid directory listing coding assetManager.spriteAnimationNames = new String[1]; assetManager.spriteAnimationNames[0] = "bird"; // loading assets into memory assetManager.loadData(); // Menu goes first initMenu(); } public void initMenu() { clear(); // Creating Scene loader which can load an Overlap2D scene SceneLoader menuLoader = new SceneLoader(assetManager); // loading MenuScene.dt from assets folder menuLoader.loadScene(Gdx.files.internal("scenes" + File.separator + "MenuScene.dt")); // Initializing iScript MenuSceneScript that will be holding all menu logic, and passing this stage for later use MenuScreenScript menuScript = new MenuScreenScript(this); // adding this script to the root scene of menu which is hold in menuLoader.sceneActor menuLoader.sceneActor.addScript(menuScript); // Adding root actor to stage addActor(menuLoader.sceneActor); } public void initGame() { clear(); // Creating Scene loader which can load an Overlap2D scene SceneLoader mainLoader = new SceneLoader(assetManager); // loading MainScene.dt from assets folder mainLoader.loadScene(Gdx.files.internal("scenes" + File.separator + "MainScene.dt")); // Initializing iScript GameSceneScript that will be holding all game, and passing this stage for later use GameScreenScript gameScript = new GameScreenScript(this, mainLoader); // adding this script to the root scene of game which is hold in mainLoader.sceneActor mainLoader.sceneActor.addScript(gameScript); // Adding root actor to stage addActor(mainLoader.sceneActor); } }
[ "ballit85@gmail.com" ]
ballit85@gmail.com
e3e33176991a2a2965cf91836fe99b50e5b49311
5d1e33efdcc6258e5ddaaadeb91d604d3daff965
/app/src/main/java/co/urbanraw/materialdesignsample/HomeActivity.java
2109505dd0ef451736983d6230cead910188b212
[]
no_license
pulabethmage/AndroidMaterialSample
917e10d2e9c1065f782ce9831431b552a90f62fc
98fd6ac35f8cf6c31acc4194d268a6907ed458df
refs/heads/main
2023-07-05T21:28:49.836334
2021-08-08T05:51:27
2021-08-08T05:51:27
393,611,781
0
0
null
2021-08-08T05:45:38
2021-08-07T07:23:34
Java
UTF-8
Java
false
false
1,910
java
package co.urbanraw.materialdesignsample; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Toast; import com.google.android.material.floatingactionbutton.FloatingActionButton; public class HomeActivity extends AppCompatActivity { AutoCompleteTextView editTextFilledExposedDropdown; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); setTitle("Home Activity"); assert getSupportActionBar() != null; //null check getSupportActionBar().setDisplayHomeAsUpEnabled(true); //show back button // Populting the dropdwon or Spinner String[] type = new String[] {"Bed-sitter", "Single", "1- Bedroom", "2- Bedroom","3- Bedroom"}; ArrayAdapter<String> adapter = new ArrayAdapter<>( this, R.layout.dropdown_menu_popup_item, type); editTextFilledExposedDropdown = findViewById(R.id.filled_exposed_dropdown); editTextFilledExposedDropdown.setAdapter(adapter); //End Populting the dropdwon or Spinner } public void btn_fab_click(View v) { Toast.makeText(HomeActivity.this, editTextFilledExposedDropdown.getText(), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(HomeActivity.this,BottomAppbarActivity.class); startActivity(intent); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()){ //Back button press case android.R.id.home: onBackPressed(); break; } return true; } }
[ "87483405+pulabethmage@users.noreply.github.com" ]
87483405+pulabethmage@users.noreply.github.com
7a371f2799ca2ae5e01091c02dc26eafd21af981
8a8451ad557bba3ce6db486122ac765430828f79
/wanjicardb-android/storeclient/app/src/main/java/com/wjika/cardstore/consumption/adapter/CheckSpinnerAdapter.java
d21eda96dedee1cb1d021d7fac0709a2ae1fc8e7
[]
no_license
dengjiaping/wanjicardb-android
ef1b5cfde075ef672c0dc88f2ba64f0976f785fa
196eaaad762e6dc471889b12c7c5f03fa0d00738
refs/heads/master
2021-08-07T11:49:12.759690
2017-11-08T03:49:03
2017-11-08T03:49:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.wjika.cardstore.consumption.adapter; import android.content.Context; import android.view.View; import android.widget.TextView; import com.common.adapter.BaseAdapterNew; import com.common.adapter.ViewHolder; import com.wjika.cardstore.R; import java.util.List; /** * Created by Liu_Zhichao on 2016/2/16 11:54. * 下拉筛选adapter */ public class CheckSpinnerAdapter extends BaseAdapterNew<String> { private int mPosition; public CheckSpinnerAdapter(Context context, List<String> mDatas, int mPosition) { super(context, mDatas); this.mPosition = mPosition; } @Override protected int getResourceId(int Position) { return R.layout.check_spinner_item; } @Override protected void setViewData(View convertView, int position) { TextView checkSpinnerText = ViewHolder.get(convertView, R.id.check_spinner_text); checkSpinnerText.setText(getItem(position)); if (mPosition == position) { checkSpinnerText.setTextColor(getContext().getResources().getColor(R.color.home_title_bg)); } else { checkSpinnerText.setTextColor(getContext().getResources().getColor(R.color.title_text)); } } }
[ "641494970@qq.com" ]
641494970@qq.com
d61231d16a53a76830bbe18741328d10841704e4
fd3245abc0a828185ab86cf8974ee98e7a2817cf
/src/core/preprocess/analyzation/generator/TrieGenerator.java
96ce47ba8ffc1363794ed84520405f5f9403b581
[]
no_license
lam8da/text-categorization
85b12af824dc173040b265fee4123c6aaeb92e1a
1d55021e11d86f36cb5b8702d37be6e6fc6d0e14
refs/heads/master
2020-04-11T01:30:25.791309
2011-07-31T14:50:01
2011-07-31T14:50:01
32,528,703
0
1
null
null
null
null
UTF-8
Java
false
false
571
java
package core.preprocess.analyzation.generator; import core.preprocess.analyzation.interfaces.FeatureContainer; import core.preprocess.analyzation.interfaces.SimpleContainer; import core.preprocess.analyzation.trie.SimpleTrie; import core.preprocess.analyzation.trie.Trie; public class TrieGenerator extends ContainerGenerator { @Override public FeatureContainer generateFeatureContainer() { return new Trie(); } @Override public SimpleContainer generateSimpleContainer(FeatureContainer mapper) { return new SimpleTrie((Trie) mapper); } }
[ "2524872+lam8da@users.noreply.github.com" ]
2524872+lam8da@users.noreply.github.com
6660cbba211146aef197d8ed94767f5b756d1623
0dc7f08eac1e0b42a36ae4bb38b95992d3173914
/src/main/java/com/amber/rest/controller/EmployeesController.java
2e6c663fc723557b5f8f0c1d804e483d8223c67d
[]
no_license
amberlovescats14/java_spring_sql
55006334baf7eed856125aed29993a63fd7d7ec8
a3695c640c5c46010b36f3c792c2212ea814f827
refs/heads/master
2020-12-02T08:34:30.316734
2019-12-31T01:55:47
2019-12-31T01:55:47
230,943,805
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.amber.rest.controller; import com.amber.rest.exceptions.EmployeeNotFoundException; import com.amber.rest.models.Employees; import com.amber.rest.repos.EmployeesRepo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class EmployeesController { @Autowired EmployeesRepo employeesRepo; //GET ALL @GetMapping("/employees") public List<Employees> getAllEmployees(){ return employeesRepo.findAll(); } //GET ONE @GetMapping("/employees/{id}") public Employees getEmployeeById(@PathVariable(value="id") Long employeeId) throws EmployeeNotFoundException { return employeesRepo.findById(employeeId) .orElseThrow(()-> new EmployeeNotFoundException(employeeId)); } //POST @PostMapping("/employees") public Employees createEmployee(@Valid @RequestBody Employees employees){ return employeesRepo.save(employees); } // PUT @PostMapping("/employees/{id}") public Employees updateEmployee(@PathVariable(value="id") Long employeeId, @Valid @RequestBody Employees employeesDetails ) throws EmployeeNotFoundException { Employees employees = employeesRepo.findById(employeeId) .orElseThrow(()-> new EmployeeNotFoundException(employeeId)); employees.setEmployee_name(employeesDetails.getEmployee_name()); employees.setDesignation(employeesDetails.getDesignation()); Employees updatedEmployee = employeesRepo.save(employees); return updatedEmployee; } //DELETE @DeleteMapping("/employees/{id}") public ResponseEntity<?> deleteEmployee(@PathVariable(value="id") Long employeeId) throws EmployeeNotFoundException { Employees employees = employeesRepo.findById(employeeId) .orElseThrow(()-> new EmployeeNotFoundException(employeeId)); employeesRepo.delete(employees); return ResponseEntity.ok().build(); } }
[ "amberlovescats14@gmail.com" ]
amberlovescats14@gmail.com
3e4b2ad106732feba06af7942c163cf73d0f151b
5325f75a8fa30084e1d88a94ceb487bcfebdbae0
/src/main/java/com/project/diploma/services/services/implementation/ItemServiceImpl.java
8023b428ea47842229fab5d8971754fe98ef002c
[]
no_license
Stivm1718/Diploma
53ebea10d565cc97d9338821a857d237083f69e6
a960cd1626a787e8d0053984e25dc512a01a08cc
refs/heads/master
2023-06-02T20:33:37.744099
2021-06-22T21:03:15
2021-06-22T21:03:15
328,595,574
0
0
null
null
null
null
UTF-8
Java
false
false
10,826
java
package com.project.diploma.services.services.implementation; import com.project.diploma.data.models.*; import com.project.diploma.data.repositories.HeroRepository; import com.project.diploma.data.repositories.ItemRepository; import com.project.diploma.data.repositories.UserRepository; import com.project.diploma.services.models.CreateItemServiceModel; import com.project.diploma.services.services.HeroService; import com.project.diploma.services.services.ItemService; import com.project.diploma.services.services.ValidationService; import com.project.diploma.web.models.*; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Comparator; import java.util.List; import java.util.Random; import java.util.stream.Collectors; @Service public class ItemServiceImpl implements ItemService { private final ModelMapper mapper; private final ItemRepository itemRepository; private final HeroRepository heroRepository; private final ValidationService validationService; private final HeroService heroService; private final UserRepository userRepository; @Autowired public ItemServiceImpl(ModelMapper mapper, ItemRepository itemRepository, HeroRepository heroRepository, ValidationService validationService, HeroService heroService, UserRepository userRepository) { this.mapper = mapper; this.itemRepository = itemRepository; this.heroRepository = heroRepository; this.validationService = validationService; this.heroService = heroService; this.userRepository = userRepository; } @Override public boolean create(CreateItemServiceModel model) throws Exception { if (validationService.isValidItemName(model)) { return false; } if ((model.getPriceInGold() == null && model.getPriceInMoney() == null) || (model.getPriceInGold() != null && model.getPriceInMoney() != null)) { return false; } itemRepository.saveAndFlush(mapper.map(model, Item.class)); return true; } @Override public List<ViewItemModel> takeAllItemsThatAreNotThere(String heroName) { return this.itemRepository.findAll() .stream() .filter(i -> !i.getHeroes().stream() .map(Hero::getName) .collect(Collectors.toList()).contains(heroName)) .map(u -> this.mapper.map(u, ViewItemModel.class)) .collect(Collectors.toList()); } @Override public void addHeroItemForAdmin(String heroName, String itemName) { Hero hero = heroRepository.findHeroByName(heroName); Item item = itemRepository.getItemByName(itemName); insertItemAndHeroInDatabase(hero, item); } @Override public ShowItemsHero getItemsOfHero(String heroName) { DetailsHeroModel details = heroService.detailsHero(heroName); return mapper.map(details, ShowItemsHero.class); } @Override public List<ViewItemModelWithTypePay> takeItemWithGoldForPay(String heroName) { return itemRepository .findAll() .stream() .filter(i -> i.getPay().equals(Pay.GOLD)) .filter(i -> !i.getHeroes().stream() .map(Hero::getName) .collect(Collectors.toList()).contains(heroName)) .sorted(Comparator.comparingInt(Item::getLevel)) .map(u -> this.mapper.map(u, ViewItemModelWithTypePay.class)) .collect(Collectors.toList()); } @Override public List<ViewItemModelWithTypePay> takeItemWithMoneyForPay(String heroName) { return itemRepository .findAll() .stream() .filter(i -> i.getPay().equals(Pay.MONEY)) .filter(i -> !i.getHeroes().stream() .map(Hero::getName) .collect(Collectors.toList()).contains(heroName)) .sorted(Comparator.comparingInt(Item::getLevel)) .map(u -> this.mapper.map(u, ViewItemModelWithTypePay.class)) .collect(Collectors.toList()); } @Override public Pay getWayToPay(String name) { return itemRepository.getItemByName(name).getPay(); } @Override public boolean buyItemWithGold(String heroName, String itemName) { Hero hero = heroRepository.findHeroByName(heroName); User user = hero.getUser(); Item item = itemRepository.getItemByName(itemName); if (item.getPriceInGold() <= user.getGold()) { insertItemAndHeroInDatabase(hero, item); user.setGold(user.getGold() - item.getPriceInGold()); userRepository.saveAndFlush(user); return true; } return false; } @Override public boolean existItem(String name) { return itemRepository.existsItemByName(name); } @Override public SelectItemsModel getTheBestItemsOfOpponent(String nameHero) { List<Item> items = heroRepository.findHeroByName(nameHero).getItems(); String weaponName = selectTheBestWeapon(items, Slot.WEAPON); String helmetName = selectTheBestWeapon(items, Slot.HELMET); String pauldronName = selectTheBestWeapon(items, Slot.PAULDRON); String padsName = selectTheBestWeapon(items, Slot.PADS); String gauntletName = selectTheBestWeapon(items, Slot.GAUNTLET); SelectItemsModel model = new SelectItemsModel(); model.setGauntlets(gauntletName); getNamePictureGauntlets(model, gauntletName); model.setHelmet(helmetName); getNamePictureHelmet(model, helmetName); model.setPads(padsName); getNamePicturePads(model, padsName); model.setPauldron(pauldronName); getNamePicturePauldron(model, pauldronName); model.setWeapon(weaponName); getNamePictureWeapon(model, weaponName); return model; } @Override public void getNamesPictureItems(SelectItemsModel model) { getNamePictureHelmet(model, model.getHelmet()); getNamePictureWeapon(model, model.getWeapon()); getNamePicturePads(model, model.getPads()); getNamePicturePauldron(model, model.getPauldron()); getNamePictureGauntlets(model, model.getGauntlets()); } @Override public SelectItemsModel getItemsOfBot(String name, Integer level) { List<Item> items = itemRepository .findAll() .stream() .filter(i -> (i.getLevel() >= level - 5) || (i.getLevel() <= level + 5)) .collect(Collectors.toList()); Random random = new Random(); SelectItemsModel model = new SelectItemsModel(); Item weapon = getRandomItem(items, random, Slot.WEAPON); if (weapon != null) { model.setWeapon(weapon.getName()); model.setItemPictureWeapon(weapon.getItemPicture()); } Item helmet = getRandomItem(items, random, Slot.HELMET); if (helmet != null) { model.setHelmet(helmet.getName()); model.setItemPictureHelmet(helmet.getItemPicture()); } Item gauntlet = getRandomItem(items, random, Slot.GAUNTLET); if (gauntlet != null){ model.setGauntlets(gauntlet.getName()); model.setItemPictureGauntlets(gauntlet.getItemPicture()); } Item pad = getRandomItem(items, random, Slot.PADS); if (pad != null){ model.setPads(pad.getName()); model.setItemPicturePads(pad.getItemPicture()); } Item pauldron = getRandomItem(items, random, Slot.PAULDRON); if (pauldron != null){ model.setPauldron(pauldron.getName()); model.setItemPicturePauldron(pauldron.getItemPicture()); } return model; } @Override public void deleteItem(String name) { String itemName = name.replace("delete", ""); Item item = itemRepository.getItemByName(itemName); List<Hero> heroes = item.getHeroes(); Hero hero; for(int i = heroes.size() - 1; i >=0; i--){ hero = heroes.get(i); hero.getItems().remove(item); item.getHeroes().remove(hero); heroRepository.saveAndFlush(hero); } itemRepository.delete(item); } private Item getRandomItem(List<Item> items, Random random, Slot slot) { List<Item> slots = items .stream() .filter(i -> i.getSlot().equals(slot)) .collect(Collectors.toList()); slots.add(null); return slots.get(random.nextInt(slots.size())); } private void getNamePictureGauntlets(SelectItemsModel model, String gauntlets) { if (gauntlets != null) { model.setItemPictureGauntlets(itemRepository.getItemByName(gauntlets).getItemPicture()); } } private void getNamePicturePauldron(SelectItemsModel model, String pauldron) { if (pauldron != null) { model.setItemPicturePauldron(itemRepository.getItemByName(pauldron).getItemPicture()); } } private void getNamePicturePads(SelectItemsModel model, String pads) { if (pads != null) { model.setItemPicturePads(itemRepository.getItemByName(pads).getItemPicture()); } } private void getNamePictureWeapon(SelectItemsModel model, String weapon) { if (weapon != null) { model.setItemPictureWeapon(itemRepository.getItemByName(weapon).getItemPicture()); } } private void getNamePictureHelmet(SelectItemsModel model, String helmet) { if (helmet != null) { model.setItemPictureHelmet(itemRepository.getItemByName(helmet).getItemPicture()); } } private String selectTheBestWeapon(List<Item> items, Slot slot) { List<Item> result = items .stream() .filter(i -> i.getSlot().equals(slot)) .sorted((a, b) -> { int powerA = a.getStamina() + a.getAttack() + a.getStrength() + a.getDefence(); int powerB = b.getStamina() + b.getAttack() + b.getStrength() + b.getDefence(); return powerB - powerA; }) .collect(Collectors.toList()); return result.size() == 0 ? null : result.get(0).getName(); } private void insertItemAndHeroInDatabase(Hero hero, Item item) { hero.getItems().add(item); item.getHeroes().add(hero); heroRepository.saveAndFlush(hero); itemRepository.saveAndFlush(item); } }
[ "stivanm1998@gmail.com" ]
stivanm1998@gmail.com
161a11c93a7b34d65c32247cc35b9270ea313b4a
beffc6542dc4bf85946ceca7cca4a31ac230d376
/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java
8fe8430f482dd7d8c167d255684e1eb78712cb4e
[ "Apache-2.0" ]
permissive
ZhouKaiDongGitHub/spring-boot-2.0.x
4395970b183eff7321748d4ad0155784aa94eaa6
3f443764747c4ee01085bed6381292fa44744a49
refs/heads/master
2023-01-07T07:27:51.067468
2020-09-13T07:13:04
2020-09-13T07:13:04
215,676,265
1
0
Apache-2.0
2022-12-27T14:52:46
2019-10-17T01:24:02
Java
UTF-8
Java
false
false
5,726
java
/* * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.gradle.plugin; import java.io.File; import java.io.IOException; import java.net.JarURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.Arrays; import java.util.List; import java.util.jar.Attributes; import java.util.jar.JarFile; import org.gradle.api.GradleException; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ResolvableDependencies; import org.gradle.util.GradleVersion; import org.springframework.boot.gradle.dsl.SpringBootExtension; import org.springframework.boot.gradle.tasks.bundling.BootJar; import org.springframework.boot.gradle.tasks.bundling.BootWar; /** * Gradle plugin for Spring Boot. * * @author Phillip Webb * @author Dave Syer * @author Andy Wilkinson * @author Danny Hyun * @since 1.2.7 */ public class SpringBootPlugin implements Plugin<Project> { private static final String SPRING_BOOT_VERSION = determineSpringBootVersion(); /** * The name of the {@link Configuration} that contains Spring Boot archives. * @since 2.0.0 */ public static final String BOOT_ARCHIVES_CONFIGURATION_NAME = "bootArchives"; /** * The name of the default {@link BootJar} task. * @since 2.0.0 */ public static final String BOOT_JAR_TASK_NAME = "bootJar"; /** * The name of the default {@link BootWar} task. * @since 2.0.0 */ public static final String BOOT_WAR_TASK_NAME = "bootWar"; /** * The coordinates {@code (group:name:version)} of the * {@code spring-boot-dependencies} bom. */ public static final String BOM_COORDINATES = "org.springframework.boot:spring-boot-dependencies:" + SPRING_BOOT_VERSION; @Override public void apply(Project project) { verifyGradleVersion(); createExtension(project); Configuration bootArchives = createBootArchivesConfiguration(project); registerPluginActions(project, bootArchives); unregisterUnresolvedDependenciesAnalyzer(project); } private void verifyGradleVersion() { if (GradleVersion.current().compareTo(GradleVersion.version("4.0")) < 0) { throw new GradleException("Spring Boot plugin requires Gradle 4.0 or later." + " The current version is " + GradleVersion.current()); } } private void createExtension(Project project) { project.getExtensions().create("springBoot", SpringBootExtension.class, project); } private Configuration createBootArchivesConfiguration(Project project) { Configuration bootArchives = project.getConfigurations().create(BOOT_ARCHIVES_CONFIGURATION_NAME); bootArchives.setDescription("Configuration for Spring Boot archive artifacts."); return bootArchives; } private void registerPluginActions(Project project, Configuration bootArchives) { SinglePublishedArtifact singlePublishedArtifact = new SinglePublishedArtifact(bootArchives.getArtifacts()); List<PluginApplicationAction> actions = Arrays.asList(new JavaPluginAction(singlePublishedArtifact), new WarPluginAction(singlePublishedArtifact), new MavenPluginAction(bootArchives.getUploadTaskName()), new DependencyManagementPluginAction(), new ApplicationPluginAction(), new KotlinPluginAction()); for (PluginApplicationAction action : actions) { Class<? extends Plugin<? extends Project>> pluginClass = action.getPluginClass(); if (pluginClass != null) { project.getPlugins().withType(pluginClass, (plugin) -> action.execute(project)); } } } private void unregisterUnresolvedDependenciesAnalyzer(Project project) { UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer(); project.getConfigurations().all((configuration) -> { ResolvableDependencies incoming = configuration.getIncoming(); incoming.afterResolve((resolvableDependencies) -> { if (incoming.equals(resolvableDependencies)) { unresolvedDependenciesAnalyzer.analyze(configuration.getResolvedConfiguration() .getLenientConfiguration().getUnresolvedModuleDependencies()); } }); }); project.getGradle().buildFinished((buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project)); } private static String determineSpringBootVersion() { String implementationVersion = DependencyManagementPluginAction.class.getPackage().getImplementationVersion(); if (implementationVersion != null) { return implementationVersion; } URL codeSourceLocation = DependencyManagementPluginAction.class.getProtectionDomain().getCodeSource() .getLocation(); try { URLConnection connection = codeSourceLocation.openConnection(); if (connection instanceof JarURLConnection) { return getImplementationVersion(((JarURLConnection) connection).getJarFile()); } try (JarFile jarFile = new JarFile(new File(codeSourceLocation.toURI()))) { return getImplementationVersion(jarFile); } } catch (Exception ex) { return null; } } private static String getImplementationVersion(JarFile jarFile) throws IOException { return jarFile.getManifest().getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION); } }
[ "Kaidong.Zhou@eisgroup.com" ]
Kaidong.Zhou@eisgroup.com
7f2eee8226d366010897182c1557db9efcdb6b39
c410d90987c58b13510d05a19db709d7d13ece07
/src/chap03/c02/MainForScope.java
38ceeeea41ea678e61c1f248035802b5d76c36da
[]
no_license
xodgree/springPro01
b473208bb57a5659e96250f429b4426a2ec56998
e2fe29146c73e954d0057b58f1972fbe1f61175d
refs/heads/master
2021-04-09T11:40:07.322017
2018-03-22T08:48:02
2018-03-22T08:48:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package chap03.c02; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.GenericXmlApplicationContext; public class MainForScope { public static void main(String[] args) { useXml(); System.out.println("*******************"); useJava(); } private static void useXml() { System.out.println("======XML Meta======"); String configLocation = "classpath:chap03/c02/config-for-scope.xml"; GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(configLocation); WorkScheduler scheduler = ctx.getBean("workScheduler", WorkScheduler.class); scheduler.makeAndRunWork(); ctx.close(); } private static void useJava() { System.out.println("=====Java Meta====="); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ConfigForScope.class); WorkScheduler scheduler = ctx.getBean("workScheduler", WorkScheduler.class); scheduler.makeAndRunWork(); ctx.close(); } }
[ "zhdzhdgl@gmail.com" ]
zhdzhdgl@gmail.com
ba65a273ac227e6ae84bb124f044ce0074d3a39a
11d6020b70c4ba465abd976a5aed866bcf9c4fac
/src/com/fameden/model/FamedenLoginRequest.java
a3e35941cc4a6034ac259b8b97f3efbb702e4799
[]
no_license
ravjot28/FameDenWebService
e19a5f86c0fc296b65fc76d35d5ebfdf758e305b
fdc96092a5f00d85c01eb96a9b904443dbfad464
refs/heads/master
2021-01-20T11:23:13.636142
2013-10-20T15:44:37
2013-10-20T15:44:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.fameden.model; public class FamedenLoginRequest extends GenericRequest { private String password; private String loginMode; public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getLoginMode() { return loginMode; } public void setLoginMode(String loginMode) { this.loginMode = loginMode; } }
[ "ravjot28@gmail.com" ]
ravjot28@gmail.com
26635c43146622fd8daa707c233e4bef625431f0
7820992aa7c82d5765918ebdaf555ce6a7e16bc1
/src/com/wanmei/tool/upload/ImageOrFileUploadUtils.java
da2e43fa1a77f55fe1d3e45eaaf16a06d7e33afa
[]
no_license
jy04651111/mvccoder
9c298945a331a2e0383fb89c15608c7850ea76ff
e1393b56d51a958fc134a619584bf25995d3969a
refs/heads/master
2021-01-15T18:08:32.556526
2012-07-20T09:54:25
2012-07-20T09:54:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,317
java
package com.wanmei.tool.upload; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Image; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Date; import javax.imageio.ImageIO; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; import com.wanmei.util.ConfigUtil; /** * User: joeytang * Date: 2012-03-20 18:17 * 图片上传、缩放、文字水印、图片水印 */ public class ImageOrFileUploadUtils { // private static final int BUFFER_SIZE = 1024 * 1024; //1M private Log log = LogFactory.getLog(getClass()); /** * 文件大小 */ private int bufferSize = 1024 * 1024; //1M /** * 缩略图宽 */ private int zoomWidth = 130; /** * 缩略图高 */ private int zoomHeight = 80; /** * 上传路径 /view/chibi/guild-logo/1/ */ private String filePath; /** * 文字水印 */ private String textTitle; /** * 图片水印 /view/chibi/guild-logo/write.gif */ private String waterImgPath; // 输入参数:上传过来的文件路径 private File file; /** * 输入参数:文件名称 由struts的拦截器默认赋值,注意setter的写法:file+fileName */ private String fileName; /** * 输入参数 由struts的拦截器默认赋值,注意setter的写法:file+contentType */ private String contentType; // 输出参数 private String imageFileName; // 输出参数:原图保存路径 private String ipath; // 输出参数:缩略图保存路径 private String imgPath; // 输出参数 private String json; public ImageOrFileUploadUtils() { } /** * 得到文件名称 * * @param fileName * @return */ public String getExtention(String fileName) { int pos = fileName.lastIndexOf("."); return fileName.substring(pos); } /** * 拷贝 * * @param src 原地址 * @param dist 目标地址 * @throws Exception */ private void copy(File src, File dist) throws Exception { log.debug("[src]--" + src); log.debug("[dist]--" + dist); try { InputStream in = null; OutputStream out = null; try { in = new BufferedInputStream(new FileInputStream(src), this.bufferSize); out = new BufferedOutputStream(new FileOutputStream(dist), this.bufferSize); byte[] buf = new byte[this.bufferSize]; while (in.read(buf) > 0) { out.write(buf); } out.close(); in.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (in != null) in.close(); if (out != null) out.close(); } } catch (Exception e) { e.printStackTrace(); throw new Exception(e); } } /** * 图片上传 */ public void uploadImage() throws Exception { log.debug("[file]--" + file); log.debug("[file name]--" + fileName); imageFileName = new Date().getTime() + getExtention(fileName); // 得到文件存放路径 log.debug("[imageFileName]--" + imageFileName); String dir = ConfigUtil.defaultHomePath() + ConfigUtil.FILE_SEPARATOR + this.filePath; File dirs = new File(dir); if (!dirs.exists()) dirs.mkdir(); // 使用原来的文件名保存图片 String path = dir + imageFileName; File imageFile = new File(path); copy(file, imageFile); // 大图路径 ipath = this.filePath + imageFileName; } /** * 缩放处理 * * @return */ public void zoom(File imageFile) throws Exception { log.debug("[zoom][imageFile]--" + imageFile); try { // 缩略图存放路径 File todir = new File(ConfigUtil.defaultHomePath() + ConfigUtil.FILE_SEPARATOR + this.filePath + "zoom"); if (!todir.exists()) { todir.mkdir(); } if (!imageFile.isFile()) throw new Exception(imageFile + " is not image file error in CreateThumbnail!"); File sImg = new File(todir, this.imageFileName); BufferedImage Bi = ImageIO.read(imageFile); // 假设图片宽 高 最大为130 80,使用默认缩略算法 Image Itemp = Bi.getScaledInstance(this.zoomWidth, this.zoomHeight, Image.SCALE_DEFAULT); double Ratio = 0.0; if ((Bi.getHeight() > this.zoomWidth) || (Bi.getWidth() > this.zoomHeight)) { if (Bi.getHeight() > Bi.getWidth()) Ratio = Double.parseDouble(String.valueOf(this.zoomHeight)) / Double.parseDouble(String.valueOf(Bi.getHeight())); else Ratio = Double.parseDouble(String.valueOf(this.zoomWidth)) / Double.parseDouble(String.valueOf(Bi.getWidth())); AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(Ratio, Ratio), null); Itemp = op.filter(Bi, null); } ImageIO.write((BufferedImage) Itemp, "jpg", sImg); imgPath = this.filePath + "zoom/" + this.imageFileName; } catch (IOException e) { e.printStackTrace(); throw new Exception(e); } } /** * 添加文字水印 * * @return * @throws Exception * @throws Exception */ public void watermark(File img) throws Exception { log.debug("[watermark file name]--" + img.getPath()); try { if (!img.exists()) { throw new IllegalArgumentException("file not found!"); } log.debug("[watermark][img]--" + img); // 创建一个FileInputStream对象从源图片获取数据流 FileInputStream sFile = new FileInputStream(img); // 创建一个Image对象并以源图片数据流填充 Image src = ImageIO.read(sFile); // 得到源图宽 int width = src.getWidth(null); // 得到源图长 int height = src.getHeight(null); // 创建一个BufferedImage来作为图像操作容器 BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // 创建一个绘图环境来进行绘制图象 Graphics2D g = image.createGraphics(); // 将原图像数据流载入这个BufferedImage log.debug("width:" + width + " height:" + height); g.drawImage(src, 0, 0, width, height, null); // 设定文本字体 g.setFont(new Font("宋体", Font.BOLD, 28)); String rand = this.textTitle; // 设定文本颜色 g.setColor(Color.blue); // 设置透明度 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f)); // 向BufferedImage写入文本字符,水印在图片上的坐标 g.drawString(rand, width - (width - 20), height - (height - 60)); // 使更改生效 g.dispose(); // 创建输出文件流 FileOutputStream outi = new FileOutputStream(img); // 创建JPEG编码对象 JPEGImageEncoder encodera = JPEGCodec.createJPEGEncoder(outi); // 对这个BufferedImage (image)进行JPEG编码 encodera.encode(image); // 关闭输出文件流 outi.close(); sFile.close(); } catch (IOException e) { e.printStackTrace(); throw new Exception(e); } } /** * 添加图片水印 */ public void imageWaterMark(File imgFile) throws Exception { try { // 目标文件 Image src = ImageIO.read(imgFile); int wideth = src.getWidth(null); int height = src.getHeight(null); BufferedImage image = new BufferedImage(wideth, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); g.drawImage(src, 0, 0, wideth, height, null); // 水印文件 路径 String waterImgPath = ConfigUtil.defaultHomePath() + ConfigUtil.FILE_SEPARATOR + this.waterImgPath; File waterFile = new File(waterImgPath); Image waterImg = ImageIO.read(waterFile); int w_wideth = waterImg.getWidth(null); int w_height = waterImg.getHeight(null); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f)); g.drawImage(waterImg, (wideth - w_wideth) / 2, (height - w_height) / 2, w_wideth, w_height, null); // 水印文件结束 g.dispose(); FileOutputStream out = new FileOutputStream(imgFile); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode(image); out.close(); } catch (Exception e) { e.printStackTrace(); } } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getTextTitle() { return textTitle; } public void setTextTitle(String textTitle) { this.textTitle = textTitle; } public String getWaterImgPath() { return waterImgPath; } public void setWaterImgPath(String waterImgPath) { this.waterImgPath = waterImgPath; } public File getFile() { return file; } public void setFile(File file) { this.file = file; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } public String getImageFileName() { return imageFileName; } public void setImageFileName(String imageFileName) { this.imageFileName = imageFileName; } public String getIpath() { return ipath; } public void setIpath(String ipath) { this.ipath = ipath; } public String getImgPath() { return imgPath; } public void setImgPath(String imgPath) { this.imgPath = imgPath; } public String getJson() { return json; } public void setJson(String json) { this.json = json; } public int getZoomWidth() { return zoomWidth; } public void setZoomWidth(int zoomWidth) { this.zoomWidth = zoomWidth; } public int getZoomHeight() { return zoomHeight; } public void setZoomHeight(int zoomHeight) { this.zoomHeight = zoomHeight; } public int getBufferSize() { return bufferSize; } public void setBufferSize(int bufferSize) { this.bufferSize = bufferSize; } }
[ "tanghc@163.com" ]
tanghc@163.com
c953e30b11fc75a9f4d8dacf1998ecc597ff53a4
16024a8ce673a3ece864b80897f14512359a7b31
/Exercícios06_08_2021/Cliente01.java
a2185942cbd3183db29fff043f455548ed255a60
[]
no_license
BrunaGam/Generation
dbb689b1f508b77c79a7a8cbda371b4684eb819a
0f2ed53cfeb397def20204e74eec8f7acd126b2a
refs/heads/master
2023-07-08T20:18:37.547771
2021-08-11T20:12:26
2021-08-11T20:12:26
391,755,079
1
0
null
null
null
null
ISO-8859-1
Java
false
false
762
java
package AtividadeGeneration04POO; public class Cliente01 { //Crie uma classe cliente e apresente os atributos e métodos referentes esta classe, em seguida crie um objeto cliente, defina as instancias deste objeto e //apresente as informações deste objeto no console. private String nomeCompleto; private String adressCliente; private String telefonCliente; private String idCliente; public Cliente01 (String nome, String endereço, String telefone, String id) { nomeCompleto=nome; adressCliente=endereço; telefonCliente=telefone; idCliente=id; } public String getinformacoesCliente() { String informacoesCliente = nomeCompleto + " "+ adressCliente + " "+ telefonCliente + " " + idCliente; return informacoesCliente; } }
[ "brubru.amoretti@gmail.com" ]
brubru.amoretti@gmail.com
d61ffb69566bd317c0302cba63428f1f9a712a53
2547b1365e18509068e4df17e35eb7915458adec
/ingsw/src/test/java/ingsw/TestServer/GameFlow/GridSetupStateTest.java
1f29f321f1960798e795a953b3e6182c1f738a5f
[]
no_license
gianmarco27/Sagrada
924438cbbd6f254a4f55aace41131ac33bd16225
a7a921a84b91836dcd58dd99bff514d4484368cd
refs/heads/master
2020-05-04T17:16:31.634003
2019-04-03T14:13:16
2019-04-03T14:13:16
179,303,587
0
0
null
null
null
null
UTF-8
Java
false
false
2,230
java
package ingsw.TestServer.GameFlow; import ingsw.Server.Dice.DiceBag; import ingsw.Server.GameBoard; import ingsw.Server.GameFlow.GameFlowHandler; import ingsw.Server.GameFlow.GameFlowStates.GridSetupState; import ingsw.Server.Grid.GridBag; import ingsw.Server.Player; import ingsw.TestServer.Mockers.GameBoardMocker; import org.junit.Assert; import org.junit.Test; import static java.lang.Thread.sleep; public class GridSetupStateTest { GameFlowHandler gameFH = new GameFlowHandler(); GameBoardMocker gbMock = new GameBoardMocker(); GameBoard gb = gbMock.getGameBoard(1, 4); public GridSetupStateTest() { gameFH.gameBoard = gb; gameFH.setState(gameFH.gridSetupState); } @Test public void testGridChoiche() { gameFH.gridsBag = new GridBag(); Thread execution = new Thread(() -> gameFH.getCurrent().execute()); execution.start(); Thread playersGridPick = new Thread(() -> { Boolean executed = false; while (execution.isAlive() && !executed) { if (execution.getState() == Thread.State.TIMED_WAITING) { for (Player p : gb.getActivePlayers()) { p.setConnected(true); ((GridSetupState) gameFH.getCurrent()).chooseGrid(p, p.getPossibleGrids()[0]); } executed = true; } } }); playersGridPick.start(); Thread playersAck = new Thread(() -> { while (execution.isAlive()) { if (execution.getState() == Thread.State.TIMED_WAITING) { for (Player p : gb.getActivePlayers()) { p.setConnected(true); gameFH.getCurrent().ack(p); } } } }); playersAck.start(); try { execution.join(); } catch (InterruptedException e) { e.printStackTrace(); } Assert.assertEquals(gameFH.toolsSetupState, gameFH.getCurrent()); for (Player p : gb.getActivePlayers()) { Assert.assertEquals(p.getPossibleGrids()[0], p.getGrid()); } } }
[ "gianmarco.poggi@mail.polimi.it" ]
gianmarco.poggi@mail.polimi.it
9bcb6f64f2b30dbfbf3b0211786af2134b280301
fab44f880229bffdb2d685d0b48190b7f38aef54
/DrawAndGuessClient/src/UserPanel.java
cb3cb4278b75af608f98932f4c83fb2912933e78
[]
no_license
FJR-Nancy/you-draw-I-guess
ec744ea978385a9cf5bf0c70c17d4ce93620e669
abcf348292dd33430c3d459f758e6101351619a5
refs/heads/master
2016-08-12T23:37:32.609439
2015-10-29T01:32:57
2015-10-29T01:32:57
45,151,322
1
1
null
null
null
null
GB18030
Java
false
false
2,565
java
import java.awt.FlowLayout; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class UserPanel extends JPanel{ private JLabel userLabel1, userLabel2, userLabel3, userLabel4, userLabel5, userLabel6; JLabel scoreLabel1, scoreLabel2, scoreLabel3, scoreLabel4, scoreLabel5, scoreLabel6; JLabel nameLabel1, nameLabel2, nameLabel3, nameLabel4, nameLabel5, nameLabel6; UserPanel(){ userLabel1 = new JLabel(); userLabel1.setIcon(new ImageIcon("resource/1.jpg")); userLabel2 = new JLabel(); userLabel2.setIcon(new ImageIcon("resource/1.jpg")); userLabel3 = new JLabel(); userLabel3.setIcon(new ImageIcon("resource/1.jpg")); userLabel4 = new JLabel(); userLabel4.setIcon(new ImageIcon("resource/1.jpg")); userLabel5 = new JLabel(); userLabel5.setIcon(new ImageIcon("resource/1.jpg")); userLabel6 = new JLabel(); userLabel6.setIcon(new ImageIcon("resource/1.jpg")); scoreLabel1 = new JLabel("积分"); scoreLabel2 = new JLabel("积分"); scoreLabel3 = new JLabel("积分"); scoreLabel4 = new JLabel("积分"); scoreLabel5 = new JLabel("积分"); scoreLabel6 = new JLabel("积分"); nameLabel1 = new JLabel("姓名"); nameLabel2 = new JLabel("姓名"); nameLabel3 = new JLabel("姓名"); nameLabel4 = new JLabel("姓名"); nameLabel5 = new JLabel("姓名"); nameLabel6 = new JLabel("姓名"); Box box1 = new Box(BoxLayout.Y_AXIS); box1.add(userLabel1); box1.add(nameLabel1); box1.add(scoreLabel1); Box box2 = new Box(BoxLayout.Y_AXIS); box2.add(userLabel2); box2.add(nameLabel2); box2.add(scoreLabel2); Box box3 = new Box(BoxLayout.Y_AXIS); box3.add(userLabel3); box3.add(nameLabel3); box3.add(scoreLabel3); Box box4 = new Box(BoxLayout.Y_AXIS); box4.add(userLabel4); box4.add(nameLabel4); box4.add(scoreLabel4); Box box5 = new Box(BoxLayout.Y_AXIS); box5.add(userLabel5); box5.add(nameLabel5); box5.add(scoreLabel5); Box box6 = new Box(BoxLayout.Y_AXIS); box6.add(userLabel6); box6.add(nameLabel6); box6.add(scoreLabel6); setLayout(new FlowLayout()); add(box1); add(box2); add(box3); add(box4); add(box5); add(box6); } //测试 public static void main(String[] args){ JFrame frame = new JFrame(); JPanel panel = new UserPanel(); frame.add(panel); frame.setSize(800, 200); frame.setVisible(true); } }
[ "FanJiarou@gmail.com" ]
FanJiarou@gmail.com
7d8cd2c8f5cbb287407cd9db9f51de4afa892b2d
e3c81e7379ec995ec54fa5ca81cc7ccc12466e10
/src/application/Main.java
75a1d2c804eb08b54f8d88875553df4f1ec5ca9c
[]
no_license
hugbubby/Instructor-Assigned-Team-2
df5eebdc4175af0d7cf1bea48ce1090ad80b163b
3fe2e9836f6037caf5440c377b1050e4c6284272
refs/heads/master
2020-09-22T05:56:36.108235
2019-12-03T05:10:56
2019-12-03T05:10:56
224,698,885
0
0
null
2019-11-30T22:12:25
2019-11-28T17:13:14
Java
UTF-8
Java
false
false
846
java
package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; /* * Purpose: * * Parameters: * * Returns: * * Notes: * */ public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { try { AnchorPane root = FXMLLoader.load(getClass().getResource("view/Login.fxml")); Scene scene = new Scene(root, 800, 800); scene.getStylesheets().add(getClass().getResource("view/application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } catch (Exception e) { e.printStackTrace(); } } }
[ "dean@dean.com" ]
dean@dean.com
d075c2d162f9d3051fcf431aa630b0fe7eb7e7e3
877f3de9a55544323a53c54c499da74375f27661
/src/state/State.java
0108b7bdb5cb10ad9612735132700769320861ec
[]
no_license
PlumpMath/DesignPattern-67
ffc9105b5695052475b11e3e93adc8b239009fbe
71c5a05a66f11f3e82ec052814da3c1e71b9bf93
refs/heads/master
2021-01-20T09:32:57.121557
2015-03-16T04:59:34
2015-03-16T04:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package state; public class State { private String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } public void method1() { System.out.println("execute the first opt!"); } public void method2() { System.out.println("execute the second opt!"); } }
[ "304381616@qq.com" ]
304381616@qq.com