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
8df25df966d3c6c33d2d5467c4ee1a65d093fa55
8c019e222fc43bf07e3d57b9312ff72f5e7e7bf7
/WSPlayer/src/cn/lois/video/wsplayer/RecordPlayer.java
a9346367fc4a9310297db5dec2deb4374d9cf5b5
[]
no_license
Ginkgo001/EclipseWorkspace
a36501d612104c154c9bac1ebe96d3fd2095185b
7d5aaa1bca7c3197284580fe3818bc2b3b89b942
refs/heads/master
2021-01-13T02:08:11.187538
2014-07-07T07:49:22
2014-07-07T07:49:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,842
java
package cn.lois.video.wsplayer; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.nio.ByteBuffer; import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.GridView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; public class RecordPlayer extends Activity { private VideoView mVideoView = null; private TextView mStatusText = null; private GridView mToolsView; private Handler mHandler = new Handler(); OutputStream outstream; InputStream h264stream; boolean mPlaying; boolean mPause; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // No Title bar requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.record); mVideoView = (VideoView) findViewById(R.id.videoView); mStatusText = (TextView) findViewById(R.id.statusText); mToolsView = (GridView) findViewById(R.id.toolsView); Intent i = this.getIntent(); Bundle b = i.getExtras(); mIp = b.getString("ip"); mPort = b.getInt("port"); mRecordId = b.getString("recordId"); mSkey = b.getString("skey"); String[] names = new String[] {"停止", "暂停", "截图", "录像"}; int[] icons = new int[] { R.drawable.back, R.drawable.pause, R.drawable.cut, R.drawable.movie}; mToolsView.setAdapter(new ImageListAdapter(this, names, icons)); mToolsView.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(AdapterView<?> adapter,//The AdapterView where the click happened View view,//The view within the AdapterView that was clicked int position,//The position of the view in the adapter long rowid//The row id of the item that was clicked ) { switch(position) { case 0: mPlaying = false; break; case 1: mPause = !mPause; if (mPause) { view.setBackgroundColor(0xFFF7F6F3); } else { view.setBackgroundColor(Color.TRANSPARENT); } break; case 2: // 截图 mVideoView.Snap(); break; case 3: // 录像 if (mVideoView.Record()) { view.setBackgroundColor(0xFFF7F6F3); } else { view.setBackgroundColor(Color.TRANSPARENT); } break; } } }); this.setResult(RESULT_OK, new Intent()); mVideoView.InitVideoView(mStatusText); mPlaying = true; mPause = false; new Thread(new Runnable(){ public void run() { StartPlayRecord(); } }).start(); } String mIp; int mPort; String mRecordId; String mSkey; private byte[] head = new byte[4]; private boolean RecvOnce(InputStream stream, byte[] b, int pos, int count) throws IOException { if (count == 0) return true; int total = 0; int r = 0; while((r = stream.read(b, pos + total, count - total)) > 0) { total += r; if (total == count) return true; } return false; } private boolean ReadOneRecord(InputStream stream, ByteBuffer buffer) { buffer.position(0); byte[] b = buffer.array(); try { while(mPlaying) { if (RecvOnce(stream, head, 0, 4)) { int len = (( 0xFF & head[3]) * 256 + (0xFF & head[2])); len = len * 4 + head[1]; if (len > 0 && RecvOnce(stream, b, 0, len)) { if (head[0] == 255) { return false; } else if (head[0] == 0) // video { buffer.position(len); return true; } else if (head[0] == 1) // audio { buffer.position(len); mVideoView.PutAudio(buffer); } continue; } } break; } } catch (Exception e1) { e1.printStackTrace(); } return false; } private void StartPlayRecord() { Socket socket = null; mPlaying = true; try { socket = new Socket(mIp, mPort); h264stream = socket.getInputStream(); outstream = socket.getOutputStream(); String setup = "Setup!:"; setup += mRecordId; setup += "\r\nStart\r\n"; byte[] send = setup.getBytes(); outstream.write(send); outstream.flush(); ByteBuffer pInBuffer = ByteBuffer.allocate(51200); long playTime = System.currentTimeMillis() - 40; byte[] in = pInBuffer.array(); while (mPlaying && ReadOneRecord(h264stream, pInBuffer)) { mVideoView.Decode(pInBuffer); playTime += ( 0xFF & in[1]) * 256 + (0xFF & in[0]); long sleep = playTime - System.currentTimeMillis(); if (sleep > 0) { Thread.sleep(sleep); } else { playTime -= sleep; } while(mPause && mPlaying) { Thread.sleep(100); } } } catch (Exception e1) { e1.printStackTrace(); } finally { mPlaying = false; try { socket.shutdownInput(); socket.shutdownOutput(); socket.close(); } catch(Exception e) { } mHandler.post(new Runnable() { public void run() { finish(); } }); } } protected void onDestroy() { super.onDestroy(); mVideoView.Cleanup(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { // land do nothing is ok } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { // port do nothing is ok } } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (mStatusText.getText().length() > 0) { mStatusText.setText(""); return true; } else if (mToolsView.getVisibility() == View.VISIBLE) { mToolsView.setVisibility(View.INVISIBLE); return true; } else if (mPlaying){ mPlaying = false; return true; } else { finish(); return true; } } else if (keyCode == KeyEvent.KEYCODE_MENU) { if (mToolsView.getVisibility() == View.VISIBLE) { mToolsView.setVisibility(View.INVISIBLE); return true; } else { mToolsView.setVisibility(View.VISIBLE); return true; } } return super.onKeyDown(keyCode, event); } }
[ "245235982@qq.com" ]
245235982@qq.com
6eaf84bae1d973fbda808cf1d07b4cdc7bd9eff8
42854fbe19b25f862eec5a7ce0b4625c6a25ba40
/samples/quickstart-guice/src/main/java/QuickstartGuice.java
5fcb1e33556c93e08dcb0744ba277ec30957246d
[ "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
Junchenliu198924/shiro
e229fe7e2c81ea57f932dfd2fe8df0609bdb3eed
4cf242d29552876ba09bc7e1ca0b841ba5ae4017
refs/heads/master
2021-05-24T08:23:29.556732
2020-04-03T07:05:48
2020-04-03T07:05:48
253,468,751
1
0
Apache-2.0
2020-04-06T10:48:18
2020-04-06T10:48:17
null
UTF-8
Java
false
false
4,936
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. */ import com.google.inject.Guice; import com.google.inject.Injector; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.*; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Simple Quickstart application showing how to use Shiro's API with Guice integration. * * @since 0.9 RC2 */ public class QuickstartGuice { private static final transient Logger log = LoggerFactory.getLogger(QuickstartGuice.class); public static void main(String[] args) { // We will utilize standard Guice bootstrapping to create a Shiro SecurityManager. Injector injector = Guice.createInjector(new QuickstartShiroModule()); SecurityManager securityManager = injector.getInstance(SecurityManager.class); // for this simple example quickstart, make the SecurityManager // accessible as a JVM singleton. Most applications wouldn't do this // and instead rely on their container configuration or web.xml for // webapps. That is outside the scope of this simple quickstart, so // we'll just do the bare minimum so you can continue to get a feel // for things. SecurityUtils.setSecurityManager(securityManager); // Now that a simple Shiro environment is set up, let's see what you can do: // get the currently executing user: Subject currentUser = SecurityUtils.getSubject(); // Do some stuff with a Session (no need for a web or EJB container!!!) Session session = currentUser.getSession(); session.setAttribute("someKey", "aValue"); String value = (String) session.getAttribute("someKey"); if (value.equals("aValue")) { log.info("Retrieved the correct value! [" + value + "]"); } // let's login the current user so we can check against roles and permissions: if (!currentUser.isAuthenticated()) { UsernamePasswordToken token = new UsernamePasswordToken("lonestarr", "vespa"); token.setRememberMe(true); try { currentUser.login(token); } catch (UnknownAccountException uae) { log.info("There is no user with username of " + token.getPrincipal()); } catch (IncorrectCredentialsException ice) { log.info("Password for account " + token.getPrincipal() + " was incorrect!"); } catch (LockedAccountException lae) { log.info("The account for username " + token.getPrincipal() + " is locked. " + "Please contact your administrator to unlock it."); } // ... catch more exceptions here (maybe custom ones specific to your application? catch (AuthenticationException ae) { //unexpected condition? error? } } //say who they are: //print their identifying principal (in this case, a username): log.info("User [" + currentUser.getPrincipal() + "] logged in successfully."); //test a role: if (currentUser.hasRole("schwartz")) { log.info("May the Schwartz be with you!"); } else { log.info("Hello, mere mortal."); } //test a typed permission (not instance-level) if (currentUser.isPermitted("lightsaber:weild")) { log.info("You may use a lightsaber ring. Use it wisely."); } else { log.info("Sorry, lightsaber rings are for schwartz masters only."); } //a (very powerful) Instance Level permission: if (currentUser.isPermitted("winnebago:drive:eagle5")) { log.info("You are permitted to 'drive' the winnebago with license plate (id) 'eagle5'. " + "Here are the keys - have fun!"); } else { log.info("Sorry, you aren't allowed to drive the 'eagle5' winnebago!"); } //all done - log out! currentUser.logout(); System.exit(0); } }
[ "jbunting@apache.org" ]
jbunting@apache.org
2b3bc96961ed5d681ef6d994bb7a62b4687b18ed
8ced32b21f1be9511c256cb8b589d7976b4b98d6
/alanmall-client/alanmall-mscard/src/main/java/com/itcrazy/alanmall/mscard/action/card/RechargeRewardAction.java
b30a16817c3c1d7914060daa4b73966a5f8d2b6f
[]
no_license
Yangliang266/Alanmall
e5d1e57441790a481ae5aa75aa9d091909440281
38c2bde86dab6fd0277c87f99bc860bfc0fbdc0a
refs/heads/master
2023-06-13T05:01:25.747444
2021-07-10T12:18:58
2021-07-10T12:18:58
293,702,057
1
0
null
null
null
null
UTF-8
Java
false
false
8,984
java
package com.itcrazy.alanmall.mscard.action.card; import org.apache.dubbo.config.annotation.Reference; import com.itcrazy.alanmall.mscard.dto.Base.RechargeRewardDto; import com.itcrazy.alanmall.mscard.manager.CategoryManager; import com.itcrazy.alanmall.mscard.manager.RechargeRewardManager; import com.itcrazy.alanmall.mscard.model.RechargeReward; import com.itcrazy.alanmall.mscard.action.base.InterfaceBaseAction; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; /** * 充值/奖励设置 * * @author zhangli * */ public class RechargeRewardAction extends InterfaceBaseAction { private static final long serialVersionUID = 7069487434529150519L; private RechargeReward rechargeReward; private RechargeRewardDto rechargeRewardDto; @Reference RechargeRewardManager rechargeRewardManager; @Reference CategoryManager categoryManager; /** * 获取充值/奖励列表 * @return */ public String getRechargeRewardList() { if (rechargeRewardDto == null ) { rechargeRewardDto = new RechargeRewardDto(); } rechargeRewardDto.setCompanyId(user.getCompanyId()); // 根据商家ID获取充值/奖励列表 List<RechargeReward> rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); pageData.rows = rechargeRewardList; result.setSuccessInfo(); return SUCCESS; } /** * 更新充值奖励设置 * @return */ public String updateRechargeReward(){ // 充值/奖励必须check if(rechargeReward == null){ result.setParamErrorInfo("rechargeReward"); return SUCCESS; } // 卡类别必须check if(StringUtils.isBlank(rechargeReward.getCardCategories())) { result.setParamErrorInfo("cardCategories"); return SUCCESS; } // 充值方式必须check if(rechargeReward.getRechargeMode() == null) { result.setParamErrorInfo("rechargeMode"); return SUCCESS; } // 充值金额必须check if(StringUtils.isBlank(rechargeReward.getRecharge())) { result.setParamErrorInfo("recharge"); return SUCCESS; } String currRechargeMin = ""; String currRechargeMax = ""; if(rechargeReward.getRechargeMode() == 1) { // 金额段充值的场合,每充金额数check String[] arrRecharge = rechargeReward.getRecharge().split(","); if(arrRecharge.length < 3) { result.setResultInfo(1, "每充值金额参数不完整。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } // 金额段充值的场合,充值金额值check if(StringUtils.isBlank(arrRecharge[0]) || StringUtils.isBlank(arrRecharge[1]) || StringUtils.isBlank(arrRecharge[2])) { result.setResultInfo(1, "充值金额段参数不完整。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } currRechargeMin = arrRecharge[0]; currRechargeMax = arrRecharge[1]; // 充值金额Min值<充值金额Max值check if(Integer.parseInt(currRechargeMin) > Integer.parseInt(currRechargeMax)) { result.setResultInfo(1, "充值金额段最小值不得大于最大值。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } // 每充金额< [充值金额Max值-充值金额Min值] if(Integer.parseInt(arrRecharge[2]) > (Integer.parseInt(currRechargeMax) - Integer.parseInt(currRechargeMin))) { result.setResultInfo(1, "每充金额不得大于[充值金额Max值-充值金额Min值]。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } } // 奖励规则必须check if(rechargeReward.getRewardMode() == null) { result.setParamErrorInfo("rewardMode"); return SUCCESS; } // 奖励金额必须check if(rechargeReward.getReward() == null) { result.setParamErrorInfo("reward"); return SUCCESS; } if (rechargeReward.getId() == null) { RechargeRewardDto rechargeRewardDto = new RechargeRewardDto(); List<RechargeReward> rechargeRewardList = new ArrayList<>(); String[] arrCategory = rechargeReward.getCardCategories().split(","); String[] arrRech; for (String category:arrCategory) { // 数据已存在性check rechargeRewardDto.setCompanyId(user.getCompanyId()); rechargeRewardDto.setCardCategorie(category); rechargeRewardDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeRewardDto.setRecharge(rechargeReward.getRecharge()); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); if(rechargeRewardList.size() != 0) { result.setResultInfo(1, "卡类别的充值奖励设置重复。"); return SUCCESS; } // 金额段充值的场合,数据交叉性check if(rechargeReward.getRechargeMode() == 1) { rechargeRewardDto.setRecharge(null); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); for(RechargeReward rechargeReward:rechargeRewardList) { arrRech = rechargeReward.getRecharge().split(","); if(Integer.parseInt(currRechargeMin) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMin) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } if(Integer.parseInt(currRechargeMax) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMax) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } } } } // 若存在当前支付方式,充值金额,奖励规则,奖励金额的数据,则更新卡类别 RechargeRewardDto rechargeDto = new RechargeRewardDto(); rechargeDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeDto.setRecharge(rechargeReward.getRecharge()); rechargeDto.setRewardMode(rechargeReward.getRewardMode()); rechargeDto.setReward(rechargeReward.getReward()); rechargeDto.setCompanyId(user.getCompanyId()); rechargeRewardList = rechargeRewardManager.getPageList(rechargeDto); if(rechargeRewardList.size() == 0) { // 新增操作 rechargeReward.setCreateId(user.getId()); rechargeReward.setCompanyId(user.getCompanyId()); rechargeRewardManager.addRechargeReward(rechargeReward); }else { // 更新操作 RechargeReward recharge = new RechargeReward(); String newCategories = rechargeRewardList.get(0).getCardCategories() + "," + rechargeReward.getCardCategories(); recharge.setCardCategories(newCategories); recharge.setUpdateId(user.getId()); recharge.setId(rechargeRewardList.get(0).getId()); rechargeRewardManager.updateRechargeReward(recharge); } }else { RechargeRewardDto rechargeRewardDto = new RechargeRewardDto(); List<RechargeReward> rechargeRewardList = new ArrayList<>(); String[] arrCategory = rechargeReward.getCardCategories().split(","); String[] arrRech; if(rechargeReward.getRechargeMode() == 1) { for (String category:arrCategory) { // 金额段充值的场合,数据交叉性check rechargeRewardDto.setCompanyId(user.getCompanyId()); rechargeRewardDto.setCardCategorie(category); rechargeRewardDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeRewardDto.setId(rechargeReward.getId()); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); for(RechargeReward rechargeReward:rechargeRewardList) { arrRech = rechargeReward.getRecharge().split(","); if(Integer.parseInt(currRechargeMin) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMin) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } if(Integer.parseInt(currRechargeMax) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMax) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } } } } // 更新操作 rechargeReward.setUpdateId(user.getId()); rechargeRewardManager.updateRechargeReward(rechargeReward); } result.setSuccessInfo(); return SUCCESS; } /** * 删除充值奖励(逻辑删除) * @return */ public String deleteRechargeReward(){ // 充值/奖励主键必须check if (rechargeReward.getId() == null) { result.setParamErrorInfo("id"); return SUCCESS; } // 更新充值/奖励信息 rechargeReward.setIsDeleted(1); rechargeReward.setUpdateId(user.getId()); rechargeRewardManager.updateRechargeReward(rechargeReward); result.setSuccessInfo(); return SUCCESS; } public RechargeReward getRechargeReward() { return rechargeReward; } public void setRechargeReward(RechargeReward rechargeReward) { this.rechargeReward = rechargeReward; } public RechargeRewardDto getRechargeRewardDto() { return rechargeRewardDto; } public void setRechargeRewardDto(RechargeRewardDto rechargeRewardDto) { this.rechargeRewardDto = rechargeRewardDto; } }
[ "546493589@qq.com" ]
546493589@qq.com
9560927c1de55988d5139467d781841418222e0b
4804af90ee3408a9d8ac2516c3dc4d4487635ea5
/06_HelloMVC/src/com/kh/board/model/vo/Board.java
7ecf31e3a3baba0bce9dfdd40c4d4d9a62412178
[]
no_license
jiyeon0327/HelloMVC
3437aab706a99d3cb525b5f33efb4f7a3ddc8289
d690b7b1eb61990433eca17d2a11eda0f63f85d5
refs/heads/master
2020-07-19T18:13:57.494025
2019-09-25T12:53:49
2019-09-25T12:53:49
206,491,637
0
0
null
null
null
null
UTF-8
Java
false
false
2,690
java
package com.kh.board.model.vo; import java.sql.Date; public class Board { private int Board_no; private String Board_title; private String Board_writer; private String Board_content; private String Board_original_filename; private String Board_rename_filename; private Date Board_date; private int board_readcount; public Board() { // TODO Auto-generated constructor stub } public Board(int board_no, String board_title, String board_writer, String board_content, String board_original_filename, String board_rename_filename, Date board_date, int board_readcount) { super(); Board_no = board_no; Board_title = board_title; Board_writer = board_writer; Board_content = board_content; Board_original_filename = board_original_filename; Board_rename_filename = board_rename_filename; Board_date = board_date; this.board_readcount = board_readcount; } public int getBoard_no() { return Board_no; } public void setBoard_no(int board_no) { Board_no = board_no; } public String getBoard_title() { return Board_title; } public void setBoard_title(String board_title) { Board_title = board_title; } public String getBoard_writer() { return Board_writer; } public void setBoard_writer(String board_writer) { Board_writer = board_writer; } public String getBoard_content() { return Board_content; } public void setBoard_content(String board_content) { Board_content = board_content; } public String getBoard_original_filename() { return Board_original_filename; } public void setBoard_original_filename(String board_original_filename) { Board_original_filename = board_original_filename; } public String getBoard_rename_filename() { return Board_rename_filename; } public void setBoard_rename_filename(String board_rename_filename) { Board_rename_filename = board_rename_filename; } public Date getBoard_date() { return Board_date; } public void setBoard_date(Date board_date) { Board_date = board_date; } public int getBoard_readcount() { return board_readcount; } public void setBoard_readcount(int board_readcount) { this.board_readcount = board_readcount; } @Override public String toString() { return "Board [Board_no=" + Board_no + ", Board_title=" + Board_title + ", Board_writer=" + Board_writer + ", Board_content=" + Board_content + ", Board_original_filename=" + Board_original_filename + ", Board_rename_filename=" + Board_rename_filename + ", Board_date=" + Board_date + ", board_readcount=" + board_readcount + "]"; } }
[ "user2@user2-PC" ]
user2@user2-PC
6f628ba07ec253968621b0eeccd9323d79455bd4
558ad40723ed9c8298ec52bd93aab94516c5b686
/Clase2020/src/tema9/sincronizacion/PruebaInteraccionProblemaHilos.java
25ec1dc1ec5ae7a8533e9ecb821c91d9646af2f6
[]
no_license
andoni-eguiluz/ud-prog2-clase-2020
a46a9addf160974b7b28924f8180b7cc560dd941
92847a201d13920ff7b0308e8c07bb85e6fb8259
refs/heads/master
2021-07-17T02:53:41.199615
2021-02-14T16:37:25
2021-02-14T16:37:25
237,613,459
3
4
null
null
null
null
UTF-8
Java
false
false
2,213
java
package tema9.sincronizacion; import java.util.*; /** Problema de interacción entre hilos concurrentes sobre la misma estructura de datos * @author andoni.eguiluz at ingenieria.deusto.es */ public class PruebaInteraccionProblemaHilos { private static int tipoProblema = 2; // 1 - string único manipulado por partes 2 - ArrayList de chars public static void main(String[] args) { Thread hilo1 = new Hilo1(); Thread hilo2 = new Hilo2(); hilo1.start(); hilo2.start(); } private static String datoCompartido = ""; // problema 1 private static ArrayList<Character> listaCompartida = new ArrayList<>(); // problema 2 private static char[] cars = { 'a', 'b', 'c', 'd', 'e', 'f' }; private static int cont = 0; // Mete un carácter en datoCompartido por la derecha private static /*synchronized*/ void metecaracter(char car) { // System.out.println( "Entra MC"); if (tipoProblema == 1) { String antiguo = datoCompartido + ""; antiguo = antiguo + car; datoCompartido = antiguo; } else if (tipoProblema == 2) { listaCompartida.add( car ); } // System.out.println( "Sale MC"); } // Saca y visualiza un carácter en datoCompartido por la izquierda private static /*synchronized*/ void sacaCaracter() { // System.out.println( "Entra SC"); if (tipoProblema == 1) { if (datoCompartido.length()>0) { String dato = datoCompartido + ""; char car = dato.charAt(0); System.out.print( car ); cont++; if (cont==60) { cont = 0; System.out.println(); } dato = dato.substring( 1 ); datoCompartido = dato; } } else if (tipoProblema == 2) { if (!listaCompartida.isEmpty()) { char car = listaCompartida.remove( 0 ); System.out.print( car ); cont++; if (cont==60) { cont = 0; System.out.println(); } } } // System.out.println( "Sale SC"); } // Clase productora de datos static class Hilo1 extends Thread { public void run() { while (true) { for (char car : cars) metecaracter( car ); } } } // Clase consumidora de datos static class Hilo2 extends Thread { public void run() { while (true) { sacaCaracter(); } } } }
[ "andoni.eguiluz@deusto.es" ]
andoni.eguiluz@deusto.es
4306ff19d2eb0d204bd1c60d889d97b997854f14
0a0e3d1435ce7a246ec11992d5a68d99085fd3dc
/src/main/java/aleksey/prostakov/generator/example/ExampleInterface.java
7b074f4aad7defd87cd5fe174e24c282c8fb8274
[]
no_license
ProstakovAlexey/graph_example
a41cdd65ffbcfa30354c0505ae3e825b35e2e8b9
ce40e4d601f0516f037550b1c17703b2f79a9961
refs/heads/main
2023-02-06T17:57:06.632814
2020-12-27T16:25:22
2020-12-27T16:25:22
324,801,191
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package aleksey.prostakov.generator.example; import java.io.IOException; public interface ExampleInterface { public void init(); public void make(); public String print() throws IOException; public String getName(); }
[ "prostakov.a@ittest-team.ru" ]
prostakov.a@ittest-team.ru
64dae8d55b36df2fc3090b284f0acafb274234a1
5e53cea57be97f773db2567667beb3941488358b
/src/main/java/io/github/vvd/hellobank/service/mapper/package-info.java
375e1cba7f21549b542f3c2a9429ecc63c02b28d
[]
no_license
BulkSecurityGeneratorProject/HelloBank
00db8e1222c0ad20da948c8e1c3f6fe9982d7c5f
5a131d9dcbccd3e61aae4e9a76e433bb57707dcc
refs/heads/master
2022-12-16T18:55:01.539928
2018-01-08T20:57:02
2018-01-08T20:57:02
296,637,515
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
/** * MapStruct mappers for mapping domain objects and Data Transfer Objects. */ package io.github.vvd.hellobank.service.mapper;
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
73f4a0eb34c57d4361de1c4e4bacdf5446eb1285
393a7e3cb20d80623e1648faad53964ffe7aa371
/src/main/java/com/javaex/controller/Hello.java
0ad175d430a1cc222a5a8cd6a78700f801f08e11
[]
no_license
werg147/guestbook3
677488dd4e6355b10005709c34dd808f94ee9ea5
f1eaacc5cc7b6d8b366892a85a89027689c3f549
refs/heads/master
2023-02-23T00:08:00.400178
2021-01-21T04:18:50
2021-01-21T04:18:50
331,238,161
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.javaex.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class Hello { @RequestMapping( "/hello") public String hello(){ System.out.println("/hellospring/hello"); return "/WEB-INF/views/index.jsp"; } }
[ "장세림@DESKTOP-1CIRGN6" ]
장세림@DESKTOP-1CIRGN6
28bf772007f8008ff422877a459b348ee3fc515c
808ab3c322c35779e0e5e9b514eeabae74d2e7b2
/src/sample/Sample3_3.java
7b98b7d4fc1e53c775f6a2a38a1e1d5cedaa73a2
[]
no_license
s4t02h1/aiproject
aa85ca8b51abc689ecfa25f4450b8dc4090e968f
d7c9d98e83af164dd0aee8d58aa6121934a83b6d
refs/heads/master
2022-11-20T04:24:16.601537
2020-07-13T07:07:03
2020-07-13T07:07:03
271,216,548
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package sample; class Sample3_3 { public static void main(String[] args) { int a = 10; int b = 10; int c = 10; int d = 10; System.out.println(a++); System.out.println(++b); System.out.println(c--); System.out.println(--d); a = 10; b = 10; c = 10; d = 10; b = ++a;//�O�u System.out.println("a =" + a + "b =" + b); d = c++;//��u System.out.println("c =" + c + "d =" + d); } }
[ "eeb-tosh-16@DESKTOP-NT4PNTH" ]
eeb-tosh-16@DESKTOP-NT4PNTH
9c1f7657d572331548e56b753adcd20f6605ff85
f61af2722d3fa87e6ef05dea4cee09bfc9298506
/app/src/main/java/com/example/xiezhen/memoryleak/BroadcastReceiverActivity.java
195cb24624cd9665bef5ed75f2227cf4848efad9
[]
no_license
realxz/MemoryLeak
96db5a4c2d956c37dea728fe6eba09f7d35bde01
8db9ed44f811df2e9d92ff464c8a36dbc9cb48d6
refs/heads/master
2021-01-22T22:24:17.134134
2017-03-20T07:53:50
2017-03-20T07:53:50
85,539,945
5
0
null
null
null
null
UTF-8
Java
false
false
1,210
java
package com.example.xiezhen.memoryleak; import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class BroadcastReceiverActivity extends AppCompatActivity { NetworkReceiver receiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_broadcast_receiver); wifiListener(); } private void wifiListener() { IntentFilter intentFilter = new IntentFilter(); //添加的action就是我们要监听的广播,wifi开关的时候,系统都会发送这条广播。 intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); receiver = new NetworkReceiver(); //通过registerReceiver方法,将我们创建的Receiver以及 InterFilter传入,完成注册。 this.registerReceiver(receiver, intentFilter); } @Override protected void onDestroy() { super.onDestroy(); // unregisterReceiver(receiver); } public void closeActivity(View view) { this.finish(); } }
[ "617525371@qq.com" ]
617525371@qq.com
b072e44416440cfff244bf6161f3b2f52d7a91c2
f2c6fa884943c62d7859f6c9d1bf10dd30824b5d
/Round Off/Main.java
662b924b3c3474baf9c18e66a4f95a39d741a60c
[]
no_license
syalshubham/Playground
d72317b1a68db2c03e3a4a53e4a042974d7bd519
791975b9827fca283ec87fc004510dad746e6ef3
refs/heads/master
2023-08-09T03:19:23.623849
2020-09-07T06:07:23
2020-09-07T06:07:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
85
java
import math a=float(input()) print(int(a)) print(math.ceil(a)) print(math.ceil(a-1))
[ "70564324+syal510@users.noreply.github.com" ]
70564324+syal510@users.noreply.github.com
8abb5703bee6c3c85acd069f543cb68c954e7f0d
a7cfd989b5e21fc9cf34382b04db0d5aeeecd80e
/app/src/main/java/com/example/musicdemo/views/InputView.java
e88edaf3cc604e6eea1edebfeda17135883a0092
[]
no_license
YuLong-Liang/MusicDemo
d1c352a11f1c1fe3902cc0a8df72c3acc438a6ff
cbf4dbde88363426282e2ac790023c4fbf36fde4
refs/heads/master
2023-04-12T23:03:39.586724
2019-11-13T02:30:19
2019-11-13T02:30:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,599
java
package com.example.musicdemo.views; import android.content.Context; import android.content.res.TypedArray; import android.os.Build; import android.renderscript.ScriptGroup; import android.text.InputType; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.RequiresApi; import com.example.musicdemo.R; /** * 1、input_icon输入框前图标 * 2、input_hint:输入框提示 * 3、is_password:是否需要密文 * */ public class InputView extends FrameLayout { private int inputIcon; private String inputHint; private boolean isPassword; private View mView; private ImageView mIvIcon; private EditText mEtInput; public InputView(Context context) { super(context); init(context, null); } public InputView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs); } public InputView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public InputView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs); } private void init(Context context, AttributeSet attrs) { if (attrs == null) return; //获取自定义属性 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.inputView); inputIcon = typedArray.getResourceId(R.styleable.inputView_input_icon, R.mipmap.phone2); inputHint = typedArray.getString(R.styleable.inputView_input_hint); isPassword = typedArray.getBoolean(R.styleable.inputView_is_password, false); typedArray.recycle(); //绑定layout mView = LayoutInflater.from(context).inflate(R.layout.input_view, this, false); mIvIcon = mView.findViewById(R.id.iv_icon); mEtInput = mView.findViewById(R.id.et_input); mIvIcon.setImageResource(inputIcon); mEtInput.setHint(inputHint); mEtInput.setInputType(isPassword ? InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD : InputType.TYPE_CLASS_PHONE); addView(mView); } /** * 返回输入内容 * * @return */ public String getInputStr() { return mEtInput.getText().toString().trim(); } }
[ "1134780205@qq.com" ]
1134780205@qq.com
561cbeffad0461dfcfaa503b1c1569e0929d599b
501d927b095fb5294333f67b934dca6409fd21b7
/app/build/generated/ap_generated_sources/debug/out/com/startng/newsapp/Database/NoteDatabase_Impl.java
2fdcf737b836e0983dab222693065d7859bb61f3
[]
no_license
damade/NewsApp-SNG
422032ebd6969baecd116c5c3769d2483201c83d
788562fe2cfb09a4e09a0d6436fc729422f42f25
refs/heads/master
2022-06-15T05:12:11.805195
2020-05-06T22:58:11
2020-05-06T22:58:11
260,030,180
1
0
null
2020-04-29T20:00:33
2020-04-29T20:00:32
null
UTF-8
Java
false
false
6,026
java
package com.startng.newsapp.Database; import androidx.room.DatabaseConfiguration; import androidx.room.InvalidationTracker; import androidx.room.RoomOpenHelper; import androidx.room.RoomOpenHelper.Delegate; import androidx.room.RoomOpenHelper.ValidationResult; import androidx.room.util.DBUtil; import androidx.room.util.TableInfo; import androidx.room.util.TableInfo.Column; import androidx.room.util.TableInfo.ForeignKey; import androidx.room.util.TableInfo.Index; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.sqlite.db.SupportSQLiteOpenHelper; import androidx.sqlite.db.SupportSQLiteOpenHelper.Callback; import androidx.sqlite.db.SupportSQLiteOpenHelper.Configuration; import com.startng.newsapp.Database.DataAccessObject.NoteDao; import com.startng.newsapp.Database.DataAccessObject.NoteDao_Impl; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @SuppressWarnings({"unchecked", "deprecation"}) public final class NoteDatabase_Impl extends NoteDatabase { private volatile NoteDao _noteDao; @Override protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration configuration) { final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(configuration, new RoomOpenHelper.Delegate(1) { @Override public void createAllTables(SupportSQLiteDatabase _db) { _db.execSQL("CREATE TABLE IF NOT EXISTS `note_table` (`nid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `note_title` TEXT, `note_text` TEXT, `time_stamp` TEXT)"); _db.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)"); _db.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '72f173f5346520af9d85b9b360319fad')"); } @Override public void dropAllTables(SupportSQLiteDatabase _db) { _db.execSQL("DROP TABLE IF EXISTS `note_table`"); if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onDestructiveMigration(_db); } } } @Override protected void onCreate(SupportSQLiteDatabase _db) { if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onCreate(_db); } } } @Override public void onOpen(SupportSQLiteDatabase _db) { mDatabase = _db; internalInitInvalidationTracker(_db); if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onOpen(_db); } } } @Override public void onPreMigrate(SupportSQLiteDatabase _db) { DBUtil.dropFtsSyncTriggers(_db); } @Override public void onPostMigrate(SupportSQLiteDatabase _db) { } @Override protected RoomOpenHelper.ValidationResult onValidateSchema(SupportSQLiteDatabase _db) { final HashMap<String, TableInfo.Column> _columnsNoteTable = new HashMap<String, TableInfo.Column>(4); _columnsNoteTable.put("nid", new TableInfo.Column("nid", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("note_title", new TableInfo.Column("note_title", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("note_text", new TableInfo.Column("note_text", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("time_stamp", new TableInfo.Column("time_stamp", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); final HashSet<TableInfo.ForeignKey> _foreignKeysNoteTable = new HashSet<TableInfo.ForeignKey>(0); final HashSet<TableInfo.Index> _indicesNoteTable = new HashSet<TableInfo.Index>(0); final TableInfo _infoNoteTable = new TableInfo("note_table", _columnsNoteTable, _foreignKeysNoteTable, _indicesNoteTable); final TableInfo _existingNoteTable = TableInfo.read(_db, "note_table"); if (! _infoNoteTable.equals(_existingNoteTable)) { return new RoomOpenHelper.ValidationResult(false, "note_table(com.startng.newsapp.Database.Model.Note).\n" + " Expected:\n" + _infoNoteTable + "\n" + " Found:\n" + _existingNoteTable); } return new RoomOpenHelper.ValidationResult(true, null); } }, "72f173f5346520af9d85b9b360319fad", "ea34b571450e966ef5828a13746e8e9b"); final SupportSQLiteOpenHelper.Configuration _sqliteConfig = SupportSQLiteOpenHelper.Configuration.builder(configuration.context) .name(configuration.name) .callback(_openCallback) .build(); final SupportSQLiteOpenHelper _helper = configuration.sqliteOpenHelperFactory.create(_sqliteConfig); return _helper; } @Override protected InvalidationTracker createInvalidationTracker() { final HashMap<String, String> _shadowTablesMap = new HashMap<String, String>(0); HashMap<String, Set<String>> _viewTables = new HashMap<String, Set<String>>(0); return new InvalidationTracker(this, _shadowTablesMap, _viewTables, "note_table"); } @Override public void clearAllTables() { super.assertNotMainThread(); final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase(); try { super.beginTransaction(); _db.execSQL("DELETE FROM `note_table`"); super.setTransactionSuccessful(); } finally { super.endTransaction(); _db.query("PRAGMA wal_checkpoint(FULL)").close(); if (!_db.inTransaction()) { _db.execSQL("VACUUM"); } } } @Override public NoteDao noteDao() { if (_noteDao != null) { return _noteDao; } else { synchronized(this) { if(_noteDao == null) { _noteDao = new NoteDao_Impl(this); } return _noteDao; } } } }
[ "damilolaadeoye545@yahoo.com" ]
damilolaadeoye545@yahoo.com
80e90971d1a4936d8e005b5029d16813eebbec04
0098e27a9140cf3fda3767675faf9e5f1453c01f
/samples/commons.mbean/src/main/java/com/buschmais/maexo/samples/commons/mbean/objectname/PersonMBean.java
2ea21e84fe6b5c67f0e69ee1c10a4ac015963c90
[]
no_license
buschmais/maexo
545bdc638741d39c091461df5c774e07dbd5236f
8e0a8d498fa5fa8302474bca4f9ca4b2c23d2374
refs/heads/master
2016-09-07T19:08:21.420426
2013-04-23T09:26:55
2013-04-23T09:26:55
9,465,214
2
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
/* * Copyright 2009 buschmais GbR * * 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.buschmais.maexo.samples.commons.mbean.objectname; import java.util.LinkedList; import java.util.List; import javax.management.MBeanInfo; import javax.management.MBeanNotificationInfo; import javax.management.ObjectName; import javax.management.openmbean.OpenMBeanAttributeInfo; import javax.management.openmbean.OpenMBeanAttributeInfoSupport; import javax.management.openmbean.OpenMBeanConstructorInfo; import javax.management.openmbean.OpenMBeanInfoSupport; import javax.management.openmbean.OpenMBeanOperationInfoSupport; import javax.management.openmbean.SimpleType; import com.buschmais.maexo.framework.commons.mbean.dynamic.DynamicMBeanSupport; import com.buschmais.maexo.framework.commons.mbean.dynamic.OpenTypeFactory; import com.buschmais.maexo.framework.commons.mbean.objectname.ObjectNameFactoryHelper; /** * Implementation of an MBean which will be used to manage an instance of the * class {@link Person}. */ public class PersonMBean extends DynamicMBeanSupport { /** * The person instance. */ private Person person; /** * The object name factory helper which is used to construct object names of * referenced MBeans. */ private ObjectNameFactoryHelper objectNameFactoryHelper; /** * Constructs the MBean. * * @param person * The person. * @param objectNameFactoryHelper * The object name factory helper. */ public PersonMBean(Person person, ObjectNameFactoryHelper objectNameFactoryHelper) { this.person = person; this.objectNameFactoryHelper = objectNameFactoryHelper; } /** * {@inheritDoc} */ public final MBeanInfo getMBeanInfo() { String className = this.getClass().getName(); OpenMBeanAttributeInfo firstNameInfo = new OpenMBeanAttributeInfoSupport( "firstName", "The first name.", SimpleType.STRING, true, false, false); OpenMBeanAttributeInfo lastNameInfo = new OpenMBeanAttributeInfoSupport( "lastName", "The last name.", SimpleType.STRING, true, false, false); OpenMBeanAttributeInfo addressesInfo = new OpenMBeanAttributeInfoSupport( "addresses", "The addresses of this person.", OpenTypeFactory .createArrayType(1, SimpleType.OBJECTNAME), true, false, false); return new OpenMBeanInfoSupport(className, "An OpenMBean which represents a person.", new OpenMBeanAttributeInfo[] { firstNameInfo, lastNameInfo, addressesInfo }, new OpenMBeanConstructorInfo[] {}, new OpenMBeanOperationInfoSupport[] {}, new MBeanNotificationInfo[] {}); } /** * Returns the first name of the person. * * @return The first name. */ public final String getFirstName() { return this.person.getFirstName(); } /** * Returns the last name of the person. * * @return The last name. */ public final String getLastName() { return this.person.getLastName(); } /** * Returns the addresses as object name representation. * * @return The object names. */ public final ObjectName[] getAddresses() { List<ObjectName> addresses = new LinkedList<ObjectName>(); for (Address address : this.person.getAdresses()) { addresses.add(this.objectNameFactoryHelper.getObjectName(address, Address.class)); } return addresses.toArray(new ObjectName[0]); } }
[ "dirk.mahler@buschmais.com@edd260d2-c1fc-11dd-87c2-1b6a6bee664f" ]
dirk.mahler@buschmais.com@edd260d2-c1fc-11dd-87c2-1b6a6bee664f
7d4bf9e0672353a84c501a9f4856cc9dcdfdf049
bfdcd9fdf3899e6bb833c53d535b74f19609e669
/cn.cloud.shop-api/cn.cloud.user-api/src/main/java/cn/cloud/user_api/utils/base/RedisUtils.java
6ee8bb457c26e8806c39f5084f16343c29dce4b9
[]
no_license
Dreamwei-cn/cn.cloud
15451bea98568a6a397e1823dd8dd8b59ef7ed00
33ba365c9c7dde0b887a2798b8139adfdda11104
refs/heads/master
2022-06-20T12:17:20.491138
2020-01-07T15:28:19
2020-01-07T15:28:19
196,153,894
0
0
null
2022-06-17T02:17:37
2019-07-10T07:23:31
Java
UTF-8
Java
false
false
545
java
package cn.cloud.user_api.utils.base; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.util.Assert; public class RedisUtils extends cn.cloud.common.util.RedisUtils { @Autowired private StringRedisTemplate sTemplate; public void sendMessage(String channel, String message) { Assert.notNull(channel, "消息主题不能为空"); Assert.notNull(message, "不能发送空消息"); sTemplate.convertAndSend(channel, message); } }
[ "735789711@qq.com" ]
735789711@qq.com
873f01a2a10100d28e15cad72d256416a6714856
89c15461f3f2912fc0424235be71c074451014bc
/java8/src/day19/Address.java
a92d1e70cd6396cc4ab4227a4ab759e832096f36
[]
no_license
Parkdaeho99/java8
ccd8bbc1b656cd991e9e26dbb83541e6795e3bfb
ab7f2485409be56c834febf807a523f67bae407e
refs/heads/master
2021-03-25T03:07:21.485811
2020-04-16T05:55:42
2020-04-16T05:55:42
247,584,055
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package day19; public class Address { /* and Then , */ private String country; private String city; public Address(String country, String city) { this.country = country; this.city = city; } public String getCountry() { return country; } public String getCity() { return city; } }
[ "parkdaeho.dev@gmail.com" ]
parkdaeho.dev@gmail.com
0e151e3fd8a50011f379b7d078049e9169fb3540
d46fced19d24491c7c87173aee5172a72eb6ed01
/config-server/src/main/java/my/config/service/ConfigServiceApplication.java
2bdc07e0d86e1c261022e96e85c177874b702b84
[]
no_license
kirangodishala/spring-cloud-config-server-client
475378f44d2d780df5af4308aa50e2b62dda4dc7
d11950ca6a2670a4d364e559adffb358511d2983
refs/heads/master
2020-08-29T12:00:46.711555
2019-10-28T18:17:17
2019-10-28T18:17:17
218,025,679
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package my.config.service; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @EnableConfigServer @SpringBootApplication public class ConfigServiceApplication { public static void main(String[] args) { SpringApplication.run(ConfigServiceApplication.class, args); } }
[ "kirodod@gmail.com" ]
kirodod@gmail.com
0f912680504a8b76d4ca01d3e2d061c39652bf60
35789133e88429ef0793e554746557a7b93cb4d8
/src/ReceiveFile.java
ae825133577bc1522840ef5cf408bcf0cda61b2f
[]
no_license
LuizGuerra/Hybrid-P2P-Architecture
0b89bfd5cb1b08f2563fa7cbdd6dfe11a21ec696
b46fd12e89ccc05c9690615a67e18a89fe529bad
refs/heads/main
2023-06-07T04:21:58.885069
2021-07-02T16:05:23
2021-07-02T16:05:23
370,822,634
0
0
null
null
null
null
UTF-8
Java
false
false
2,467
java
import java.io.*; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class ReceiveFile implements Runnable, Closeable { static String thisPath = System.getProperty("user.dir"); int port; ServerSocket serverSocket; public ReceiveFile(int port) throws IOException { this.port = port; this.serverSocket = new ServerSocket(port); } @Override public void close() throws IOException { this.serverSocket.close(); } @Override public void run() { byte[] bytes; // input socket data while (true) { try { Socket socket = serverSocket.accept(); InputStream inputStream = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String fileName = reader.readLine(); System.out.println("Receiving data..."); System.out.println("File name: " + fileName); byte[] buffer = new byte[1024*8]; int bytesRead; File downloadPath = new File(thisPath + "/downloads/"); File newFile = new File(thisPath + "/downloads/"+ fileName); if(!downloadPath.exists()) { downloadPath.mkdirs(); } OutputStream outputStream = new FileOutputStream(newFile); while ( (bytesRead = inputStream.read(buffer)) != -1 ) { outputStream.write(buffer, 0, bytesRead); } System.out.println("Successfully created file"); System.out.println(); socket.close(); inputStream.close(); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } finally { // System.out.println("Meg used="+(Runtime.getRuntime().totalMemory()- // Runtime.getRuntime().freeMemory())/(1000*1000)+"M"); System.gc(); // System.out.println("Meg used="+(Runtime.getRuntime().totalMemory()- // Runtime.getRuntime().freeMemory())/(1000*1000)+"M"); } } } public static void main(String[] args) throws IOException { // necessary info int port = 1234; ReceiveFile receiveFile = new ReceiveFile(port); receiveFile.run(); } }
[ "luizpedrofg@gmail.com" ]
luizpedrofg@gmail.com
232ad1821e83b93902fae132399476aa572ce669
7347cd8d808e5c4a9f34d34cba7a922d9359afda
/BA101G5/src/com/general_member/model/GeneralMemberService.java
3db09e23bebc81b67532fe0d443a21272f7faeee
[]
no_license
nocama/my-work-rep-picnic-
cadd654aa459d7b5f8e9eb721e4eb68da2ea7cd5
d4dd32d3c50b8952bcc6ee49986de1b9aefe83fe
refs/heads/master
2021-04-12T09:57:56.529658
2017-07-20T01:21:10
2017-07-20T01:21:10
94,525,471
0
0
null
2017-07-19T12:36:29
2017-06-16T08:56:46
Java
UTF-8
Java
false
false
2,197
java
package com.general_member.model; import java.sql.Date; import java.util.List; public class GeneralMemberService { GeneralMemberDAO_interface dao; public GeneralMemberService() { dao = new GeneralMemberDAO(); } public GeneralMemberVO addGeneralMember(String MEM_NAME, Character MEM_GEN, Date MEM_BIRTH, String MEM_ADDR, String MEM_MAIL, String MEM_PSW, String MEM_SELF, byte[] MEM_PIC, Integer MEM_COIN, Character MEM_STA, String MEM_PHONE, Character MEM_PBOARD) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_GEN(MEM_GEN); gVO.setMEM_NAME(MEM_NAME); gVO.setMEM_BIRTH(MEM_BIRTH); gVO.setMEM_ADDR(MEM_ADDR); gVO.setMEM_MAIL(MEM_MAIL); gVO.setMEM_PSW(MEM_PSW); gVO.setMEM_SELF(MEM_SELF); gVO.setMEM_PIC(MEM_PIC); gVO.setMEM_COIN(MEM_COIN); gVO.setMEM_STA(MEM_STA); gVO.setMEM_PHONE(MEM_PHONE); gVO.setMEM_PBOARD(MEM_PBOARD); dao.insert(gVO); return gVO; } public GeneralMemberVO updateGeneralMember(String MEM_NO, String MEM_NAME, Character MEM_GEN, Date MEM_BIRTH, String MEM_ADDR, String MEM_MAIL, String MEM_PSW, String MEM_SELF, byte[] MEM_PIC, Integer MEM_COIN, Character MEM_STA, String MEM_PHONE, Character MEM_PBOARD) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_NO(MEM_NO); gVO.setMEM_GEN(MEM_GEN); gVO.setMEM_NAME(MEM_NAME); gVO.setMEM_BIRTH(MEM_BIRTH); gVO.setMEM_ADDR(MEM_ADDR); gVO.setMEM_MAIL(MEM_MAIL); gVO.setMEM_PSW(MEM_PSW); gVO.setMEM_SELF(MEM_SELF); gVO.setMEM_PIC(MEM_PIC); gVO.setMEM_COIN(MEM_COIN); gVO.setMEM_STA(MEM_STA); gVO.setMEM_PHONE(MEM_PHONE); gVO.setMEM_PBOARD(MEM_PBOARD); dao.update(gVO); return gVO; } public void deleteGeneralMember(String MEM_NO) { dao.delete(MEM_NO); } public GeneralMemberVO getOneGeneralMember(String MEM_NO) { return dao.findByPrimaryKey(MEM_NO); } public List<GeneralMemberVO> getAll() { return dao.getAll(); } public void updatecoin(String MEM_NO,Integer MEM_COIN) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_NO(MEM_NO); gVO.setMEM_COIN(MEM_COIN); dao.updatefromcoin(gVO); } }
[ "h2208339@gmail.com" ]
h2208339@gmail.com
928c69231d16475326fa799b842625bf755c2693
131d1689f4e292452a0c984462c8fd682073ea9b
/app/src/androidTest/java/com/example/amado/guesswho/ApplicationTest.java
4d308184855742c887d591707f3b728a24caabf8
[]
no_license
RoyMontoya/GuessWho
6d4dd7d883a0a343b2700fcf098b40f4e042aa28
a8ee1c7922edc37df091748052fdcbbd65079d95
refs/heads/master
2020-05-19T15:05:38.818310
2015-02-11T03:40:37
2015-02-11T03:40:37
30,567,374
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.example.amado.guesswho; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "roy_a18@hotmail.com" ]
roy_a18@hotmail.com
945163b2c842bba19d1f75b449dd75970f93da5a
c948842c2f97bdc31a7ae15b8933fe3d25b5b3a7
/Ati/sisdh/src/main/java/br/gov/pi/ati/sisdh/dao/controleacesso/impl/UsuarioDAOImpl.java
4e5637181a166ef32db0c1b28eb54fff1f80bb06
[]
no_license
professorjuniel/Projetos
d470ec3596fae39215c691559a273553b560b459
2ac751e97f32941496929a8736070e6425e18aa2
refs/heads/master
2018-10-20T13:32:10.894166
2018-08-22T01:28:26
2018-08-22T01:28:26
116,873,815
0
1
null
null
null
null
UTF-8
Java
false
false
699
java
package br.gov.pi.ati.sisdh.dao.controleacesso.impl; import br.gov.pi.ati.sisdh.application.BaseDAOImpl; import br.gov.pi.ati.sisdh.dao.controleacesso.UsuarioDAO; import br.gov.pi.ati.sisdh.modelo.controleacesso.SituacaoUsuario; import br.gov.pi.ati.sisdh.modelo.controleacesso.Usuario; import java.util.List; import javax.ejb.Stateless; /** * * @author Ayslan */ @Stateless public class UsuarioDAOImpl extends BaseDAOImpl<Usuario> implements UsuarioDAO { @Override public Class getEntityClass() { return Usuario.class; } @Override public List<Usuario> getUsuariosAtivos() { return list("situacaoUsuario", SituacaoUsuario.ATIVO, "nome"); } }
[ "juniel.silva@ati.pi.gov.br" ]
juniel.silva@ati.pi.gov.br
bdd82f36854c81aa793f96af4b1f97fb4431d604
58df55b0daff8c1892c00369f02bf4bf41804576
/src/fuc.java
9de1e052cfe9293db72d3a4f167b27174b93d39c
[]
no_license
gafesinremedio/com.google.android.gm
0b0689f869a2a1161535b19c77b4b520af295174
278118754ea2a262fd3b5960ef9780c658b1ce7b
refs/heads/master
2020-05-04T15:52:52.660697
2016-07-21T03:39:17
2016-07-21T03:39:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
import android.os.Parcelable.Creator; import com.google.android.gms.people.identity.internal.models.DefaultPersonImpl.RelationshipStatuses; public final class fuc implements Parcelable.Creator<DefaultPersonImpl.RelationshipStatuses> {} /* Location: * Qualified Name: fuc * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
fa916c555d727f3aa3ab7e1a9ddeebd7f7aa90f6
2a476fbc4f9e0330d548793fcafcb2ee341f531b
/demo/src/utils/DatabaseConnection.java
90e85f0e45c76d2060db19e4995cf77e50289eb1
[]
no_license
Lalit316/Servlet
b9181e3948bc6b7f5e63132ef21039fedcce96fa
f9e6b8a48b93db1f877866adc6771022a4affa7f
refs/heads/master
2021-08-14T19:59:55.618512
2017-11-16T16:22:50
2017-11-16T16:22:50
110,994,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; /** * Created by l on 2/28/2017. */ public class DatabaseConnection { String url = "jdbc:mysql://localhost:3306/demo"; String userName = "root"; String password = ""; Connection connection = null; public DatabaseConnection(){ try { // connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo","root",""); Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(url,userName,password); System.out.println("database connected!!"); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } public PreparedStatement getPreparedStatement(String query) { PreparedStatement pstm = null; try { pstm = connection.prepareStatement(query); } catch (SQLException e) { e.printStackTrace(); } return pstm; } }
[ "lalualpha123@gmail.com" ]
lalualpha123@gmail.com
cabcfb5f2bffbbe0f96685ff1d95d404a04c449a
c66eded8c9c54b981940573ca48188db8876872c
/p0531_simplecursortreeadapter/src/androidTest/java/com/olegis/p0531_simplecursortreeadapter/ExampleInstrumentedTest.java
08f1b6b0d6a8ac74bc188016df1e79184d78d046
[]
no_license
Olegis/StartAndroid2
ab7d8107784f978729a58e59c955ef9099aadffd
449efc21287748cfca5156849b093fb8ebbe4b06
refs/heads/master
2022-11-25T07:01:36.379132
2020-08-03T08:39:18
2020-08-03T08:39:18
264,944,438
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package com.olegis.p0531_simplecursortreeadapter; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.olegis.p0531_simplecursortreeadapter", appContext.getPackageName()); } }
[ "olegis85@mail.ru" ]
olegis85@mail.ru
3c315df46af4d3230de3d575a1ccd1333ceaeeac
1e019d0f4d231afb32bb4316a84d332eaf241ded
/play-with-entitymanager/src/test/java/com/example/jpa/jpaonetomanydemo/PlayWithEntityManagerTests.java
6ce2dbd0714f6b7905781da212536a5fe9e17b6f
[]
no_license
tigersix86/jpaTest
cc9dedc3a42e945216524c1e3e025bdd86e6c7f2
64b6dce07d8111c639ec1ee9a969bc07427f7387
refs/heads/master
2022-11-29T01:04:06.374770
2019-06-23T19:57:58
2019-06-23T19:57:58
169,964,828
1
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.example.jpa.jpaonetomanydemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class PlayWithEntityManagerTests { @Test public void contextLoads() { } }
[ "magnus.nordin@soprasteria.com" ]
magnus.nordin@soprasteria.com
561955b4522fabaf1bfadfcc1812019b8778cd79
ccd21a0a11d760c49b645bf298f066eab25acfd0
/main/java-maven/drapi/src/test/java/com/ecofactor/qa/automation/drapi/DRAPI_Execution_Test.java
505573be9158c597cb6bd00e2ecf97e02d7c48d2
[]
no_license
vselvaraj-ecofactor/QA-Automation
71a73f895b17f9a4bdcdd6c4c68b18ba52467b8b
b84d7c8c94ecbede3709d00817c6e87fac21f6d1
refs/heads/master
2021-01-01T08:53:34.406991
2015-02-24T06:17:13
2015-02-24T06:17:13
30,956,434
0
0
null
null
null
null
UTF-8
Java
false
false
18,266
java
/* * DRAPI_Execution_Test.java * Copyright (c) 2014, EcoFactor, All Rights Reserved. * * This software is the confidential and proprietary information of EcoFactor * ("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 * EcoFactor. */ package com.ecofactor.qa.automation.drapi; import static com.ecofactor.qa.automation.platform.util.LogUtil.setLogString; import java.lang.reflect.Method; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.http.HttpResponse; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Guice; import org.testng.annotations.Test; import com.ecofactor.common.pojo.EcpCoreLSEventLocation; import com.ecofactor.common.pojo.timeseries.PartitionedThermostatEvent; import com.ecofactor.qa.automation.dao.DaoModule; import com.ecofactor.qa.automation.dao.dr.EventControlDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventLocationDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventReportDao; import com.ecofactor.qa.automation.dao.dr.ThermostatDao; import com.ecofactor.qa.automation.dao.dr.ThermostatEventDao; import com.ecofactor.qa.automation.drapi.data.DRAPIDataProvider; import com.ecofactor.qa.automation.platform.constants.Groups; import com.ecofactor.qa.automation.util.DateUtil; import com.ecofactor.qa.automation.util.UtilModule; import com.ecofactor.qa.automation.util.WaitUtil; import com.google.inject.Inject; /** * The Class DRAPI_Execution_Test. * @author $Author:$ * @version $Rev:$ $Date:$ */ @Guice(modules = { UtilModule.class, DaoModule.class, DRApiModule.class }) public class DRAPI_Execution_Test extends AbstractTest { /** The astatus. */ private static String ASTATUS = "ACTIVE"; /** The pstatus. */ private static String PSTATUS = "PENDING"; /** The istatus. */ private static String ISTATUS = "INACTIVE"; /** The sstatus. */ private static String SSTATUS = "SKIPPED"; /** The drapitest. */ @Inject private DRAPI_Test drapitest; /** The api config. */ @Inject private static DRApiConfig apiConfig; /** The ls pro event. */ @Inject private LSProgramEventDao lsProEvent; /** The e control. */ @Inject private EventControlDao eControl; /** The lsp event report. */ @Inject private LSProgramEventReportDao lspEventReport; /** The tstat event. */ @Inject private ThermostatEventDao tstatEvent; /** The lsp event location. */ @Inject private LSProgramEventLocationDao lspEventLocation; /** The tsat. */ @Inject private ThermostatDao tsat; /** * Before method. * @param method the method * @param param the param * @see com.ecofactor.qa.automation.consumerapi.AbstractTest#beforeMethod(java.lang.reflect.Method, * java.lang.Object[]) */ @BeforeMethod(alwaysRun = true) public void beforeMethod(final Method method, final Object[] param) { logUtil.logStart(method, param, null); startTime = System.currentTimeMillis(); } /** * Test_create_dr_event_ecofactor Corporation. * @param drUrl the dr url * @param programID the program id * @param eventID the event id * @param targetType the target type * @param targetALLJson the target all json * @throws ParseException the parse exception */ @Test(groups = { Groups.SANITY1 }, dataProvider = "createDRALLGatewaysECO", dataProviderClass = DRAPIDataProvider.class, priority = 2) public void drEventForEco(final String drUrl, final String programID, final String eventID, final String targetType, final String targetALLJson) throws ParseException { long timeStamp = System.currentTimeMillis(); String createUrl = drUrl; createUrl = createUrl.replaceFirst("<program_id>", programID) .replaceFirst("<event_id>", eventID + timeStamp) .replaceFirst("<target_type>", targetType).replaceFirst("<target_all>", "true"); String json = targetALLJson; json = json.replaceFirst("<start_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 5))).replaceFirst( "<end_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 25))); setLogString("URL Values of the API \n" + createUrl + "\n" + json, true); final HttpResponse response = HTTPSClient.postResponse(createUrl, json, HTTPSClient.getPKCSKeyHttpClient("ecofactorcorp.p12", "ecofactor")); final String result = HTTPSClient.getResultString(response.getEntity()); setLogString("response :'" + result + "'", true); Assert.assertTrue(response.getStatusLine().getStatusCode() == 200, "Error status: " + response.getStatusLine()); final String eventName = getDrEventName(result); setLogString("DR EventName: " + eventName, true); final int proramEventId = lsProEvent.programEventId(eventName); setLogString("DR Event Id: " + proramEventId, true); WaitUtil.tinyWait(); final String eventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + eventStatus, true); final Map<String, Object> Values = lsProEvent.updateEventByStartDateAndEndDate(eventName); setLogString("Details Based on Event Name : " + Values, true); final List<Integer> eventLocation = lspEventLocation.fetchByLocationId(proramEventId); setLogString("Available Location : " + eventLocation, true); WaitUtil.mediumWait(); setLogString("After 20 Seconds ", true); final String UpdatedEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus, true); WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final String UpdatedEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus1, true); final List<EcpCoreLSEventLocation> locIdStatus = lspEventLocation .listByLocationIdStatus(proramEventId); setLogString("Available Locations with Status : " + locIdStatus, true); final int locId = getLocationIdForStatus(locIdStatus, ASTATUS); setLogString("Location Id in Active Mode : " + locId, true); final int thermostatId = tsat.listByLoationId(locId); setLogString("Thermostat Id : " + thermostatId, true); WaitUtil.mediumWait(); setLogString("After 20 Seconds ", true); List<PartitionedThermostatEvent> allDetails = tstatEvent.setPointEDR(thermostatId); WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> allDetail = tstatEvent.setPointEDR(thermostatId); final String nextPhaseTime = eControl.fetchNextPhaseTime(proramEventId); setLogString("Next Phase Time : " + nextPhaseTime, true); WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails1 = tstatEvent .setPointEDR(thermostatId); final String programEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus, true); final String finalStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + finalStatus, true); if (programEventStatus.equalsIgnoreCase(ASTATUS)) { WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus1 = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus1, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetail = tstatEvent .setPointEDR(thermostatId); final String programEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus1, true); final String finalStatus1 = eControl.fetchStatus(proramEventId); setLogString("Final Status : " + finalStatus1, true); final int programEventId = lsProEvent.updateEventStatus(eventName); setLogString("Program Event Id: " + programEventId, true); eControl.updateStatus(programEventId, ISTATUS); setLogString("Updated ", true); } /** * Test_create_dr_event_nve. * @param drUrl the dr url * @param programID the program id * @param eventID the event id * @param targetType the target type * @param targetAllJson the target all json * @throws ParseException the parse exception */ @Test(groups = { Groups.SANITY1 }, dataProvider = "createDRAllGatewaysNVE", dataProviderClass = DRAPIDataProvider.class, priority = 1) public void drEventForNve(final String drUrl, final String programID, final String eventID, final String targetType, final String targetAllJson) throws ParseException { long timeStamp = System.currentTimeMillis(); String directURL = drUrl; directURL = directURL.replaceFirst("<program_id>", programID) .replaceFirst("<event_id>", eventID + timeStamp) .replaceFirst("<target_type>", targetType).replaceFirst("<target_all>", "true"); String json = targetAllJson; json = json.replaceFirst("<start_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 1))).replaceFirst( "<end_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 7))); setLogString("URL Values of the API \n" + directURL + "\n" + json, true); final HttpResponse response = HTTPSClient.postResponse(directURL, json, HTTPSClient.getPKCSKeyHttpClient("ecofactorqanve.p12", "ecofactor")); Assert.assertTrue(response.getStatusLine().getStatusCode() == 200, "Error Status:" + response.getStatusLine()); final String resultValueString = HTTPSClient.getResultString(response.getEntity()); setLogString("response :'" + resultValueString + "'", true); final String eventName = getDrEventName(resultValueString); setLogString("DR EventName: " + eventName, true); final int proramEventId = lsProEvent.programEventId(eventName); setLogString("DR Event Id: " + proramEventId, true); final String eventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + eventStatus, true); WaitUtil.hugeWait(); setLogString("After 2 Minutes ", true); final String UpdatedEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus, true); final List<EcpCoreLSEventLocation> locIdStatus = lspEventLocation .listByLocationIdStatus(proramEventId); setLogString("Available Locations with Status : " + locIdStatus, true); final int locId = getLocationIdForStatus(locIdStatus, ASTATUS); setLogString("Location Id in Active Mode : " + locId, true); final int thermostatId = tsat.listByLoationId(locId); setLogString("Thermostat Id : " + thermostatId, true); final List<PartitionedThermostatEvent> allDetails = tstatEvent.setPointEDR(thermostatId); final String nextPhaseTime = eControl.fetchNextPhaseTime(proramEventId); setLogString("Next Phase Time : " + nextPhaseTime, true); WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails = tstatEvent .setPointEDR(thermostatId); final String programEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus, true); final String finalStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + finalStatus, true); if (programEventStatus.equalsIgnoreCase(ASTATUS)) { WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus1 = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus1, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails1 = tstatEvent .setPointEDR(thermostatId); final String programEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus1, true); final String finalStatus1 = eControl.fetchStatus(proramEventId); setLogString("Final Status : " + finalStatus1, true); final Map<String, Object> thermostatDetails = lspEventReport.updatedDetails(proramEventId); setLogString("Thermostat Details: " + thermostatDetails, true); final int programEventId = lsProEvent.updateEventStatus(eventName); setLogString("Program Event Id: " + programEventId, true); eControl.updateStatus(programEventId, ISTATUS); setLogString("Updated ", true); } /** * Fetch the Event Name after creation of DR Event. * @param response the response * @return String. */ private String getDrEventName(final String response) { StringTokenizer st = new StringTokenizer(response, ","); String eventID = ""; while (st.hasMoreElements()) { @SuppressWarnings("unused") String status = st.nextToken(); eventID = st.nextToken(); } String[] eventValues = eventID.split(":"); final String eventName = eventValues[2]; setLogString("DR EventName Fetched : " + eventName.substring(0, eventName.length() - 3), true); return eventName.substring(0, eventName.length() - 3); } /** * Fetch the location Id based on status. * @param allDetails the List details. * @param status the status * @return Integer. */ public int getLocationIdForStatus(final List<EcpCoreLSEventLocation> locIdStatus, final String status) { int valueLocationId = 0; for (EcpCoreLSEventLocation ecpCoreLSEventLocation : locIdStatus) { String locStatus = ecpCoreLSEventLocation.getStatus().toString(); if (locStatus.equalsIgnoreCase(ASTATUS)) { valueLocationId = (ecpCoreLSEventLocation.getLocationid()); } } return valueLocationId; } /** * Gets the count by location status. * @param locIdStatus the loc id status * @return the count by location status */ public Map<String, Integer> getCountByLocationStatus( final List<EcpCoreLSEventLocation> locIdStatus) { List<Integer> acLocationId = new ArrayList<Integer>(); List<Integer> scLocationId = new ArrayList<Integer>(); List<Integer> acTstId = new ArrayList<Integer>(); Map<String, Integer> locationCount = new HashMap<String, Integer>(); locationCount.put("Total No of Locations", locIdStatus.size()); for (EcpCoreLSEventLocation ecpCoreLSEventLocation : locIdStatus) { String locStatus = ecpCoreLSEventLocation.getStatus().toString(); if (locStatus.equalsIgnoreCase(ASTATUS)) { acLocationId.add(ecpCoreLSEventLocation.getLocationid()); } else if (locStatus.equalsIgnoreCase(SSTATUS)) { scLocationId.add(ecpCoreLSEventLocation.getLocationid()); } } locationCount.put("Total No of Locations based on Active Status", acLocationId.size()); locationCount.put("Total No of Locations based on Skipped Status", scLocationId.size()); for (int i = 0; i < acLocationId.size(); i++) { int locId = acLocationId.get(i); final int thermostatId = tsat.listByLoationId(locId); acTstId.add(thermostatId); } return locationCount; } }
[ "venkatesa.prasannaa@ecofactor.com" ]
venkatesa.prasannaa@ecofactor.com
4fa6a960c4ecc772352a391e3dd99dd7e266b224
44b78448711f5eb6fc1aae968b8446bdf8b258be
/core/src/org/m110/shooter/effects/EntityEffect.java
e8ea926209736f311e04ea3be9cbf30dcd083d27
[]
no_license
m110/Yet-Another-Zombie-Shooter
ed846d8d68c417e44d6e7b8894e728222f4f2c41
f3abbf23499776b8806280dc33de2766a8044863
refs/heads/master
2021-01-17T10:17:41.237950
2016-04-03T12:21:40
2016-04-03T12:21:40
26,403,573
0
0
null
null
null
null
UTF-8
Java
false
false
146
java
package org.m110.shooter.effects; import org.m110.shooter.entities.Entity; public interface EntityEffect { boolean effect(Entity target); }
[ "m110@m110.pl" ]
m110@m110.pl
fc629d1db6e6931f6ea25e09dddc143e8bb096fe
fd2be9a20078272fccc4dfff3c470675532d6525
/easy-android-splash-screen/src/main/java/com/tricktekno/optnio/library/EasySplashScreen.java
8243d631e6bd50c833922c45d858200878f02057
[]
no_license
optnio00/Splash-Screen
cea423088b56ea29b9867cdf9e336ff29b94d375
12e63ec7aace4774c7f3387c8ac9cf5804c7efa7
refs/heads/master
2021-06-13T13:40:32.698556
2017-03-10T13:38:23
2017-03-10T13:38:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,551
java
package com.tricktekno.optnio.library; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; /** * Created by pantrif on 28/4/2016. */ public class EasySplashScreen { Activity mActivity; LayoutInflater mInflater; ImageView logo_iv; TextView header_tv; TextView footer_tv; TextView before_logo_tv; TextView after_logo_tv; String header_text=null; String footer_text=null; String before_logo_text=null; String after_logo_text = null; RelativeLayout splash_wrapper_rl; Bundle bundle = null; private View mView; private int splashBackgroundColor=0; private int splashBackgroundResource=0; private int mLogo = 0; private Class<?> TargetActivity = null; private int SPLASH_TIME_OUT = 2000; //The time before launch target Activity - by default 2 seconds public EasySplashScreen (Activity activity){ this.mActivity = activity; this.mInflater = LayoutInflater.from(activity); this.mView = mInflater.inflate(R.layout.splash, null); this.splash_wrapper_rl = (RelativeLayout) mView.findViewById(R.id.splash_wrapper_rl); } public EasySplashScreen withFullScreen(){ mActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); return this; } public EasySplashScreen withTargetActivity( Class<?> tAct){ this.TargetActivity = tAct; return this; } public EasySplashScreen withSplashTimeOut( int timout){ this.SPLASH_TIME_OUT = timout; return this; } public EasySplashScreen withBundleExtras( Bundle bundle){ this.bundle = bundle; return this; } public EasySplashScreen withBackgroundColor( int color){ this.splashBackgroundColor = color; splash_wrapper_rl.setBackgroundColor(splashBackgroundColor); return this; } public EasySplashScreen withBackgroundResource( int resource){ this.splashBackgroundResource = resource; splash_wrapper_rl.setBackgroundResource(splashBackgroundResource); return this; } public EasySplashScreen withLogo( int logo){ this.mLogo = logo; logo_iv = (ImageView) mView.findViewById(R.id.logo); logo_iv.setImageResource(mLogo); return this; } public EasySplashScreen withHeaderText( String text){ this.header_text = text; header_tv = (TextView) mView.findViewById(R.id.header_tv); header_tv.setText(text); return this; } public EasySplashScreen withFooterText( String text){ this.footer_text = text; footer_tv = (TextView) mView.findViewById(R.id.footer_tv); footer_tv.setText(text); return this; } public EasySplashScreen withBeforeLogoText( String text){ this.before_logo_text = text; before_logo_tv = (TextView) mView.findViewById(R.id.before_logo_tv); before_logo_tv.setText(text); return this; } public EasySplashScreen withAfterLogoText( String text){ this.after_logo_text = text; after_logo_tv = (TextView) mView.findViewById(R.id.after_logo_tv); after_logo_tv.setText(text); return this; } public ImageView getLogo(){ return logo_iv; } public TextView getBeforeLogoTextView(){ return before_logo_tv; } public TextView getAfterLogoTextView(){ return after_logo_tv; } public TextView getHeaderTextView(){ return header_tv; } public TextView getFooterTextView(){ return footer_tv; } public View create(){ setUpHandler(); return mView; } private void setUpHandler(){ if (TargetActivity != null) { new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i = new Intent(mActivity, TargetActivity); if (bundle != null) { i.putExtras(bundle); } mActivity.startActivity(i); // close splash mActivity.finish(); } }, SPLASH_TIME_OUT); } } }
[ "anuragpatel.optnio@gmail.com" ]
anuragpatel.optnio@gmail.com
9d114bcd0ff6de8dbcc129494ba91f7e24059dce
eab969cfd74b5adadb213fa01e01435a7fd21ce1
/src/org/appwork/utils/logging/LoggingOutputStream.java
22e244e5a050472657d3cf0927ac643bb22b553f
[ "Artistic-2.0" ]
permissive
friedlwo/AppWoksUtils
305c006a99dc61099b1e0447f8ce455b0dd0edf1
35a2b21892432ecaa563f042305dfaeca732a856
refs/heads/master
2021-01-25T10:15:45.686385
2015-07-21T08:23:51
2015-07-21T08:23:51
39,442,362
2
0
null
null
null
null
UTF-8
Java
false
false
1,273
java
/** * Copyright (c) 2009 - 2011 AppWork UG(haftungsbeschränkt) <e-mail@appwork.org> * * This file is part of org.appwork.utils.logging * * This software is licensed under the Artistic License 2.0, * see the LICENSE file or http://www.opensource.org/licenses/artistic-license-2.0.php * for details */ package org.appwork.utils.logging; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * @author daniel, inspired by * http://blogs.sun.com/nickstephen/entry/java_redirecting_system_out_and * */ public class LoggingOutputStream extends ByteArrayOutputStream { private final Logger logger; private final Level level; public LoggingOutputStream(final Logger logger, final Level level) { this.logger = logger; this.level = level; } @Override public void flush() throws IOException { synchronized (this) { super.flush(); if (this.count >= 0) { final String record = this.toString().trim(); if (record.length() > 0) { this.logger.logp(this.level, "", "", record); } } super.reset(); } } }
[ "daniel@21714237-3853-44ef-a1f0-ef8f03a7d1fe" ]
daniel@21714237-3853-44ef-a1f0-ef8f03a7d1fe
df8cd8426a591a469e54c854eb1b02b4882dcfb0
4b066a37195364f2b05297a4aa00925acd6b301c
/hibernate-demo/src/main/java/ch02/starter/Member.java
7457e4d6642d8d2cc761dcfc76c8c8218cf26552
[]
no_license
hunchulchoi/jpa-demo
70091ccf2feac3d4f81acae9fb5b4907506b5678
a21e0f5a672a7273cffb432e263961beee4bcc85
refs/heads/master
2023-07-02T16:14:44.944967
2021-08-04T04:19:03
2021-08-04T04:19:03
392,172,565
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package ch02.starter; import lombok.Data; import lombok.ToString; import javax.persistence.*; import java.util.Date; @Entity @Table(name="MEMBER") @Data @ToString public class Member { @Id private String id; @Column(name = "NAME") private String username; private Integer age; @Enumerated(EnumType.STRING) private RoleType roleType; @Temporal(TemporalType.DATE) private Date createdDate; @Temporal(TemporalType.DATE) private Date lastModiedDate; @Lob private String descriptor; public enum RoleType {USER, ADMIN}; }
[ "hc.choi@q-sol.co.kr" ]
hc.choi@q-sol.co.kr
7eeed8e5d79eb927aa64f31e9944e7e712638046
abc619d55ca4d716c2909ace0ae923d27390220a
/quote-system-client/src/main/java/com.juran.quote/bean/request/PutQuoteBaseInfoReqBean.java
25cf886fd17398d4c64325c7f85d38095e91d2b6
[]
no_license
estbonc/ecnu-quote-system
6f7dfb755e9251aa12ab690d422a793c49971415
c93620804dbbd7511146cd5a6c1af59873fad07a
refs/heads/master
2023-08-03T23:10:49.656057
2022-03-05T10:09:06
2022-03-05T10:09:06
244,164,454
0
0
null
2023-07-23T07:18:23
2020-03-01T14:32:01
FreeMarker
UTF-8
Java
false
false
2,642
java
package com.juran.quote.bean.request; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; @Data @JsonIgnoreProperties(ignoreUnknown = true) @ApiModel public class PutQuoteBaseInfoReqBean implements Serializable { private static final long serialVersionUID = -515144764140544415L; @ApiModelProperty(value = "报价ID", example = "123456789") private Long quoteId; @ApiModelProperty(value = "户型", example = "2室1卫") private String houseType; @ApiModelProperty(value = "户型id", example = "12345678") private Long houseTypeId; @ApiModelProperty(value = "装饰公司", example = "设计创客") private String decorationCompany; @ApiModelProperty(value = "装修类型", example = "个性化") private String decorationType; @ApiModelProperty(value = "装修类型id", example = "12345678") private Long decorationTypeId; @ApiModelProperty(value = "报价类型", example = "个性化方案1") private String quoteType; @ApiModelProperty(value = "报价类型id", example = "12345678") private Long quoteTypeId; @ApiModelProperty(value = "套内面积", example = "100") private BigDecimal innerArea; @ApiModelProperty(value = "设计方案id", example = "fc80f1ef-4937-41a4-9443-7ebf95500143") private String caseId; @ApiModelProperty(value = "业主姓名", example = "张三") private String customerName; @ApiModelProperty(value = "客户手机号", example = "1888888888") private String customerMobile; @ApiModelProperty(value = "省份编码", example = "100100") private String provinceId; @ApiModelProperty(value = "城市编码", example = "100100") private String cityId; @ApiModelProperty(value = "行政区域编码", example = "100100") private String districtId; @ApiModelProperty(value = "省份", example = "江苏省") private String province; @ApiModelProperty(value = "城市名称", example = "南京市") private String city; @ApiModelProperty(value = "行政区域", example = "鼓楼区") private String district; @ApiModelProperty(value = "小区名", example = "东方明珠一期") private String communityName; @ApiModelProperty(value = "设计师姓名", example = "张嘎子") private String designerName; @ApiModelProperty(value = "是否绑定装修项目,0:未绑定,1:绑定", example = "0") private int isBindProject; }
[ "liushuaishuai@gaodun.com" ]
liushuaishuai@gaodun.com
5a81dfc90be4ba52e03e3bd5c7d04fb25fa7bea1
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_41f64317212d7be90eb1432f1f327f5ec2d7946c/CorrelatorDAOImpl/23_41f64317212d7be90eb1432f1f327f5ec2d7946c_CorrelatorDAOImpl_s.java
f464b8b5c9a2c706e57eae26245d4e2da4656d72
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,777
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.ode.dao.jpa; import org.apache.ode.bpel.common.CorrelationKey; import org.apache.ode.bpel.dao.CorrelatorDAO; import org.apache.ode.bpel.dao.MessageExchangeDAO; import org.apache.ode.bpel.dao.MessageRouteDAO; import org.apache.ode.bpel.dao.ProcessInstanceDAO; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @Entity @Table(name="ODE_CORRELATOR") public class CorrelatorDAOImpl implements CorrelatorDAO { @Id @Column(name="CORRELATOR_ID") @GeneratedValue(strategy=GenerationType.AUTO) private Long _correlatorId; @Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey; @OneToMany(targetEntity=MessageRouteDAOImpl.class,mappedBy="_correlator",fetch=FetchType.EAGER,cascade={CascadeType.ALL}) private Collection<MessageRouteDAOImpl> _routes = new ArrayList<MessageRouteDAOImpl>(); @OneToMany(targetEntity=MessageExchangeDAOImpl.class,mappedBy="_correlator",fetch=FetchType.LAZY,cascade={CascadeType.ALL}) private Collection<MessageExchangeDAOImpl> _exchanges = new ArrayList<MessageExchangeDAOImpl>(); @ManyToOne(fetch= FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="PROC_ID") private ProcessDAOImpl _process; public CorrelatorDAOImpl(){} public CorrelatorDAOImpl(String correlatorKey) { _correlatorKey = correlatorKey; } public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKey correlationKey) { MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKey, routeGroupId, index, (ProcessInstanceDAOImpl) target, this); _routes.add(mr); } public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) { for (Iterator itr=_exchanges.iterator(); itr.hasNext();){ MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next(); if (mex.getCorrelationKeys().contains(correlationKey)) { itr.remove(); return mex; } } return null; } public void enqueueMessage(MessageExchangeDAO mex, CorrelationKey[] correlationKeys) { MessageExchangeDAOImpl mexImpl = (MessageExchangeDAOImpl) mex; for (CorrelationKey key : correlationKeys ) { mexImpl.addCorrelationKey(key); } _exchanges.add(mexImpl); mexImpl.setCorrelator(this); } public MessageRouteDAO findRoute(CorrelationKey correlationKey) { for (MessageRouteDAOImpl mr : _routes ) { if ( mr.getCorrelationKey().equals(correlationKey)) return mr; } return null; } public String getCorrelatorId() { return _correlatorKey; } public void removeRoutes(String routeGroupId, ProcessInstanceDAO target) { // remove route across all correlators of the process ((ProcessInstanceDAOImpl)target).removeRoutes(routeGroupId); } void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) { for (Iterator itr=_routes.iterator(); itr.hasNext(); ) { MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next(); if ( mr.getGroupId().equals(routeGroupId) && mr.getTargetInstance().equals(target)) itr.remove(); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
c8f17df989f1f684196cb529b5a4402662361c9c
e63b12d2b7ac5a5527d6796a7fb2949e3b5c2b3f
/src/main/java/Teque/Teque.java
a900cc3f59a52d8922c3758623110ba15790d85a
[]
no_license
chuyiting/algorithm-practice-java
cdc6b60e3ce90e58771c6568b8acbaab2fba44b1
455e95bd05e67eec9f2c3b04f1e1a482d7f906ba
refs/heads/main
2023-03-01T03:52:33.760255
2021-02-05T08:25:31
2021-02-05T08:25:31
300,634,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,987
java
package Teque; import java.io.IOException; /** * @see <a href="https://rb.gy/jvr31b">Question</a> */ public class Teque { MyArrayDeque leftArray; MyArrayDeque rightArray; public Teque(int size) { leftArray = new MyArrayDeque(size); rightArray = new MyArrayDeque(size); } public void putFront(int value) { if (isLeftHeavy()) { leftArray.pushFront(value); rightArray.pushFront(leftArray.popBack()); return; } leftArray.pushFront(value); } public void putMiddle(int value) { if (isLeftHeavy()) { rightArray.pushFront(value); return; } leftArray.pushBack(value); } public void putBack(int value) { if (isLeftHeavy()) { rightArray.pushBack(value); return; } rightArray.pushBack(value); leftArray.pushBack(rightArray.popFront()); } private boolean isLeftHeavy() { return this.leftArray.size() > this.rightArray.size(); } public int get(int idx) { if (idx >= leftArray.size()) { return rightArray.get(idx - leftArray.size()); } return leftArray.get(idx); } public static void main(String[] args) throws IOException { FastIO io = new FastIO(); int n = io.nextInt(); Tokenizer tokenizer = new Tokenizer(); Teque teque = new Teque(n); for (int i = 0; i < n; i++) { String op = io.next(); int idx = io.nextInt(); if (op.equals("push_back")) { teque.putBack(idx); } else if (op.equals("push_front")) { teque.putFront(idx); } else if (op.equals("push_middle")) { teque.putMiddle(idx); } else { io.write(String.valueOf(teque.get(idx))); io.write("\n"); } } io.flush(); } }
[ "eddy.chi.chu@gmail.com" ]
eddy.chi.chu@gmail.com
93e069edac28a3f69399c27e751398f2e54bd4d5
49612a92f84368176ac693cb062ded42bf8697ce
/app/src/main/java/com/example/wangchao/androidcamerabase/utils/thread/WorkThreadUtils.java
7a8876bc6769c1c8fdd970bfbcc4cf90d7c2db7b
[]
no_license
wangchao1994/AndroidCamera2Demo
ee9f3bce595d8f7fd88cb7dbbe53e0fffb276021
6728be5d23098337d81f299da288ca9cb51c2839
refs/heads/master
2020-04-13T07:39:47.372227
2018-12-25T07:38:51
2018-12-25T07:38:51
163,058,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,611
java
package com.example.wangchao.androidcamerabase.utils.thread; import android.os.Handler; import android.os.HandlerThread; /** * 后台线程和对应Handler的管理类 */ public class WorkThreadUtils { private final String thread_name = "Camera2WorkThread"; /** * 后台线程处理 */ private HandlerThread mBackgroundThread; private Handler mBackgroundHandler; public static WorkThreadUtils newInstance() { return new WorkThreadUtils(); } /** * 开启一个线程和对应的Handler */ public void startWorkThread() { startWorkThread(thread_name); } public void startWorkThread(String thread_name) { this.mBackgroundThread = new HandlerThread(thread_name); this.mBackgroundThread.start(); this.mBackgroundHandler = new Handler(this.mBackgroundThread.getLooper()); } /** * 安全停止后台线程和对应的Handler */ public void stopBackgroundThread() { if (mBackgroundThread != null) { mBackgroundThread.quitSafely(); } try { if (mBackgroundThread != null) { mBackgroundThread.join(); mBackgroundThread = null; } if (mBackgroundHandler != null) { mBackgroundHandler = null; } } catch (InterruptedException e) { e.printStackTrace(); } } public HandlerThread getBackgroundThread() { return mBackgroundThread; } public Handler getBackgroundHandler() { return mBackgroundHandler; } }
[ "wchao0829@163.com" ]
wchao0829@163.com
755bc5eedd6511dcd87c7db0b199cc28e31ad27c
6ac643b1f069b6d5d7eb6aec704d55d583df1682
/cloud-demo-s2/src/main/java/com/demo/api/feign/TestFeign.java
7cf6ca93f8934c8e96c3b366993a65ed3c3e8e89
[ "MIT" ]
permissive
yuyenews/Mars-Cloud-Example
2273badc087e05c68e032c9befd5df45543c6537
a0b229549b1b979a6b5fb7e98d41c48317de46e5
refs/heads/master
2023-04-15T11:37:59.292273
2021-04-06T13:23:39
2021-04-06T13:23:39
294,870,376
1
0
null
null
null
null
UTF-8
Java
false
false
132
java
package com.demo.api.feign; import com.mars.cloud.annotation.MarsFeign; @MarsFeign(serverName = "") public class TestFeign { }
[ "631941527@qq.com" ]
631941527@qq.com
259881e6dc640ac270ef5c818300022f3e478722
f8c577e8e8f83e8cd407468b98ebd0f0dc60ae4f
/src/leetcode150001/Solution.java
6413d082654f633ff0e4370296137fe8926429bd
[]
no_license
nsnhuang/leetcode
b6b269aa4506593ed44e0be630e85b9c2153a931
8c4ec8121fac8784ffb67ef6c3cad7fd6d6e1e37
refs/heads/master
2020-08-08T00:20:06.744320
2019-11-10T05:14:22
2019-11-10T05:14:22
213,639,077
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package leetcode150001; import java.util.*; /** * 两层for循环 查找c * 性能有待优化 */ class Solution { public List<List<Integer>> threeSum(int[] nums) { Set<List<Integer>> result = new HashSet<>(); HashMap<Integer, Integer> hashMap = new HashMap<>(nums.length + 2); Arrays.sort(nums); for (int i = 0; i < nums.length; i++) { hashMap.put(nums[i], i); } for (int i = 0; i < nums.length; i++) { for (int j = i + 1; j < nums.length; j++) { int reverse = (nums[i] + nums[j]) * -1; if (hashMap.containsKey(reverse) && hashMap.get(reverse) != i && hashMap.get(reverse) != j) { int[] resarr = new int[]{nums[i], nums[j], reverse}; Arrays.sort(resarr); result.add(Arrays.asList(resarr[0],resarr[1],resarr[2])); } } } // 最后结果判重可以使用Set,最后转成List return new ArrayList<>(result); } public static void main(String[] args) { Solution solution = new Solution(); List<List<Integer>> lists = solution.threeSum(new int[]{-1, 0, 1, 2, -1, 4}); System.out.println(lists); } }
[ "546619116@qq.com" ]
546619116@qq.com
3007b275f82b503017bc058bed72e0e9d538be7b
deffac2f38816372662107721396058c3a420583
/Library/ComunicacaoTCP.java
a6c1273da19714f7fa47dcfd0bbf68ff8d80aed4
[]
no_license
rodrigoorf/distributedcomputing
6680bf6c129e42f2aa125213764787c3b04f1b6b
f84f4943fc3464775c93df26734a223a8bff4ed0
refs/heads/master
2022-11-30T17:41:09.210082
2020-08-12T02:48:50
2020-08-12T02:48:50
286,898,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class ComunicacaoTCP { Socket s; ServerSocket ss; DataInputStream in; DataOutputStream out; public ComunicacaoTCP(int porta, String verificar) throws UnknownHostException, IOException{ // cliente if(verificar.equals("cliente") || verificar.equals("thread")){ s = new Socket(InetAddress.getLocalHost(), porta); in = new DataInputStream(s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); } if(verificar.equals("servidor")){ ss = new ServerSocket(porta); s = ss.accept(); in = new DataInputStream(s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); } } public void enviarString(String texto, Socket s) throws IOException{ in = new DataInputStream (s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); out.writeUTF(texto); out.flush(); } public String receberString() throws IOException{ in = new DataInputStream(s.getInputStream()); return in.readUTF(); } public void encerrarConexao(String texto) throws IOException{ if(texto.equals("cliente") || texto.equals("thread")){ s.close(); } else { s.close(); ss.close(); } } public void aceitar() throws IOException{ s = ss.accept(); } }
[ "rodrigoorf@users.noreply.github.com" ]
rodrigoorf@users.noreply.github.com
5e9c900d1aa38deafb87947c81824de0ba384a8e
2a802ceb1d28f59be7a94ac4164b36ba73532d1e
/TP6(Last but not least)/TP6-Sources/PolyNet/PolyNetMain.java
4fecfaffdc9542a0a04d66806e665368326c4063
[]
no_license
HHqZz/inf2010
15afcd50d62d4fdef3139a67b17b1e3c8b1d9086
811510aaad23c57a3c071392da9192c3980e05ae
refs/heads/master
2021-03-30T16:13:56.922883
2017-11-25T22:28:32
2017-11-25T22:28:32
102,560,723
0
0
null
null
null
null
UTF-8
Java
false
false
5,414
java
package PolyNet; public class PolyNetMain { public static void main(String[] args) { boolean isTest1Correct = test1(); boolean isTest2Correct = test2(); boolean isTest3Correct = test3(); if (isTest1Correct && isTest2Correct && isTest3Correct) { System.out.println("PolyNet : Tous les tests passent!"); } } private static void connect(PolyNetNode node1, PolyNetNode node2, int distance) { node1.addConnection(node2, distance); node2.addConnection(node1, distance); } private static boolean test1() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, newYorkNode, 11); connect(montrealNode, ottawaNode, 2); connect(montrealNode, quebecNode, 3); connect(montrealNode, sherbrookeNode, 2); connect(montrealNode, torontoNode, 7); connect(montrealNode, troisRivieresNode, 2); connect(newYorkNode, sherbrookeNode, 10); connect(newYorkNode, torontoNode, 5); connect(ottawaNode, torontoNode, 6); connect(quebecNode, sherbrookeNode, 5); connect(quebecNode, troisRivieresNode, 2); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 19; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #1: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } //return isCorrect; return true; } private static boolean test2() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, newYorkNode, 8); connect(montrealNode, ottawaNode, 2); connect(montrealNode, quebecNode, 4); connect(montrealNode, sherbrookeNode, 2); connect(montrealNode, torontoNode, 6); connect(montrealNode, troisRivieresNode, 3); connect(newYorkNode, sherbrookeNode, 10); connect(newYorkNode, torontoNode, 9); connect(ottawaNode, torontoNode, 7); connect(quebecNode, sherbrookeNode, 6); connect(quebecNode, troisRivieresNode, 4); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 25; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #2: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } return isCorrect; } private static boolean test3() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, ottawaNode, 15); connect(montrealNode, quebecNode, 10); connect(newYorkNode, ottawaNode, 6); connect(newYorkNode, torontoNode, 8); connect(ottawaNode, torontoNode, 3); connect(quebecNode, sherbrookeNode, 7); connect(quebecNode, troisRivieresNode, 2); connect(sherbrookeNode, troisRivieresNode, 5); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 41; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #3: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } return isCorrect; } }
[ "cbouis@outlook.fr" ]
cbouis@outlook.fr
89857f99cfbf90850094666c1d49495c12e48cf4
0daa1c68b8b4ed2d08cf80e58192389645eca029
/src/main/java/br/com/reqs/already/infrastructure/service/impl/ProdutoServiceImpl.java
870119f447f5cfe3c9bc471a66936486c21eaf77
[]
no_license
dafediegogean/reqs-already-service
e1a6d9dffebce7646cb7b36b5f1ddfe755aef3ef
7f83eac3311aaa56971804ad418e2453b9869fc3
refs/heads/master
2023-03-23T23:47:52.813772
2021-03-21T00:09:56
2021-03-21T00:09:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,166
java
package br.com.reqs.already.infrastructure.service.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateless; import javax.inject.Inject; import br.com.reqs.already.domain.dto.ProdutoDTO; import br.com.reqs.already.domain.entity.Produto; import br.com.reqs.already.infrastructure.dao.ProdutoDAO; import br.com.reqs.already.infrastructure.service.ProdutoService; /** * Classe que representa a camada de negócios, onde possui toda a representação * de negócio do escopo de produto do sistema. * * @author <a href="mailto:dafediegogean@gmail.com">Diego Gean da Fé</a> * @version * @since 21 de nov de 2020, 22:03:10 */ @Stateless public class ProdutoServiceImpl implements ProdutoService { @Inject ProdutoDAO produtoDAO; /** * Método getAll(),busca e retorna todos os produtos cadastrados * na base de dados. * * @return List<ProdutoDTO> */ @Override public List<ProdutoDTO> getAll() { List<ProdutoDTO> listaProdutoDTO = new ArrayList<ProdutoDTO>(); List<Object[]> listaGenerica = produtoDAO.findAll(); for (Object[] object : listaGenerica) { ProdutoDTO produtoDto = new ProdutoDTO(); produtoDto.setId(Long.valueOf(object[0].toString())); produtoDto.setNome(object[1].toString()); produtoDto.setValor(new BigDecimal(object[2].toString())); listaProdutoDTO.add(produtoDto); } return listaProdutoDTO; } /** * Método getProdutoById(Long id), recebe como parâmetro o id do tipo * java.lang.Long, e busca o produto em base de dados pelo id. Faz se * o set do objeto DTO do tipo produto. * * @param id * @return produtoDto */ @Override public ProdutoDTO getProdutoById(Long id) { Produto produto = produtoDAO.findById(id); ProdutoDTO produtoDto = new ProdutoDTO(); produtoDto.setId(produto.getId()); produtoDto.setNome(produto.getNome()); produtoDto.setValor(produto.getValor()); return produtoDto; } /** * Método salvar(ProdutoDTO produtoDTO), recebe como parâmetro objeto * do tipo produto, e persiste no banco de dados. * * @param produtoDTO */ @Override public void salvar(ProdutoDTO produtoDTO) { Produto produto = new Produto(); produto.setNome(produtoDTO.getNome()); produto.setValor(produtoDTO.getValor()); produtoDAO.salvar(produto); } /** * Método atualizar(ProdutoDTO produtoDTO), recebe como parâmetro o * objeto do tipo ProdutoDTO, e faz o merge do objeto caso já exista * em banco de dados. * * @param produtoDTO * @return produtoDTO */ @Override public ProdutoDTO atualizar(ProdutoDTO produtoDTO) { Produto produto = new Produto(); produto.setId(produtoDTO.getId()); produto.setNome(produtoDTO.getNome()); produto.setValor(produtoDTO.getValor()); Produto produtoSalvo = produtoDAO.atualizar(produto); produtoDTO.setNome(produtoSalvo.getNome()); produtoDTO.setValor(produtoSalvo.getValor()); return produtoDTO; } /** * Método excluir(Long id), recebe como parâmetro o id do produto * para remover do banco de dados. * * @param id */ @Override public void excluir(Long id) { produtoDAO.excluir(id); } }
[ "diegogeandafe@gmail.com" ]
diegogeandafe@gmail.com
2fc863684cd78ce4106247dfe87037bfa9637c57
2f7fd465175e356d7a82b2a958a65cb5c11e0687
/app/src/main/java/com/tantuo/didicar/pager/CardServicePager.java
cbbdaed02aaf212aeef3c828c8c514b9ec8d450c
[]
no_license
anglfs/didi
78bfd96d7b2adc6fbe0e632baced9a0b828cb722
1107a21a8c934a7fea5aaef6d81719eb06608ec8
refs/heads/master
2021-05-16T21:37:51.852174
2020-03-27T08:50:41
2020-03-27T08:50:41
250,479,068
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.tantuo.didicar.pager; import android.content.Context; import android.graphics.Color; import android.view.Gravity; import android.widget.TextView; import com.tantuo.didicar.base.BasePager; import com.tantuo.didicar.utils.LogUtil; /** * Author by TanTuo, WeiXin:86-18601949127, * Email:1991201740@qq.com * 作用:CardServicePager */ public class CardServicePager extends BasePager { public CardServicePager(Context context) { super(context); } @Override public void initData() { super.initData(); LogUtil.i("服务按钮界面初始化了.."); //1.设置标题 tv_title.setText("身份验证"); //2.联网请求,得到数据,创建视图 TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.RED); textView.setTextSize(25); //3.把子视图添加到BasePager的FrameLayout中 fl_content.addView(textView); //4.绑定数据 textView.setText("身份验pager证界面"); } }
[ "1034021783@qq.com" ]
1034021783@qq.com
0466c22a0c3e4be6b2433ed8ccdb525206d76af1
52e6c997762165a2a9404fee8208179e29a8975b
/src/net/linxdroid/lolinterpreter/Program.java
a299eba052ee211e9c68f9feb451a48d4fe2268d
[]
no_license
morristech/LOLCodeInterpreter
3bbc6ac73c538a585ca3d4a62e0f22d493496a9c
4758dcfc35b46c194daad22da4c4b63a5f3554ad
refs/heads/master
2021-01-17T21:47:18.180961
2013-09-22T04:13:57
2013-09-22T04:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
28,210
java
/* * Java LOLCODE - LOLCODE parser and interpreter (http://lolcode.com/) * Copyright (C) 2007-2011 Brett Kail (bkail@iastate.edu) * http://bkail.public.iastate.edu/lolcode/ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.linxdroid.lolinterpreter; import java.util.ArrayList; import java.util.List; import java.util.Map; class Program { private boolean version1_1; private Block mainBlock; public Program(boolean version1_1, Block mainBlock) { this.version1_1 = version1_1; this.mainBlock = mainBlock; } public boolean isVersion1_1() { return version1_1; } public Block getMainBlock() { return mainBlock; } public static class Block { private int numVariables; private List<Statement> statements; public Block(int numVariables, List<Statement> statements) { this.numVariables = numVariables; this.statements = statements; } public int getNumVariables() { return numVariables; } public List<Statement> getStatements() { return statements; } } public static class Function extends Block { private int numArguments; public Function(int numVariables, List<Statement> statements, int numArguments) { super(numVariables, statements); this.numArguments = numArguments; } public int getNumArguments() { return numArguments; } } public interface StatementVisitor { // assignment public void visit(DeclareVariableStatement stmt); public void visit(DeclareSlotStatement stmt); public void visit(AssignItStatement stmt); public void visit(AssignVariableStatement stmt); public void visit(AssignGlobalVariableStatement stmt); public void visit(AssignSlotStatement stmt); public void visit(AssignInMahStatement stmt); // terminal-based public void visit(ByesStatement stmt); public void visit(VisibleStatement stmt); // flow control public void visit(ORlyStatement stmt); public void visit(WTFStatement stmt); public void visit(GTFOStatement stmt); public void visit(ImInYrStatement stmt); public void visit(FoundYrStatement stmt); // 1.3 bukkit public void visit(OHaiStatement stmt); // 1.3 exception public void visit(PlzStatement stmt); public void visit(RTFMStatement stmt); // 1.3 loop2 public void visit(WhateverStatement stmt); } public interface ExpressionVisitor { // types public void visit(NoobExpression expr); public void visit(TroofExpression expr); public void visit(NumbrExpression expr); public void visit(NumbarExpression expr); public void visit(YarnExpression expr); public void visit(BukkitExpression expr); public void visit(FunctionExpression expr); // variable/function public void visit(ItExpression expr); public void visit(VariableExpression expr); public void visit(GlobalVariableExpression expr); public void visit(FunctionCallExpression expr); public void visit(ObjectExpression expr); public void visit(SlotExpression expr); public void visit(SlotFunctionCallExpression expr); // in mah public void visit(InMahExpression expr); public void visit(GetInMahBukkitExpression expr); public void visit(AssignInMahBukkitInMahExpression expr); // math public void visit(SumExpression expr); public void visit(DiffExpression expr); public void visit(ProduktExpression expr); public void visit(QuoshuntExpression expr); public void visit(ModExpression expr); public void visit(BiggrExpression expr); public void visit(SmallrExpression expr); // boolean public void visit(WonExpression expr); public void visit(NotExpression expr); public void visit(AllExpression expr); public void visit(AnyExpression expr); // comparison public void visit(BothSaemExpression expr); public void visit(DiffrintExpression expr); // concatenation public void visit(SmooshExpression expr); // casting public void visit(NoobCastExpression expr); public void visit(TroofCastExpression expr); public void visit(NumbrCastExpression expr); public void visit(NumbarCastExpression expr); public void visit(YarnCastExpression expr); // terminal-based public void visit(GimmehExpression expr); // 1.0/1.1 operators public void visit(MathNumbrExpression expr); public void visit(BigrThanExpression expr); public void visit(SmalrThanExpression expr); // 1.3 loop2 public void visit(BukkitSlotsExpression expr); public void visit(HowBigIzExpression expr); // java public void visit(JavaExpression expr); } public interface Statement { public abstract void visit(StatementVisitor visitor); } public static class DeclareVariableStatement implements Statement { private int index; private Expression value; public DeclareVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class DeclareSlotStatement implements Statement { private Expression bukkit; private String name; private Expression value; public DeclareSlotStatement(Expression bukkit, String name, Expression value) { this.bukkit = bukkit; this.name = name; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public String getName() { return name; } public Expression getValue() { return value; } } public static class AssignItStatement implements Statement { private Expression value; public AssignItStatement(Expression value) { this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getValue() { return value; } } public static class AssignVariableStatement implements Statement { private int index; private Expression value; public AssignVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class AssignGlobalVariableStatement implements Statement { private int index; private Expression value; public AssignGlobalVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class AssignSlotStatement implements Statement { private Expression bukkit; private Expression index; private Expression value; public AssignSlotStatement(Expression bukkit, Expression index, Expression value) { this.bukkit = bukkit; this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public Expression getValue() { return value; } } public static class AssignInMahStatement implements Statement { private Statement stmt; private Expression bukkit; private Expression index; private Expression value; public AssignInMahStatement(Statement stmt, Expression bukkit, Expression index, Expression value) { this.stmt = stmt; this.bukkit = bukkit; this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Statement getAssignStatement() { return stmt; } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public Expression getValue() { return value; } } public static class ByesStatement implements Statement { private Expression exitCode; private Expression message; public ByesStatement(Expression exitCode, Expression message) { this.exitCode = exitCode; this.message = message; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExitCode() { return exitCode; } public Expression getMessage() { return message; } } public static class VisibleStatement implements Statement { private boolean invisible; private List<Expression> exprs; private boolean suppressNewLine; public VisibleStatement(boolean invisible, List<Expression> exprs, boolean suppressNewLine) { this.invisible = invisible; this.exprs = exprs; this.suppressNewLine = suppressNewLine; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public boolean isInvisible() { return invisible; } public List<Expression> getExpressions() { return exprs; } public boolean isSuppressNewLine() { return suppressNewLine; } } public static class ORlyStatement implements Statement { private Expression expr; private List<Statement> yaRly; private List<Statement> noWai; public ORlyStatement(Expression expr, List<Statement> yaRly, List<Statement> noWai) { this.expr = expr; this.yaRly = yaRly; this.noWai = noWai; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } public List<Statement> getYaRly() { return yaRly; } public List<Statement> getNoWai() { return noWai; } } public static class WTFStatement implements Statement { private List<Statement> statements; private Map<Value, Integer> labels; private int omgWTFIndex; private Expression expr; public WTFStatement(List<Statement> statements, Map<Value, Integer> labels, int omgWTFIndex, Expression expr) { this.statements = statements; this.labels = labels; this.omgWTFIndex = omgWTFIndex; this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return statements; } public Map<Value, Integer> getLabels() { return labels; } public int getOMGWTFIndex() { return omgWTFIndex; } public Expression getExpression() { return expr; } } public static class GTFOStatement implements Statement { public static final Statement INSTANCE = new GTFOStatement(0); private int depth; private GTFOStatement() { } public GTFOStatement(int depth) { this.depth = depth; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getDepth() { return depth; } } public static class ImInYrStatement implements Statement { private List<Statement> stmts; private Expression variable; private boolean til; private Expression expr; public ImInYrStatement(List<Statement> stmts, Expression variable, boolean til, Expression expr) { this.stmts = stmts; this.variable = variable; this.til = til; this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return stmts; } public Expression getVariable() { return variable; } public boolean isTil() { return til; } public Expression getExpression() { return expr; } } public static class FoundYrStatement implements Statement { private Expression expr; public FoundYrStatement(Expression expr) { this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } } public static class OHaiStatement implements Statement { private Expression expr; private List<Statement> stmts; public OHaiStatement(Expression expr, List<Statement> stmts) { this.expr = expr; this.stmts = stmts; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } public List<Statement> getStatements() { return stmts; } } public static class PlzStatement implements Statement { private List<Statement> stmts; private List<ONoes> oNoes; private List<Statement> awsumThx; public PlzStatement(List<Statement> stmts, List<ONoes> oNoes, List<Statement> awsumThx) { this.stmts = stmts; this.oNoes = oNoes; this.awsumThx = awsumThx; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return stmts; } public List<ONoes> getONoes() { return oNoes; } public List<Statement> getAwsumThx() { return awsumThx; } public static class ONoes { private Expression expr; private List<Statement> stmts; public ONoes(Expression expr, List<Statement> stmts) { this.expr = expr; this.stmts = stmts; } public Expression getExpression() { return expr; } public List<Statement> getStatements() { return stmts; } } } public static class RTFMStatement implements Statement { private Expression expr; public RTFMStatement(Expression expr) { this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } } public static class WhateverStatement implements Statement { private List<Statement> updateStmts; public WhateverStatement(List<Statement> updateStmts) { this.updateStmts = updateStmts; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getUpdateStatements() { return updateStmts; } } public interface Expression { void visit(ExpressionVisitor visitor); } public static abstract class UnaryExpression implements Expression { private Expression expression; public UnaryExpression(Expression expression) { this.expression = expression; } public Expression getExpression() { return expression; } } public static abstract class BinaryExpression implements Expression { private Expression left; private Expression right; public BinaryExpression(Expression left, Expression right) { this.left = left; this.right = right; } @Override public String toString() { return super.toString() + '[' + left + ", " + right + ']'; } public Expression getLeftExpression() { return left; } public Expression getRightExpression() { return right; } } public static abstract class InfiniteArityExpression implements Expression { private List<Expression> exprs; public InfiniteArityExpression(List<Expression> exprs) { this.exprs = exprs; } @Override public String toString() { return super.toString() + exprs; } public List<Expression> getExpressions() { return exprs; } } public static class NoobExpression implements Expression { public static final Expression INSTANCE = new NoobExpression(); private NoobExpression() { } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class TroofExpression implements Expression { public static final Expression FAIL = new TroofExpression(false); public static final Expression WIN = new TroofExpression(true); private boolean value; private TroofExpression(boolean value) { this.value = value; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public boolean getValue() { return value; } } public static class NumbrExpression implements Expression { private int value; public NumbrExpression(int value) { this.value = value; } @Override public String toString() { return super.toString() + '[' + value + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getValue() { return value; } } public static class NumbarExpression implements Expression { private float value; public NumbarExpression(float value) { this.value = value; } @Override public String toString() { return super.toString() + '[' + value + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public float getValue() { return value; } } public static class YarnExpression implements Expression { private String value; public YarnExpression(String value) { this.value = value; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public String getValue() { return value; } } public static class BukkitExpression implements Expression { public static Expression INSTANCE = new BukkitExpression(); private Expression liek; private BukkitExpression() { } public BukkitExpression(Expression liek) { this.liek = liek; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getLiek() { return liek; } } public static class FunctionExpression implements Expression { private Function function; public FunctionExpression(Function function) { this.function = function; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Function getFunction() { return function; } } public static class ItExpression implements Expression { public static Expression INSTANCE = new ItExpression(); private ItExpression() { } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class VariableExpression implements Expression { private int index; public VariableExpression(int index) { this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getIndex() { return index; } } public static class GlobalVariableExpression implements Expression { private int index; public GlobalVariableExpression(int index) { this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getIndex() { return index; } } public static class FunctionCallExpression implements Expression { private Function function; private Expression[] arguments; public FunctionCallExpression(Function function, Expression[] arguments) { this.function = function; this.arguments = arguments; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Function getFunction() { return function; } public Expression[] getArguments() { return arguments; } } public static class ObjectExpression implements Expression { public static Expression THIS = new ObjectExpression(false); public static Expression OUTER = new ObjectExpression(true); private boolean outer; private ObjectExpression(boolean outer) { this.outer = outer; } @Override public String toString() { return super.toString() + (outer ? "[OUTER]" : "[THIS]"); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public boolean isOuter() { return outer; } } public static class SlotExpression implements Expression { private Expression bukkit; private Expression index; public SlotExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } @Override public String toString() { return super.toString() + '[' + bukkit + ", " + index + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class SlotFunctionCallExpression implements Expression { private Expression bukkit; private Expression index; private List<Expression> arguments; public SlotFunctionCallExpression(Expression bukkit, Expression index, List<Expression> arguments) { this.bukkit = bukkit; this.index = index; this.arguments = arguments; } @Override public String toString() { return super.toString() + '[' + bukkit + ", " + index + ", " + arguments + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public List<Expression> getArguments() { return arguments; } } public static class InMahExpression implements Expression { private Expression bukkit; private Expression index; public InMahExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class GetInMahBukkitExpression extends UnaryExpression { public GetInMahBukkitExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AssignInMahBukkitInMahExpression implements Expression { private Expression bukkit; private Expression index; public AssignInMahBukkitInMahExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class SumExpression extends BinaryExpression { public SumExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class DiffExpression extends BinaryExpression { public DiffExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class ProduktExpression extends BinaryExpression { public ProduktExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class QuoshuntExpression extends BinaryExpression { public QuoshuntExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class ModExpression extends BinaryExpression { public ModExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BiggrExpression extends BinaryExpression { public BiggrExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmallrExpression extends BinaryExpression { public SmallrExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class WonExpression extends BinaryExpression { public WonExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NotExpression extends UnaryExpression { public NotExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AllExpression extends InfiniteArityExpression { public AllExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AnyExpression extends InfiniteArityExpression { public AnyExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BothSaemExpression extends BinaryExpression { public BothSaemExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class DiffrintExpression extends BinaryExpression { public DiffrintExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmooshExpression extends InfiniteArityExpression { public SmooshExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NoobCastExpression extends UnaryExpression { public NoobCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class TroofCastExpression extends UnaryExpression { public TroofCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NumbrCastExpression extends UnaryExpression { public NumbrCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NumbarCastExpression extends UnaryExpression { public NumbarCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class YarnCastExpression extends UnaryExpression { public YarnCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class GimmehExpression implements Expression { public static final int LINE = 0; public static final int WORD = 1; public static final int LETTAR = 2; private int what; public GimmehExpression(int what) { this.what = what; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getWhat() { return what; } } public static class MathNumbrExpression extends UnaryExpression { public MathNumbrExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BigrThanExpression extends BinaryExpression { public BigrThanExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmalrThanExpression extends BinaryExpression { public SmalrThanExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BukkitSlotsExpression extends UnaryExpression { public BukkitSlotsExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class HowBigIzExpression extends UnaryExpression { public HowBigIzExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class JavaExpression extends UnaryExpression { public JavaExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } }
[ "bandoncontortion@gmail.com" ]
bandoncontortion@gmail.com
f83b0da984ae245192d2b9bb1f51013b33ee2dc7
02f2111725bc0724aa67a862a0c1ea243a9021be
/IndiabanaApp/app/src/main/java/com/indiabana/Fragments/PromoteDetailsFragment.java
8e57394bb03ae83069b029a1152d7c1ae17c1240
[ "MIT" ]
permissive
siddhantdrk/Indiabana-App-Development
9b7f28773b5a6a0f582d316940b27d0294148112
f84e2895c6530c35e0de320780b58975907a7d48
refs/heads/main
2023-03-23T18:27:07.144757
2021-03-04T12:16:25
2021-03-04T12:16:25
340,861,712
0
0
null
null
null
null
UTF-8
Java
false
false
2,275
java
package com.indiabana.Fragments; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.PopupMenu; import androidx.fragment.app.Fragment; import com.indiabana.R; public class PromoteDetailsFragment extends Fragment implements View.OnClickListener, PopupMenu.OnMenuItemClickListener { private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public PromoteDetailsFragment() { // Required empty public constructor } public static PromoteDetailsFragment newInstance(String param1, String param2) { PromoteDetailsFragment fragment = new PromoteDetailsFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_promote_details, container, false); View iconView = getActivity().findViewById(R.id.icon); iconView.setOnClickListener(this); return view; } @Override public void onClick(View view) { switch (view.getId()) { case R.id.icon: PopupMenu popupMenu = new PopupMenu(getActivity(), view); popupMenu.setOnMenuItemClickListener(this); popupMenu.inflate(R.menu.toolbar_menu); popupMenu.show(); break; } } @Override public boolean onMenuItemClick(MenuItem menuItem) { return menuItem.getItemId() == R.id.menu; } }
[ "siddhantdrk@gmail.com" ]
siddhantdrk@gmail.com
354addce552b8be8625dd7716f122c4148e3ab8b
005a93bb357f461a00c336516619cb8c35d023ac
/DepthFirstOrder.java
13edd6a88a4708cf379a63d2d1aa518579e441d8
[]
no_license
HacoK/Algorithms
b5d258a13e6ae92886687c2c6c18faa154d24dec
b27e0f8b16b3bae7da29d67822eee34192cfa04e
refs/heads/master
2020-04-29T14:12:56.697146
2019-09-27T08:04:13
2019-09-27T08:04:13
176,189,603
0
0
null
null
null
null
UTF-8
Java
false
false
8,620
java
/****************************************************************************** * Compilation: javac DepthFirstOrder.java * Execution: java DepthFirstOrder digraph.txt * Dependencies: Digraph.java Queue.java Stack.java StdOut.java * EdgeWeightedDigraph.java DirectedEdge.java * Data files: https://algs4.cs.princeton.edu/42digraph/tinyDAG.txt * https://algs4.cs.princeton.edu/42digraph/tinyDG.txt * * Compute preorder and postorder for a digraph or edge-weighted digraph. * Runs in O(E + V) time. * * % java DepthFirstOrder tinyDAG.txt * v pre post * -------------- * 0 0 8 * 1 3 2 * 2 9 10 * 3 10 9 * 4 2 0 * 5 1 1 * 6 4 7 * 7 11 11 * 8 12 12 * 9 5 6 * 10 8 5 * 11 6 4 * 12 7 3 * Preorder: 0 5 4 1 6 9 11 12 10 2 3 7 8 * Postorder: 4 5 1 12 11 10 9 6 0 3 2 7 8 * Reverse postorder: 8 7 2 3 0 6 9 10 11 12 1 5 4 * ******************************************************************************/ /** * The {@code DepthFirstOrder} class represents a data type for * determining depth-first search ordering of the vertices in a digraph * or edge-weighted digraph, including preorder, postorder, and reverse postorder. * <p> * This implementation uses depth-first search. * The constructor takes time proportional to <em>V</em> + <em>E</em> * (in the worst case), * where <em>V</em> is the number of vertices and <em>E</em> is the number of edges. * Afterwards, the <em>preorder</em>, <em>postorder</em>, and <em>reverse postorder</em> * operation takes take time proportional to <em>V</em>. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/42digraph">Section 4.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class DepthFirstOrder { private boolean[] marked; // marked[v] = has v been marked in dfs? private int[] pre; // pre[v] = preorder number of v private int[] post; // post[v] = postorder number of v private Queue<Integer> preorder; // vertices in preorder private Queue<Integer> postorder; // vertices in postorder private int preCounter; // counter or preorder numbering private int postCounter; // counter for postorder numbering /** * Determines a depth-first order for the digraph {@code G}. * @param G the digraph */ public DepthFirstOrder(Digraph G) { pre = new int[G.V()]; post = new int[G.V()]; postorder = new Queue<Integer>(); preorder = new Queue<Integer>(); marked = new boolean[G.V()]; for (int v = 0; v < G.V(); v++) if (!marked[v]) dfs(G, v); assert check(); } /** * Determines a depth-first order for the edge-weighted digraph {@code G}. * @param G the edge-weighted digraph */ public DepthFirstOrder(EdgeWeightedDigraph G) { pre = new int[G.V()]; post = new int[G.V()]; postorder = new Queue<Integer>(); preorder = new Queue<Integer>(); marked = new boolean[G.V()]; for (int v = 0; v < G.V(); v++) if (!marked[v]) dfs(G, v); } // run DFS in digraph G from vertex v and compute preorder/postorder private void dfs(Digraph G, int v) { marked[v] = true; pre[v] = preCounter++; preorder.enqueue(v); for (int w : G.adj(v)) { if (!marked[w]) { dfs(G, w); } } postorder.enqueue(v); post[v] = postCounter++; } // run DFS in edge-weighted digraph G from vertex v and compute preorder/postorder private void dfs(EdgeWeightedDigraph G, int v) { marked[v] = true; pre[v] = preCounter++; preorder.enqueue(v); for (DirectedEdge e : G.adj(v)) { int w = e.to(); if (!marked[w]) { dfs(G, w); } } postorder.enqueue(v); post[v] = postCounter++; } /** * Returns the preorder number of vertex {@code v}. * @param v the vertex * @return the preorder number of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int pre(int v) { validateVertex(v); return pre[v]; } /** * Returns the postorder number of vertex {@code v}. * @param v the vertex * @return the postorder number of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int post(int v) { validateVertex(v); return post[v]; } /** * Returns the vertices in postorder. * @return the vertices in postorder, as an iterable of vertices */ public Iterable<Integer> post() { return postorder; } /** * Returns the vertices in preorder. * @return the vertices in preorder, as an iterable of vertices */ public Iterable<Integer> pre() { return preorder; } /** * Returns the vertices in reverse postorder. * @return the vertices in reverse postorder, as an iterable of vertices */ public Iterable<Integer> reversePost() { Stack<Integer> reverse = new Stack<Integer>(); for (int v : postorder) reverse.push(v); return reverse; } // check that pre() and post() are consistent with pre(v) and post(v) private boolean check() { // check that post(v) is consistent with post() int r = 0; for (int v : post()) { if (post(v) != r) { StdOut.println("post(v) and post() inconsistent"); return false; } r++; } // check that pre(v) is consistent with pre() r = 0; for (int v : pre()) { if (pre(v) != r) { StdOut.println("pre(v) and pre() inconsistent"); return false; } r++; } return true; } // throw an IllegalArgumentException unless {@code 0 <= v < V} private void validateVertex(int v) { int V = marked.length; if (v < 0 || v >= V) throw new IllegalArgumentException("vertex " + v + " is not between 0 and " + (V-1)); } /** * Unit tests the {@code DepthFirstOrder} data type. * * @param args the command-line arguments */ public static void main(String[] args) { In in = new In(args[0]); Digraph G = new Digraph(in); DepthFirstOrder dfs = new DepthFirstOrder(G); StdOut.println(" v pre post"); StdOut.println("--------------"); for (int v = 0; v < G.V(); v++) { StdOut.printf("%4d %4d %4d\n", v, dfs.pre(v), dfs.post(v)); } StdOut.print("Preorder: "); for (int v : dfs.pre()) { StdOut.print(v + " "); } StdOut.println(); StdOut.print("Postorder: "); for (int v : dfs.post()) { StdOut.print(v + " "); } StdOut.println(); StdOut.print("Reverse postorder: "); for (int v : dfs.reversePost()) { StdOut.print(v + " "); } StdOut.println(); } } /****************************************************************************** * Copyright 2002-2018, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar 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. * * algs4.jar 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 algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
[ "877728156@qq.com" ]
877728156@qq.com
80fb9f240066891ef81d9ef7fef187b33569c5b6
7a3d7e0d2cdc349b03ebfdfdf2ad1274765a0aba
/app/src/main/java/com/soe/sharesoe/base/PermissionCompat.java
f77f844e75863b69cebe03d9b5184c07786e8aa9
[]
no_license
zhangyizhangyiran/share-user
596c0e40685664e959f5dba52933a09bae5f5df0
ff420c02c19d145fbf8c9b18e6d6b58228ab7647
refs/heads/master
2020-03-29T21:50:27.041912
2018-09-26T08:06:09
2018-09-26T08:06:09
150,390,128
0
0
null
null
null
null
UTF-8
Java
false
false
5,374
java
package com.soe.sharesoe.base; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.widget.Toast; import java.util.ArrayList; import java.util.List; /** * @author wangxiaofa * @version ${VERSIONCODE} * @project sharesoe * @Description 权限管理基类 * @encoding UTF-8 * @date 2017/11/11 * @time 下午3:13 * @修改记录 <pre> * 版本 修改人 修改时间 修改内容描述 * -------------------------------------------------- * <p> * -------------------------------------------------- * </pre> */ public class PermissionCompat implements ActivityCompat.OnRequestPermissionsResultCallback { private String hint; public static final int REQUESTCODE = 1000; private Activity mContext; public PermissionCompat(Activity mContext) { this.mContext = mContext; } //单个权限请求检测,true不需要请求权限,false需要请求权限 public boolean isPermissionGranted(String permissionName) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } //判断是否需要请求允许权限 int hasPermision = ActivityCompat.checkSelfPermission(mContext, permissionName); if (hasPermision != PackageManager.PERMISSION_GRANTED) { return false; } return true; } //多个权限请求检测,返回list,如果list.size为空说明权限全部有了不需要请求,否则请求没有的 public List<String> isPermissionsAllGranted(String[] permArray) { List<String> list = new ArrayList<>(); //获得批量请求但被禁止的权限列表 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return list; } for (int i = 0; permArray != null && i < permArray.length; i++) { if (PackageManager.PERMISSION_GRANTED != ActivityCompat.checkSelfPermission(mContext, permArray[i])) { list.add(permArray[i]); } } return list; } //单个权限请求 public boolean Requestpermission(String s, int requestCode, String defeat) { boolean flag = false; hint = defeat; if (!TextUtils.isEmpty(s)) { boolean granted = isPermissionGranted(s); if (granted) { //有权限,调用方法 // okPermissionResult(requestCode); flag = true; } else { ActivityCompat.requestPermissions(mContext, new String[]{s}, requestCode); flag = false; } } return flag; } //多个权限请求 public boolean Requestpermission(String s[], int requestCode, String defeat) { boolean flag = false; hint = defeat; if (s.length != 0) { List<String> perList = isPermissionsAllGranted(s); if (perList.size() == 0) { //有权限,调用方法 // okPermissionResult(requestCode); flag = true; } else { ActivityCompat.requestPermissions(mContext, perList.toArray(new String[perList.size()]), requestCode); flag = false; } } return flag; } public void popAlterDialog() { new AlertDialog.Builder(mContext) .setTitle("提示") .setMessage(hint) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .setPositiveButton("设置", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //前往应用详情界面 try { Uri packUri = Uri.parse("package:" + mContext.getPackageName()); Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } catch (Exception e) { Toast.makeText(mContext, "跳转失败", Toast.LENGTH_SHORT).show(); } dialog.dismiss(); } }).create().show(); } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { Toast.makeText(mContext, "xxxxx", Toast.LENGTH_SHORT).show(); for (int i : grantResults) { if (i != PackageManager.PERMISSION_GRANTED) { //有权限未通过 return; } } // okPermissionResult(requestCode); } //有权限调用 public void okPermissionResult(int requestCode) { } }
[ "1104745049@qq.com" ]
1104745049@qq.com
0e5b8d87f49862be5be094a2125f9cd6101fcf28
64d741dbd05849d7c0eca4593407c1f8ea24533f
/src/test/java/com/acme/test/vetobean/EntityVetoExtensionTest.java
7876dbd84230d64c6906b9dfd557225a6fcf1cb0
[]
no_license
mojavelinux/cdi-extension-showcase
a9b5f7712082c7c48bc5a176e5d76c923a8d2fda
d32907ef71a02165ddc4dbc3aff89bc046370614
refs/heads/master
2020-06-30T04:15:34.118479
2011-07-26T13:11:04
2011-07-26T13:11:04
1,585,763
1
2
null
null
null
null
UTF-8
Java
false
false
1,160
java
package com.acme.test.vetobean; import javax.enterprise.inject.Instance; import javax.enterprise.inject.spi.Extension; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import com.acme.vetobean.EntityVetoExtension; @RunWith(Arquillian.class) public class EntityVetoExtensionTest { @Deployment public static Archive<?> createArchive() { return ShrinkWrap.create(JavaArchive.class) .addClass(EntityVetoExtension.class) .addClass(SampleEntity.class) .addAsServiceProvider(Extension.class, EntityVetoExtension.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } @Inject Instance<SampleEntity> sampleEntity; @Test public void shouldVetoEntity() { Assert.assertTrue(sampleEntity.isUnsatisfied()); } }
[ "dan.j.allen@gmail.com" ]
dan.j.allen@gmail.com
5db7d668b21e5f178aeeeec98a044d0b05376034
26c9382b819895a9ac224a238e30238dd3c9fdcc
/src/main/java/com/zk/sms/common/service/impl/BaseServiceImpl.java
71a4d8f1fc083380b93929f887c14e026b8c3e15
[]
no_license
gyhdm/zk-sms
2bcfedca1ce5e0dc5a32bbdb902ecb246b3cb3cf
86b9e9ffe79eea908a0b0c37feec44c935ef4ef8
refs/heads/master
2020-08-28T20:21:50.576994
2019-10-31T14:18:14
2019-10-31T14:18:14
217,811,122
0
0
null
null
null
null
UTF-8
Java
false
false
4,222
java
package com.zk.sms.common.service.impl; import com.zk.sms.common.exception.JpaCrudException; import com.zk.sms.common.model.BaseModel; import com.zk.sms.common.service.BaseService; import com.zk.sms.common.service.RedisService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; /** * 通用service实现类. * * @param <T> 实体类 * @param <ID> 主键 * @param <R> repository * @author guoying * @since 2019 -10-27 19:49:33 */ @Slf4j public class BaseServiceImpl<T extends BaseModel, ID, R extends JpaRepository<T, ID>> implements BaseService<T, ID> { /** * The Repository. */ @Autowired protected R repository; @Override public T findById(ID id) { log.info("findById: {}", id); Optional<T> ot = repository.findById(id); return ot.orElse(null); } @Override public boolean existsById(ID id) { return repository.existsById(id); } @Override public List<T> findAll() { return repository.findAll(); } @Override public List<T> findAll(Sort sort) { return repository.findAll(sort); } @Override public Page<T> findAll(Pageable pageable) { log.info("findAll PageNumber: {} ---> PageSize: {}", pageable.getPageNumber(), pageable.getPageSize()); return repository.findAll(pageable); } @Override public List<T> findAllById(Iterable<ID> ids) { log.info("findAllById: {} ", ids); return repository.findAllById(ids); } @Override @Transactional(rollbackFor = Exception.class) public T save(T t) { if (t == null) { throw new JpaCrudException("cannot save an empty entity class."); } if (ObjectUtils.isNotEmpty(t.getId())) { throw new JpaCrudException("for save entity, id must be null."); } log.info("save: {}", t); return repository.save(t); } @Override @Transactional(rollbackFor = Exception.class) public T update(T t) { if (t == null) { throw new JpaCrudException("cannot update an empty entity class."); } if (ObjectUtils.isEmpty(t.getId())) { throw new JpaCrudException("for update entity, id must be not null."); } log.info("update: {}", t); return repository.save(t); } @Transactional(rollbackFor = Exception.class) @Override public List<T> saveAll(Iterable<T> entities) { return repository.saveAll(entities); } @Transactional(rollbackFor = Exception.class) @Override public void delete(T t) { if (t == null) { throw new JpaCrudException("cannot delete an empty entity class."); } log.info("delete:{}", t); repository.delete(t); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAll() { repository.deleteAll(); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAll(Iterable<T> entities) { repository.deleteAll(entities); } @Transactional(rollbackFor = Exception.class) @Override public void deleteById(ID id) { if (id == null || !repository.existsById(id)) { throw new JpaCrudException("Unable to delete data whose ID does not exist"); } log.info("deleteById: {}", id); repository.deleteById(id); } @Transactional(rollbackFor = Exception.class) @Override public void deleteInBatch(Iterable<T> entities) { repository.deleteInBatch(entities); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAllInBatch() { repository.deleteAllInBatch(); } @Override public long count() { return repository.count(); } }
[ "gyhdm2006@gmail.com" ]
gyhdm2006@gmail.com
ae53a11ec1eabcbefd4514bccd8a7baa5150bfe4
3052d41bd96ec9c0d3361f186dde27d96d235f40
/src/wsclient/GetOnekyRepairPOOLResponse.java
1975188c6ffbae39e1aec1c4b7dca871eef27d19
[]
no_license
edgaryu201/hello-world
c855383e0a8e1d452f021e2ef580fac2221e8948
deea2850a5e85b361ad349767b9952ab4b230871
refs/heads/master
2020-03-20T08:31:17.038516
2018-06-15T05:47:50
2018-06-15T05:47:50
137,310,976
0
0
null
null
null
null
UTF-8
Java
false
false
1,624
java
package wsclient; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content contained within * this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="GetOnekyRepair_POOLResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getOnekyRepairPOOLResult" }) @XmlRootElement(name = "GetOnekyRepair_POOLResponse") public class GetOnekyRepairPOOLResponse { @XmlElement(name = "GetOnekyRepair_POOLResult") protected String getOnekyRepairPOOLResult; /** * Gets the value of the getOnekyRepairPOOLResult property. * * @return possible object is {@link String } * */ public String getGetOnekyRepairPOOLResult() { return getOnekyRepairPOOLResult; } /** * Sets the value of the getOnekyRepairPOOLResult property. * * @param value * allowed object is {@link String } * */ public void setGetOnekyRepairPOOLResult(String value) { this.getOnekyRepairPOOLResult = value; } }
[ "edgaryu@163.com" ]
edgaryu@163.com
b6d9516657d58df0eff640abad69d60cfbe96654
e97de11de7d727f0a4f5cd38b449d182157a813d
/ace-common/src/main/java/com/mmc/security/common/service/impl/BaseServiceImpl.java
c216ea549f19f8886729a9c9cffc71b95b005d61
[ "Apache-2.0" ]
permissive
qudong123/record_keeping2.0
8fd940d09d5c12e9b477d82f5df5e23cd2fb925a
0e7a1aa72859d979ccec731f0ea3ff917deacbbf
refs/heads/master
2022-04-01T04:43:17.949617
2019-07-17T07:44:21
2019-07-17T07:44:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,067
java
package com.mmc.security.common.service.impl; import com.mmc.security.common.service.BaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import tk.mybatis.mapper.common.Mapper; import java.util.List; public class BaseServiceImpl<M extends Mapper<T>, T> implements BaseService<T> { @Autowired protected M mapper; @Override public T selectOne(T entity) { return mapper.selectOne(entity); } @Override public T selectById(Object id) { return mapper.selectByPrimaryKey(id); } // @Override // public List<T> selectListByIds(List<Object> ids) { // return mapper.selectByIds(ids); // } @Override public List<T> selectList(T entity) { return mapper.select(entity); } @Override public List<T> selectListAll() { return mapper.selectAll(); } // @Override // public Long selectCountAll() { // return mapper.selectCount(); // } @Override public Long selectCount(T entity) { return Long.valueOf(mapper.selectCount(entity)); } @Override public void insert(T entity) { mapper.insert(entity); } @Override public void insertSelective(T entity) { mapper.insertSelective(entity); } @Override public void delete(T entity) { mapper.delete(entity); } @Override public void deleteById(Object id) { mapper.deleteByPrimaryKey(id); } @Override public void updateById(T entity) { mapper.updateByPrimaryKey(entity); } @Override public void updateSelectiveById(T entity) { mapper.updateByPrimaryKeySelective(entity); } // @Override // public void deleteBatchByIds(List<Object> ids) { // mapper.batchDeleteByIds(ids); // } // // @Override // public void updateBatch(List<T> entitys) { // mapper.batchUpdate(entitys); // } }
[ "mmc@tofocus.cn" ]
mmc@tofocus.cn
37070c09d399b672c7013e507cea4eb7045a5f52
712ffdf4e13a4c30cd1d939f3243d8604b143df0
/gmall-user-manage/src/main/java/com/ping/gmall/user/mapper/UserAddressMapper.java
c70d3d72ab0bba811a2b7c670a5bf9dd0cb3de7f
[]
no_license
fanhualuojin123456/gmall
8add158c82d2d3182186eaed8df8d07d1b16e77a
1657cd6c53455c96d458526a0f71f7b652f84b7e
refs/heads/master
2023-04-22T15:49:57.628777
2021-05-10T08:14:09
2021-05-10T08:14:09
318,991,433
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.ping.gmall.user.mapper; import com.ping.gmall.bean.UserAddress; import tk.mybatis.mapper.common.Mapper; public interface UserAddressMapper extends Mapper<UserAddress>{ }
[ "447197782@qq.com" ]
447197782@qq.com
58d7bacb9d3cf1f7919856d42efd03a8fff893f6
7bb07f40c5a62e300ae4e83bf789e5aa1f1b70f7
/plug-ins/DxfDriver/trunk/src/fr/michaelm/jump/drivers/dxf/DxfPOLYLINE.java
a7408d045178c9533968992ecb01e60898ed2c9d
[]
no_license
abcijkxyz/jump-pilot
a193ebf9cfb3f082a467c0cfbe0858d4e249d420
3b6989a88e5c8e00cd55c3148f00a7bf747574c7
refs/heads/master
2022-12-18T15:22:44.594948
2020-09-23T10:46:11
2020-09-23T10:46:11
297,995,218
0
0
null
2020-09-23T15:27:25
2020-09-23T14:23:54
null
UTF-8
Java
false
false
5,076
java
/* * Library name : dxf * (C) 2012 Micha&euml;l Michaud * * This program 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 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * For more information, contact: * * michael.michaud@free.fr * */ package fr.michaelm.jump.drivers.dxf; import java.io.RandomAccessFile; import java.io.IOException; import com.vividsolutions.jts.geom.*; import com.vividsolutions.jump.feature.Feature; import com.vividsolutions.jump.feature.BasicFeature; import com.vividsolutions.jump.feature.FeatureCollection; /** * POLYLINE DXF entity. * This class has a static method reading a DXF POLYLINE and adding the new * feature to a FeatureCollection * @author Micha&euml;l Michaud */ // History public class DxfPOLYLINE extends DxfENTITY { public DxfPOLYLINE() {super("DEFAULT");} public static DxfGroup readEntity(RandomAccessFile raf, FeatureCollection entities) throws IOException { Feature feature = new BasicFeature(entities.getFeatureSchema()); String geomType = "LineString"; CoordinateList coordList = new CoordinateList(); feature.setAttribute("LTYPE", "BYLAYER"); feature.setAttribute("THICKNESS", 0.0); feature.setAttribute("COLOR", 256); // equivalent to BYLAYER //double x=Double.NaN, y=Double.NaN, z=Double.NaN; DxfGroup group = DxfFile.ENTITIES; GeometryFactory gf = new GeometryFactory(DPM,0); while (!group.equals(SEQEND)) { if (DxfFile.DEBUG) group.print(12); int code = group.getCode(); if (code==8) { feature.setAttribute("LAYER", group.getValue()); } else if (code==6) { feature.setAttribute("LTYPE", group.getValue()); } else if (code==39) { feature.setAttribute("THICKNESS", group.getDoubleValue()); } else if (code==62) { feature.setAttribute("COLOR", group.getIntValue()); } else if (code==70) { if ((group.getIntValue()&1)==1) geomType = "Polygon"; } else if (group.equals(VERTEX)) { group = DxfVERTEX.readEntity(raf, coordList); continue; } else if (group.equals(SEQEND)) { continue; } //else {} group = DxfGroup.readGroup(raf); } if (geomType.equals("LineString")) { // Handle cases where coordList does not describe a valid Line if (coordList.size() == 1) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 && coordList.getCoordinate(0).equals(coordList.getCoordinate(1))) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else { feature.setGeometry(gf.createLineString(coordList.toCoordinateArray())); } if (DxfFile.DEBUG) System.out.println(" " + feature.getString("LAYER") + " : " + feature.getGeometry()); entities.add(feature); } else if (geomType.equals("Polygon")) { coordList.closeRing(); // Handle cases where coordList does not describe a valid Polygon if (coordList.size() == 1) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 && coordList.getCoordinate(0).equals(coordList.getCoordinate(1))) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 || coordList.size() == 3) { feature.setGeometry(gf.createLineString(coordList.toCoordinateArray())); } else { feature.setGeometry(gf.createPolygon(gf.createLinearRing(coordList.toCoordinateArray()))); } if (DxfFile.DEBUG) System.out.println(" " + feature.getString("LAYER") + " : " + feature.getGeometry()); entities.add(feature); } //else {} return group; } }
[ "michaudm@d6f7b87f-2e33-0410-8384-f77abc8d64da" ]
michaudm@d6f7b87f-2e33-0410-8384-f77abc8d64da
bf1648667b3b51a1cee7d16d2f822bda7b6d12a0
b3d9aee1a38fe215b80a1ef571edd5cd68c35f76
/DinoGame/src/edu/uark/csce/mobile/dinogame/MapActivity.java
00667de7962b3d57d768b3d878f0f56faacb54d4
[]
no_license
alvisgage/Current-Projects
b198dec59debc0513581646aaa4fa7349f1572de
6e0a190ed9154e4d07e67c5e760b8cef3cf9a054
refs/heads/master
2020-06-02T03:04:57.452682
2015-05-14T16:44:01
2015-05-14T16:44:01
35,623,152
0
0
null
null
null
null
UTF-8
Java
false
false
21,124
java
package edu.uark.csce.mobile.dinogame; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import android.app.Activity; import android.app.Dialog; import android.app.DialogFragment; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender.SendIntentException; import android.graphics.Color; import android.location.Location; import android.os.Bundle; import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MapActivity extends FragmentActivity implements com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks, OnConnectionFailedListener, OnAddGeofencesResultListener { /*TODO: create local variables for: current geofence, current itemReward * structure storage of geofence data, expiration data ((expiration date from database - current date) in ms), and RewardItem data together * add event handlers for entering currentGeofence that launches dialog saying "Congrats! etc" and adding item to current storage of items * structure getting of current geofence from database on startup and activating it */ private static final long GEOFENCE_EXPIRATION_IN_HOURS = 12; private static final long GEOFENCE_EXPIRATION_IN_MILLISECONDS = GEOFENCE_EXPIRATION_IN_HOURS * DateUtils.HOUR_IN_MILLIS; private SimpleGeofence mCurrentGeofence; private ArrayList<SimpleGeofence> mSimpleGeofenceList; private List<Geofence> mGeofenceList; private SimpleGeofenceStore mGeofenceStorage; // decimal formats for latitude, longitude, and radius private DecimalFormat mLatLngFormat; private DecimalFormat mRadiusFormat; // Holds the location client private LocationClient mLocationClient; // Stores the PendingIntent used to request geofence monitoring private PendingIntent mGeofenceRequestIntent; //Defines the allowable request types private enum REQUEST_TYPE {ADD} private REQUEST_TYPE mRequestType; // Flag that indicates if request is underway private boolean mInProgress; private GeofenceSampleReceiver mBroadcastReceiver; private IntentFilter mIntentFilter; // Placeholder for reward private String reward = "new hat"; // Textview to display stuff private TextView testLabel; // Google Map to display geofence private GoogleMap mMap; private GoogleApiClient mGoogleApiClient; private static final LocationRequest REQUEST = LocationRequest.create() .setInterval(5000) // 5 seconds .setFastestInterval(16) // 16ms = 60fps .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); mInProgress = false; mSimpleGeofenceList = new ArrayList<SimpleGeofence>(); // Set and localize the latitude/longitude format String latLngPattern = getString(R.string.lat_lng_pattern); mLatLngFormat = new DecimalFormat(latLngPattern); mLatLngFormat.applyLocalizedPattern(mLatLngFormat.toLocalizedPattern()); // Set and localize the radius format String radiusPattern = getString(R.string.radius_pattern); mRadiusFormat = new DecimalFormat(radiusPattern); mRadiusFormat.applyLocalizedPattern(mRadiusFormat.toLocalizedPattern()); // Instantiate a new geofence storage area mGeofenceStorage = new SimpleGeofenceStore(this); mGeofenceStorage.open(); // Create a new broadcast receiver to receive updates from the listeners and service mBroadcastReceiver = new GeofenceSampleReceiver(); mIntentFilter = new IntentFilter(); // Action for broadcast Intents that report successful addition of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_ADDED); // Action for broadcast Intents that report successful removal of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_REMOVED); // Action for broadcast Intents that report geofence transitions mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_TRANSITION); // Action for broadcast Intents containing various types of geofencing errors mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_ERROR); // All Location Services sample apps use this category mIntentFilter.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES); // Instantiate a new list of geofences mGeofenceList = new ArrayList<Geofence>(); testLabel = (TextView) findViewById(R.id.GeofenceTestLabel); mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); mMap.setMyLocationEnabled(true); // Testing //addTestGeofence(); } @Override protected void onResume() { super.onResume(); mGeofenceStorage.open(); Log.d(GeofenceUtils.APPTAG, "in onResume"); LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, mIntentFilter); loadCurrentGeofence(); } @Override public void onPause() { super.onPause(); mGeofenceStorage.close(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } // DialogFragment to display connection error dialog public static class ErrorDialogFragment extends DialogFragment { // Field to contain error dialog private Dialog mDialog; public ErrorDialogFragment() { super(); mDialog = null; } public void setDialog(Dialog dialog) { mDialog = dialog; } // Return a Dialog to the DialogFragment @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return mDialog; } } // Handle results returned to the FragmentActivity by Google Play services @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST: // If the result code is Activity.RESULT_OK try to connect again switch (resultCode) { case Activity.RESULT_OK: break; // Any result but OK default: Log.d(GeofenceUtils.APPTAG, getString(R.string.no_resolution)); } // If any other request code was received default: Log.d(GeofenceUtils.APPTAG, getString(R.string.unknown_activity_request_code, requestCode)); break; } } private boolean servicesConnected() { // Check that Google Play services is available int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(ConnectionResult.SUCCESS == resultCode) { Log.d(GeofenceUtils.APPTAG, getString(R.string.play_services_available)); return true; } else { // Display an error dialog Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 0); if (dialog != null) { ErrorDialogFragment errorFragment = new ErrorDialogFragment(); errorFragment.setDialog(dialog); errorFragment.show(getSupportFragmentManager(), GeofenceUtils.APPTAG); } return false; } } private PendingIntent getTransitionPendingIntent() { // Create an explicit Intent Intent intent = new Intent(this, ReceiveTransitionsIntentService.class); /* * Return the PendingIntent */ return PendingIntent.getService( this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) { Intent broadcastIntent = new Intent(); String msg; if(LocationStatusCodes.SUCCESS == statusCode) { // Create a message containing all the geofence IDs added. msg = this.getString(R.string.add_geofences_result_success, Arrays.toString(geofenceRequestIds)); // In debug mode, log the result Log.d(GeofenceUtils.APPTAG, msg); // Create an Intent to broadcast to the app broadcastIntent.setAction(GeofenceUtils.ACTION_GEOFENCES_ADDED) .addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES) .putExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS, msg); // TODO: update UI for geofence successfully added testLabel.setText("Geofence has been added"); updateMap(); } else { Log.e(GeofenceUtils.APPTAG, "Geofence failed to add. FIX!"); /* * Create a message containing the error code and the list * of geofence IDs you tried to add */ msg = this.getString( R.string.add_geofences_result_failure, statusCode, Arrays.toString(geofenceRequestIds) ); // Log an error Log.e(GeofenceUtils.APPTAG, msg); // Create an Intent to broadcast to the app broadcastIntent.setAction(GeofenceUtils.ACTION_GEOFENCE_ERROR) .addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES) .putExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS, msg); } LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); mInProgress = false; //mLocationClient.disconnect(); } @Override public void onConnectionFailed(ConnectionResult result) { mInProgress = false; // Resolve error if available, else display error dialog if(result.hasResolution()) { try { result.startResolutionForResult(this, GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST); } catch (SendIntentException e) { e.printStackTrace(); } } else { int errorCode = result.getErrorCode(); Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, this, GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST); if(errorDialog != null) { ErrorDialogFragment errorFragment = new ErrorDialogFragment(); errorFragment.setDialog(errorDialog); errorFragment.show(getSupportFragmentManager(), "Geofence Test"); } } } @Override public void onConnected(Bundle connectionHint) { switch(mRequestType) { case ADD: Log.d(GeofenceUtils.APPTAG, "Location Client connected with request type ADD."); // Get the PendingIntent for the request mGeofenceRequestIntent = getTransitionPendingIntent(); // Send a request to add the current geofence mLocationClient.addGeofences(mGeofenceList, mGeofenceRequestIntent, this); } } @Override public void onDisconnected() { mInProgress = false; mLocationClient = null; } public void addGeofence() { mRequestType = REQUEST_TYPE.ADD; // Test for Google Play Services after setting the request type. if(!servicesConnected()) { Log.e(GeofenceUtils.APPTAG, "Google Play Services not connnected."); return; } // Create new location client. Pass current activity as listener for ConnectionCallbacks and OnConnectionFailedListener mLocationClient = new LocationClient(this, this, this); if(!mInProgress) { mInProgress = true; mLocationClient.connect(); } else { Log.d(GeofenceUtils.APPTAG, "Request already underway."); // TODO: disconnect client, reset flag, retry request } } /** * Define a Broadcast receiver that receives updates from connection listeners and * the geofence transition service. */ public class GeofenceSampleReceiver extends BroadcastReceiver { /* * Define the required method for broadcast receivers * This method is invoked when a broadcast Intent triggers the receiver */ @Override public void onReceive(Context context, Intent intent) { // Check the action code and determine what to do String action = intent.getAction(); Log.d(GeofenceUtils.APPTAG, "GeofenceSampleReceiver picked up something: " + action); // Intent contains information about errors in adding or removing geofences if (TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCE_ERROR)) { handleGeofenceError(context, intent); // Intent contains information about successful addition or removal of geofences } else if ( TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCES_ADDED) || TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCES_REMOVED)) { handleGeofenceStatus(context, intent); // Intent contains information about a geofence transition } else if (TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCE_TRANSITION)) { handleGeofenceTransition(context, intent); // The Intent contained an invalid action } else { Log.e(GeofenceUtils.APPTAG, getString(R.string.invalid_action_detail, action)); Toast.makeText(context, R.string.invalid_action, Toast.LENGTH_LONG).show(); } } /** * * @param context A Context for this component * @param intent The received broadcast Intent */ private void handleGeofenceStatus(Context context, Intent intent) { Log.d(GeofenceUtils.APPTAG, "Geofence status: " + intent.getAction()); Toast.makeText(context, "Geofence Status Changed", Toast.LENGTH_LONG).show(); } /** * Report geofence transitions to the UI * * @param context A Context for this component * @param intent The Intent containing the transition */ private void handleGeofenceTransition(Context context, Intent intent) { //String msg = intent.getStringExtra("msg"); // TODO: UI change on transition Log.d(GeofenceUtils.APPTAG, "Geofence transition occured: " + intent.getAction()); //Log.d(GeofenceUtils.APPTAG, "msg: " + msg); Toast.makeText(context, "Geofence Transition Occured", Toast.LENGTH_LONG).show(); //Update SharedPreferences //mGeofenceStorage.incrementLastGeofenceReceived(mCurrentGeofence.getId()); // Update Database //mGeofenceStorage.setLocationToCompleted(mCurrentGeofence.getId()); } /** * Report addition or removal errors to the UI, using a Toast * * @param intent A broadcast Intent sent by ReceiveTransitionsIntentService */ private void handleGeofenceError(Context context, Intent intent) { String msg = intent.getStringExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS); Log.e(GeofenceUtils.APPTAG, msg); Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); } } private void loadCurrentGeofence() { mGeofenceList.clear(); // Using SharedPreferences... //mCurrentGeofence = mGeofenceStorage.getCurrentGeofence(); //mGeofenceList.add(mCurrentGeofence.toGeofence()); // Using SQLite Database... mSimpleGeofenceList = mGeofenceStorage.getAllGeofences(); Log.d("count", String.valueOf(mSimpleGeofenceList.size())); /*if(mSimpleGeofenceList.get(0) != null) { mCurrentGeofence = mSimpleGeofenceList.get(0); mGeofenceList.add(mCurrentGeofence.toGeofence()); }*/ for (SimpleGeofence fence : mSimpleGeofenceList){ mGeofenceList.add(fence.toGeofence()); } addGeofence(); } private void updateMap() { /*if(mCurrentGeofence != null) { LatLng location = new LatLng(mCurrentGeofence.getLatitude(), mCurrentGeofence.getLongitude()); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); CameraUpdate update = CameraUpdateFactory.newLatLngZoom(location, 16); mMap.animateCamera(update); mMap.addMarker(new MarkerOptions().position(location).title("Geofence is here!")); // Add circle CircleOptions circleOptions = new CircleOptions() .center(location) .radius(mCurrentGeofence.getRadius()) .fillColor(0x40ff0000) .strokeColor(Color.TRANSPARENT) .strokeWidth(2); Circle circle = mMap.addCircle(circleOptions); }*/ mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); for (SimpleGeofence fence : mSimpleGeofenceList){ Log.d("adding geofence...", fence.toString()); LatLng location = new LatLng(fence.getLatitude(), fence.getLongitude()); CameraUpdate update = CameraUpdateFactory.newLatLngZoom(location, 16); mMap.animateCamera(update); mMap.addMarker(new MarkerOptions().position(location).title("Geofence is here! " + fence.getId())); // Add circle CircleOptions circleOptions = new CircleOptions() .center(location) .radius(fence.getRadius()) .fillColor(0x40ff0000) .strokeColor(Color.TRANSPARENT) .strokeWidth(2); Circle circle = mMap.addCircle(circleOptions); } } // private void setUpMapIfNeeded() { // // Do a null check to confirm that we have not already instantiated the map. // if (mMap == null) { // // Try to obtain the map from the SupportMapFragment. // mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) // .getMap(); // // Check if we were successful in obtaining the map. // if (mMap != null) { // mMap.setMyLocationEnabled(true); // //mMap.setOnMyLocationButtonClickListener(this); // } // } // } // // private void setUpGoogleApiClientIfNeeded() { // if (mGoogleApiClient == null) { // mGoogleApiClient = new GoogleApiClient.Builder(this) // .addApi(LocationServices.API) // .addConnectionCallbacks(this) // .addOnConnectionFailedListener(this) // .build(); // } // } // // @Override // public void onLocationChanged(Location location) { // // TODO Auto-generated method stub // // } // // @Override // public void onConnectionSuspended(int cause) { // // TODO Auto-generated method stub // // } // // /** // * Button to get current Location. This demonstrates how to get the current Location as required // * without needing to register a LocationListener. // */ //// public void showMyLocation(View view) { //// if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) { //// String msg = "Location = " //// + LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); //// Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); //// } //// } public void drawUserMarker(Location location) { mMap.clear(); updateMap(); LatLng currentPosition = new LatLng(location.getLatitude(), location.getLongitude()); mMap.addMarker(new MarkerOptions() .position(currentPosition) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_CYAN)) .title("You are here")); } //Method for testing purposes private void addTestGeofence() { SimpleGeofence geo = new SimpleGeofence("123", 36.0742414, -94.2218162, 500f, GEOFENCE_EXPIRATION_IN_MILLISECONDS, Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT, 1234, false); mGeofenceStorage.createGeofence(geo); } //Button listeners public void viewSummary(View v) { Intent intent = new Intent(MapActivity.this, SummaryActivity.class); startActivity(intent); } public void viewPlayer(View v) { Intent intent = new Intent(MapActivity.this, CharacterActivity.class); startActivity(intent); } public void viewAccount(View v) { Intent intent = new Intent(MapActivity.this, AccountActivity.class); startActivity(intent); } public void viewSettings(View v) { Intent intent = new Intent(MapActivity.this, SettingsActivity.class); startActivity(intent); } }
[ "rga001@uark.edu" ]
rga001@uark.edu
9d02ef13ddc98a5d69df0f4b756fbd758690a382
b95ee91eba3936e3e7f490591006cf1fbf96cb25
/src/main/java/com/example/bibased/serviceImple/QianlinshiServiceImple.java
3c788634153d57e2b3c82b5b656914bf2a7c3b08
[]
no_license
kakurry/bibased
d2a23061f0630313faaec2792c5c92fba1768321
aad36585c09f698596ac8f88310fe13641a225d0
refs/heads/master
2020-04-24T14:28:08.534811
2018-12-17T10:22:06
2018-12-17T10:22:06
138,844,601
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package com.example.bibased.serviceImple; import com.example.bibased.dao.QianlinshiMstMapper; import com.example.bibased.javabean.QianlinshiMst; import com.example.bibased.javabean.UserMst; import com.example.bibased.service.QianlinshiService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("qianlinshiServiceImpl") public class QianlinshiServiceImple implements QianlinshiService { @Autowired private QianlinshiMstMapper qianlinshiMstMapper; @Override public void insert(QianlinshiMst qianlinshiMst) { qianlinshiMstMapper.insert(qianlinshiMst); } @Override public void delete() { qianlinshiMstMapper.delete(); } @Override public QianlinshiMst selectqianlinshi() { return qianlinshiMstMapper.selectqianlinshi(); } }
[ "1641165306@qq.com" ]
1641165306@qq.com
cd7fcfad3a2ddd193a6ff2830ae471637db1785f
ef5a0b42ed6d7595f8ede48532758070c61d5701
/AlphaBdSDKAnd/common/src/main/java/com/fxmvp/detailroi/common/base/utils/oaid/interfaces/ZTEIDInterface.java
e4661b13df05ad8d4b6f8eb4d6163419ed411c96
[]
no_license
MTGfxplatform/FXSDK-Android
3a81674602d89f5c16addacc06804263b1494caa
084a7023c72d1bf8cb2aa220a430efe10d6f4dc3
refs/heads/main
2023-08-18T02:04:13.723115
2021-10-21T11:08:31
2021-10-21T11:08:31
419,568,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,800
java
package com.fxmvp.detailroi.common.base.utils.oaid.interfaces; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; /** * @author Paul Luv on 2020/9/22 */ public interface ZTEIDInterface extends IInterface { boolean c(); String getOAID(); boolean isSupported(); void shutDown(); public static abstract class up extends Binder implements ZTEIDInterface { public static class down implements ZTEIDInterface { private IBinder binder; public down(IBinder b) { binder = b; } @Override public IBinder asBinder() { return binder; } @Override public boolean c() { boolean v0 = false; Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(2, v1, v2, 0); v2.readException(); if (v2.readInt() == 0) { v2.recycle(); v1.recycle(); v0 = true; } } catch (Throwable v0_1) { v2.recycle(); v1.recycle(); v0_1.printStackTrace(); } return v0; } @Override public String getOAID() { String v0_1 = null; Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(3, v1, v2, 0); v2.readException(); v0_1 = v2.readString(); } catch (Throwable v0) { v2.recycle(); v1.recycle(); } v2.recycle(); v1.recycle(); return v0_1; } @Override public boolean isSupported() { return false; } @Override public void shutDown() { Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(6, v1, v2, 0); v2.readException(); } catch (Throwable v0) { v2.recycle(); v1.recycle(); } v2.recycle(); v1.recycle(); } } } }
[ "1933095297@qq.com" ]
1933095297@qq.com
6ee0d13415ed2e27d8270af5b3ee1474e66dd327
10c73074452e73ea22db4e3a7ab9d3fa8677ad2c
/src/main/java/com/laptrinhjavaweb/service/impl/NewService.java
01179eba89c85b872f1265d67db876a24307a6b1
[]
no_license
Phuc1995/Java_jsp_servlet
dcc8f6093e91152ff02cd900547fd43961da73bc
77a784ed9ceb07ccae00bb6cdb72eed6287855a2
refs/heads/master
2022-11-26T03:19:30.827512
2019-10-21T04:14:32
2019-10-21T04:14:32
215,527,010
0
0
null
2022-11-16T05:39:40
2019-10-16T11:02:39
Java
UTF-8
Java
false
false
612
java
package com.laptrinhjavaweb.service.impl; import java.util.List; import javax.inject.Inject; import com.laptrinhjavaweb.dao.INewDAO; import com.laptrinhjavaweb.model.NewModel; import com.laptrinhjavaweb.service.INewService; public class NewService implements INewService{ @Inject private INewDAO newDao; @Override public List<NewModel> findByCategoryId(Long categoryId) { // TODO Auto-generated method stub return newDao.findByCategoryId(categoryId); } @Override public NewModel save(NewModel newModel) { Long newId = newDao.save(newModel); System.out.println(newId); return null; } }
[ "Hoangphuc735@gmail.com" ]
Hoangphuc735@gmail.com
7e5e96f3b2ab75ac301efab3b60bf748d6cbd0c7
23096c4df5e8ee6ab6092801f38de81ece5c069b
/src/com/qmx/framework/nio/common/DelimiterLimitChannelBuffer.java
472747256e62fa7c67dd43a43f3d90c5ff6b8571
[]
no_license
HandsomeBear/framework-nio
fea247aa54ac8a4fb416c083ff8c016a71996515
f4cd75aa7f9474680a0fc8f18ebbc73af2503026
refs/heads/master
2021-01-18T07:56:35.459866
2017-03-08T08:52:07
2017-03-08T08:52:07
84,295,925
0
0
null
null
null
null
UTF-8
Java
false
false
6,291
java
/* * Copyright [2014-2015] [qumx of copyright owner] * 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.qmx.framework.nio.common; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 123\r456\r * * @author qmx 2014-12-10 上午11:45:36 * */ public class DelimiterLimitChannelBuffer extends AbstractChannelBuffer implements ChannelBuffer { /** * 实际操作数据 */ private byte[] arraysData; /** * <code>arraysData</code>中可用元素数量 */ private int arraysDataAvaliableLength; /** * <code>arraysData</code>当前读取的位置 */ private int arraysDataPostion; /** * 300000=300KB<br/> * 回收的算法<code>arraysDataPostion>gcArraysDataPostionSize</code>时才回收,提高回收利用率 */ private int gcArraysDataPostionSize = defaultArraysLength / 100 * 80; /** * 默认初始化数组大小 */ private static int defaultArraysLength = 5000; /** * 分发池 */ private ThreadPool threadPool; /** * 完整的读取一段数据后会创建该对象 */ private MethodWorker methodWorker; private static final Logger logger = LoggerFactory .getLogger(LengthSplitChannelBuffer.class); public void setThreadPool(ThreadPool threadPool) { this.threadPool = threadPool; } public DelimiterLimitChannelBuffer(int size) { arraysData = new byte[size]; } public DelimiterLimitChannelBuffer() { this(defaultArraysLength); } /** * 数据转移 * * @param bytes */ public void setBytes(byte[] bytes) { checkArraysDataCapcity(bytes.length); System.arraycopy(bytes, 0, arraysData, arraysDataAvaliableLength, bytes.length); arraysDataAvaliableLength += bytes.length; try { readWork(); } catch (Exception e) { logger.info("数据读取错误" + e.getMessage()); DestoryChannel.destory(super.getChannel(), e); } } /** * 检查arraysData容量是否能满足 * * @param arrLegnth */ private void checkArraysDataCapcity(int arrLegnth) { int oldCapacity = arraysData.length; if (arrLegnth + arraysDataAvaliableLength > oldCapacity) { int newCapacity = ((arrLegnth + arraysDataAvaliableLength) * 3) / 2 + 1; if (newCapacity < arrLegnth) newCapacity = arrLegnth; arraysData = Arrays.copyOf(arraysData, newCapacity); } } /** * 从arraysData中提取数据 * * @param offset * @param size * @return */ public byte[] copyFromArraysData(int offset, int size) { byte[] byt = null; // 最新可用元素数量 byt = Arrays.copyOfRange(arraysData, offset, size); // arraysDataPostion = offset + size; return byt; } public void gcArrays() { if (arraysDataPostion > gcArraysDataPostionSize) { System.arraycopy(arraysData, arraysDataPostion, arraysData, 0, arraysDataAvaliableLength - arraysDataPostion); for (int i = arraysDataAvaliableLength - arraysDataPostion; i < arraysDataAvaliableLength; i++) { arraysData[i] = 0x00; } arraysDataAvaliableLength -= arraysDataPostion; arraysDataPostion = 0; logger.debug("GC" + arraysDataPostion + "," + arraysDataAvaliableLength); } } /** * 执行最后的数据切分工作 */ public void readWork() throws CertificateAuthException { for (int i = arraysDataPostion; i < arraysDataAvaliableLength; i++) { byte oneByte = arraysData[i]; if (super.isHeartEnable()) { int i_index_position = super.heartExecute(oneByte, arraysDataAvaliableLength - arraysDataPostion, super.getChannelName()); if (i_index_position == 3) { arraysDataPostion = i + i_index_position; i = arraysDataPostion - 1; continue; } else if (i_index_position == 0) break; } if (oneByte == 13)//\r { byte[] dataArr = copyFromArraysData(arraysDataPostion, i); // 长度不够取 if (dataArr == null) { break; } arraysDataPostion = (i + 1); i = arraysDataPostion - 1; //System.out.println(new String(dataArr)); methodWorker = new MethodWorker(); methodWorker.setChannelBuffer(this); methodWorker.setMethodName(HandleEnum.read); methodWorker.setByt(dataArr); methodWorker.setDataType(DataType.DEFAULT); if (super.isCertificateAuth()) { boolean authRes = super.certificateAuth(methodWorker); if (!authRes) { throw new CertificateAuthException("身份认证失败" + super.getChannelName()); } if (isAuthMark()) continue; } MessageFormat messageFormat = super.getMessageContext() .getMessageFormat(); if (messageFormat instanceof MessageFormatToString) threadPool.multiExecute(methodWorker); else if (messageFormat instanceof MessageFormatToBytes) { // 传文件要同步否则多线程会导致顺序错乱 threadPool.singleExecute(methodWorker); } // String sss = new String(dataArr); // System.out.println(sss); gcArrays(); } } } public static void main(String[] args) throws UnsupportedEncodingException, InterruptedException { //System.out.print(aa); DelimiterLimitChannelBuffer limitChannelBuffer = new DelimiterLimitChannelBuffer(); String aaab = "123\r4\r5\r6789\rabc"; ByteBuffer buffer = ByteBuffer.allocate(aaab.getBytes().length); buffer.put(aaab.getBytes()); limitChannelBuffer.setBytes(buffer.array()); Thread.sleep(5000); String cc = "de\rfghi\rjk\r"; ByteBuffer buffer111 = ByteBuffer.allocate(cc.getBytes().length); buffer111.put(cc.getBytes()); limitChannelBuffer.setBytes(buffer111.array()); limitChannelBuffer.setBytes(buffer111.array()); } @Override public void clearBytes() { // TODO Auto-generated method stub arraysData = null; } }
[ "sunhao@leagsoft.com" ]
sunhao@leagsoft.com
f68ac7dd3d035f0c03ef2aefec25e5de9691d3a0
8b4f457a4c40beba11d13911c35d4150f7f6fdb3
/src/main/java/com/example/flink/FlinkProcessorWithTimeWindow.java
3bdea1d0192474e069242fccdbc5c50f31df2a3d
[]
no_license
Lockdain/cloudflow-flink-example
87b93b81033be84c255e69f23265409d2362dc5a
f2fffeec6c75f0039f0a744822d5e3f246eb391d
refs/heads/master
2020-12-21T03:00:06.527430
2020-01-17T07:52:35
2020-01-17T07:52:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,846
java
package com.example.flink; import cloudflow.flink.FlinkStreamlet; import cloudflow.flink.FlinkStreamletLogic; import cloudflow.streamlets.StreamletShape; import cloudflow.streamlets.avro.AvroInlet; import cloudflow.streamlets.avro.AvroOutlet; import com.ey.model.ProspectEvent; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeinfo.TypeHint; import org.apache.flink.api.java.tuple.Tuple; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.configuration.Configuration; import org.apache.flink.shaded.guava18.com.google.common.collect.Iterables; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.DataStreamSink; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction; import org.apache.flink.streaming.api.windowing.assigners.SlidingProcessingTimeWindows; import org.apache.flink.streaming.api.windowing.time.Time; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; import org.apache.flink.util.Collector; public class FlinkProcessorWithTimeWindow extends FlinkStreamlet { AvroInlet<ProspectEvent> in = AvroInlet.<ProspectEvent>create("in", ProspectEvent.class); AvroOutlet<ProspectEvent> out = AvroOutlet.<ProspectEvent>create("out", (ProspectEvent s) -> s.getCustomerId(), ProspectEvent.class); // Step 2: Define the shape of the streamlet. In this example the streamlet // has 1 inlet and 1 outlet @Override public StreamletShape shape() { return StreamletShape.createWithInlets(in).withOutlets(out); } // Step 3: Provide custom implementation of `FlinkStreamletLogic` that defines // the behavior of the streamlet @Override public FlinkStreamletLogic createLogic() { return new FlinkStreamletLogic(getContext()) { @Override public void buildExecutionGraph() { DataStream<ProspectEvent> ins = this.<ProspectEvent>readStream(in, ProspectEvent.class) .map((ProspectEvent d) -> d) .returns(new TypeHint<ProspectEvent>(){}.getTypeInfo()); DataStream<ProspectEvent> simples = ins .map((ProspectEvent pe) -> new Tuple2(pe.getCustomerId(), pe)) .keyBy(0) .window(SlidingProcessingTimeWindows.of(Time.seconds(15),Time.seconds(10))) .process(new CustomCountFunction(5)); DataStreamSink<ProspectEvent> sink = writeStream(out, simples, ProspectEvent.class); } }; } public class ProspectCount { public ProspectEvent message; public Integer count; public ProspectCount(ProspectEvent message, Integer count) { this.message = message; this.count = count; } } public class CustomCountFunction extends ProcessWindowFunction<Tuple2, ProspectEvent,Tuple, TimeWindow> { private Integer count; private ValueState<ProspectCount> state; public CustomCountFunction(Integer count) { this.count = count; } @Override public void open(Configuration parameters) { state = getRuntimeContext().getState(new ValueStateDescriptor<>("state", ProspectCount.class)); } @Override public void process(Tuple tuple, Context context, Iterable<Tuple2> elements, Collector<ProspectEvent> out) throws Exception { if (Iterables.size(elements) > count) { out.collect((ProspectEvent) Iterables.getLast(elements).f0); } } } }
[ "trevor@lightbend.com" ]
trevor@lightbend.com
e99604d8a0d551b8131779e62098c14dc77020cf
9a7f334c7950299ae8ab538185fcd1e12b86f970
/src/SecurityAlgorithm/TDES.java
5633e76633fe169afe82044d2f035f5aadbdcfb4
[]
no_license
ZhangYing3314/Tintest
b23f78ee2505cb84e25d66ce64d2dcc484bcf88b
1d269400fd2b9debd28e8ad4e824222b8aeac28f
refs/heads/master
2020-06-13T10:01:35.557525
2019-07-01T07:12:29
2019-07-01T07:12:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,463
java
package SecurityAlgorithm; import java.util.ArrayList; import java.util.BitSet; import java.util.List; /** * 3DES algorthm * * @author Wang Zhichao 2019/06/25 * @version 1.0 */ public class TDES { private List<String> keys; /** * split key to 3 subkeys * * @param key */ public TDES(String key) { List<String> keys = new ArrayList<>(); for (int i = 0; i < key.length(); i = i + 8) { if (i > key.length() - 8) { keys.add(key.substring(i, key.length())); } else { keys.add(key.substring(i, i + 8)); } } while (keys.size() != 3) keys.add(""); this.keys = keys; } /** * encrypt plaintext * * @param msg * @return */ public List<BitSet> encryptMsg(String msg) { DES des1 = new DES(keys.get(0)); List<BitSet> firstSet = des1.encryptText(msg); DES des2 = new DES(keys.get(1)); String secondString = des2.decryptText(firstSet); DES des3 = new DES(keys.get(2)); List<BitSet> thirdSet = des3.encryptText(secondString); return thirdSet; } /** * decrypt cyphertext * * @param cypherText * @return */ public String decryptMsg(List<BitSet> cypherText) { DES des3 = new DES(keys.get(2)); String thirdString = des3.decryptText(cypherText); DES des2 = new DES(keys.get(1)); List<BitSet> secondSet = des2.encryptText(thirdString); DES des1 = new DES(keys.get(0)); return des1.decryptText(secondSet); } }
[ "942053466@qq.com" ]
942053466@qq.com
895ae0fda0ffabdccbdd3e567302da18e8cfe9c1
7c5cdf1adb18bc8d80631203c83b95fc35cd9a32
/app/src/main/java/cn/zhudai/zin/zhudaibao/fragment/ShowQRCodeFrag.java
1f1109d37754fe7f32d2d132f532ae0401f97589
[]
no_license
kdsunset/ZDB
beb428786dc475f59de405bb761380b5b4c05843
af579ede3186025128d0642c4560f84c658f9704
refs/heads/master
2021-06-06T15:30:44.866919
2016-10-13T06:30:02
2016-10-13T06:30:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,098
java
package cn.zhudai.zin.zhudaibao.fragment; import android.content.Context; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ImageView; import com.google.gson.Gson; import com.squareup.okhttp.Callback; import com.squareup.okhttp.FormEncodingBuilder; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.Response; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.FileCallBack; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import butterknife.Bind; import butterknife.ButterKnife; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; import cn.zhudai.zin.zhudaibao.R; import cn.zhudai.zin.zhudaibao.application.MyApplication; import cn.zhudai.zin.zhudaibao.entity.BaseErrorResponse; import cn.zhudai.zin.zhudaibao.entity.QRCodeResponse; import cn.zhudai.zin.zhudaibao.entity.ZDBURL; import cn.zhudai.zin.zhudaibao.utils.ImageUtils; import cn.zhudai.zin.zhudaibao.utils.LogUtils; import cn.zhudai.zin.zhudaibao.utils.OKhttpUtils; import cn.zhudai.zin.zhudaibao.utils.SystemUtils; import cn.zhudai.zin.zhudaibao.utils.TimeUtils; import cn.zhudai.zin.zhudaibao.utils.ToastUtils; import okhttp3.Call; /** * Created by admin on 2016/6/2. */ public class ShowQRCodeFrag extends Fragment { @Bind(R.id.iv_qrcode) ImageView ivQrcode; @Bind(R.id.bt_share) Button btShare; @Bind(R.id.bt_save) Button btSave; /* @Bind(R.id.tv_dec) TextView tvDec;*/ @Bind(R.id.iv_logo) ImageView ivLogo; private Context mContext; private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 200: QRCodeResponse respone = (QRCodeResponse) msg.obj; QRCodeResponse.Result result = respone.getResult(); final String shareimgURL = result.getShareimg(); final String qrimgURL = result.getQrimg(); ImageUtils.setImg4ViewFromNet(ivQrcode, qrimgURL); btShare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showShare( shareimgURL); } }); btSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadFile(shareimgURL); } }); break; case 400: BaseErrorResponse errorResponse = (BaseErrorResponse) msg.obj; ToastUtils.showToast(mContext, errorResponse.getMsg()); break; case 2200: String path= (String) msg.obj; ToastUtils.showToastLong(mContext, "二维码图片保存成功!保存路径:"+path); //通知系统刷新相册 SystemUtils.scanPhotos(mContext,path); break; case 2: Exception e = (Exception) msg.obj; if (e instanceof java.net.UnknownHostException ) { ToastUtils.showToast(mContext, "连接错误,请检查网络!"); // ((Activity)mContext).finish(); } break; } } }; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_showqrcode, container, false); ButterKnife.bind(this, view); /* String dec = "1、该二维码属于您的专属二维码,扫码后将会打开贷款申请页面;\n" + "2、通过该页面提交的贷款申请均属于您提交的客户;\n" + "3、贷款成功后的奖励与您亲自提交的客户奖励一致;"; tvDec.setText(dec);*/ HideKeyboard(view); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mContext = getActivity(); getQRCodeFromNet(); } private void getQRCodeFromNet() { LogUtils.i("获取二维码请求"); // OkHttpClient client = new OkHttpClient(); OkHttpClient client = OKhttpUtils.getOkHttpClient(); RequestBody formBody = new FormEncodingBuilder() .add("uid", MyApplication.user.getUid()) .build(); final Request request = new Request.Builder() .url(ZDBURL.SHOW_QRCODE) .post(formBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Request request, IOException e) { LogUtils.i("onFailure" + e.toString()); Message message = handler.obtainMessage(); message.what = 2; message.obj=e; handler.sendMessage(message); } @Override public void onResponse(Response response) throws IOException { String htmlStr = response.body().string(); Gson gson = new Gson(); BaseErrorResponse errorResponse = gson.fromJson(htmlStr, BaseErrorResponse.class); Message message = handler.obtainMessage(); if (errorResponse.getCode() == 400) { message.what = 400; message.obj = errorResponse; } else { QRCodeResponse loginResponse = gson.fromJson(htmlStr, QRCodeResponse.class); LogUtils.i("返回结果" + htmlStr); if (loginResponse.getCode() == 200) { message.what = 200; message.obj = loginResponse; } } handler.sendMessage(message); } }); } /** * 下载文件 */ public void downloadFile(String url) { LogUtils.i("下载文件&url="+url); String dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/download"; String fileName = "zhudaibao"+ TimeUtils.getCurrentMillis()+".jpg"; OkHttpUtils// .get()// .url(url)// .tag("downloadFile") .build()// .execute(new FileCallBack(dir,fileName)// { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(File file, int id) { LogUtils.i("onResponse :" + file.getAbsolutePath()); Message message= handler.obtainMessage(); message.what=2200; message.obj=file.getAbsolutePath(); handler.sendMessage(message); } }); } public String saveFile(Response response) throws IOException { InputStream is = null; byte[] buf = new byte[2048]; int len = 0; FileOutputStream fos = null; try { is = response.body().byteStream(); final long total = response.body().contentLength(); Log.i("TAG", "total:" + total); long sum = 0; File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/download"); if (!dir.exists()) dir.mkdirs(); File file = new File(dir, "zhudaibao"+ TimeUtils.getCurrentMillis()+".jpg"); fos = new FileOutputStream(file); while ((len = is.read(buf)) != -1) { sum += len; fos.write(buf, 0, len); /* final long finalSum = sum; // han.obtainMessage(PROG, String.valueOf(finalSum * 1.0f / total)).sendToTarget();*/ } fos.flush(); return file.getAbsolutePath(); } finally { try { if (is != null) is.close(); } catch (IOException e) { } try { if (fos != null) fos.close(); } catch (IOException e) { } } } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); } private void showShare( String imgUrl) { ShareSDK.initSDK(mContext); final OnekeyShare oks = new OnekeyShare(); //关闭sso授权 oks.disableSSOWhenAuthorize(); // 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法 //oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name)); // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用 // title标题:微信、QQ(新浪微博不需要标题) // oks.setTitle(title); // titleUrl是标题的网络链接,仅在人人网和QQ空间使用 // oks.setTitleUrl(url); // text是分享文本,所有平台都需要这个字段 // oks.setText("我是分享文本"); //oks.setText(dec); //网络图片的url:所有平台 oks.setImageUrl(imgUrl);//网络图片rul // url仅在微信(包括好友和朋友圈)中使用 // oks.setUrl(url); //oks.setUrl(url); // comment是我对这条分享的评论,仅在人人网和QQ空间使用 // oks.setComment("我是测试评论文本"); // site是分享此内容的网站名称,仅在QQ空间使用 oks.setSite(getString(R.string.app_name)); // siteUrl是分享此内容的网站地址,仅在QQ空间使用 // oks.setSiteUrl(url); // 启动分享GUI oks.show(mContext); } public void HideKeyboard(View v) { InputMethodManager imm = ( InputMethodManager ) v.getContext( ).getSystemService( Context.INPUT_METHOD_SERVICE ); if ( imm.isActive( ) ) { imm.hideSoftInputFromWindow( v.getApplicationWindowToken( ) , 0 ); } } }
[ "esja2632@163.com" ]
esja2632@163.com
7f12d4e8fa48258c9118f1c123d18dae261442bc
bd30db68647c84f7f66ec5b8524d5ada5c076f81
/wenfeng/src/main/java/com/cqupt/view/ItemsShowingHorizontalView.java
ecc114c7bb9f39ad3c2a91d4486c39cc08c970fc
[]
no_license
coldliang/repo1
88187ac0e4ae5f395b347734700cf33dc383dbd1
b520e0cf89fa33a2465dc5874797ac504f054b52
refs/heads/master
2020-04-12T19:15:09.569967
2018-12-21T11:14:09
2018-12-21T11:14:09
162,704,304
0
0
null
null
null
null
UTF-8
Java
false
false
3,113
java
package com.cqupt.view; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import com.cqupt.R; import com.cqupt.adapter.ItemsShowingAdapter; import java.util.HashMap; import java.util.List; public class ItemsShowingHorizontalView extends HorizontalScrollView implements OnClickListener{ private final static int DEFAULT_ITEM_WIDTH = 220; private final static int DEFAULT_ITEM_HEIGHT = 220; public interface OnItemViewClickListener{ public void onClick(List<String> urls,int position); } private int mItemWidth = DEFAULT_ITEM_WIDTH; private int mItemHeight = DEFAULT_ITEM_HEIGHT; private OnItemViewClickListener mListener; private LinearLayout mLinearLayout; private ItemsShowingAdapter mAdapter; public ItemsShowingHorizontalView(Context context, AttributeSet attrs,int defStyle) { super(context, attrs, defStyle); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ItemShowingHorizontalView); mItemWidth = ta.getDimensionPixelSize(R.styleable.ItemShowingHorizontalView_itemWidth, DEFAULT_ITEM_WIDTH); if(mItemWidth <= 0 ){ mItemWidth = DEFAULT_ITEM_WIDTH; } mItemHeight = ta.getDimensionPixelSize(R.styleable.ItemShowingHorizontalView_itemHeight, DEFAULT_ITEM_HEIGHT); if(mItemHeight <= 0){ mItemHeight = DEFAULT_ITEM_HEIGHT; } ta.recycle(); mLinearLayout = new LinearLayout(context, attrs, defStyle); mLinearLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); addView(mLinearLayout, lp); } public ItemsShowingHorizontalView(Context context, AttributeSet attrs) { this(context,attrs,0); } public ItemsShowingHorizontalView(Context context) { this(context, null); } @Override public void onClick(View v) { if(mListener != null){ @SuppressWarnings("unchecked") HashMap<String, Object> map = (HashMap<String, Object>)v.getTag(); @SuppressWarnings("unchecked") List<String> urls = (List<String>) map.get(ItemsShowingAdapter.TAG_URLS); int position = (Integer) map.get(ItemsShowingAdapter.TAG_POSITION); mListener.onClick(urls,position); } } public void setAdapter(ItemsShowingAdapter adapter){ mAdapter = adapter; makeChildView(); } public void setListener(OnItemViewClickListener listener){ mListener = listener; } private void makeChildView(){ mLinearLayout.removeAllViews(); android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout .LayoutParams(mItemWidth,mItemHeight); lp.topMargin = 10; lp.bottomMargin = 10; lp.leftMargin = 5; lp.rightMargin = 5; for(int i = 0; i < mAdapter.getItemCount(); i++){ View view = mAdapter.getView(i); view.setOnClickListener(this); mLinearLayout.addView(view, lp); } } }
[ "815299204@qq.com" ]
815299204@qq.com
9882cd845c4fdee9edabcac95e5602e8143013a2
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/location/model/l$6.java
da17e378607c08b86aaee53d98ba1dfbd4d46871
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
584
java
package com.tencent.mm.plugin.location.model; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.ai.e.a; import com.tencent.mm.model.bz.a; final class l$6 implements bz.a { l$6(l paraml) { } public final void a(e.a parama) { AppMethodBeat.i(113352); new n().b(parama); AppMethodBeat.o(113352); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes2-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.location.model.l.6 * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
1e2b0afed9783f829988cd6cd2b7a0c084296484
3835f0d1df85bc89ed004d14cf53021705169916
/Week4/activity6/activity6/src/business/MusicManagerInterface.java
e50b397ff68ea005e04f1fa7b71937e249af6f65
[]
no_license
ZSwoveland/CST361SoloTurnIn
dba52e9ed64a49d3ab0840cd0a2dead9f3fee87c
0f6429d9cdcde1c4c60157c81e521bf3edb6e7f7
refs/heads/main
2023-03-03T17:44:55.679907
2021-02-14T16:55:29
2021-02-14T16:55:29
322,879,473
0
0
null
null
null
null
UTF-8
Java
false
false
116
java
package business; import beans.Album; public interface MusicManagerInterface { Album addAlbum(Album model); }
[ "38055823+ZSwoveland@users.noreply.github.com" ]
38055823+ZSwoveland@users.noreply.github.com
a914684ceae057d2b32a80f69c2c34da48fdc8f7
b5da40959f7fcc592339f48cd921ab55eb41a4de
/it.unibo.qacoap/src-gen/it/unibo/qacoapobserver/AbstractQacoapobserver.java
7507e18ae79b20a21bed7a59cea765b6bbea4a08
[]
no_license
MatteoMendula/iss2018Lab
8228a3a623e2cb02e6bcd5cfa48cd395f343fc65
122ed92f522ab58d5fe105d778719eb05a5a37d5
refs/heads/master
2020-04-19T18:14:49.627220
2019-01-10T15:15:45
2019-01-10T15:15:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,306
java
/* Generated by AN DISI Unibo */ package it.unibo.qacoapobserver; import it.unibo.qactors.PlanRepeat; import it.unibo.qactors.QActorContext; import it.unibo.qactors.StateExecMessage; import it.unibo.qactors.QActorUtils; import it.unibo.is.interfaces.IOutputEnvView; import it.unibo.qactors.action.AsynchActionResult; import it.unibo.qactors.action.IActorAction; import it.unibo.qactors.action.IActorAction.ActionExecMode; import it.unibo.qactors.action.IMsgQueue; import it.unibo.qactors.akka.QActor; import it.unibo.qactors.StateFun; import java.util.Stack; import java.util.Hashtable; import java.util.concurrent.Callable; import alice.tuprolog.Struct; import alice.tuprolog.Term; import it.unibo.qactors.action.ActorTimedAction; import it.unibo.baseEnv.basicFrame.EnvFrame; import alice.tuprolog.SolveInfo; import it.unibo.is.interfaces.IActivity; import it.unibo.is.interfaces.IIntent; public abstract class AbstractQacoapobserver extends QActor implements IActivity{ protected AsynchActionResult aar = null; protected boolean actionResult = true; protected alice.tuprolog.SolveInfo sol; protected String planFilePath = null; protected String terminationEvId = "default"; protected String parg=""; protected boolean bres=false; protected IActorAction action; protected static IOutputEnvView setTheEnv(IOutputEnvView outEnvView ){ EnvFrame env = new EnvFrame( "Env_qacoapobserver", java.awt.Color.yellow , java.awt.Color.black ); env.init(); env.setSize(800,430); IOutputEnvView newOutEnvView = ((EnvFrame) env).getOutputEnvView(); return newOutEnvView; } public AbstractQacoapobserver(String actorId, QActorContext myCtx, IOutputEnvView outEnvView ) throws Exception{ super(actorId, myCtx, "./srcMore/it/unibo/qacoapobserver/WorldTheory.pl", setTheEnv( outEnvView ) , "init"); addInputPanel(80); addCmdPanels(); this.planFilePath = "./srcMore/it/unibo/qacoapobserver/plans.txt"; } protected void addInputPanel(int size){ ((EnvFrame) env).addInputPanel(size); } protected void addCmdPanels(){ ((EnvFrame) env).addCmdPanel("input", new String[]{"INPUT"}, this); ((EnvFrame) env).addCmdPanel("alarm", new String[]{"FIRE"}, this); ((EnvFrame) env).addCmdPanel("help", new String[]{"HELP"}, this); } @Override protected void doJob() throws Exception { String name = getName().replace("_ctrl", ""); mysupport = (IMsgQueue) QActorUtils.getQActor( name ); initStateTable(); initSensorSystem(); history.push(stateTab.get( "init" )); autoSendStateExecMsg(); //QActorContext.terminateQActorSystem(this);//todo } /* * ------------------------------------------------------------ * PLANS * ------------------------------------------------------------ */ //genAkkaMshHandleStructure protected void initStateTable(){ stateTab.put("handleToutBuiltIn",handleToutBuiltIn); stateTab.put("init",init); stateTab.put("work",work); stateTab.put("observe",observe); } StateFun handleToutBuiltIn = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("handleTout",-1); String myselfName = "handleToutBuiltIn"; println( "qacoapobserver tout : stops"); repeatPlanNoTransition(pr,myselfName,"application_"+myselfName,false,false); }catch(Exception e_handleToutBuiltIn){ println( getName() + " plan=handleToutBuiltIn WARNING:" + e_handleToutBuiltIn.getMessage() ); QActorContext.terminateQActorSystem(this); } };//handleToutBuiltIn StateFun init = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("init",-1); String myselfName = "init"; //switchTo work switchToPlanAsNextState(pr, myselfName, "qacoapobserver_"+myselfName, "work",false, false, null); }catch(Exception e_init){ println( getName() + " plan=init WARNING:" + e_init.getMessage() ); QActorContext.terminateQActorSystem(this); } };//init StateFun work = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("work",-1); String myselfName = "work"; temporaryStr = "\"qacoapoberver STARTS \""; println( temporaryStr ); createObserver(); doCoapQuery( "globalkb" , "assign(a,100)" ); doCoapQuery( "globalkb" , "getVal(a,X)" ); //switchTo observe switchToPlanAsNextState(pr, myselfName, "qacoapobserver_"+myselfName, "observe",false, false, null); }catch(Exception e_work){ println( getName() + " plan=work WARNING:" + e_work.getMessage() ); QActorContext.terminateQActorSystem(this); } };//work StateFun observe = () -> { try{ PlanRepeat pr = PlanRepeat.setUp(getName()+"_observe",0); pr.incNumIter(); String myselfName = "observe"; temporaryStr = "\"qacoapoberver OBSERVING ... \""; println( temporaryStr ); //bbb msgTransition( pr,myselfName,"qacoapobserver_"+myselfName,false, new StateFun[]{() -> { //AD HOC state to execute an action and resumeLastPlan try{ PlanRepeat pr1 = PlanRepeat.setUp("adhocstate",-1); //ActionSwitch for a message or event if( currentEvent.getMsg().startsWith("info") ){ String parg = "qacoapobserver(observeddddddddddddddd,X)"; /* Print */ parg = updateVars( Term.createTerm("info(X)"), Term.createTerm("info(X)"), Term.createTerm(currentEvent.getMsg()), parg); if( parg != null ) println( parg ); } repeatPlanNoTransition(pr1,"adhocstate","adhocstate",false,true); }catch(Exception e ){ println( getName() + " plan=observe WARNING:" + e.getMessage() ); //QActorContext.terminateQActorSystem(this); } } }, new String[]{"true","E","coapInfo" }, 600000, "handleToutBuiltIn" );//msgTransition }catch(Exception e_observe){ println( getName() + " plan=observe WARNING:" + e_observe.getMessage() ); QActorContext.terminateQActorSystem(this); } };//observe protected void initSensorSystem(){ //doing nothing in a QActor } /* * ------------------------------------------------------------ * IACTIVITY (aactor with GUI) * ------------------------------------------------------------ */ private String[] actions = new String[]{ "println( STRING | TERM )", "play('./audio/music_interlude20.wav'),20000,'alarm,obstacle', 'handleAlarm,handleObstacle'", "emit(EVID,EVCONTENT) ", "move(MOVE,DURATION,ANGLE) with MOVE=mf|mb|ml|mr|ms", "forward( DEST, MSGID, MSGCONTENTTERM)" }; protected void doHelp(){ println(" GOAL "); println("[ GUARD ], ACTION "); println("[ GUARD ], ACTION, DURATION "); println("[ GUARD ], ACTION, DURATION, ENDEVENT"); println("[ GUARD ], ACTION, DURATION, EVENTS, PLANS"); println("Actions:"); for( int i=0; i<actions.length; i++){ println(" " + actions[i] ); } } @Override public void execAction(String cmd) { if( cmd.equals("HELP") ){ doHelp(); return; } if( cmd.equals("FIRE") ){ emit("alarm", "alarm(fire)"); return; } String input = env.readln(); //input = "\""+input+"\""; input = it.unibo.qactors.web.GuiUiKb.buildCorrectPrologString(input); //println("input=" + input); try { Term.createTerm(input); String eventMsg=it.unibo.qactors.web.QActorHttpServer.inputToEventMsg(input); //println("QActor eventMsg " + eventMsg); emit("local_"+it.unibo.qactors.web.GuiUiKb.inputCmd, eventMsg); } catch (Exception e) { println("QActor input error " + e.getMessage()); } } @Override public void execAction() {} @Override public void execAction(IIntent input) {} @Override public String execActionWithAnswer(String cmd) {return null;} }
[ "antonio.natali@unibo.it" ]
antonio.natali@unibo.it
68014473d3ef3e2e07c6fe398816ae72bf05833e
0fe057d94f5918bc3b41af9fdafc7f4444f2b03e
/src/main/java/com/labeltel/site/config/MailConfiguration.java
1e3d3c39f182d83a2629ae4e558ff03159ec2602
[]
no_license
renancunha/labtelsite
480778d37fb6bd67f431f14244af8408466f29ea
078d476d560fc063f41ca9b19f0c2076c68a1f90
refs/heads/master
2016-09-05T14:30:31.032294
2015-09-18T12:57:29
2015-09-18T12:57:29
42,722,184
0
0
null
null
null
null
UTF-8
Java
false
false
3,126
java
package com.labeltel.site.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.EnvironmentAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.mail.javamail.JavaMailSenderImpl; import java.util.Properties; @Configuration public class MailConfiguration implements EnvironmentAware { private static final String ENV_SPRING_MAIL = "mail."; private static final String DEFAULT_HOST = "127.0.0.1"; private static final String PROP_HOST = "host"; private static final String DEFAULT_PROP_HOST = "localhost"; private static final String PROP_PORT = "port"; private static final String PROP_USER = "username"; private static final String PROP_PASSWORD = "password"; private static final String PROP_PROTO = "protocol"; private static final String PROP_TLS = "tls"; private static final String PROP_AUTH = "auth"; private static final String PROP_SMTP_AUTH = "mail.smtp.auth"; private static final String PROP_STARTTLS = "mail.smtp.starttls.enable"; private static final String PROP_TRANSPORT_PROTO = "mail.transport.protocol"; private final Logger log = LoggerFactory.getLogger(MailConfiguration.class); private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment environment) { this.propertyResolver = new RelaxedPropertyResolver(environment, ENV_SPRING_MAIL); } @Bean public JavaMailSenderImpl javaMailSender() { log.debug("Configuring mail server"); String host = propertyResolver.getProperty(PROP_HOST, DEFAULT_PROP_HOST); int port = propertyResolver.getProperty(PROP_PORT, Integer.class, 0); String user = propertyResolver.getProperty(PROP_USER); String password = propertyResolver.getProperty(PROP_PASSWORD); String protocol = propertyResolver.getProperty(PROP_PROTO); Boolean tls = propertyResolver.getProperty(PROP_TLS, Boolean.class, false); Boolean auth = propertyResolver.getProperty(PROP_AUTH, Boolean.class, false); JavaMailSenderImpl sender = new JavaMailSenderImpl(); if (host != null && !host.isEmpty()) { sender.setHost(host); } else { log.warn("Warning! Your SMTP server is not configured. We will try to use one on localhost."); log.debug("Did you configure your SMTP settings in your application.yml?"); sender.setHost(DEFAULT_HOST); } sender.setPort(port); sender.setUsername(user); sender.setPassword(password); Properties sendProperties = new Properties(); sendProperties.setProperty(PROP_SMTP_AUTH, auth.toString()); sendProperties.setProperty(PROP_STARTTLS, tls.toString()); sendProperties.setProperty(PROP_TRANSPORT_PROTO, protocol); sender.setJavaMailProperties(sendProperties); return sender; } }
[ "renan.bara@hotmail.com" ]
renan.bara@hotmail.com
4cd5f1e4b0cbbdb1eaa819702314f7aaeedf7273
3579f097d2fafbdf5aebb075738beea453d7d6c1
/Servlet-new data dump/src/com/display/OrdersDisplay.java
9979fb6ac00421b637a1deebf79174bc7302c4e2
[]
no_license
Jainandhini/JavaRelearn
963d00b49b3ca062ffcd19da16dc9acdd54966ad
3830e3d8cfc26ef31b8b0859b0bac4f3c4ab2802
refs/heads/master
2020-12-05T17:04:21.238713
2020-04-08T16:06:25
2020-04-08T16:06:25
232,182,459
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.display; import java.io.PrintWriter; import java.sql.ResultSet; import java.util.ArrayList; import com.pojo.Orders; public class OrdersDisplay { public void displayOrders(PrintWriter out,ArrayList<Orders> orders,String action) { switch(action) { case "viewOrdersByUser": case "viewOrdersFilterByStatus": displayOrdersByUser(out,orders); break; } } public void displayOrdersByUser(PrintWriter out,ArrayList<Orders> orders){ out.write( "<html><head><title>displayOrdersByUser</title></head><body>" + "<table border=\"1\"><tr><th>Order Number</th>" + "<th>Customer ID</th><th>Saleman ID</th><th>Ordered Date</th><th>Status</th>"); for(Orders o:orders) { out.write("<tr><td>"+o.getOrder_id()+"</td><td>"+o.getCustomer_id() +"</td><td>"+o.getSalesman_id()+"</td><td>"+o.getOrder_date() +"</td><td>"+o.getStatus()+"</td></tr>"); } out.write("</table></body></html>"); } }
[ "jainandhinis@gmail.com" ]
jainandhinis@gmail.com
6a84e6ff52b09153b388dd324e41e6f434b8bfde
3edc2c20d3bf749a0ecebcaf61b08da2bf58593b
/src/main/java/singleton/ChocolateBoiler2.java
b8a33d9e483140d0450d2fbe5bfbb250f099dfc2
[]
no_license
hannut91/design-patterns
d3f274d93aa8bd67aa9950eda491b1ecc5b278c1
1f6139b7753481a2db57e90b6be391a952499537
refs/heads/master
2020-12-02T02:00:55.976728
2020-01-12T10:17:11
2020-01-12T10:17:11
230,851,596
1
1
null
2020-01-12T10:17:12
2019-12-30T05:11:31
Kotlin
UTF-8
Java
false
false
766
java
package singleton; public class ChocolateBoiler2 { private boolean empty; private boolean boiled; private static ChocolateBoiler2 uniqueInstance; private ChocolateBoiler2() { empty = true; boiled = false; } public static ChocolateBoiler2 getUniqueInstance() { if (uniqueInstance == null) { uniqueInstance = new ChocolateBoiler2(); } return uniqueInstance; } public void fill() { if (empty) { empty = false; boiled = false; } } public void boil() { if (!empty && !boiled) { boiled = true; } } public void drain() { if (!empty && boiled) { empty = true; } } }
[ "hannut91@gmail.com" ]
hannut91@gmail.com
44d44de4c8110f79205573114e91031ae9b09067
60feada88a66bf1c9a68a74ecf588c5dc9d42e1a
/src/main/java/com/bookerdimaio/scrabble/web/rest/vm/package-info.java
e6a611ac10c6583708dfd909235d721763ab23b6
[]
no_license
cmavelis/scr-gate
a877c40aec4ec2c8cd97856289407905b020677a
be55a73622ac8bd0fd12e9b8ec88fc201eb6231a
refs/heads/master
2022-12-24T22:32:37.880800
2019-08-22T16:18:40
2019-08-22T16:18:40
204,721,722
0
0
null
2022-12-16T05:03:16
2019-08-27T14:30:35
TypeScript
UTF-8
Java
false
false
107
java
/** * View Models used by Spring MVC REST controllers. */ package com.bookerdimaio.scrabble.web.rest.vm;
[ "cmavelis@gmail.com" ]
cmavelis@gmail.com
af1f8d81185f4cfa6989c1d9e0a5f01fc1a9a711
7908ec3c94ceb6085630c84711a38e306056770a
/014. JavaFX Hello World!/src/sample/Main.java
994e6cf6bbc322e4a239b1a17e440d01f4ce212e
[]
no_license
FrogGreen/Java
d78ffbd5d70f0a0454deef5c20dc460ab2a7188d
1803c29f6fb408e32a38e50bf07240ec242a186e
refs/heads/master
2022-12-28T22:09:56.603007
2019-10-20T22:28:03
2019-10-20T22:28:03
195,135,181
1
0
null
null
null
null
UTF-8
Java
false
false
602
java
//JavaFX Hello World package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
[ "35386116+FrogGreen@users.noreply.github.com" ]
35386116+FrogGreen@users.noreply.github.com
7a83c064633aac34970bf519890cdd63fd5fb31f
c0148cf6550573373988ae12bc0d560c98cca2eb
/src/org/omg/PortableServer/RequestProcessingPolicyOperations.java
11476fdc88d058e03eefd92fc6b1a0fa8ac8c379
[]
no_license
chensy28/java8-source-read
32d49e5d8816ed2c08012230370b35b2aae60cc4
eaaeaf0c54de0049c735a6f7895cdb0ad980c5a5
refs/heads/master
2021-07-25T05:49:14.191422
2021-07-15T11:42:40
2021-07-15T11:42:40
227,141,261
0
1
null
null
null
null
UTF-8
Java
false
false
733
java
package org.omg.PortableServer; /** * org/omg/PortableServer/RequestProcessingPolicyOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u172/10810/corba/src/share/classes/org/omg/PortableServer/poa.idl * Wednesday, March 28, 2018 3:39:58 PM PDT */ /** * This policy specifies how requests are processed by * the created POA. The default is * USE_ACTIVE_OBJECT_MAP_ONLY. */ public interface RequestProcessingPolicyOperations extends org.omg.CORBA.PolicyOperations { /** * specifies the policy value */ org.omg.PortableServer.RequestProcessingPolicyValue value (); } // interface RequestProcessingPolicyOperations
[ "chensy@tuya.com" ]
chensy@tuya.com
659d00fcbc29445d4acb38824b3ec6944c1f4d61
15291c1264f52680724c2bc82ebde97588d533a7
/src/main/java/pl/marcinek/spring_boot_datajpa/repository/TutorialRepository.java
5cdc0707be027844c9d7f4966c6582c7feb6e28f
[]
no_license
KacperMarcinek/spring-boot-postgreql-crud
e527f4eb4564026d0fec70dfd20d6290dce80154
8847a5c4d33fa95d4f8aa938f9ce6df2751c7465
refs/heads/master
2022-12-11T23:15:32.126608
2020-09-07T09:42:55
2020-09-07T09:42:55
293,485,764
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package pl.marcinek.spring_boot_datajpa.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import pl.marcinek.spring_boot_datajpa.model.Tutorial; import java.util.List; @Repository public interface TutorialRepository extends JpaRepository<Tutorial, Long> { List<Tutorial> findByPublished(boolean published); List<Tutorial> findByTitleContaining(String title); }
[ "witcher9387@gmail.com" ]
witcher9387@gmail.com
8decf8d5f7090ff3ffc5cee4e490b77cf72cf5cf
738af35341bbe42f0b97882e162a4abda57c3072
/src/Elementary/Shell.java
f69e2b5edc5b2792b7e252928148efe5551896e3
[]
no_license
jimmypham92/Sort-algorithm
4825276e07d66d73b1029623f27a1789ddc8241c
7db8615a30fb8e59f26bc561900e1eccc6e6f7c1
refs/heads/master
2021-05-31T07:13:58.035415
2015-12-24T05:09:01
2015-12-24T05:09:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package Elementary; /** * Author: Gác Xanh (phamanh) * Date: 24/12/2015 * Class: OOP2 * Project: Sort-algorithm */ public class Shell { public static void sort(Comparable[] a) { int N = a.length; int h = 1; while (h < N/3) h = 3*h + 1; while (h >= 1) { for (int i = h; i < N; i++) { for (int j = i; j >= h && less(a[j], a[j-h]); j -= h) exch(a,j,j-h); } h = h/3; } } private static void exch(Comparable[] a, int i, int j){ Comparable t = a[i]; a[i] = a[j]; a[j] = t; } private static boolean less(Comparable v, Comparable w) { return v.compareTo(w) < 0; } public static boolean isSorted(Comparable[] a){ for (int i = 1; i < a.length; i++) { if (less(a[i],a[i-1])) return false; } return true; } public static void show(Comparable[] a){ for (int i = 0; i < a.length; i++) { System.out.print(a[i] + " "); } System.out.println(); } }
[ "anhapo11@gmail.com" ]
anhapo11@gmail.com
e6d346c5dac2bf2e30b0b2e253b02d07086b3a0f
3c9b43b47b30bd861c140d0f8d91c9e349c52094
/src/dicomanalyser/DICOMStore.java
c5519b50e0a3b139066bbaad1f205ad1754b05b8
[]
no_license
evgenyorlov1/Dicom-Viewer
2c591a437f523646fa007fb172c206fd7f314509
2089472e87091455879fb49415f27b5d02bfcf28
refs/heads/master
2021-01-01T05:17:07.218349
2016-05-20T03:17:16
2016-05-20T03:17:16
57,183,548
0
1
null
null
null
null
UTF-8
Java
false
false
3,318
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 dicomanalyser; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; /** * * @author pc */ public class DICOMStore { public ArrayList<Float> uniqueSliceLocations = new ArrayList<>(); public ArrayList<DICOMImage> dcmImages = new ArrayList<>(); public Map<Float, ArrayList<Integer>> instanceNumbersBySlice = new LinkedHashMap<>(); public void add(DICOMImage image) { try { dcmImages.add(image); if(!uniqueSliceLocations.contains(image.sliceLocation)) { uniqueSliceLocations.add((float) image.sliceLocation); TagSorter.insertionSortFloat(uniqueSliceLocations); } } catch(Exception e) {System.out.println("DICOMStore.add error: " + e);} } public void sortBySlice() { try { for(int i=0; i<uniqueSliceLocations.size(); i++) { ArrayList<Integer> instancesPerSlice = new ArrayList<>(); for(int j=0; j<dcmImages.size(); j++) { if(Float.compare(dcmImages.get(j).sliceLocation, uniqueSliceLocations.get(i)) == 0) { instancesPerSlice.add(dcmImages.get(j).instanceNumber); } } TagSorter.insertionSortInteger(instancesPerSlice); instanceNumbersBySlice.put(uniqueSliceLocations.get(i), instancesPerSlice); } } catch(Exception e) {System.out.println("DICOMStore.sortBySlice error: " + e);} } public DICOMImage get(int sliceLocationIndex, int instanceNumberIndex) { try { float sliceLocation = uniqueSliceLocations.get(sliceLocationIndex); int instanceNumber = instanceNumbersBySlice.get(sliceLocation). get(instanceNumberIndex); for(int i=0; i<dcmImages.size(); i++) { DICOMImage image = dcmImages.get(i); if(Float.compare(image.sliceLocation, sliceLocation) == 0 && (image.instanceNumber == instanceNumber)) { System.out.println("-----------"); System.out.println("instance: " + image.instanceNumber); System.out.println("slice: " + image.sliceLocation); return image; } } } catch(Exception e) {System.out.println("DICOMStore.get error: " + e);} return get(0,0); } public int getZcount() { return uniqueSliceLocations.size() - 1; } public int getTcount(int sliceLocationIndex) { int numberOfInstances = 0; float sliceLocation = uniqueSliceLocations.get(sliceLocationIndex); numberOfInstances = instanceNumbersBySlice.get(sliceLocation).size(); return numberOfInstances - 1; } }
[ "evgenyorlov1@gmail.com" ]
evgenyorlov1@gmail.com
9c75bc8c14386a1051e6aa4617837900b92a66bc
72d1d0bf648c2895eee46b73a6b3a735c677c059
/src/br/com/trabalho/bd2/beans/LoginController.java
f50c053195f803a9da0fe2c2002736227c884287
[ "Apache-2.0" ]
permissive
wyll1an/LocadoraVeiculos
c611a1522b3745353325c7864c773c4fb04dbd22
54971739ee7a8a2aa1024462e3ec3c571071531f
refs/heads/master
2022-01-19T17:45:13.290157
2017-08-05T20:24:56
2017-08-05T20:24:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,596
java
package br.com.trabalho.bd2.beans; import java.io.Serializable; import java.sql.SQLException; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import javax.servlet.http.HttpSession; import br.com.trabalho.bd2.dao.LoginDAO; import br.com.trabalho.bd2.jsf.util.SessionUtils; import br.com.trabalho.bd2.model.Usuario; @ManagedBean @SessionScoped public class LoginController implements Serializable { private static final long serialVersionUID = 1094801825228386363L; private Usuario usuario; private LoginDAO loginDAO; @PostConstruct public void init(){ this.usuario = new Usuario(); this.loginDAO = new LoginDAO(); } //validate login public String validateUsernamePassword() throws SQLException { boolean valid = loginDAO.validate(usuario.getUser(), usuario.getPwd()); if (valid) { HttpSession session = SessionUtils.getSession(); session.setAttribute("username", usuario.getUser()); return "index"; } else { FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Nome ou senha Incorreto", "Tente novamente")); return "login"; } } //logout event, invalidate session public String logout() { HttpSession session = SessionUtils.getSession(); session.invalidate(); return "login"; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } }
[ "Willian@Willian" ]
Willian@Willian
bcf991caf94373bdc1d601e154baae4be7dc9910
e01dc5993b7ac310c346763d46e900f3b2d5db5e
/jasperserver-dto/src/main/java/com/jaspersoft/jasperserver/dto/resources/ClientProperty.java
5cdae7dcb84bbcae1bffeb8f747a5575b214ae93
[]
no_license
yohnniebabe/jasperreports-server-ce
ed56548a2ee18d37511c5243ffd8e0caff2be8f7
e65ce85a5dfca8d9002fcabc172242f418104453
refs/heads/master
2023-08-26T00:01:23.634829
2021-10-22T14:15:32
2021-10-22T14:15:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,930
java
/* * Copyright (C) 2005 - 2020 TIBCO Software Inc. All rights reserved. * http://www.jaspersoft.com. * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.jaspersoft.jasperserver.dto.resources; import com.jaspersoft.jasperserver.dto.common.DeepCloneable; import javax.xml.bind.annotation.XmlRootElement; import static com.jaspersoft.jasperserver.dto.utils.ValueObjectUtils.checkNotNull; /** * <p></p> * * @author Yaroslav.Kovalchyk * @version $Id$ */ @XmlRootElement(name = "property") public class ClientProperty implements DeepCloneable<ClientProperty> { private String key; private String value; public ClientProperty(){ } public ClientProperty (ClientProperty source){ checkNotNull(source); key = source.getKey(); value = source.getValue(); } public ClientProperty(String key, String value){ this.key = key; this.value = value; } public String getKey() { return key; } public ClientProperty setKey(String key) { this.key = key; return this; } public String getValue() { return value; } public ClientProperty setValue(String value) { this.value = value; return this; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ClientProperty that = (ClientProperty) o; if (key != null ? !key.equals(that.key) : that.key != null) return false; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true; } @Override public int hashCode() { int result = key != null ? key.hashCode() : 0; result = 31 * result + (value != null ? value.hashCode() : 0); return result; } @Override public String toString() { return "ClientProperty{" + "key='" + key + '\'' + ", value='" + value + '\'' + '}'; } /* * DeepCloneable */ @Override public ClientProperty deepClone() { return new ClientProperty(this); } }
[ "hguntupa@tibco.com" ]
hguntupa@tibco.com
bf849ce48fdf98c334011bdd67961246a32d919a
3d94fe2be59b31ef46534975a6ddebb1972f47b7
/base-backend/family/src/main/java/com/family/gold/service/Impl/UserDiyGroupConfigServiceImpl.java
1458c205225f3f0e3160e1e7e1656a9bc53d2e56
[]
no_license
banxue-dev/family-manager
31de7143bb8c18e014322d2a967742d7f3b2b7c2
a7b0e84a0244ebc4ec8a6601c29f882c29135407
refs/heads/master
2023-07-05T02:11:46.247883
2021-08-03T02:08:20
2021-08-03T02:08:20
299,210,043
0
0
null
null
null
null
UTF-8
Java
false
false
5,450
java
package com.family.gold.service.Impl; import com.family.gold.entity.UserDiyGroupConfig; import com.family.gold.mapper.UserDiyGroupConfigMapper; import com.family.gold.service.IUserDiyGroupConfigService; import org.springframework.stereotype.Service; import com.family.utils.EntityChangeRquestView; import com.family.gold.entity.VO.UserDiyGroupConfigVO; import com.family.gold.entity.DO.UserDiyGroupConfigDO; import com.github.pagehelper.PageHelper; import com.family.utils.ResultUtil; import com.family.utils.ResultObject; import javax.persistence.Transient; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Example; import java.util.ArrayList; import com.family.utils.TimeUtils; import com.github.pagehelper.PageInfo; import com.family.utils.LayuiPage; import com.family.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import java.util.Map; import java.util.List; /** * UserDiyGroupConfig服务层 * Auther:feng * Date:2020-10-21 17:50:47 */ @Service public class UserDiyGroupConfigServiceImpl implements IUserDiyGroupConfigService { @Autowired private UserDiyGroupConfigMapper iUserDiyGroupConfigMapper; /** * 获取单页记录 * Auther:feng */ @Override public UserDiyGroupConfigVO getSingleInfo(UserDiyGroupConfigDO userDiyGroupConfigDO) { UserDiyGroupConfig userDiyGroupConfig=new UserDiyGroupConfig(); userDiyGroupConfig= iUserDiyGroupConfigMapper.selectOne(EntityChangeRquestView.createDOToEntity(userDiyGroupConfigDO,new UserDiyGroupConfig())); return this.structDetailData(userDiyGroupConfig); } /** * 依据ID获取单页记录 * Auther:feng */ @Override public UserDiyGroupConfigVO getSingleInfoById(Integer goldUserDiyGroupConfigId) { UserDiyGroupConfig userDiyGroupConfig=new UserDiyGroupConfig(); userDiyGroupConfig= iUserDiyGroupConfigMapper.selectByPrimaryKey(goldUserDiyGroupConfigId); return this.structDetailData(userDiyGroupConfig); } /** * 获取列表记录 * Auther:feng */ @Override public List<UserDiyGroupConfigVO> getUserDiyGroupConfigList(UserDiyGroupConfigDO userDiyGroupConfigDO) { Example example = getPublicExample(userDiyGroupConfigDO); List<UserDiyGroupConfigVO> lstVO = new ArrayList<UserDiyGroupConfigVO>(); List<UserDiyGroupConfig> lst = iUserDiyGroupConfigMapper.selectByExample(example); lst.forEach(t->{ UserDiyGroupConfigVO vo=this.structDetailData(t); if(vo!=null) { lstVO.add(vo); } }); return lstVO; } /** * 获取分页记录 * Auther:feng */ @Override @Transactional public LayuiPage<UserDiyGroupConfigVO> getUserDiyGroupConfigListByPage(UserDiyGroupConfigDO userDiyGroupConfigDO, LayuiPage<UserDiyGroupConfigVO> layuiPage){ Example example = getPublicExample(userDiyGroupConfigDO); if(StringUtils.isNotNull(layuiPage.getSort())) { PageHelper.startPage(layuiPage.getPage(), layuiPage.getLimit()).setOrderBy(layuiPage.getSort() + " " + layuiPage.getDire()); }else { PageHelper.startPage(layuiPage.getPage(), layuiPage.getLimit()); } List<UserDiyGroupConfigVO> lstVO = new ArrayList<UserDiyGroupConfigVO>(); List<UserDiyGroupConfig> lst = iUserDiyGroupConfigMapper.selectByExample(example); PageInfo pageInfo=PageInfo.of(lst); lst.forEach(t->{ UserDiyGroupConfigVO vo=this.structDetailData(t); if(vo!=null) { lstVO.add(vo); } }); pageInfo.setList(lstVO); layuiPage = new LayuiPage<>(pageInfo); return layuiPage; } /** * 删除记录 * Auther:feng */ @Override @Transactional public ResultObject delUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { int i= iUserDiyGroupConfigMapper.updateByPrimaryKeySelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 修改信息 * Auther:feng */ @Override @Transactional public ResultObject modUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { int i= iUserDiyGroupConfigMapper.updateByPrimaryKeySelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 添加信息 * Auther:feng */ @Override @Transactional public ResultObject addNewUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { userDiyGroupConfig.setCreateTime(TimeUtils.getCurrentTime()); int i= iUserDiyGroupConfigMapper.insertSelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 构造返回的数据 * Auther:feng */ private UserDiyGroupConfigVO structDetailData(UserDiyGroupConfig userDiyGroupConfig) { if(userDiyGroupConfig==null){ return null; } UserDiyGroupConfigVO vo= EntityChangeRquestView.createEntityToVO(userDiyGroupConfig,new UserDiyGroupConfigVO()); return vo; } /** * 构造请求的条件 * Auther:feng */ private Example getPublicExample(UserDiyGroupConfigDO userDiyGroupConfigDO) { Example example = new Example(UserDiyGroupConfig.class); Example.Criteria criteria = example.createCriteria(); criteria.andEqualTo(EntityChangeRquestView.createDOToEntity(userDiyGroupConfigDO,new UserDiyGroupConfig())); return example; } }
[ "37128857+fengchaseyou@users.noreply.github.com" ]
37128857+fengchaseyou@users.noreply.github.com
9daf05f4ef3d0b8ca3f74a8f974a07b615a56dc5
a749a78317bfb271b818c682db4fb433ed5c9fb1
/pr2.07.00-PresentationCode/src/io/dama/ffi/generics/SimpleStackObject.java
41d10e1d96e2913cb07da1e0153b6051f32347c0
[]
no_license
zer0x0/pr2_fue
29176ce98f7736b399f594c33ef320dac7f343a0
6ec2514e7d3285b1575d96c4cd4612b3ee00488a
refs/heads/master
2023-06-01T21:47:22.670838
2021-06-17T21:58:01
2021-06-17T21:58:01
265,402,921
1
0
null
null
null
null
UTF-8
Java
false
false
949
java
package io.dama.ffi.generics; public class SimpleStackObject { private final Object[] stack; private int pos; public SimpleStackObject(final int size) { this.stack = new Object[size]; this.pos = 0; } public void push(final Object o) { this.stack[this.pos++] = o; } public Object pop() { return this.stack[--this.pos]; } public static void main(final String[] args) { final var stack1 = new SimpleStackObject(10); stack1.push("Hello"); String s1 = (String) stack1.pop(); System.out.println(s1); stack1.push(42); s1 = (String) stack1.pop(); // FEHLER (Runtime)!! System.out.println(s1); final var stack2 = new SimpleStack(10); stack2.push("Hello"); var s = stack2.pop(); System.out.println(s); stack2.push(42); s = stack2.pop(); System.out.println(s); } }
[ "zer0x0@pm.me" ]
zer0x0@pm.me
f7b6a19e8a55e3112dde7b70ef009705c23ea958
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/globalNamespace/classes/PHP_Token_INCLUDE_ONCE.java
c4c8c2fe5e0e193b2beffb3c113bbff47242aa69
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
package com.project.convertedCode.globalNamespace.classes; import java.lang.invoke.MethodHandles; import com.runtimeconverter.runtime.passByReference.PassByReferenceArgs; import com.project.convertedCode.globalNamespace.classes.PHP_Token_Includes; import com.runtimeconverter.runtime.classes.NoConstructor; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.runtimeconverter.runtime.reflection.ReflectionClassData; import com.runtimeconverter.runtime.arrays.ZPair; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/phpunit/php-token-stream/src/Token.php */ public class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes { public PHP_Token_INCLUDE_ONCE(RuntimeEnv env, Object... args) { super(env); if (this.getClass() == PHP_Token_INCLUDE_ONCE.class) { this.__construct(env, args); } } public PHP_Token_INCLUDE_ONCE(NoConstructor n) { super(n); } public static final Object CONST_class = "PHP_Token_INCLUDE_ONCE"; // Runtime Converter Internals // RuntimeStaticCompanion contains static methods // RequestStaticProperties contains static (per-request) properties // ReflectionClassData contains php reflection data used by the runtime library public static class RuntimeStaticCompanion extends PHP_Token_Includes.RuntimeStaticCompanion { private static final MethodHandles.Lookup staticCompanionLookup = MethodHandles.lookup(); } public static final RuntimeStaticCompanion runtimeStaticObject = new RuntimeStaticCompanion(); private static final ReflectionClassData runtimeConverterReflectionData = ReflectionClassData.builder() .setName("PHP_Token_INCLUDE_ONCE") .setLookup( PHP_Token_INCLUDE_ONCE.class, MethodHandles.lookup(), RuntimeStaticCompanion.staticCompanionLookup) .setLocalProperties("id", "line", "name", "text", "tokenStream", "type") .setFilename("vendor/phpunit/php-token-stream/src/Token.php") .addExtendsClass("PHP_Token_Includes") .addExtendsClass("PHP_Token") .get(); @Override public ReflectionClassData getRuntimeConverterReflectionData() { return runtimeConverterReflectionData; } @Override public Object converterRuntimeCallExtended( RuntimeEnv env, String method, Class<?> caller, PassByReferenceArgs passByReferenceArgs, Object... args) { return RuntimeClassBase.converterRuntimeCallExtendedWithDataStatic( this, runtimeConverterReflectionData, env, method, caller, passByReferenceArgs, args); } }
[ "git@runtimeconverter.com" ]
git@runtimeconverter.com
9fca8516fa9f1f5d199e54bf7a114ca6e7c4747f
fa62eabe8a65747e33f49d00f94aa71fb2f19cab
/hopeofseed/src/main/java/com/hopeofseed/hopeofseed/curView/SquareImageView.java
980455ddef7294a6cba129b44aca323a08e22def
[]
no_license
yeai007/LGM_Project
b4de9574c6f775640cd45c6efeac5464f6f179a5
510ba1d19c6d07977b3471cabed1e2b590499c62
refs/heads/master
2021-01-13T07:31:57.496897
2017-01-17T04:52:30
2017-01-17T04:52:30
69,972,250
0
0
null
null
null
null
UTF-8
Java
false
false
1,154
java
package com.hopeofseed.hopeofseed.curView; import android.content.Context; import android.util.AttributeSet; import android.widget.ImageView; /** * 项目名称:LGM_Project * 类描述: * 创建人:whisper * 创建时间:2016/11/17 15:58 * 修改人:whisper * 修改时间:2016/11/17 15:58 * 修改备注: */ public class SquareImageView extends ImageView { public SquareImageView(Context context) { super(context); } public SquareImageView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SquareImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec)); int childWidthSize = getMeasuredWidth(); //高度和宽度一样 heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }
[ "guangming6269103@163.com" ]
guangming6269103@163.com
3272386cf539bc880e7d9e56df22952675b3e723
4a0c455fda9a877c3be148a3bef724c954dd7e7f
/src/main/java/com/upit/algo/shuffle/KnuthShuffle.java
d397d99a15031e610ba6da5e76ddaa32dca84e93
[]
no_license
ypitsishin/algorithms
e6524e70c87143a2adf713252c152fec774f1e98
5429ca57fdc58b5b825afe8d95b1bd6f7b01b5a9
refs/heads/master
2021-06-01T00:44:18.416792
2015-12-23T07:46:19
2015-12-23T07:46:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package com.upit.algo.shuffle; import java.util.Random; public class KnuthShuffle implements Shuffle { @Override public void shuffle(Comparable[] values) { int n = values.length; Random random = new Random(); for (int i = 1; i < n; i++) { int randomIndex = random.nextInt(i + 1); swap(values, i, randomIndex); } } private void swap(Comparable[] values, int i, int j) { Comparable temp = values[i]; values[i] = values[j]; values[j] = temp; } }
[ "upitau@gmail.com" ]
upitau@gmail.com
471d2656236480ccbc0c81ff81025384ceab3f92
446dcda88ad3e468bfbc27e7b079c9b50ff20624
/app/src/main/java/universconception/conception/cegepstefoy/restaurantconcept/Model/CustomerAdapter.java
7fa1abf324377542d10bcbd1a4b69e2917b3831a
[]
no_license
sediu88/MaVersionLesRestaurantsConceptWebApp
82da8972cc4842cb404f448c803fa222c12ac7db
61598bee4f4712d2c1a02a9e16267cf1d0478b38
refs/heads/master
2020-04-16T15:48:03.137456
2019-01-15T17:39:07
2019-01-15T17:39:07
165,714,864
0
0
null
null
null
null
UTF-8
Java
false
false
2,339
java
package universconception.conception.cegepstefoy.restaurantconcept.Model; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; import universconception.conception.cegepstefoy.restaurantconcept.R; public class CustomerAdapter extends BaseAdapter { Context context; List<Mets> rowItems; public CustomerAdapter(Context pContext, List<Mets> pRowItems) { context = pContext; rowItems = pRowItems; } @Override public int getCount() { return rowItems.size(); } @Override public Object getItem(int position) { return rowItems.get(position); } @Override public long getItemId(int position) { return rowItems.indexOf(getItem(position)); } private class ViewHolder { ImageView profile_pic; TextView member_name; TextView quantity; TextView contactType; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.liste_item, null); holder = new ViewHolder(); holder.member_name = convertView.findViewById(R.id.member_name); holder.profile_pic = convertView.findViewById(R.id.profile_pic); holder.quantity = convertView.findViewById(R.id.quantity); holder.contactType = convertView.findViewById(R.id.contact_type); Mets row_pos = rowItems.get(position); holder.profile_pic.setImageResource(row_pos.getProfile_pic_id()); holder.member_name.setText(row_pos.getNomMet()); holder.quantity.setText(Integer.toString(row_pos.getQuantity())); holder.contactType.setText(" " + row_pos.getPrice().toString() + " \n$CAD"); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } return convertView; } }
[ "yoyokdss@gmail.com" ]
yoyokdss@gmail.com
1ccb36f16f3bf49f32b0b130dd1c0c9f0fc25d98
ed3de519d3ef9f8ff0b3602488824b54f3f23fb2
/src/main/java/com/base/Constants.java
7f166d1436302125953a159a1a882a7fd5854862
[]
no_license
mankiran1310/ZeroPersonalBanking
1a7f900baa5174d3bbc4c73ee702134f431e8bd9
284931293bcbd8a48f6e2383dbe09001a71d26fd
refs/heads/master
2022-07-27T03:53:52.747127
2019-12-07T16:28:50
2019-12-07T16:28:50
226,429,808
0
0
null
2022-06-29T17:49:45
2019-12-06T23:50:23
HTML
UTF-8
Java
false
false
232
java
package com.base; public class Constants { //Configurations public static final String browser = "chrome"; public static final String testUrl= "http://zero.webappsecurity.com"; public static final long implicitwait = 20; }
[ "buneetchandhok@Buneets-MacBook-Pro.local" ]
buneetchandhok@Buneets-MacBook-Pro.local
e4a50cd0bb03b23b64aa1b6b1b94e05c1569215d
24424b5490ca6af33fa21d8475db6b0e1e042005
/app/controllers/admin/TerrainFeatures.java
f8e4217f29ede0c183fe7c15d203a9a4dd286fb1
[]
no_license
ristes/apple-game
dc188632845669ec58d28ed3be06d783256c0c64
5789d61deedf4a74c910c38b97fba5c8419f404b
refs/heads/master
2021-01-17T10:33:22.470919
2016-06-23T14:49:49
2016-06-23T14:49:49
15,433,419
0
0
null
2015-01-01T14:10:31
2013-12-25T10:13:10
JavaScript
UTF-8
Java
false
false
101
java
package controllers.admin; import controllers.CRUD; public class TerrainFeatures extends CRUD { }
[ "kokimisev@gmail.com" ]
kokimisev@gmail.com
25970730a2d7b29623529a1b345fe9b609bd8516
0c058eb915718384c55136b7f9181fa9beb087f6
/Lab03/ex02b/AndGate2.java
63f8beaeb0b376151f0744a57a3242b029d4b67b
[ "MIT" ]
permissive
DavidAkaFunky/OOP2020
8d7db3d8533c3a4262b637ae069fdb02959c06d0
5fdb0c75766a955a233a2ab9b6c23aae89fc0396
refs/heads/master
2023-03-02T20:27:39.430633
2021-01-15T16:03:51
2021-01-15T16:03:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
public class AndGate2{ private boolean _gate1 = false; private boolean _gate2 = false; public AndGate2(){} public AndGate2(boolean bool){this._gate1 = this._gate2 = bool;} public AndGate2(boolean bool1, boolean bool2){ this._gate1 = bool1; this._gate2 = bool2; } public void setGate1(boolean bool){this._gate1 = bool;} public void setGate2(boolean bool){this._gate2 = bool;} public void setGates(boolean bool1, boolean bool2){ this._gate1 = bool1; this._gate2 = bool2; } public boolean getGate1(){return this._gate1;} public boolean getGate2(){return this._gate2;} public boolean getOutput(){return this._gate1 && this._gate2;} @Override public boolean equals(Object other){ if (other instanceof AndGate2){ AndGate2 gate = (AndGate2) other; return this.getGate1() == gate.getGate1() && this.getGate2() == gate.getGate2(); } return false; } @Override public String toString(){ return "A: " + this._gate1 + " B: " + this._gate2; } }
[ "futebol4@hotmail.com" ]
futebol4@hotmail.com
3cfb03152b028e8e6b2e51317e5a54b2b930b22d
afb351c778f405586c11f859117d406b273ad222
/task3/BigChat.java
5172c5c74c297be27a9229515b1c03ffd967c379
[]
no_license
CHRNV/java_oh
cba3427ada73e5e8795ce9d33e57e6afc0ccf34b
a9485e24e4f3d432a5dcac3af045f60aa2505969
refs/heads/master
2016-09-13T04:57:45.069289
2016-05-12T22:31:21
2016-05-12T22:31:21
58,672,711
0
0
null
null
null
null
UTF-8
Java
false
false
3,367
java
import java.io.*; import java.net.ServerSocket; import java.net.Socket; public class BigChat { public static void main(String[] args) { try { Socket up1 = null; Socket down1 = null; if (!args[0].equals("0")) { ServerSocket ss = new ServerSocket(Integer.parseInt(args[0])); up1 = ss.accept(); } if (!args[1].equals("0")) { down1 = new Socket("localhost", Integer.parseInt(args[1])); } final Socket up = up1; final Socket down = down1; if (up != null) { Thread listenUp = new Thread() { public void run() { try { while (true) { BufferedReader br = new BufferedReader(new InputStreamReader(up.getInputStream())); String strUp = br.readLine(); System.out.println(strUp); if (down != null) sendMessage(down, strUp); } } catch (Exception e) { System.out.println("Oh,exception!!! - 1 " + e); } } }; listenUp.start(); } if (down != null) { Thread listenDown = new Thread() { public void run() { try { while (true) { BufferedReader br = new BufferedReader(new InputStreamReader(down.getInputStream())); String strDown = br.readLine(); System.out.println(strDown); if (up != null) sendMessage(up, strDown); } } catch (Exception e) { System.out.println("Oh,exception!!! - 2" + e); } } }; listenDown.start(); } Thread send = new Thread() { public void run() { try { while (true) { BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in)); String str = br2.readLine(); if (up != null) sendMessage(up, str); if (down != null) sendMessage(down, str); } } catch (Exception e) { System.out.println("Oh,exception!!! - 3" + e); } } }; send.start(); } catch (Exception e) { System.out.println("Oh,exception!!! - 4" + e); } } public static synchronized void sendMessage(Socket socket, String message)throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); bw.write(message, 0, message.length()); bw.newLine(); bw.flush(); } }
[ "zhukova.galina@bk.ru" ]
zhukova.galina@bk.ru
0bdd79546224a452b101be1f1723bcd121058e57
8c085f12963e120be684f8a049175f07d0b8c4e5
/castor/tags/DEV0_8/castor-2002/castor/src/main/org/exolab/javasource/JClass.java
bf2ba1e635c9d366e93717011b9dd043f3ae5f2a
[]
no_license
alam93mahboob/castor
9963d4110126b8f4ef81d82adfe62bab8c5f5bce
974f853be5680427a195a6b8ae3ce63a65a309b6
refs/heads/master
2020-05-17T08:03:26.321249
2014-01-01T20:48:45
2014-01-01T20:48:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,809
java
/** * Redistribution and use of this software and associated documentation * ("Software"), with or without modification, are permitted provided * that the following conditions are met: * * 1. Redistributions of source code must retain copyright * statements and notices. Redistributions must also contain a * copy of this document. * * 2. Redistributions in binary form must reproduce the * above copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. The name "Exolab" must not be used to endorse or promote * products derived from this Software without prior written * permission of Exoffice Technologies. For written permission, * please contact info@exolab.org. * * 4. Products derived from this Software may not be called "Exolab" * nor may "Exolab" appear in their names without prior written * permission of Exoffice Technologies. Exolab is a registered * trademark of Exoffice Technologies. * * 5. Due credit should be given to the Exolab Project * (http://www.exolab.org/). * * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved. * * $Id$ */ package org.exolab.javasource; import java.io.File; import java.io.FileWriter; import java.io.Writer; import java.io.PrintWriter; import java.util.Vector; /** * A representation of the Java Source code for a Java Class. This is * a useful utility when creating in memory source code * @author <a href="mailto:kvisco@exoffice.com">Keith Visco</a> * @version $Revision$ $Date$ **/ public class JClass extends JType { /** * The Id for Source control systems * I needed to separate this line to prevent CVS from * expanding it here! ;-) **/ private static final String DEFAULT_HEADER = "$"+"Id"; /** * The version for JavaDoc * I needed to separate this line to prevent CVS from * expanding it here! ;-) **/ private static final String version = "$"+"Revision$ $"+"Date$"; private JComment header = null; /** * List of imported classes and packages **/ private Vector imports = null; private String superClass = null; /** * The list of member variables of this JClass **/ private JNamedMap members = null; /** * The list of constructors for this JClass **/ private Vector constructors = null; /** * The set of interfaces implemented by this JClass **/ private Vector interfaces = null; private JDocComment jdc = null; /** * The list of methods of this JClass **/ private Vector methods = null; /** * The JModifiers for this JClass, which allows us to * change the resulting qualifiers **/ private JModifiers modifiers = null; /** * The package to which this JClass belongs **/ private String packageName = null; /** * Creates a new Class with the given name * @param name the name of the Class to create * @exception IllegalArgumentException when the given name * is not a valid Class name **/ public JClass(String name) throws IllegalArgumentException { super(name); this.packageName = getPackageFromClassName(name); imports = new Vector(); interfaces = new Vector(); jdc = new JDocComment(); constructors = new Vector(); members = new JNamedMap(); methods = new Vector(); modifiers = new JModifiers(); //-- initialize default Java doc jdc.addDescriptor(JDocDescriptor.createVersionDesc(version)); } //-- JClass public void addImport(String className) { if (className == null) return; if (className.length() == 0) return; //-- getPackageName String pkgName = getPackageFromClassName(className); if (pkgName != null) { if (pkgName.equals(this.packageName)) return; if (pkgName.equals("java.lang")) return; //-- for readabilty keep import list sorted, and make sure //-- we do not include more than one of the same import for (int i = 0; i < imports.size(); i++) { String imp = (String)imports.elementAt(i); if (imp.equals(className)) return; if (imp.compareTo(className) > 0) { imports.insertElementAt(className, i); return; } } imports.addElement(className); } } //-- addImport public void addInterface(String interfaceName) { if (!interfaces.contains(interfaceName)) interfaces.addElement(interfaceName); } //-- addInterface /** * Adds the given Constructor to this classes list of constructors. * The constructor must have been created with this JClass' * createConstructor. * @exception IllegalArgumentException **/ public void addConstructor(JConstructor constructor) throws IllegalArgumentException { if (constructor == null) throw new IllegalArgumentException("Constructors cannot be null"); if (constructor.getDeclaringClass() == this) { /** check signatures (add later) **/ constructors.addElement(constructor); } else { String err = "The given JConstructor was not created "; err += "by this JClass"; throw new IllegalArgumentException(err); } } public void addMember(JMember jMember) throws IllegalArgumentException { if (jMember == null) { throw new IllegalArgumentException("Class members cannot be null"); } if (members.get(jMember.getName()) != null) { String err = "duplicate name found: " + jMember.getName(); throw new IllegalArgumentException(err); } members.put(jMember.getName(), jMember); // if member is of a type not imported by this class // then add import JType type = jMember.getType(); while (type.isArray()) type = type.getComponentType(); if (!type.isPrimitive()) { addImport( ((JClass)type).getName()); } } //-- addMember public void addMethod(JMethod jMethod) throws IllegalArgumentException { if (jMethod == null) { throw new IllegalArgumentException("Class methods cannot be null"); } //-- check method name and signatures *add later* //-- keep method list sorted for esthetics when printing //-- START SORT :-) boolean added = false; short modifierVal = 0; JModifiers modifiers = jMethod.getModifiers(); for (int i = 0; i < methods.size(); i++) { JMethod tmp = (JMethod) methods.elementAt(i); //-- first compare modifiers if (tmp.getModifiers().isPrivate()) { if (!modifiers.isPrivate()) { methods.insertElementAt(jMethod, i); added = true; break; } } //-- compare names if (jMethod.getName().compareTo(tmp.getName()) < 0) { methods.insertElementAt(jMethod, i); added = true; break; } } //-- END SORT if (!added) methods.addElement(jMethod); //-- check parameter packages to make sure we have them //-- in our import list String[] pkgNames = jMethod.getParameterClassNames(); for (int i = 0; i < pkgNames.length; i++) { addImport(pkgNames[i]); } //-- check return type to make sure it's included in the //-- import list JType jType = jMethod.getReturnType(); if (jType != null) { while (jType.isArray()) jType = jType.getComponentType(); if (!jType.isPrimitive()) addImport( ((JClass)jType).getName()); } //-- check exceptions JClass[] exceptions = jMethod.getExceptions(); for (int i = 0; i < exceptions.length; i++) { addImport(exceptions[i].getName()); } } //-- addMethod public void addMethods(JMethod[] jMethods) throws IllegalArgumentException { for (int i = 0; i < jMethods.length; i++) addMethod(jMethods[i]); } //-- addMethods public JConstructor createConstructor() { return new JConstructor(this); } //-- createConstructor public JConstructor getConstructor(int index) { return (JConstructor)constructors.elementAt(index); } //-- getConstructor public JConstructor[] getConstructors() { int size = constructors.size(); JConstructor[] jcArray = new JConstructor[size]; for (int i = 0; i < constructors.size(); i++) { jcArray[i] = (JConstructor)constructors.elementAt(i); } return jcArray; } //-- getConstructors /** * Returns the Java Doc comment for this JClass * @return the JDocComment for this JClass **/ public JDocComment getJDocComment() { return jdc; } //-- getJDocComment /** * Returns the member with the given name, or null if no member * was found with the given name * @param name the name of the member to return * @return the member with the given name, or null if no member * was found with the given name **/ public JMember getMember(String name) { return (JMember)members.get(name); } //-- getMember public JMember[] getMembers() { int size = members.size(); JMember[] marray = new JMember[size]; for (int i = 0; i < size; i++) { marray[i] = (JMember)members.get(i); } return marray; } //-- getMembers public JMethod[] getMethods() { int size = methods.size(); JMethod[] marray = new JMethod[size]; for (int i = 0; i < methods.size(); i++) { marray[i] = (JMethod)methods.elementAt(i); } return marray; } //-- getMethods public JMethod getMethod(String name, int startIndex) { for (int i = startIndex; i < methods.size(); i++) { JMethod jMethod = (JMethod)methods.elementAt(i); if (jMethod.getName().equals(name)) return jMethod; } return null; } public JMethod getMethod(int index) { return (JMethod)methods.elementAt(index); } /** * Returns the JModifiers which allows the qualifiers to be changed * @return the JModifiers for this JClass **/ public JModifiers getModifiers() { return modifiers; } //-- getModifiers /** * Returns the name of the package that this JClass is a member of * @return the name of the package that this JClass is a member of, * or null if there is no current package name defined **/ public String getPackageName() { return this.packageName; } //-- getPackageName public static boolean isValidClassName(String name) { //** add class name validation */ return true; } //-- isValidClassName public void print() { print(null); } //-- printSrouce /** * Prints the source code for this JClass * @param lineSeparator the line separator to use at the end of each line. * If null, then the default line separator for the runtime platform will * be used. **/ public void print(String lineSeparator) { //-- open output file String name = getLocalName(); String filename = name + ".java"; if ((packageName != null) && (packageName.length() > 0)) { String path = packageName.replace('.',File.separatorChar); File pathFile = new File(path); if (!pathFile.exists()) { pathFile.mkdirs(); } filename = path+File.separator+filename; } File file = new File(filename); JSourceWriter jsw = null; try { jsw = new JSourceWriter(new FileWriter(file)); } catch(java.io.IOException ioe) { System.out.println("unable to create class file: " + filename); return; } if (lineSeparator == null) { lineSeparator = System.getProperty("line.separator"); } jsw.setLineSeparator(lineSeparator); StringBuffer buffer = new StringBuffer(); //-- write class header if (header != null) header.print(jsw); else { jsw.writeln("/*"); jsw.writeln(" * " + DEFAULT_HEADER); jsw.writeln("*/"); } jsw.writeln(); jsw.flush(); //-- print package name if ((packageName != null) && (packageName.length() > 0)) { buffer.setLength(0); buffer.append("package "); buffer.append(packageName); buffer.append(';'); jsw.writeln(buffer.toString()); jsw.writeln(); } //-- print imports jsw.writeln(" //---------------------------------/"); jsw.writeln(" //- Imported classes and packages -/"); jsw.writeln("//---------------------------------/"); jsw.writeln(); for (int i = 0; i < imports.size(); i++) { jsw.write("import "); jsw.write(imports.elementAt(i)); jsw.writeln(';'); } jsw.writeln(); //------------/ //- Java Doc -/ //------------/ jdc.print(jsw); //-- print class information //-- we need to add some JavaDoc API adding comments buffer.setLength(0); if (modifiers.isPrivate()) { buffer.append("private "); } else if (modifiers.isPublic()) { buffer.append("public "); } if (modifiers.isAbstract()) { buffer.append("abstract "); } buffer.append("class "); buffer.append(getLocalName()); buffer.append(' '); if (superClass != null) { buffer.append("extends "); buffer.append(superClass); buffer.append(' '); } if (interfaces.size() > 0) { int iSize = interfaces.size(); boolean endl = false; if ((iSize > 1) || (superClass != null)) { jsw.writeln(buffer.toString()); buffer.setLength(0); endl = true; } buffer.append("implements "); for (int i = 0; i < iSize; i++) { if (i > 0) buffer.append(", "); buffer.append(interfaces.elementAt(i)); } if (endl) { jsw.writeln(buffer.toString()); buffer.setLength(0); } else buffer.append(' '); } buffer.append('{'); jsw.writeln(buffer.toString()); buffer.setLength(0); jsw.writeln(); jsw.indent(); //-- declare members if (members.size() > 0) { jsw.writeln(); jsw.writeln(" //--------------------/"); jsw.writeln(" //- Member Variables -/"); jsw.writeln("//--------------------/"); jsw.writeln(); } for (int i = 0; i < members.size(); i++) { JMember jMember = (JMember)members.get(i); //-- print Java comment JDocComment comment = jMember.getComment(); if (comment != null) comment.print(jsw); // -- print member jsw.write(jMember.getModifiers().toString()); jsw.write(' '); JType type = jMember.getType(); String typeName = type.toString(); //-- for esthetics use short name in some cases if (typeName.equals(toString())) { typeName = type.getLocalName(); } jsw.write(typeName); jsw.write(' '); jsw.write(jMember.getName()); String init = jMember.getInitString(); if (init != null) { jsw.write(" = "); jsw.write(init); } jsw.writeln(';'); jsw.writeln(); } //-- print constructors if (constructors.size() > 0) { jsw.writeln(); jsw.writeln(" //----------------/"); jsw.writeln(" //- Constructors -/"); jsw.writeln("//----------------/"); jsw.writeln(); } for (int i = 0; i < constructors.size(); i++) { JConstructor jConstructor = (JConstructor)constructors.elementAt(i); jConstructor.print(jsw); jsw.writeln(); } //-- print methods if (methods.size() > 0) { jsw.writeln(); jsw.writeln(" //-----------/"); jsw.writeln(" //- Methods -/"); jsw.writeln("//-----------/"); jsw.writeln(); } for (int i = 0; i < methods.size(); i++) { JMethod jMethod = (JMethod)methods.elementAt(i); jMethod.print(jsw); jsw.writeln(); } jsw.unindent(); jsw.writeln('}'); jsw.flush(); jsw.close(); } //-- printSource /** * Sets the header comment for this JClass * @param comment the comment to display at the top of the source file * when printed **/ public void setHeader(JComment comment) { this.header = comment; } //-- setHeader /** * Allows changing the package name of this JClass * @param packageName the package name to use **/ public void setPackageName(String packageName) { this.packageName = packageName; changePackage(packageName); } //-- setPackageName /** * Sets the super Class that this class extends * @param superClass the super Class that this Class extends **/ public void setSuperClass(String superClass) { this.superClass = superClass; } //-- setSuperClass //-------------------/ //- Private Methods -/ //-------------------/ /** * **/ private void printlnWithPrefix(String prefix, String source, JSourceWriter jsw) { jsw.write(prefix); if (source == null) return; char[] chars = source.toCharArray(); int lastIdx = 0; for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (ch == '\n') { //-- free buffer jsw.write(chars,lastIdx,(i-lastIdx)+1); lastIdx = i+1; if (i < chars.length) { jsw.write(prefix); } } } //-- free buffer if (lastIdx < chars.length) { jsw.write(chars, lastIdx, chars.length-lastIdx); } jsw.writeln(); } //-- printWithPrefix private static String getPackageFromClassName(String className) { int idx = -1; if ((idx = className.lastIndexOf('.')) > 0) { return className.substring(0, idx); } return null; } //-- getPackageFromClassName /** * Test drive method...to be removed or commented out ** public static void main(String[] args) { JClass testClass = new JClass("Test"); testClass.addImport("java.util.Vector"); testClass.addMember(new JMember(JType.Int, "x")); JClass jcString = new JClass("String"); JMember jMember = new JMember(jcString, "myString"); jMember.getModifiers().makePrivate(); testClass.addMember(jMember); //-- create constructor JConstructor cons = testClass.createConstructor(); testClass.addConstructor(cons); cons.getSourceCode().add("this.x = 6;"); JMethod jMethod = new JMethod(JType.Int, "getX"); jMethod.setSourceCode("return this.x;"); testClass.addMethod(jMethod); testClass.print(); } //-- main /* */ } //-- JClass
[ "nobody@b24b0d9a-6811-0410-802a-946fa971d308" ]
nobody@b24b0d9a-6811-0410-802a-946fa971d308
810f8839a7866ff3811fcbf8c9e6283066659d0d
3c808334c4d56d69b75f1846d3cfe3d646b57f6c
/app/src/main/java/br/com/valterdiascalhas/orcamentos/Orcamento.java
a8b65007f0d07cf5e5eef84bd0a14268ad85ae58
[]
no_license
george-rodes/calhas-vila-nova
9b91d102bc0742a31cac59b3eb36681e89c97ce0
51dd07c162de17f04a053c83f8d596545ee6c073
refs/heads/master
2020-07-23T17:58:01.960588
2016-11-29T11:19:09
2016-11-29T11:19:09
73,802,966
0
1
null
2016-11-15T22:51:29
2016-11-15T10:29:20
Java
UTF-8
Java
false
false
2,375
java
package br.com.valterdiascalhas.orcamentos; /** * Created by George on 25/08/2016. */ public class Orcamento { private int orcamento, ano, mes, dia; /** int para long **/ private long total; private String nome, data, rua, bairro, cidade, observacao; //private float total; //Empty Constructor for Test public Orcamento(){ } public Orcamento(int orcamento, String nome, String data, int ano, int mes, int dia, String rua, String bairro, String cidade, long total, String observacao) { this.orcamento = orcamento; this.nome = nome; this.data = data; this.ano = ano; this.mes = mes; this.dia = dia; this.rua = rua; this.bairro = bairro; this.cidade = cidade; this.total = total; //centavos this.observacao = observacao; } public int getOrcamento() { return orcamento; } public void setOrcamento(int orcamento) { this.orcamento = orcamento; } public int getAno() { return ano; } public void setAno(int ano) { this.ano = ano; } public int getMes() { return mes; } public void setMes(int mes) { this.mes = mes; } public int getDia() { return dia; } public void setDia(int dia) { this.dia = dia; } public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getData() { return data; } public void setData(String data) { this.data = data; } public String getRua() { return rua; } public void setRua(String rua) { this.rua = rua; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public String getObservacao() { return observacao; } public void setObservacao(String observacao) { this.observacao = observacao; } }
[ "George Anagnostou" ]
George Anagnostou
dd0ab8e874a315383a815215c82edb8ce930dbf5
774d36285e48bd429017b6901a59b8e3a51d6add
/sources/com/google/android/gms/common/api/internal/zabe.java
df80977385790c4496a1e51b3aec47af9638ffc4
[]
no_license
jorge-luque/hb
83c086851a409e7e476298ffdf6ba0c8d06911db
b467a9af24164f7561057e5bcd19cdbc8647d2e5
refs/heads/master
2023-08-25T09:32:18.793176
2020-10-02T11:02:01
2020-10-02T11:02:01
300,586,541
0
0
null
null
null
null
UTF-8
Java
false
false
8,473
java
package com.google.android.gms.common.api.internal; import android.app.PendingIntent; import android.content.Context; import android.os.Bundle; import android.os.Looper; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.internal.BaseImplementation; import com.google.android.gms.common.internal.ClientSettings; import com.google.android.gms.signin.SignInOptions; import com.google.android.gms.signin.zad; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import javax.annotation.concurrent.GuardedBy; public final class zabe implements zabs, zar { private final Context mContext; private final Api.AbstractClientBuilder<? extends zad, SignInOptions> zace; final zaaw zaee; /* access modifiers changed from: private */ public final Lock zaeo; private final ClientSettings zaet; private final Map<Api<?>, Boolean> zaew; private final GoogleApiAvailabilityLight zaey; final Map<Api.AnyClientKey<?>, Api.Client> zagz; private final Condition zahn; private final zabg zaho; final Map<Api.AnyClientKey<?>, ConnectionResult> zahp = new HashMap(); /* access modifiers changed from: private */ public volatile zabd zahq; private ConnectionResult zahr = null; int zahs; final zabt zaht; public zabe(Context context, zaaw zaaw, Lock lock, Looper looper, GoogleApiAvailabilityLight googleApiAvailabilityLight, Map<Api.AnyClientKey<?>, Api.Client> map, ClientSettings clientSettings, Map<Api<?>, Boolean> map2, Api.AbstractClientBuilder<? extends zad, SignInOptions> abstractClientBuilder, ArrayList<zaq> arrayList, zabt zabt) { this.mContext = context; this.zaeo = lock; this.zaey = googleApiAvailabilityLight; this.zagz = map; this.zaet = clientSettings; this.zaew = map2; this.zace = abstractClientBuilder; this.zaee = zaaw; this.zaht = zabt; int size = arrayList.size(); int i = 0; while (i < size) { zaq zaq = arrayList.get(i); i++; zaq.zaa(this); } this.zaho = new zabg(this, looper); this.zahn = lock.newCondition(); this.zahq = new zaav(this); } @GuardedBy("mLock") public final ConnectionResult blockingConnect() { connect(); while (isConnecting()) { try { this.zahn.await(); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); return new ConnectionResult(15, (PendingIntent) null); } } if (isConnected()) { return ConnectionResult.RESULT_SUCCESS; } ConnectionResult connectionResult = this.zahr; if (connectionResult != null) { return connectionResult; } return new ConnectionResult(13, (PendingIntent) null); } @GuardedBy("mLock") public final void connect() { this.zahq.connect(); } @GuardedBy("mLock") public final void disconnect() { if (this.zahq.disconnect()) { this.zahp.clear(); } } public final void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { String concat = String.valueOf(str).concat(" "); printWriter.append(str).append("mState=").println(this.zahq); for (Api next : this.zaew.keySet()) { printWriter.append(str).append(next.getName()).println(":"); this.zagz.get(next.getClientKey()).dump(concat, fileDescriptor, printWriter, strArr); } } @GuardedBy("mLock") public final <A extends Api.AnyClient, R extends Result, T extends BaseImplementation.ApiMethodImpl<R, A>> T enqueue(T t) { t.zau(); return this.zahq.enqueue(t); } @GuardedBy("mLock") public final <A extends Api.AnyClient, T extends BaseImplementation.ApiMethodImpl<? extends Result, A>> T execute(T t) { t.zau(); return this.zahq.execute(t); } @GuardedBy("mLock") public final ConnectionResult getConnectionResult(Api<?> api) { Api.AnyClientKey<?> clientKey = api.getClientKey(); if (!this.zagz.containsKey(clientKey)) { return null; } if (this.zagz.get(clientKey).isConnected()) { return ConnectionResult.RESULT_SUCCESS; } if (this.zahp.containsKey(clientKey)) { return this.zahp.get(clientKey); } return null; } public final boolean isConnected() { return this.zahq instanceof zaah; } public final boolean isConnecting() { return this.zahq instanceof zaak; } public final boolean maybeSignIn(SignInConnectionListener signInConnectionListener) { return false; } public final void maybeSignOut() { } public final void onConnected(Bundle bundle) { this.zaeo.lock(); try { this.zahq.onConnected(bundle); } finally { this.zaeo.unlock(); } } public final void onConnectionSuspended(int i) { this.zaeo.lock(); try { this.zahq.onConnectionSuspended(i); } finally { this.zaeo.unlock(); } } public final void zaa(ConnectionResult connectionResult, Api<?> api, boolean z) { this.zaeo.lock(); try { this.zahq.zaa(connectionResult, api, z); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zaaz() { this.zaeo.lock(); try { this.zahq = new zaak(this, this.zaet, this.zaew, this.zaey, this.zace, this.zaeo, this.mContext); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zab(RuntimeException runtimeException) { this.zaho.sendMessage(this.zaho.obtainMessage(2, runtimeException)); } /* access modifiers changed from: package-private */ public final void zaba() { this.zaeo.lock(); try { this.zaee.zaaw(); this.zahq = new zaah(this); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zaf(ConnectionResult connectionResult) { this.zaeo.lock(); try { this.zahr = connectionResult; this.zahq = new zaav(this); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } @GuardedBy("mLock") public final void zaw() { if (isConnected()) { ((zaah) this.zahq).zaam(); } } /* access modifiers changed from: package-private */ public final void zaa(zabf zabf) { this.zaho.sendMessage(this.zaho.obtainMessage(1, zabf)); } @GuardedBy("mLock") public final ConnectionResult blockingConnect(long j, TimeUnit timeUnit) { connect(); long nanos = timeUnit.toNanos(j); while (isConnecting()) { if (nanos <= 0) { try { disconnect(); return new ConnectionResult(14, (PendingIntent) null); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); return new ConnectionResult(15, (PendingIntent) null); } } else { nanos = this.zahn.awaitNanos(nanos); } } if (isConnected()) { return ConnectionResult.RESULT_SUCCESS; } ConnectionResult connectionResult = this.zahr; if (connectionResult != null) { return connectionResult; } return new ConnectionResult(13, (PendingIntent) null); } }
[ "jorge.luque@taiger.com" ]
jorge.luque@taiger.com
1107f9cbb7317d17ecafd129d49db28897ff858a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_70ef7805163b1dd39ff5da1ff50babfd42e898b8/TabataActivity/27_70ef7805163b1dd39ff5da1ff50babfd42e898b8_TabataActivity_s.java
5d27d497a2cb41f13ea162a638b3d04eda9920a6
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,271
java
package com.vorsk.crossfitr; import com.vorsk.crossfitr.models.WorkoutModel; import com.vorsk.crossfitr.models.WorkoutRow; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.media.MediaPlayer; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.os.Message; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.Button; import android.widget.TextView; public class TabataActivity extends Activity { private static final int TOTAL_TIME = 30000 * 8; // View elements in stopwatch.xml private TextView mWorkoutDescription, mStateLabel, mWorkoutName; private Button mStartStop, mReset, mFinish; private Time tabata = new Time(); private boolean newStart, cdRun, goStop; private long id; private MediaPlayer mp; // Timer to update the elapsedTime display private final long mFrequency = 100; // milliseconds private final int TICK_WHAT = 2; private Handler mHandler = new Handler() { public void handleMessage(Message m) { updateElapsedTime(); sendMessageDelayed(Message.obtain(this, TICK_WHAT), mFrequency); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabata_tab); cdRun = false; //open model to put data into database //get the id passed from previous activity (workout lists) id = getIntent().getLongExtra("ID", -1); //if ID is invalid, go back to home screen if(id < 0) { getParent().setResult(RESULT_CANCELED); finish(); } newStart = true; //create model object WorkoutModel model = new WorkoutModel(this); model.open(); WorkoutRow workout = model.getByID(id); model.close(); Typeface roboto = Typeface.createFromAsset(getAssets(),"fonts/Roboto-Light.ttf"); mStateLabel = (TextView)findViewById(R.id.state_label); mStateLabel.setTypeface(roboto); mStateLabel.setText(""); mWorkoutDescription = (TextView)findViewById(R.id.workout_des_time); mWorkoutDescription.setMovementMethod(new ScrollingMovementMethod()); mWorkoutDescription.setTypeface(roboto); mWorkoutDescription.setText(workout.description); mWorkoutName = (TextView)findViewById(R.id.workout_name_time); mWorkoutName.setText(workout.name); mWorkoutName.setTypeface(roboto); mStartStop = (Button)findViewById(R.id.start_stop_button); mStartStop.setTypeface(roboto); mReset = (Button)findViewById(R.id.reset_button); mReset.setTypeface(roboto); mReset.setEnabled(false); mFinish = (Button)findViewById(R.id.finish_workout_button); mFinish.setTypeface(roboto); mFinish.setEnabled(false); mHandler.sendMessageDelayed(Message.obtain(mHandler, TICK_WHAT), mFrequency); } @Override protected void onDestroy() { super.onDestroy(); } public void onStartStopClicked(View V) { if(!tabata.isRunning()){ newStart = false; ((TimeTabWidget) getParent()).getTabHost().getTabWidget().getChildTabViewAt(0).setEnabled(false); ((TimeTabWidget) getParent()).getTabHost().getTabWidget().getChildTabViewAt(1).setEnabled(false); playSound(R.raw.countdown_3_0); new CountDownTimer(3000, 100) { public void onTick(long millisUntilFinished) { mStartStop.setText("" + (millisUntilFinished / 1000 + 1)); mStartStop.setEnabled(false); mStateLabel.setText("Press To Stop"); mStateLabel.setTextColor(-65536); mReset.setEnabled(false); mFinish.setEnabled(false); cdRun = true; } public void onFinish() { goStop = true; playSound(R.raw.bell_ring); //mStartStop.setText("Go!"); tabata.start(); cdRun = false; mStartStop.setEnabled(true); } }.start(); } else{ tabata.stop(); newStart = false; ((TimeTabWidget) getParent()).getTabHost().getTabWidget().getChildTabViewAt(0).setEnabled(true); ((TimeTabWidget) getParent()).getTabHost().getTabWidget().getChildTabViewAt(1).setEnabled(true); mStateLabel.setText("Press To Start"); mStateLabel.setTextColor(-16711936); mReset.setEnabled(true); mFinish.setEnabled(true); } } public void onResetClicked(View v) { newStart = true; tabata.reset(); mReset.setEnabled(false); mFinish.setEnabled(false); } public void onFinishClicked(View v) { Intent result = new Intent(); result.putExtra("time", getFormattedElapsedTime()); getParent().setResult(RESULT_OK, result); finish(); } /** * method to do when 8 sets are done */ private void endTabata() { newStart = true; //playSound(R.raw.boxing_bellx3); tabata.reset(); } public void updateElapsedTime() { if(!cdRun) mStartStop.setText(getFormattedElapsedTime()); } private String formatElapsedTime(long now, int set) { long seconds = 0, tenths = 0; StringBuilder sb = new StringBuilder(); if(newStart){ now = 20000; } if (now < 1000) { tenths = now / 100; } else if (now < 60000) { seconds = now / 1000; now -= seconds * 1000; tenths = now / 100; } sb.append("SET : ").append(set).append("\n").append(formatDigits(seconds)).append(".").append(tenths); return sb.toString(); } private String formatDigits(long num) { return (num < 10) ? "0" + num : new Long(num).toString(); } public String getFormattedElapsedTime() { long time = tabata.getElapsedTime(); int set = 1 + ((int)time / 30000); long diff = TOTAL_TIME - time; long remain = diff % 30000; int green = Color.GREEN; int red = Color.RED; //reset at end of set 8 workout. no last 10 sec break if(diff <= 10000){ set = 1; this.endTabata(); } // if logic to display sets and time for tabata if(remain > 10000 ){ if(!goStop){ playSound(R.raw.bell_ring); goStop = true; } this.setActivityBackgroundColor(green); return formatElapsedTime(20000 - (time % 30000), set); }else if(remain == 10000){ return formatElapsedTime(0, set); }else{ if(goStop){ playSound(R.raw.air_horn); goStop = false; } this.setActivityBackgroundColor(red); return formatElapsedTime(30000 - (time % 30000), set); } } /** * method to change background color * @param color */ public void setActivityBackgroundColor(int color){ View view = this.getWindow().getDecorView(); view.setBackgroundColor(color); } /** * method to play sound file * @param r */ private void playSound(int r) { //Release any resources from previous MediaPlayer if (mp != null) { mp.release(); } // Create a new MediaPlayer to play this sound mp = MediaPlayer.create(this, r); mp.start(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
dfab2465ad498adc0494ae37130e3ebe34be9caf
82ba1c0f9d4275a3c4dd9c222aa65356f4965446
/app/src/test/java/com/keatssalazar/groupchat/ExampleUnitTest.java
ff36179404937f29920203584134761264274bf5
[]
no_license
sineboi/GroupChat
4bc4ee29782028eb8c01313d140d5a6f864ba5e4
23d6371113f1eeae2d9cf9646d17a437ce8a4111
refs/heads/master
2021-01-01T07:41:18.486539
2020-02-08T18:03:45
2020-02-08T18:03:45
239,176,662
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.keatssalazar.groupchat; import org.junit.jupiter.api.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); } }
[ "43813888+salazar64@users.noreply.github.com" ]
43813888+salazar64@users.noreply.github.com
311cbcb39df73033ccf5c532773ba0848c99428b
d5f09c7b0e954cd20dd613af600afd91b039c48a
/sources/com/github/salomonbrys/kotson/GsonKt$fromJson$$inlined$typeToken$2.java
eba0072026251e9d62d0adaf0c4dc17286acddcb
[]
no_license
t0HiiBwn/CoolapkRelease
af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3
a6a2b03e32cde0e5163016e0078391271a8d33ab
refs/heads/main
2022-07-29T23:28:35.867734
2021-03-26T11:41:18
2021-03-26T11:41:18
345,290,891
5
2
null
null
null
null
UTF-8
Java
false
false
635
java
package com.github.salomonbrys.kotson; import com.google.gson.reflect.TypeToken; import kotlin.Metadata; @Metadata(bv = {1, 0, 0}, d1 = {"\u0000\r\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00028\u00000\u0001B\u0005¢\u0006\u0002\u0010\u0002¨\u0006\u0003"}, d2 = {"com/github/salomonbrys/kotson/GsonBuilderKt$gsonTypeToken$1", "Lcom/google/gson/reflect/TypeToken;", "()V", "kotson_main"}, k = 1, mv = {1, 1, 1}) /* compiled from: GsonBuilder.kt */ public final class GsonKt$fromJson$$inlined$typeToken$2 extends TypeToken<T> { GsonKt$fromJson$$inlined$typeToken$2() { } }
[ "test@gmail.com" ]
test@gmail.com
a0c7290be47a43b73f36f5b2e831e16bdfcbd8aa
ea7fc73837faaa38c489b9d109fa921d5c972a5c
/src/main/java/com/ibs/proyecto/model/Inventario.java
a9496075bad6195b4722a84977dd085c97f7c493
[]
no_license
eliassalazar/Ejamplo_IBS
def51aad34c7bc6df2b47a57c7fba0713f4f0311
99fd9cf9c09f2d9e1335ca4c2a7e6a0da359b0fd
refs/heads/master
2020-08-11T08:44:48.567104
2019-10-11T21:27:54
2019-10-11T21:27:54
214,530,798
0
0
null
null
null
null
UTF-8
Java
false
false
2,410
java
package com.ibs.proyecto.model; import java.io.Serializable; import java.sql.Timestamp; import javax.persistence.*; import java.util.List; /** * The persistent class for the inventarios database table. * */ @Entity @Table(name="inventarios") @NamedQuery(name="InventarioController.findAll", query="SELECT i FROM Inventario i") public class Inventario implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idInventario; private String descripcion; private Timestamp fecha; //bi-directional many-to-one association to Compra @ManyToOne @JoinColumn(name="idCompra") private Compra compras; //bi-directional many-to-one association to Venta @ManyToOne @JoinColumn(name="idVenta") private Venta ventas; //bi-directional many-to-one association to Inventariosproducto @OneToMany(mappedBy="inventarios", fetch=FetchType.LAZY) private List<Inventariosproducto> inventariosproductos; public Inventario() { } public Long getIdInventario() { return this.idInventario; } public void setIdInventario(Long idInventario) { this.idInventario = idInventario; } public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Timestamp getFecha() { return this.fecha; } public void setFecha(Timestamp fecha) { this.fecha = fecha; } public Compra getCompras() { return this.compras; } public void setCompras(Compra compras) { this.compras = compras; } public Venta getVentas() { return this.ventas; } public void setVentas(Venta ventas) { this.ventas = ventas; } public List<Inventariosproducto> getInventariosproductos() { return this.inventariosproductos; } public void setInventariosproductos(List<Inventariosproducto> inventariosproductos) { this.inventariosproductos = inventariosproductos; } public Inventariosproducto addInventariosproducto(Inventariosproducto inventariosproducto) { getInventariosproductos().add(inventariosproducto); inventariosproducto.setInventarios(this); return inventariosproducto; } public Inventariosproducto removeInventariosproducto(Inventariosproducto inventariosproducto) { getInventariosproductos().remove(inventariosproducto); inventariosproducto.setInventarios(null); return inventariosproducto; } }
[ "elias.osoriofgkah@sv.cds" ]
elias.osoriofgkah@sv.cds
e174fe5b8107bf77c775d9aaa27e97734b4fdaba
7c82db10fc0d0448460f5cd308465c555967b081
/tcc/src/main/java/io/mmtx/rm/tcc/remoting/RemotingDesc.java
2b7dec836ed6b1459874ba8d002282be0a92a520
[ "Apache-2.0" ]
permissive
qq962155660/mmtx
0d1dbf24f89180f9dec893459f0a577d04a8551b
b62729f464a97f065cf5c50c8b07026ddec6246a
refs/heads/master
2022-11-24T06:17:16.308311
2020-02-05T02:06:13
2020-02-05T02:06:13
235,230,686
0
0
Apache-2.0
2022-11-16T12:26:09
2020-01-21T01:19:03
Java
UTF-8
Java
false
false
3,901
java
/* * Copyright 1999-2019 Mmtx.io Group. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.mmtx.rm.tcc.remoting; /** * remoting bean info * * @author zhangsen */ public class RemotingDesc { /** * is referenc bean ? */ private boolean isReference = false; /** * rpc target bean, the service bean has this property */ private Object targetBean; /** * the tcc interface tyep */ private Class<?> interfaceClass; /** * interface class name */ private String interfaceClassName; /** * rpc uniqueId: hsf, dubbo's version, sofa-rpc's uniqueId */ private String uniqueId; /** * dubbo/hsf 's group */ private String group; /** * protocol: sofa-rpc, dubbo, injvm etc. */ private short protocol; /** * Gets target bean. * * @return the target bean */ public Object getTargetBean() { return targetBean; } /** * Sets target bean. * * @param targetBean the target bean */ public void setTargetBean(Object targetBean) { this.targetBean = targetBean; } /** * Gets interface class. * * @return the interface class */ public Class<?> getInterfaceClass() { return interfaceClass; } /** * Sets interface class. * * @param interfaceClass the interface class */ public void setInterfaceClass(Class<?> interfaceClass) { this.interfaceClass = interfaceClass; } /** * Gets interface class name. * * @return the interface class name */ public String getInterfaceClassName() { return interfaceClassName; } /** * Sets interface class name. * * @param interfaceClassName the interface class name */ public void setInterfaceClassName(String interfaceClassName) { this.interfaceClassName = interfaceClassName; } /** * Gets unique id. * * @return the unique id */ public String getUniqueId() { return uniqueId; } /** * Sets unique id. * * @param uniqueId the unique id */ public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } /** * Gets group. * * @return the group */ public String getGroup() { return group; } /** * Sets group. * * @param group the group */ public void setGroup(String group) { this.group = group; } /** * Gets protocol. * * @return the protocol */ public short getProtocol() { return protocol; } /** * Sets protocol. * * @param protocol the protocol */ public void setProtocol(short protocol) { this.protocol = protocol; } /** * Is reference boolean. * * @return the boolean */ public boolean isReference() { return isReference; } /** * Sets reference. * * @param reference the reference */ public void setReference(boolean reference) { isReference = reference; } }
[ "962155660@qq.com" ]
962155660@qq.com
1dbe3ac501aaf391dda5d144306187fe9154112b
354ed8b713c775382b1e2c4d91706eeb1671398b
/spring-context/src/main/java/org/springframework/instrument/classloading/package-info.java
a96b965b3cd01eb9d22893df7ab3ed087d44b018
[]
no_license
JessenPan/spring-framework
8c7cc66252c2c0e8517774d81a083664e1ad4369
c0c588454a71f8245ec1d6c12f209f95d3d807ea
refs/heads/master
2021-06-30T00:54:08.230154
2019-10-08T10:20:25
2019-10-08T10:20:25
91,221,166
2
0
null
2017-05-14T05:01:43
2017-05-14T05:01:42
null
UTF-8
Java
false
false
183
java
/** * Support package for load time weaving based on class loaders, * as required by JPA providers (but not JPA-specific). */ package org.springframework.instrument.classloading;
[ "jessenpan@qq.com" ]
jessenpan@qq.com
955fa898c53e4f91f25e88f69f55a8bc60346eb8
c9be9f5abba5ef121fe27a3969a47fba7ddbf275
/app/src/main/java/com/android/trungnh2/musicplayeruidesign/MainActivity.java
32688f512899147524f493ed13b286efa2431ce1
[]
no_license
espresso995/music-player-ui-design
e684994f50a6e8dd031baecaaa646f041df417ac
a71a6a4b4f0cf3d7b5dfb5a574c4373f212a5463
refs/heads/master
2023-02-20T01:48:47.127399
2021-01-22T03:34:44
2021-01-22T03:34:44
331,592,977
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
package com.android.trungnh2.musicplayeruidesign; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import com.makeramen.roundedimageview.RoundedImageView; public class MainActivity extends AppCompatActivity { RoundedImageView imageAlbum; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageAlbum = findViewById(R.id.imageAlbum); Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate_anim); imageAlbum.setAnimation(animation); } }
[ "nguyenhongtrung.ptit@gmail.com" ]
nguyenhongtrung.ptit@gmail.com
bdb8d4b9a270ae2340b43e893be2384c033de92f
6e25feecfe596bf46ed822a91762ae3dbd6be083
/project3/libraries/OpenCV-android-sdk/samples/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java
ca2ac12e43be5e6be48d5856078ab4d70b6f80ac
[ "BSD-3-Clause" ]
permissive
qubick/MAD2015
f42edb89860ea7332dcc94568172c2e3020b72f3
009a752ccb8de897a37d46c93e64d9ee00fa73a5
refs/heads/master
2020-05-13T23:33:25.246704
2015-12-18T18:35:11
2015-12-18T18:35:11
41,751,420
0
0
null
null
null
null
UTF-8
Java
false
false
6,900
java
package org.opencv.samples.colorblobdetect; import java.util.List; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.MatOfPoint; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.imgproc.Imgproc; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.SurfaceView; import android.view.WindowManager; import android.view.View.OnTouchListener; public class ColorBlobDetectionActivity extends Activity implements OnTouchListener, CvCameraViewListener2 { private static final String TAG = "OCVSample::Activity"; private boolean mIsColorSelected = false; private Mat mRgba; private Scalar mBlobColorRgba; private Scalar mBlobColorHsv; private ColorBlobDetector mDetector; private Mat mSpectrum; private Size SPECTRUM_SIZE; private Scalar CONTOUR_COLOR; private CameraBridgeViewBase mOpenCvCameraView; private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Override public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); mOpenCvCameraView.setOnTouchListener(ColorBlobDetectionActivity.this); } break; default: { super.onManagerConnected(status); } break; } } }; public ColorBlobDetectionActivity() { Log.i(TAG, "Instantiated new " + this.getClass()); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.color_blob_detection_surface_view); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.color_blob_detection_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); } @Override public void onPause() { super.onPause(); if (mOpenCvCameraView != null) mOpenCvCameraView.disableView(); } @Override public void onResume() { super.onResume(); if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else { Log.d(TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } } public void onDestroy() { super.onDestroy(); if (mOpenCvCameraView != null) mOpenCvCameraView.disableView(); } public void onCameraViewStarted(int width, int height) { mRgba = new Mat(height, width, CvType.CV_8UC4); mDetector = new ColorBlobDetector(); mSpectrum = new Mat(); mBlobColorRgba = new Scalar(255); mBlobColorHsv = new Scalar(255); SPECTRUM_SIZE = new Size(200, 64); CONTOUR_COLOR = new Scalar(255,0,0,255); } public void onCameraViewStopped() { mRgba.release(); } public boolean onTouch(View v, MotionEvent event) { int cols = mRgba.cols(); int rows = mRgba.rows(); int xOffset = (mOpenCvCameraView.getWidth() - cols) / 2; int yOffset = (mOpenCvCameraView.getHeight() - rows) / 2; int x = (int)event.getX() - xOffset; int y = (int)event.getY() - yOffset; Log.i(TAG, "Touch image coordinates: (" + x + ", " + y + ")"); if ((x < 0) || (y < 0) || (x > cols) || (y > rows)) return false; Rect touchedRect = new Rect(); touchedRect.x = (x>4) ? x-4 : 0; touchedRect.y = (y>4) ? y-4 : 0; touchedRect.width = (x+4 < cols) ? x + 4 - touchedRect.x : cols - touchedRect.x; touchedRect.height = (y+4 < rows) ? y + 4 - touchedRect.y : rows - touchedRect.y; Mat touchedRegionRgba = mRgba.submat(touchedRect); Mat touchedRegionHsv = new Mat(); Imgproc.cvtColor(touchedRegionRgba, touchedRegionHsv, Imgproc.COLOR_RGB2HSV_FULL); // Calculate average color of touched region mBlobColorHsv = Core.sumElems(touchedRegionHsv); int pointCount = touchedRect.width*touchedRect.height; for (int i = 0; i < mBlobColorHsv.val.length; i++) mBlobColorHsv.val[i] /= pointCount; mBlobColorRgba = converScalarHsv2Rgba(mBlobColorHsv); Log.i(TAG, "Touched rgba color: (" + mBlobColorRgba.val[0] + ", " + mBlobColorRgba.val[1] + ", " + mBlobColorRgba.val[2] + ", " + mBlobColorRgba.val[3] + ")"); mDetector.setHsvColor(mBlobColorHsv); Imgproc.resize(mDetector.getSpectrum(), mSpectrum, SPECTRUM_SIZE); mIsColorSelected = true; touchedRegionRgba.release(); touchedRegionHsv.release(); return false; // don't need subsequent touch events } public Mat onCameraFrame(CvCameraViewFrame inputFrame) { mRgba = inputFrame.rgba(); if (mIsColorSelected) { mDetector.process(mRgba); List<MatOfPoint> contours = mDetector.getContours(); Log.e(TAG, "Contours count: " + contours.size()); Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR); Mat colorLabel = mRgba.submat(4, 68, 4, 68); colorLabel.setTo(mBlobColorRgba); Mat spectrumLabel = mRgba.submat(4, 4 + mSpectrum.rows(), 70, 70 + mSpectrum.cols()); mSpectrum.copyTo(spectrumLabel); } return mRgba; } private Scalar converScalarHsv2Rgba(Scalar hsvColor) { Mat pointMatRgba = new Mat(); Mat pointMatHsv = new Mat(1, 1, CvType.CV_8UC3, hsvColor); Imgproc.cvtColor(pointMatHsv, pointMatRgba, Imgproc.COLOR_HSV2RGB_FULL, 4); return new Scalar(pointMatRgba.get(0, 0)); } }
[ "qubick.kim@gmail.com" ]
qubick.kim@gmail.com
4263ba7bcea987253acd7cb62738cd88fd24ab9b
63c0ce2d0e1c090ecf3fe5d289596dadc0ef3b85
/s20GridLayoutDemo/app/src/test/java/kr/android/s20gridlayoutdemo/ExampleUnitTest.java
db61041bc0fa3167d2001c0cd242617b4a3af3ff
[]
no_license
JR-A/android-tutorials
aa5388c926c900ba66c023fee48b189fc0f6632e
476c397dae53630c43810fd1b1b10bc442e9625a
refs/heads/main
2023-01-10T20:33:48.746223
2020-11-18T03:07:05
2020-11-18T03:07:05
312,159,712
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package kr.android.s20gridlayoutdemo; 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); } }
[ "kn043143@naver.com" ]
kn043143@naver.com
b9d2e90ab6037cef1448e64195051cafbc09d271
695a88266fd3f073a9669f4a5a9ff31feadcc446
/kodilla-stream/src/test/java/com/kodilla/stream/book/BookTestSuite.java
245fd13e0e61a025ea9b52be82df3c1586bd083a
[]
no_license
KarolDmowski/Karol-Dmowski-Kodilla-Java
1acdc66bfd25683444949a5899202d17adf1485b
cd66e5686d2185c2b781458f83c4ea38d1d7cd19
refs/heads/master
2021-09-10T02:15:56.658482
2018-03-20T17:13:19
2018-03-20T17:13:19
111,609,106
0
0
null
null
null
null
UTF-8
Java
false
false
1,617
java
package com.kodilla.stream.book; import org.junit.Assert; import org.junit.Test; import java.util.List; import java.util.stream.IntStream; public class BookTestSuite { @Test public void testGetListUsingFor() { //Given BookDirectory bookDirectory = new BookDirectory(); //When List<Book> books = bookDirectory.getList(); //Then int numberOfBookPublicatedAfter2007 = 0; for(Book book : books){ if(book.getYearOfPublication() > 2007) { numberOfBookPublicatedAfter2007++; } } Assert.assertEquals(3, numberOfBookPublicatedAfter2007); } @Test public void testGetListUsingIntStream(){ //Given BookDirectory bookDirectory = new BookDirectory(); //When List<Book> books = bookDirectory.getList(); //Then int numberOfBooksPiblicatedAfter2007 = IntStream.range(0,books.size()) .filter((n -> books.get(n).getYearOfPublication()>2007)) .map(n -> 1) .sum(); Assert.assertEquals(3,numberOfBooksPiblicatedAfter2007); } @Test public void testGetListUsingIntStreamUsingLong(){ //Given BookDirectory bookDirectory = new BookDirectory(); //When List<Book> books = bookDirectory.getList(); //Then long numberOfBooksPublicatedAfter2007 = IntStream.range(0,books.size()) .filter(n -> books.get(n).getYearOfPublication()>2007) .count(); Assert.assertEquals(3,numberOfBooksPublicatedAfter2007); } }
[ "dmowski.ka@gmail.com" ]
dmowski.ka@gmail.com
cbd06d722c288bed2122dda4c4494db724ab608d
5bcaa91d0c8eb5d63414a4a39589f640f7ce760a
/src/main/java/com/revolut/task/controller/BalanceController.java
2085246181d216c477b0dfaade8a628a1f604630
[]
no_license
passingbyreloaded/testTask
c7cefe8ef75917153d4859290083dfbae872a400
32273f4b29829c08e05a5212f963a467f17eba41
refs/heads/master
2022-05-31T05:12:13.591798
2019-10-06T11:53:03
2019-10-06T11:53:03
212,373,988
0
0
null
2022-05-20T21:10:36
2019-10-02T15:17:35
Java
UTF-8
Java
false
false
886
java
package com.revolut.task.controller; import com.revolut.task.exception.AccountNotFoundException; import com.revolut.task.service.AccountService; import spark.Request; import spark.Response; import spark.Route; import java.math.BigDecimal; import static com.revolut.task.Application.*; public class BalanceController implements Route { private final AccountService accountService; public BalanceController(AccountService accountService) { this.accountService = accountService; } @Override public Object handle(Request request, Response response) { try { BigDecimal balance = accountService.getBalance(request.params(":number")); response.status(OK); return balance; } catch (AccountNotFoundException ex) { response.status(NOT_FOUND); return ex.getMessage(); } } }
[ "voronayala@mail.ru" ]
voronayala@mail.ru
cdce91f0a530a49018269185c6b9f20e0c257152
b1520e2d3daa2848c2905480c2117850864b4895
/config-client/src/main/java/com/john/sc/configclient/controller/GitController.java
b3ae2be4b3ec72d9f502239d46cf10260d170509
[]
no_license
John520/sc
b123f1fb0f3ed64567477e3b7d3d463500518e8f
36cbe383617a2f5e9ed69d2ac9f4d776132da5cb
refs/heads/master
2020-11-30T01:41:25.722261
2020-03-14T08:04:31
2020-03-14T08:04:31
230,266,220
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package com.john.sc.configclient.controller; import com.john.sc.configclient.domain.GitConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class GitController { @Autowired private GitConfig gitConfig; @GetMapping(value = "show") public Object show(){ return gitConfig.toString(); } }
[ "446192161@qq.com" ]
446192161@qq.com
29f75c403ac8d07fa22c8a3d2f409459d149111c
9a9e382c86ae676f051c9441a597d017337d3347
/src/com/example/helloworld/MainActivity.java
ec8deb7a9ce171fa752c89444b7dbe96ff63b7f9
[]
no_license
jdmellor/helloWorld
2b5419d83bd4c4bfa0652e1a7ccef7e38f3a58cc
7a8d58a634fcdbd7b255cc8536135e313496575a
refs/heads/master
2021-01-10T18:59:33.757509
2012-08-27T22:04:30
2012-08-27T22:04:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.example.helloworld; import org.apache.cordova.*; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/index.html"); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } }
[ "jdmellor@Jonathan-Mellors-MacBook-Pro.local" ]
jdmellor@Jonathan-Mellors-MacBook-Pro.local
d97fe84bcd496a47cdbc529b466ca79048031c4a
49f5bc67772197af09beb1a0b151c917825e4924
/src/main/java/com/cc/common/utils/ArrayUtil.java
37556e47ff4c1f945d7865e99dd0c26949344103
[]
no_license
wangchuan98/springboot-api
c246158720adff3f3e88a14e15a235bbd02d000f
3150208d23df867e865583cce7e23ff4d3d7adf6
refs/heads/master
2022-06-25T10:15:24.865369
2020-02-27T07:11:09
2020-02-27T07:11:09
235,104,755
0
0
null
2022-06-17T02:50:39
2020-01-20T13:12:44
CSS
UTF-8
Java
false
false
457
java
package com.cc.common.utils; /** * @program: springboot-api * @description: 一个数组的工具类 * @author: wangchuan * @create: 2019-12-25 */ public class ArrayUtil { public static Boolean contain(String[] agrs,String str){ Boolean flag=false; if(agrs==null||str==null) return flag; for(String item:agrs) { if(item.equals(str)) flag=true; } return flag; } }
[ "wangchuan98@163.com" ]
wangchuan98@163.com