blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
cd58faa3dbc94339426b67c1b73438452ddf9407
bb20167ee10a22ff5b9fe8a465eb39d1a94c128e
/Step02_MyBatis/src/main/java/com/gura/step02/member/dao/MemberDao.java
9b39f3f9d6460bbc851c6860c0285bc85aac825f
[]
no_license
crea00/spring_work
58e148b13a9ca92d56016b71a3c4f5a06f9f09df
48f833887c130f2e97fc1261e09f0bcf246209b7
refs/heads/master
2021-05-11T16:32:34.760388
2018-04-11T03:38:18
2018-04-11T03:38:18
117,615,575
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.gura.step02.member.dao; import java.util.List; import com.gura.step02.member.dto.MemberDto; /* * MemberDaoImpl 클래스가 구현할 인터페이스 정의하기 */ public interface MemberDao { public void insert(MemberDto dto); public void update(MemberDto dto); public void delete(int num); public List<MemberDto> getlist(); public MemberDto getData(int num); }
[ "654321su@gmail.com" ]
654321su@gmail.com
5ac515c41a22cfdd5f246602a533874e9143c6d1
778da6dbb2eb27ace541338d0051f44353c3f924
/src/main/java/com/espertech/esper/epl/agg/service/AggregationServiceFactoryServiceImpl.java
a5b5078f3b5978f2daba7254fca1e3784150ed06
[]
no_license
jiji87432/ThreadForEsperAndBenchmark
daf7188fb142f707f9160173d48c2754e1260ec7
fd2fc3579b3dd4efa18e079ce80d3aee98bf7314
refs/heads/master
2021-12-12T02:15:18.810190
2016-12-01T12:15:01
2016-12-01T12:15:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,925
java
/* * ************************************************************************************* * Copyright (C) 2006-2015 EsperTech, Inc. All rights reserved. * * http://www.espertech.com/esper * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * * ************************************************************************************* */ package com.espertech.esper.epl.agg.service; import com.espertech.esper.client.annotation.Hint; import com.espertech.esper.epl.agg.access.AggregationAccessorSlotPair; import com.espertech.esper.epl.agg.access.AggregationAgent; import com.espertech.esper.epl.agg.util.AggregationLocalGroupByPlan; import com.espertech.esper.epl.expression.core.ExprEvaluator; import com.espertech.esper.epl.expression.core.ExprNode; import com.espertech.esper.epl.expression.core.ExprValidationException; import com.espertech.esper.epl.spec.IntoTableSpec; import com.espertech.esper.epl.table.mgmt.TableColumnMethodPair; import com.espertech.esper.epl.table.mgmt.TableMetadata; import com.espertech.esper.epl.variable.VariableService; public class AggregationServiceFactoryServiceImpl implements AggregationServiceFactoryService { public final static AggregationServiceFactoryService DEFAULT_FACTORY = new AggregationServiceFactoryServiceImpl(); public AggregationServiceFactory getNullAggregationService() { return AggregationServiceNullFactory.AGGREGATION_SERVICE_NULL_FACTORY; } public AggregationServiceFactory getNoGroupNoAccess(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr) { return new AggSvcGroupAllNoAccessFactory(evaluatorsArr, aggregatorsArr, null); } public AggregationServiceFactory getNoGroupAccessOnly(AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggSpecs, boolean join) { return new AggSvcGroupAllAccessOnlyFactory(pairs, accessAggSpecs, join); } public AggregationServiceFactory getNoGroupAccessMixed(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join) { return new AggSvcGroupAllMixedAccessFactory(evaluatorsArr, aggregatorsArr, null, pairs, accessAggregations, join); } public AggregationServiceFactory getGroupedNoReclaimNoAccess(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, Object groupKeyBinding) { return new AggSvcGroupByNoAccessFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding); } public AggregationServiceFactory getGroupNoReclaimAccessOnly(AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggSpecs, Object groupKeyBinding, boolean join) { return new AggSvcGroupByAccessOnlyFactory(pairs, accessAggSpecs, groupKeyBinding, join); } public AggregationServiceFactory getGroupNoReclaimMixed(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join, Object groupKeyBinding) { return new AggSvcGroupByMixedAccessFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding, pairs, accessAggregations, join); } public AggregationServiceFactory getGroupReclaimAged(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, Hint reclaimGroupAged, Hint reclaimGroupFrequency, VariableService variableService, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join, Object groupKeyBinding, String optionalContextName) throws ExprValidationException{ return new AggSvcGroupByReclaimAgedFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding, reclaimGroupAged, reclaimGroupFrequency, variableService, pairs, accessAggregations, join, optionalContextName); } public AggregationServiceFactory getGroupReclaimNoAccess(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join, Object groupKeyBinding) { return new AggSvcGroupByRefcountedNoAccessFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding); } public AggregationServiceFactory getGroupReclaimMixable(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join, Object groupKeyBinding) { return new AggSvcGroupByRefcountedWAccessFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding, pairs, accessAggregations, join); } public AggregationServiceFactory getGroupReclaimMixableRollup(ExprEvaluator[] evaluatorsArr, AggregationMethodFactory[] aggregatorsArr, AggregationAccessorSlotPair[] pairs, AggregationStateFactory[] accessAggregations, boolean join, Object groupKeyBinding, AggregationGroupByRollupDesc groupByRollupDesc) { return new AggSvcGroupByRefcountedWAccessRollupFactory(evaluatorsArr, aggregatorsArr, groupKeyBinding, pairs, accessAggregations, join, groupByRollupDesc); } public AggregationServiceFactory getGroupWBinding(TableMetadata tableMetadata, TableColumnMethodPair[] methodPairs, AggregationAccessorSlotPair[] accessorPairs, boolean join, IntoTableSpec bindings, int[] targetStates, ExprNode[] accessStateExpr, AggregationAgent[] agents, AggregationGroupByRollupDesc groupByRollupDesc) { return new AggSvcGroupByWTableFactory(tableMetadata, methodPairs, accessorPairs, join, targetStates, accessStateExpr, agents, groupByRollupDesc); } public AggregationServiceFactory getNoGroupWBinding(AggregationAccessorSlotPair[] accessors, boolean join, TableColumnMethodPair[] methodPairs, String tableName, int[] targetStates, ExprNode[] accessStateExpr, AggregationAgent[] agents) { return new AggSvcGroupAllMixedAccessWTableFactory(accessors, join, methodPairs, tableName, targetStates, accessStateExpr, agents); } public AggregationServiceFactory getNoGroupLocalGroupBy(boolean join, AggregationLocalGroupByPlan localGroupByPlan, Object groupKeyBinding) { return new AggSvcGroupAllLocalGroupByFactory(join, localGroupByPlan, groupKeyBinding); } public AggregationServiceFactory getGroupLocalGroupBy(boolean join, AggregationLocalGroupByPlan localGroupByPlan, Object groupKeyBinding) { return new AggSvcGroupByLocalGroupByFactory(join, localGroupByPlan, groupKeyBinding); } }
[ "qinjie2012@163.com" ]
qinjie2012@163.com
bd8c72f3e10778b50d2448cc09db4c514dea131e
51ddf6bef8e19983095bf5cca3acb3ee9fd61a18
/FirstApp/app/src/androidTest/java/com/devlovepreet/firstapp/ApplicationTest.java
cd537caec01a7c181865a2a61b60ce9e719d9d88
[]
no_license
7azycoder/Android-Basic-Practice-Apps
a25ba8aa07412402f7b9f354edada6d7fa888a3f
94dfd8bbb74fbb2d9f8b1aa27d9f67775dba664c
refs/heads/master
2021-06-07T17:36:13.704769
2016-07-08T17:23:10
2016-07-08T17:23:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.devlovepreet.firstapp; 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); } }
[ "dev.lovepreetsingh@gmail.com" ]
dev.lovepreetsingh@gmail.com
e0d13f144e5970987b032a9d5e5fa3ef66bec3f8
8a220a5edf43e63d8512247fb8ed209f67df7476
/src/com/chinasoft/service/AlbumService.java
ff83331cbadc3fb3ea3f15869c982ee0c194c89c
[]
no_license
kuxuanMusic/ReKuxuanMusic
26633dad3a446de80880ff65902bd57483cd0993
4b3a1eba8d211fafe0119bb9c63d6293d92c7f0e
refs/heads/master
2021-01-23T01:40:51.162135
2017-03-30T10:34:34
2017-03-30T10:34:34
85,925,145
0
0
null
null
null
null
UTF-8
Java
false
false
2,421
java
package com.chinasoft.service; import java.util.ArrayList; import com.chinasoft.dao.daoImpl.AlbumDao; import com.chinasoft.entity.Album; import com.chinasoft.util.PageModel; public class AlbumService { /** * @param 类型名称 * @return 插入结果:1:插入成功 2:类型已存在 0:插入失败 * decription :增加专辑类型 * */ public int addAlbumType(String type) { // 先查询是否重名 AlbumDao dao = new AlbumDao(); int res1 = dao.selectAlbumTypeByType(type); if(res1 == 1){ // 已存在 return 2; } else{ // 未重名可插入 int res2 = dao.insertAlbumType(type); return res2; } } /** * * @param 专辑属性 * @return 新增结果:1:新增成功 0:新增失败 * decription :新增专辑 * */ public int addAlbum(String name ,int language,String date,String company,int type) { // 先查询是否重名 AlbumDao dao = new AlbumDao(); int res2 = dao.insertAlbum( name,language,date,company,type); return res2; } /** * * @param 专辑id * @return 查询对象 * decription :根据id查询专辑对象 * */ public Album changeAlbum(String albumId){ AlbumDao dao = new AlbumDao(); return dao.selectAlbumById(albumId); } /** * * @param pageNo:当前页码 pageSize:当前显示条数 * @return 显示模式对象 * decription :分页查询所有的专辑 * */ public PageModel getAlbumInfoFenye(int pageNo, int pageSize){ AlbumDao dao = new AlbumDao(); PageModel pm = dao.selectAlbumFenyeNew(pageNo, pageSize); return pm; } /** * * @param 专辑属性 * @return 更新结果:1 成功 2失败 * decription :更新专辑 * */ public int uppdateAlbum(int id, String name, int language, String date, String company, int type) { AlbumDao dao = new AlbumDao(); int res2 = dao.updateAlbum(id, name,language,date,company,type); return res2; } /** * * @param pageNo:当前页码 pageSize:当前显示条数 * @return 显示模式对象 * decription :分页查询所有的专辑类型 * */ public PageModel getAlbumTypeInfoFenye(int pageNo, int pageSize) { AlbumDao dao = new AlbumDao(); PageModel pm = dao.selectAlbumTypeFenyeNew(pageNo, pageSize); return pm; } }
[ "1101469969@qq.com" ]
1101469969@qq.com
e749f0e5b72fe88a85e7925a2ea742b04a946eaa
c40259f94705c16a690d7d44806d14efdd59a234
/filewatcher/src/main/java/file/watcher/handler/FileImportHandler.java
d6f1a0c4513e3394c72ac729f632ea284c72fdb4
[]
no_license
fatmabr/tondeuseProject
042c907a9ed547e1ef557caf494a255e96fd0ab4
57bce37f9adb62b7d6ed612b630ae444ec56f06f
refs/heads/master
2022-11-30T09:15:00.214501
2018-12-04T22:00:37
2018-12-04T22:00:37
159,989,412
0
0
null
null
null
null
UTF-8
Java
false
false
2,528
java
package file.watcher.handler; import au.com.bytecode.opencsv.CSVReader; import file.watcher.line.Header; import file.watcher.line.Line; import file.watcher.parser.FileParser; import file.watcher.processor.AbstractFileProcessor; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.nio.file.*; import java.util.logging.Logger; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; /** * Created by bradai on 28/06/2017. */ /** * FileImportHandler handles the injected files in the watched dir. */ @Component public class FileImportHandler implements InitializingBean { Logger logger = Logger.getLogger(getClass().getName()); @Autowired private ProcessorRegistry registry; @Value("${watched.file}") private String watchedDir; public void handle(File file) throws IOException { final AbstractFileProcessor fileProcessor = registry.matchProcessor(file.getName()); if (fileProcessor != null) { FileParser fileParser = fileProcessor.getFileParser(); CSVReader csvReader = fileParser.parse(file); Line line; Header header = null; if (fileParser.getHeaderLinesCount() != 0) { header = fileParser.readFileHeader(csvReader); } while ((line = fileParser.readNextItem(csvReader)) != null) { if (fileParser.getHeaderLinesCount() != 0) { fileProcessor.processWithHeader(header, line); } else { fileProcessor.process(line); } } } } public void afterPropertiesSet() throws Exception { Path dir = Paths.get(watchedDir); WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key = dir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE); final FileImportListener importListener = new FileImportListener(dir, watcher, this); final Thread thread = new Thread(importListener); logger.info("WATCHED DIR LOG: " +watchedDir); System.out.print("WATCHED DIR LOG PRINT: " +watchedDir); thread.start(); } }
[ "laila1983@" ]
laila1983@
038bbb210d99c0bc0dfb2db5685d75e9f66f46d6
3ac27f85ba95d0900262e2e566da18b0c26f8127
/app/src/main/java/com/dcs/dcsbeginneraid/Menu.java
9f15e830e695a92f452a722c5750b9a82975a88b
[]
no_license
TheIrishAce/DCS-Beginners-Guide-Companion
5c7db0fc32eca64809a9e881e8754c87106ddc25
97229167becbacfc6bbfb37b86c2513d3d2ce4f7
refs/heads/main
2023-02-15T14:47:20.752549
2021-01-15T04:28:01
2021-01-15T04:28:01
315,280,539
0
0
null
null
null
null
UTF-8
Java
false
false
4,133
java
package com.dcs.dcsbeginneraid; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import android.os.Bundle; import android.content.Intent; import android.view.MenuItem; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.Toast; import com.google.android.material.navigation.NavigationView; public class Menu extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{ private DrawerLayout drawer; private Toolbar toolbar; private ImageView menuLogo; private Animation animation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); menuLogo = findViewById(R.id.main_logo_imageview); animation = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink); menuLogo.startAnimation(animation); ImageButton plane_button = (ImageButton)findViewById(R.id.plane_button); plane_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Texthere = text.getText().toString(); Intent intent = new Intent(Menu.this, Plane.class); //intent.putExtra("Text",Texthere); startActivity(intent); } }); ImageButton helicopter_button = (ImageButton)findViewById(R.id.helicopter_button); helicopter_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Menu.this, Helicopter.class); startActivity(intent); } }); ImageButton vehicle_button = (ImageButton)findViewById(R.id.vehicle_button); vehicle_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Menu.this, Vehicle.class); startActivity(intent); } }); ImageButton weapon_button = (ImageButton)findViewById(R.id.weapon_button); weapon_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Menu.this, Weapon.class); startActivity(intent); } }); } /* onNavigationItemSelected used to give functionality to items inside the hamburger menu. Add case for each item in the list. */ @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()){ case R.id.pilot_photo: //Toast.makeText(this, "Logged out!", Toast.LENGTH_SHORT).show(); startActivity(new Intent(Menu.this, Camera.class)); break; } return true; } @Override public void onBackPressed(){ if (drawer.isDrawerOpen(GravityCompat.START)){ drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } }
[ "maxdelaney16@gmail.com" ]
maxdelaney16@gmail.com
da9c54aa80b673c64500c0907de88a1571c2cd38
35a5e70b61b7ca820cc6a6eca972cf0a71368737
/app/src/main/java/com/fzuclover/putmedown/features/timing/TimingPresenter.java
9bf6badf76c921f84060873fb1f0dfd4d2dfb974
[]
no_license
liezhengli/put-me-down
6469d3dc64fa29bc128c571f13162d9b01b2420f
b986672d185e20a40e42b75c1c40896a3e2245b3
refs/heads/master
2020-02-26T15:54:27.836938
2017-03-31T14:48:16
2017-03-31T14:48:16
70,911,900
0
2
null
2016-12-13T16:00:49
2016-10-14T13:17:56
Java
UTF-8
Java
false
false
5,495
java
package com.fzuclover.putmedown.features.timing; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; import android.graphics.Color; import com.fzuclover.putmedown.R; import com.fzuclover.putmedown.model.AchievementModel; import com.fzuclover.putmedown.model.IAchievementModel; import com.fzuclover.putmedown.model.IRecordModel; import com.fzuclover.putmedown.model.RecordModel; import com.fzuclover.putmedown.model.bean.Achievement; import com.fzuclover.putmedown.model.bean.DayAchievement; import com.fzuclover.putmedown.utils.SharePreferenceUtil; import com.tencent.mm.sdk.modelmsg.SendMessageToWX; import com.tencent.mm.sdk.modelmsg.WXMediaMessage; import com.tencent.mm.sdk.modelmsg.WXTextObject; import com.tencent.mm.sdk.openapi.IWXAPI; import com.tencent.mm.sdk.openapi.WXAPIFactory; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by lkl on 2016/11/4. */ public class TimingPresenter implements TimingContract.Presenter { private TimingContract.View mView; private IRecordModel mRecordModel; private IAchievementModel mAchievementModel; private SharePreferenceUtil mSharePreferenceUtil; private static final String APP_ID = "wx63e23a6376ee0569"; private IWXAPI api; public TimingPresenter(TimingContract.View view){ mView = view; mRecordModel = RecordModel.getInstance((Context)view); mAchievementModel = AchievementModel.getAchieveMentModelInstance((Context)view); mSharePreferenceUtil = SharePreferenceUtil.getInstance((Context)mView); //初始化 api = WXAPIFactory.createWXAPI((Context)mView, APP_ID, true); //向微信终端注册 api.registerApp(APP_ID); } @Override public void updateTimingRecord(int time) { mRecordModel.updateTimingRecord(mView.isSuccess(), mView.getRecordId(), mView.getFailComments()); String date = mSharePreferenceUtil.getDate(); DayAchievement dayAchievement = mAchievementModel.getDayAchievement(date); int totalTime = dayAchievement.getTotal_time(); int successTimes = dayAchievement.getSucces_times(); int failedTImes = dayAchievement.getFailed_times(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String dateNow = format.format(new Date()); if(date.equals(dateNow)) { if(mView.isSuccess()) { mAchievementModel.updateAchievementEveryDay(date, totalTime+time, successTimes+1, failedTImes); } else { mAchievementModel.updateAchievementEveryDay(date, totalTime, successTimes, failedTImes+1); } } else { mSharePreferenceUtil.saveDate(dateNow); if(mView.isSuccess()){ mAchievementModel.saveAchievementEveryDay(dateNow, time, 1, 0); }else{ mAchievementModel.saveAchievementEveryDay(dateNow, 0, 0, 1); } } } @Override public void shareText() { if(mSharePreferenceUtil.getIsSendWeChatMsg()){ // 初始化一个WXTextObject对象 WXTextObject textObj = new WXTextObject(); textObj.text = mSharePreferenceUtil.getWeChatMsg(); // 用WXTextObject对象初始化一个WXMediaMessage对象 WXMediaMessage msg = new WXMediaMessage(); msg.mediaObject = textObj; msg.description = "PMD微信分享"; // 构造一个Req SendMessageToWX.Req req = new SendMessageToWX.Req(); // transaction字段用于唯一标识一个请求 req.transaction = buildTransaction("text"); req.message = msg; // 分享或收藏的目标场景,通过修改scene场景值实现。 // 发送到聊天界面 —— WXSceneSession // 发送到朋友圈 —— WXSceneTimeline // 添加到微信收藏 —— WXSceneFavorite req.scene = SendMessageToWX.Req.WXSceneTimeline; // 调用api接口发送数据到微信 api.sendReq(req); } } @Override public void sendNotify() { if(mSharePreferenceUtil.getIsNotify()){ NotificationManager notificationManager= (NotificationManager) ((Context)mView).getSystemService(Context.NOTIFICATION_SERVICE); // Intent intent = new Intent((Context)mView, TimingActivity.class); // PendingIntent pi = PendingIntent.getActivity((Context)mView, 0, intent, 0); Notification.Builder builder = new Notification.Builder((Context)mView) .setTicker("计时成功") .setAutoCancel(true) .setContentTitle("pmd") // .setContentIntent(pi) .setContentText("恭喜!计时成功!") .setSmallIcon(R.mipmap.white_logo); if(mSharePreferenceUtil.getIsShock()){ builder.setVibrate(new long[]{0,500,500}); } if(mSharePreferenceUtil.getIsLight()){ builder.setLights(Color.GREEN,1000,1000); } Notification notification = builder.getNotification(); notificationManager.notify(1,notification); } } private String buildTransaction(final String type) { return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis(); } }
[ "nowlinlei@outlook.com" ]
nowlinlei@outlook.com
452cb194cb51fc0b4da624286569e3e990c3526e
c689dfbb54434151db6bcb0b9d4edbf8fdc0e905
/src/main/java/edu/cricket/api/cricketscores/rest/source/model/LeagueSeasonGroupStandings.java
da4a0867d4fbf29d9b0acddd38e5a6f63d673881
[]
no_license
devadiganagaraja/cricket-scores
07bea604bd7108dc4007b9cef5f34be6c9532f74
26457ee643d72225fef2b3ce30fc3093b00d829b
refs/heads/master
2023-04-18T19:18:53.386813
2021-05-09T12:39:12
2021-05-09T12:39:12
280,166,317
0
0
null
2020-08-27T16:07:54
2020-07-16T13:50:27
Java
UTF-8
Java
false
false
391
java
package edu.cricket.api.cricketscores.rest.source.model; import java.util.List; public class LeagueSeasonGroupStandings { private List<LeagueSeasonGroupStanding> standings; public List<LeagueSeasonGroupStanding> getStandings() { return standings; } public void setStandings(List<LeagueSeasonGroupStanding> standings) { this.standings = standings; } }
[ "nagaraja.devadiga@espn.com" ]
nagaraja.devadiga@espn.com
96c946a36b1c08d0e405866744fb493e6c15d3b8
ed5e24908ae25142b03e0b1d4e869c47960089cc
/src/main/java/com/socket/netty/hello_05_MessagePackga/hello_01/TalkClient.java
346a95d792099f67ccbb4884428990235b56fef3
[]
no_license
sunhaha123456/socketSpace
d49be899ffe1215149360225a7c28549428d2f84
1dc44c854afabc0fe8cf27f88f585ded9da54fa4
refs/heads/master
2022-05-01T03:09:36.204482
2022-04-07T12:57:16
2022-04-07T12:57:16
170,664,942
0
1
null
2019-12-23T05:09:14
2019-02-14T09:33:14
Java
UTF-8
Java
false
false
2,317
java
package com.socket.netty.hello_05_MessagePackga.hello_01; import io.netty.bootstrap.Bootstrap; import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.LengthFieldBasedFrameDecoder; import io.netty.handler.codec.LengthFieldPrepender; public class TalkClient { public void connect(String host, int port) { EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group).channel(NioSocketChannel.class). option(ChannelOption.TCP_NODELAY, true). // 无延迟发送,关闭Nagle算法,以便高实时性发送数据 option(ChannelOption.SO_KEEPALIVE, true). // 检测服务器是否还活着 option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000). // 客户端调用服务端接口的超时时间 handler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast(new LengthFieldBasedFrameDecoder(65535, 0, 2, 0, 2)); pipeline.addLast(new MsgpackDecoder()); pipeline.addLast(new LengthFieldPrepender(2)); pipeline.addLast(new MsgpackEncoder()); pipeline.addLast(new TalkClientHandle()); } }); ChannelFuture future = b.connect(host, port).sync(); Channel channel = future.channel(); for (int x = 0; x < 100; x++) { channel.writeAndFlush(new UserInfo(1, "123")); } channel.writeAndFlush(123); channel.closeFuture().sync(); } catch (Exception e) { System.out.println(e); } finally { // 优雅退出,释放线程池资源 group.shutdownGracefully(); } } public static void main(String[] args) throws Exception { new TalkClient().connect("127.0.0.1", 5555); } }
[ "771968690@qq.com" ]
771968690@qq.com
3f8fa01f146218deae7e43eddd8552c4f6938dac
03f5bd5f93fb96f3ef088970b9bd18c48f4c881c
/HdAndroidApp/gen/cn/ac/qaii/track/BuildConfig.java
490da2e61f1c5776d4d541f45054ca1be71ef7b6
[]
no_license
xiaowenhuman/BaseActivity
98a1a959f6d920e903439332719b5330005c2574
d45846f796b9cfd63eb2627dab80d6ff1f7a5fe4
refs/heads/master
2020-04-06T04:30:23.041494
2015-07-07T02:54:39
2015-07-07T02:54:39
38,658,127
0
1
null
null
null
null
UTF-8
Java
false
false
158
java
/** Automatically generated file. DO NOT MODIFY */ package cn.ac.qaii.track; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "zhongxiaowenhuman@163.com" ]
zhongxiaowenhuman@163.com
209b8d97f12f98f46207c728e4ad8f71f642d919
8f4842068d5a23fe59c78b95611be0a0309398b2
/src/com/ktao/leetcode/_388_Longest_Absolute_File_Path.java
352124d5ef6be8faf73e7dfae5f13ee1d40bc093
[]
no_license
TaoEmm/LeetCodeJava
9981ef0770dab1039937744ee34445c2f9aabca7
a66e9e329939b16a614ebe3f9a2c8c8d6043ca4c
refs/heads/master
2022-12-12T19:19:31.083221
2020-08-28T00:44:24
2020-08-28T00:44:24
258,377,746
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package com.ktao.leetcode; /** * @author kongtao * @version 1.0 * @description: * @date 2020/7/13 **/ public class _388_Longest_Absolute_File_Path { public static int lengthLongestPath(String input) { if (input.length() == 0) { return 0; } int res = 0; int[] sum = new int[input.length() + 1]; for (String s : input.split("\n")) { int level = s.lastIndexOf("\t") + 2; int len = s.length() - (level - 1); if (s.contains(".")) { res = Math.max(res, sum[level - 1] + len); } else { sum[level] = sum[level - 1] + len + 1; } } return res; } public static void main(String[] args) { String str = "dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2"; System.out.println(lengthLongestPath(str)); } }
[ "kongtao@guazi.com" ]
kongtao@guazi.com
d43fec51b39322cf718029b3abee4f8fb45384cc
3a721f8cc945979dfa88a139b8b061ca4ab00bd1
/src/PFMonkeyRegistrationChecker.java
cf9bd209a6aa2f40d4a4d169d6956690de26e7b3
[]
no_license
rdaraujo/PFMonkeyRegistrationChecker
32d74c05387043ad7979343fde534d47f11d7646
8e7a6e0e5c8a6a993c30b5f028b4d9b4f8d905d6
refs/heads/master
2021-09-08T07:25:30.040789
2021-08-30T18:29:10
2021-08-30T18:29:10
167,993,241
1
0
null
null
null
null
UTF-8
Java
false
false
2,458
java
import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; /** * Checks PFMonkey NZB registration site to see whether registration is already open for new members. * @author rda * */ public class PFMonkeyRegistrationChecker { private static String URL = "http://pfmonkey.com/register"; private static String INVITE_ONLY_TEXT = "Registrations are currently invite only"; private static String SEND_EMAIL_COMMAND = "/usr/local/bin/sendEmail.pl -f <fromEmail> -t <toEmail> -s <smtpAddr> -o tls=<tls> -xu <user> -xp <password> -u <subject> -m <messageBody>"; public static void main(String[] args) { try { boolean regOpen = true; Document doc = Jsoup.connect(URL).get(); Elements divsError = doc.select("div.error"); for (Element div : divsError) { String divText = div.hasText() ? div.ownText() : ""; if (divText.contains(INVITE_ONLY_TEXT)) { regOpen = false; } } if (regOpen) { System.out.println("Registration is now open!"); System.out.println("Sending email now.."); sendEmail("from@mail.com", "to@mail.com", "smtp.mail.com", true, "smtp@mail.com", "password", "*** PFMonkey Registration is now open ***", "Go to http://pfmonkey.com/register and try to register an account while registration is still opened."); } else { System.out.println("It seems registration is still closed! :("); } } catch (IOException e) { System.err.println("Some error has occurred: " + e.getMessage()); e.printStackTrace(); } catch (InterruptedException e) { System.err.println("Some error has occurred: " + e.getMessage()); e.printStackTrace(); } } private static void sendEmail(String fromEmail, String toEmail, String smtpAddr, boolean tls, String user, String password, String subject, String messageBody) throws IOException, InterruptedException { String emailCmd = SEND_EMAIL_COMMAND.replace("<fromEmail>", fromEmail) .replace("<toEmail>", toEmail) .replace("<smtpAddr>", smtpAddr) .replace("<tls>", tls ? "yes" : "no") .replace("<user>", user) .replace("<password>", password) .replace("<subject>", subject) .replace("<messageBody>", messageBody); Process proc = Runtime.getRuntime().exec(emailCmd); int exitVal = proc.waitFor(); System.exit(exitVal); } }
[ "noreply@github.com" ]
noreply@github.com
10a834cc0c8dcdb21cd1e17fd7969e0c833249af
4ba4e5fea86c20560979f6d9c595cb951313d11e
/app/src/test/java/com/chz/test/ExampleUnitTest.java
6272bd1c2037a1bcbf59229f46cc3db671728575
[]
no_license
TheAshes/Guide
18034218ade9a763581a64febfeb0d7ef4c36d98
3952e888ad60eae8c5abd890a7b8d34495d466f0
refs/heads/master
2020-04-09T03:05:36.453124
2018-12-23T13:47:15
2018-12-23T13:47:15
159,966,271
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.chz.test; 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); } }
[ "415948729@qq.com" ]
415948729@qq.com
b52688cfc0a12286181e226b2cc96ae99e79785d
327d615dbf9e4dd902193b5cd7684dfd789a76b1
/base_source_from_JADX/sources/com/google/android/gms/internal/ads/zzbio.java
a6ecd1dd3be925c89aac26b2a7d8aabc9aafb484
[]
no_license
dnosauro/singcie
e53ce4c124cfb311e0ffafd55b58c840d462e96f
34d09c2e2b3497dd452246b76646b3571a18a100
refs/heads/main
2023-01-13T23:17:49.094499
2020-11-20T10:46:19
2020-11-20T10:46:19
314,513,307
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.google.android.gms.internal.ads; import com.google.android.gms.ads.internal.zzb; public final class zzbio implements zzepf<zzb> { private final zzbim zzfou; public zzbio(zzbim zzbim) { this.zzfou = zzbim; } public final /* synthetic */ Object get() { return (zzb) zzepl.zza(this.zzfou.zzahu(), "Cannot return null from a non-@Nullable @Provides method"); } }
[ "dno_sauro@yahoo.it" ]
dno_sauro@yahoo.it
0d6168d401abb61f0885482985fbbe0342382e82
5194981697a363648cb049b8176e730cb61cccbd
/OCP8Apress/src/chapter11/_12/stream/Test04StringSplitAndConcatenateParallel.java
d67555623e2ae667be2c3d7064dbc7fa9ddca363
[]
no_license
demirramazan/OCP8
1b91d52c98dbf28946dddb87798be8af7a4db0c6
ec21bd4c0afba467f1e6084756a090b04a5ffbc8
refs/heads/master
2020-03-29T02:08:29.972513
2018-06-16T19:19:30
2018-06-16T19:19:30
149,422,202
1
0
null
2018-09-19T09:01:23
2018-09-19T09:01:22
null
UTF-8
Java
false
false
614
java
package chapter11._12.stream; import java.util.Arrays; class StringConcatenator2 { public static String result = ""; public static void concatStr(String str) { result = result + " " + str; } } class Test04StringSplitAndConcatenateParallel { public static void main(String[] args) { String words[] = "the quick brown fox jumps over the lazy dog".split(" "); Arrays.stream(words).parallel().forEach(StringConcatenator2::concatStr); System.out.println(StringConcatenator2.result); // When the stream is parallel, the task is split into multiple // sub-tasks and different threads execute it. } }
[ "erguder.levent@gmail.com" ]
erguder.levent@gmail.com
9c8f58228c716f0efd48632341055df4754513cb
eb1c79d4d2f904bacc75c5d8b7fd6725e8997a74
/8.Inheritance/Inh12.java
26ac9e08b03118f6f23a99dfe7ca605d8d886f31
[]
no_license
ashbora/Java-programs
ac9974691fa8a257f75c48ea585abee299cbc10e
151cf1269c6d674db6e0e86ca2a28445783657fc
refs/heads/master
2023-07-04T09:06:02.971685
2021-08-08T16:59:54
2021-08-08T16:59:54
390,077,431
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
/* use of final method */ class First { final void show() //final method { System.out.println("Inside class First show method"); } } class Second extends First { void show() //method overriding-Error - can not override final method { System.out.println("Inside class Second show method");} } class Inh12 { public static void main(String [] args) { Second s = new Second(); s.show(); } }
[ "ashwinibora28@gmail.com" ]
ashwinibora28@gmail.com
0481a159089b437b15740ede5fff6bb32cfcd6e0
c096a1bd8c8d895e11455f2cf1ac3d13ac19340c
/Robot2815/src/edu/wpi/first/wpilibj/subsystems/DriveTrain.java
b8a81afd7b574bd1bd0f8adb4e6592d5c47551cf
[]
no_license
ulmentflam/Robot2815
73f5d45680322c3401f416748d7afa73674cf06e
20ce82550e171f423a89c371b392ee7d36cf33c8
refs/heads/master
2021-05-27T09:49:53.591275
2014-09-04T21:22:14
2014-09-04T21:22:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,481
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package edu.wpi.first.wpilibj.subsystems; import edu.wpi.first.wpilibj.Jaguar; import edu.wpi.first.wpilibj.RobotMap; import edu.wpi.first.wpilibj.command.Subsystem; /** * * @author stefan.singer */ public class DriveTrain extends Subsystem { private Jaguar leftMotor[] = {new Jaguar(RobotMap.leftMotor[0]), new Jaguar(RobotMap.leftMotor[1])}; private Jaguar rightMotor[] = {new Jaguar(RobotMap.rightMotor[0]), new Jaguar(RobotMap.rightMotor[1])}; private double rTarget; private double lTarget; private double leftSpeed; private double rightSpeed; private final double ACCELERATION = .1; protected void initDefaultCommand() { } public void drive(double leftSpeed, double rightSpeed) { for (int i = 0; i < leftMotor.length; i++) { leftMotor[i].set(leftSpeed);// fix for } for (int i = 0; i < rightMotor.length; i++) { rightMotor[i].set(rightSpeed); } } public void tankDrive(double lStick, double rStick){ this.drive(lStick,rStick); } public void arcadeDrive(double xAxis, double yAxis) { if (Math.abs(yAxis) < .01) { yAxis = 0; } lTarget = yAxis * Math.abs(yAxis) + xAxis * Math.abs(xAxis) * xAxis; rTarget = yAxis * Math.abs(yAxis) - xAxis * Math.abs(xAxis) * xAxis; if (leftSpeed != lTarget) { if (leftSpeed < lTarget) { leftSpeed += ACCELERATION; if (leftSpeed > lTarget) { leftSpeed = lTarget; } } else { leftSpeed -= ACCELERATION; if (leftSpeed < lTarget) { leftSpeed = lTarget; } } } if (rightSpeed != rTarget) { if (rightSpeed < rTarget) { rightSpeed += ACCELERATION; if (rightSpeed > rTarget) { rightSpeed = rTarget; } } else { rightSpeed -= ACCELERATION; if (rightSpeed < rTarget) { rightSpeed = rTarget; } } } if (rightSpeed != 0) { rightSpeed += .03; } this.drive(leftSpeed, rightSpeed); } }
[ "stefan.singer@HDRETDG41KZL1.richlandone.local" ]
stefan.singer@HDRETDG41KZL1.richlandone.local
efd483c657cb25bb372ddee52f7cec8c54694f4c
b6fa0e7a960a94b33f0d1c05d26f70e5f4e3539d
/Lab29SecondSmallestNumberOfArray.java
328821aaa67ed5001c17cb783ea530f039389d57
[]
no_license
Khatri-Sanjay/JavaLabPractical
5f22c0b1a5a80fa66131b95f2ff7d56ff808d46d
e49c0cef0302c5219e95d48dfa8a36f96a997c7d
refs/heads/main
2023-08-25T16:28:34.826618
2021-10-29T14:50:39
2021-10-29T14:50:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package JavaLab; public class Lab29SecondSmallestNumberOfArray { public static void main(String[] args) { int [] array = {1,2,3,4,5}; int size = array.length; int temp; // System.out.println(size); System.out.println("Given array elements are:"); for(int i = 0; i<size; i++) { System.out.println(array[i]); } for(int i = 0; i < size; i++) { for(int j=i+1;j<size;j++) { if(array[i]<array[j]) { temp = array[i]; array[i]= array[j]; array[j]= temp; } } } System.out.println("Smallest number in given array is:"+(array[size-2])); } }
[ "www.khatrisanjay@gmail.com" ]
www.khatrisanjay@gmail.com
735f69cc3f1bdd4b401db59adf835de2ecf43974
ff2ee4bd421c3a319243a6485837be06fd1bb555
/src/main/java/io/security/corespringsecurity/controller/admin/AdminController.java
df53bc7d1556d70634446d1e4735458f0762aa1a
[]
no_license
Sanggoe/corespringsecurity
b2352a971847f5f58aebd0d740859a7009943fde
8f7dd7484562d2f8f38cf4f8455aba7d9ea7f978
refs/heads/master
2023-05-24T07:19:47.778843
2021-06-10T14:06:44
2021-06-10T14:06:44
363,134,661
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
package io.security.corespringsecurity.controller.admin; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller public class AdminController { @GetMapping(value = "/admin") public String home() { return "admin/home"; } }
[ "sanggoe0509@gmail.com" ]
sanggoe0509@gmail.com
50be5f7ff1d07287cfba25ccf86642c85340c7c3
758c673202689cccdcccccd413d9e4054015c989
/src/main/java/com/bloidonia/vertx/mods/SilentCloser.java
84120536ba73f05dc9224bc9071d631c3631bb2c
[ "Apache-2.0" ]
permissive
timyates/mod-jdbc-persistor
d34b00c5ac971ce7ee8ea8d2101f429f64c52728
b9b5d1c634d504d18dc07691ef4704b2032c79b4
refs/heads/master
2021-01-15T13:18:07.613513
2015-07-07T20:24:39
2015-07-07T20:24:39
5,111,715
6
6
null
2015-06-02T21:26:51
2012-07-19T15:22:36
Java
UTF-8
Java
false
false
1,660
java
/* * Copyright 2012-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bloidonia.vertx.mods ; import java.sql.Connection ; import java.sql.PreparedStatement ; import java.sql.ResultSet ; import java.sql.SQLException ; import java.sql.Statement ; import org.vertx.java.core.logging.Logger; public class SilentCloser { public static void close( Connection conn ) { close( conn, null, null ) ; } public static void close( Statement stmt ) { close( null, stmt, null ) ; } public static void close( ResultSet rslt ) { close( null, null, rslt ) ; } public static void close( Connection conn, Statement stmt ) { close( conn, stmt, null ) ; } public static void close( Statement stmt, ResultSet rslt ) { close( null, stmt, rslt ) ; } public static void close( Connection conn, Statement stmt, ResultSet rslt ) { try { if( rslt != null ) rslt.close() ; } catch( SQLException ex ) {} try { if( stmt != null ) stmt.close() ; } catch( SQLException ex ) {} try { if( conn != null ) conn.close() ; } catch( SQLException ex ) {} } }
[ "tim.yates@gmail.com" ]
tim.yates@gmail.com
23821a97592af0e32585e9eef13a6d2ce94660dc
2e0a81c14cf14e25a2adfcab6bf2ef071c3dc077
/sem3/hw3/Cannon/src/main/java/com/anton/chernikov/g244/Main.java
b8225267891c87947f3ff91e7d8cdb419632d031
[]
no_license
AntonChern/SpbuHW
dbe642586dc40627a05c7e7222fb413d20897754
f0c7b503cfbb16122dc990a39ece3ed89dcea610
refs/heads/master
2021-07-14T22:55:37.376856
2020-06-06T09:03:28
2020-06-06T09:03:28
150,789,543
0
0
null
2020-06-06T09:03:29
2018-09-28T20:06:57
Java
UTF-8
Java
false
false
3,795
java
package com.anton.chernikov.g244; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.stage.Stage; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; public class Main extends Application { private HashMap<KeyCode, Boolean> keys = new HashMap<>(); private Pane window = new Pane(); private Cannon cannon; private ArrayList<Ball> balls = new ArrayList<>(); private LandscapeGenerator generator = new LandscapeGenerator(); /** Updates the information */ public void update() { for (Iterator<Ball> iterator = balls.iterator(); iterator.hasNext(); ) { Ball ball = iterator.next(); ball.push(); if ((ball.getTranslateY() + Const.ballLandShiftY) >= generator.getCoordinate(ball.getTranslateX() + Const.ballLandShiftX)) { window.getChildren().removeAll(ball); iterator.remove(); } } if (isPressed(KeyCode.RIGHT)) { cannon.push(Const.motionSpeed, generator); } if (isPressed(KeyCode.LEFT)) { cannon.push(- Const.motionSpeed, generator); } if (isPressed(KeyCode.UP)) { cannon.rotate(- Const.rotationSpeed); } if (isPressed(KeyCode.DOWN)) { cannon.rotate(Const.rotationSpeed); } if (isPressed(KeyCode.ENTER)) { keys.put(KeyCode.ENTER, false); Ball newBall = new Ball(cannon.getRotation(), (int)(cannon.getTranslateX() + Const.ballShiftX - Const.ballExtraShiftX * cannon.getScaleX()), (int)cannon.getTranslateY(), (int)cannon.getScaleX()); window.getChildren().add(newBall); balls.add(newBall); } } /** Checks key for pressing */ public boolean isPressed(KeyCode key) { return keys.getOrDefault(key, false); } @Override public void start(Stage primaryStage) throws Exception { window.setPrefSize(Const.windowWidth, Const.windowHeight); ImageView skyTexture = new ImageView(new Image(getClass().getClassLoader().getResourceAsStream("sky.png"))); window.getChildren().add(skyTexture); Canvas canvas = new Canvas(Const.windowWidth, Const.windowHeight); GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setStroke(Color.GREEN); gc.setLineWidth(2); for (int i = 0; i < Const.windowWidth; i++) { gc.strokeLine(i + 1, generator.getCoordinate(i + 1), i + 1, Const.windowHeight); } window.getChildren().add(canvas); cannon = new Cannon(); cannon.setTranslateX(Const.windowWidth / 2 - Const.cannonShiftX - Const.cannonExtraShiftX * cannon.getScaleX()); cannon.setTranslateY(generator.getCoordinate(Const.windowWidth / 2) - Const.cannonShiftY); window.getChildren().add(cannon); Scene scene = new Scene(window); scene.setOnKeyPressed(event -> keys.put(event.getCode(), true)); scene.setOnKeyReleased(event -> keys.put(event.getCode(), false)); AnimationTimer timer = new AnimationTimer() { @Override public void handle(long now) { update(); } }; timer.start(); primaryStage.setTitle("Cannon"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
[ "anton_chernikov1@list.ru" ]
anton_chernikov1@list.ru
173a5a0fbb99baee3c7bb7f3b6cc8cff545dbcc2
d521e1ae6ce0d8a287816a5097982f81c405091b
/app/src/main/java/com/example/routes/data/model/UserData.java
8161b86580671da35e52081aca1f0f7f8bb1ead7
[]
no_license
Sohan083/Routes
b7d8e3cb8bfe3975f38feb811af2abc2538bf7f6
784dd56df62f2cb9ffa0e30b41e8eb378ffa186d
refs/heads/master
2022-12-28T19:13:24.701139
2020-10-17T17:14:23
2020-10-17T17:14:23
304,109,547
0
0
null
null
null
null
UTF-8
Java
false
false
1,566
java
package com.example.routes.data.model; import android.content.SharedPreferences; public class UserData { private static UserData userData; String name ="", id = "", team = "", area = "", todayCount = "", totalCount = ""; public static UserData getInstance() { if(userData == null) { userData = new UserData(); } return userData; } public UserData(){}; public static UserData creatUser(String name, String id) { if(userData == null) { userData = new UserData(name,id); } return userData; } public UserData(String name, String id) { this.name = name; this.id = id; } public String getArea() { return area; } public void setArea(String area) { this.area = area; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTeam() { return team; } public String getTodayCount() { return todayCount; } public String getTotalCount() { return totalCount; } public void setTeam(String team) { this.team = team; } public void setTodayCount(String todayCount) { this.todayCount = todayCount; } public void setTotalCount(String totalCount) { this.totalCount = totalCount; } }
[ "srs1059@gmail.com" ]
srs1059@gmail.com
df90aadef78de77b0508d592a6e0970778094060
59a2a6fbb63bc12929ba32f8049c649ac9d399a6
/Italiana.java
f93e6601900e2434ae2d0064f489feb038dc7c6b
[]
no_license
Samir-Carvalho/AtividadeCozinhaSquadra
e90297820d478227da75918a956bf2a82547efb0
c14428940264b5dc529d9934d1d8b9d9fe1be765
refs/heads/main
2023-03-26T23:19:02.040191
2021-03-30T21:05:06
2021-03-30T21:05:06
352,998,309
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
//package atividadecozinha; /** * * @author samir */ public class Italiana extends Ingredientes{ public Italiana(String nomeIngrediente, String dataValidade) { super(nomeIngrediente, dataValidade); } @Override public String tipoDaCozinha() { return "Cozinha Italiana"; } }
[ "samircarvalho00@gmail.com" ]
samircarvalho00@gmail.com
797ee5eaca66f14c2e3529111f9d1f5407d158a5
f252571a7d36cc82d302f79b1f04842111b1afcd
/oscafe-cms/oscafe-cms-dao/src/main/java/com/liwy/oscafe/cms/dao/model/Channel.java
a39a31ac1ece68e40feae43b3f3c568fafde4850
[ "Apache-2.0" ]
permissive
liwyspace/liwy-oscafe
0b086dbf0d9b43b5b0e200f473cef35779cb8fdf
e6a0988b3a49c7edccf672909cef9b372817b8ff
refs/heads/master
2022-12-23T00:25:49.497045
2019-07-15T02:19:06
2019-07-15T02:19:06
90,881,450
2
0
Apache-2.0
2022-12-16T11:12:49
2017-05-10T15:44:31
Java
UTF-8
Java
false
false
4,555
java
/* * Copy Right LIWY * http://www.oscafe.net * 2019-06-29 23:42:05 */ package com.liwy.oscafe.cms.dao.model; import java.util.Date; /** * 栏目表实体类 * * @table cms_channel * @author liwy * @date 2019-06-29 23:42:05 */ public class Channel { /** * 栏目ID * * column: id */ private Integer id; /** * 父栏目ID * * column: pid */ private Integer pid; /** * 名称 * * column: name */ private String name; /** * 排序 * * column: orders */ private Integer orders; /** * 创建时间 * * column: create_time */ private Date createTime; /** * 修改时间 * * column: update_time */ private Date updateTime; /** * 是否删除 * * column: is_delete */ private Byte isDelete; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getPid() { return pid; } public void setPid(Integer pid) { this.pid = pid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getOrders() { return orders; } public void setOrders(Integer orders) { this.orders = orders; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Byte getIsDelete() { return isDelete; } public void setIsDelete(Byte isDelete) { this.isDelete = isDelete; } /** * * * @return java.lang.String */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", pid=").append(pid); sb.append(", name=").append(name); sb.append(", orders=").append(orders); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); sb.append(", isDelete=").append(isDelete); sb.append("]"); return sb.toString(); } /** * * * @param that * @return boolean */ @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } Channel other = (Channel) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getPid() == null ? other.getPid() == null : this.getPid().equals(other.getPid())) && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) && (this.getOrders() == null ? other.getOrders() == null : this.getOrders().equals(other.getOrders())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete())); } /** * * * @return int */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode()); return result; } }
[ "liwy02@missfresh.cn" ]
liwy02@missfresh.cn
33c6e77b243c49f37c5cf6d8a4f110e167140476
6be39fc2c882d0b9269f1530e0650fd3717df493
/weixin反编译/sources/com/tencent/mm/f/a/u.java
d9622f6b473b2326255ff2d512fc6c58ac5807a7
[]
no_license
sir-deng/res
f1819af90b366e8326bf23d1b2f1074dfe33848f
3cf9b044e1f4744350e5e89648d27247c9dc9877
refs/heads/master
2022-06-11T21:54:36.725180
2020-05-07T06:03:23
2020-05-07T06:03:23
155,177,067
5
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.tencent.mm.f.a; import com.tencent.mm.sdk.b.b; public final class u extends b { public a foF; public static final class a { public int mode; } public u() { this((byte) 0); } private u(byte b) { this.foF = new a(); this.xmE = false; this.frD = null; } }
[ "denghailong@vargo.com.cn" ]
denghailong@vargo.com.cn
e485bbcada7f94cdb81d803ffad5d5abb91ad44f
c98b3a71f6b143b7ead59baa2d15acd0d4a73986
/day20/src/main/java/com/example/day20/MainActivity.java
e05160985eb5fe070cff420511d4fef93e5b8228
[]
no_license
Zhangxin0312/Zhang
18d7f8f12c37771c0aa5c87487a23f7b543fdb7f
e481836c0cbbb30ac16f6489e11e2eead0ed18ca
refs/heads/master
2020-04-28T08:30:02.619414
2019-04-05T06:24:07
2019-04-05T06:24:07
175,129,552
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package com.example.day20; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; public class MainActivity extends AppCompatActivity { MyLinearView myLinear; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myLinear=findViewById(R.id.myLinear); } public void getNum(String name){ Intent intent=new Intent(MainActivity.this,TwoActivity.class); startActivity(intent); } }
[ "1607742461@qq.com" ]
1607742461@qq.com
bb192c409fc1fd21192ca022b84a31ece88a00ce
27a94236ec935acedc67547e077297844111a3df
/src/p20210129/p01_decorator_model/ShapeDecorator.java
2ddf68f691bb790d35023a796cc6f1a3a23e2800
[]
no_license
github50673488/javastudy
c91b6bf26fcb82a11ba81e48d0d6dade552041ad
311d830fe929d6fdb632a403d469d145739c3a6e
refs/heads/main
2023-03-08T16:55:28.816945
2021-02-10T01:14:49
2021-02-10T01:14:49
337,582,356
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package p20210129.p01_decorator_model; public abstract class ShapeDecorator implements Shape { protected Shape decoratedShape; public ShapeDecorator(Shape decoratedShape){ this.decoratedShape = decoratedShape; } public void draw(){ decoratedShape.draw(); } }
[ "gj.liu@sj-sol.com" ]
gj.liu@sj-sol.com
94d739a913a981a455fb18f335c50ab0a0b807ef
cd618d2b471a3ed7e240f72645c1f0278e02713d
/Blog/src/dao/CategoryDao.java
d8cb17918bce0e3171b71841bca40edbaefc2aec
[]
no_license
Ning2018/Blog
2d8408ea247a391d58d38e3e8330d5fe0fc6ba2f
7876e15e3b5ee159e4a74089fb141d432c8abfad
refs/heads/master
2020-04-03T11:44:25.423324
2018-10-29T15:16:02
2018-10-29T15:16:02
155,230,422
0
0
null
null
null
null
UTF-8
Java
false
false
48
java
package dao; public interface CategoryDao { }
[ "3352496347@qq.com" ]
3352496347@qq.com
71f46715d2680b52ce731f8ffd91d2a75afa7cb8
301e3b08a9aa5870b487c24c99d34a175c28297b
/test_p29/src/test_p29/Sample4_10.java
ebcb9307be18d19f9da7411c53b4394e99f405d4
[]
no_license
107360128/JavaHW12-3
10a864711f922c9e5a30e68d325d605469d4226d
195eaf5df235b3fa67ee74bfad765975a1483d18
refs/heads/master
2023-01-24T04:38:10.595299
2020-12-03T11:41:28
2020-12-03T11:41:28
318,173,925
0
0
null
null
null
null
UTF-8
Java
false
false
1,037
java
package test_p29; public class Sample4_10 { public static void main(String[]args) { Vehicle[] vc = new Vehicle[2]; vc[0] = new Car(1234, 20.5); vc[0].setSpeed(60); vc[1] = new Plane(232); vc[1].setSpeed(500); for (int i=0; i<vc.length;i++) { vc[i].show(); } } } abstract class Vehicle { protected int speed; public void setSpeed(int s) { speed =s; System.out.println("將速度設為"+speed+"了"); } abstract void show(); } class Car extends Vehicle { private int num; private double gas; public Car (int n, double g) { num = n; gas = g; System.out.println("生產了車號為"+num+"汽油量為"+gas+"的車子"); } public void show() { System.out.println("車號是"+num); System.out.println("汽油量是"+gas); System.out.println("速度是"+speed); } } class Plane extends Vehicle { private int flight; public Plane(int f) { flight = f; System.out.println("生産了"+flight+"班次的飛樣"); } public void show() { System.out.println("飛機的班次是"+flight); System.out.println("速度是"+speed); } }
[ "damondamon86@gmail.com" ]
damondamon86@gmail.com
b55167754bf5f3bae7f22c5e4acab7e072d51034
dbbde0b13c3b6f8e432b74cf3fbfb934b81c0b30
/JAVA/商城聊天机器人/商城聊天机器人/src/main/java/com/xmu/mall/goodsmgt/wcf/service/BrandServiceImp.java
7331e94d5054602c0b63563c6c90414c93b6090b
[]
no_license
JunhuiJiang/MyCode
0a428133806085f3c11db196f84d4e9db560be7e
770aa75a0481b83b39d79be8ce2bb61dab74a36e
refs/heads/master
2020-06-05T00:57:11.146652
2018-10-26T03:11:49
2018-10-26T03:11:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,347
java
package com.xmu.mall.goodsmgt.wcf.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.xmu.mall.goodsmgt.wcf.mapper.BrandMapper; import com.xmu.mall.goodsmgt.wcf.model.Brand; /** *@author created by ����� *@date 2017��5��31��--����1:44:37 */ @Transactional @Service("wcf_BrandService") public class BrandServiceImp implements BrandService{ @Autowired private BrandMapper brandMapper; public BrandServiceImp() { System.out.println("BrandServiceImp"); } public List<Brand> getBrandList() { // TODO Auto-generated method stub //System.out.println(this.brandMapper.getBrandList()); return this.brandMapper.getBrandList(); } public boolean addBrand(Brand brand) { // TODO Auto-generated method stub return this.brandMapper.addBrand(brand); } public boolean deleteBrandById(long id) { // TODO Auto-generated method stub return this.brandMapper.deleteBrandById(id); } public Brand getBrandById(long id) { // TODO Auto-generated method stub return this.brandMapper.getBrandById(id); } public boolean updateBrand(Brand brand) { // TODO Auto-generated method stub return this.brandMapper.updateBrand(brand); } }
[ "280298985@qq.com" ]
280298985@qq.com
22e9c510517a9c37d5cdf96d530b351ac298ca88
38e5773b5edd8b9ceaafab0bb0abf11dc4097fd0
/sql-parser/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleDropIndexTypeStatement.java
650099f5fda0d3203e67bd4ce572e0c048759a0d
[ "Apache-2.0" ]
permissive
cjdxhjj/sharding-jdbc
f2eac2193a89fe389e04239c7c12f4ce2c6bcf3e
05a88dc658d47f9f89cd2a948ffb9ccfeefef40d
refs/heads/master
2022-11-13T06:46:02.096003
2022-10-29T06:30:42
2022-10-29T06:30:42
61,268,353
1
0
null
2016-06-16T06:35:10
2016-06-16T06:35:09
null
UTF-8
Java
false
false
1,266
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.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl; import lombok.ToString; import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement; /** * Oracle drop index type statement. */ @ToString(callSuper = true) public final class OracleDropIndexTypeStatement extends AbstractSQLStatement implements OracleStatement { }
[ "noreply@github.com" ]
noreply@github.com
c7f636ed46499e4f49b1d311ece2b9c99d02010f
90c0f9493407a8fd598d347d6f38e8569d6e8a24
/Hamka/src/Model/MoveValidation.java
c3bac067e11cd7616bd311ea9eb8bd8cb3833a01
[]
no_license
Rawige98/-Hamka---Damka-Game
f4acf931d84730bcc91602033337bca6a00aadbb
b1c9c07405ac80c0f31a454a5ea2ae69615eb4f6
refs/heads/main
2023-03-13T00:31:40.715224
2021-03-02T08:27:54
2021-03-02T08:27:54
307,367,891
0
0
null
null
null
null
UTF-8
Java
false
false
10,815
java
package Model; import java.awt.Point; import Utils.Consts; public class MoveValidation { private int xStart; private int xEnd; private int yStart; private int yEnd; private boolean finish; private ValidateDistance vDistance; private ValidateID vID; private SkipValidation vSkip; private int direction; private Board myBoard; private boolean isP1; public MoveValidation(int xStart, int xEnd, int yStart, int yEnd, Board myBoard, boolean isP1, boolean finish) { super(); this.xStart = xStart; this.xEnd = xEnd; this.yStart = yStart; this.yEnd = yEnd; this.finish = finish; this.myBoard = myBoard; this.isP1 = isP1; vID = new ValidateID(xStart, xEnd, yStart, yEnd, myBoard, isP1, finish); vSkip = new SkipValidation(xStart, xEnd, yStart, yEnd, myBoard, isP1); vDistance = new ValidateDistance(xStart, xEnd, yStart, yEnd, myBoard, isP1); direction = Direction(); } /** * Determines if the specified move is valid based on the rules of checkers. * * @param isP1Turn the flag indicating if it is player 1's turn. * @param startIndex the start index of the move. * @param endIndex the end index of the move. * @return true if the move is legal according to the rules of checkers. */ public boolean moveValidation() { if (toIndex(xStart, yStart) == -1 || toIndex(xEnd, yEnd) == -1) { if (finish) return false; System.out.println("you cant move to white Tile"); return false; } if (toIndex(xStart, yStart) == toIndex(xEnd, yEnd)) { if (finish) return false; System.out.println("you insert the same coordinates"); return false; } if (toIndex(xStart, yStart) < 0 || toIndex(xStart, yStart) > 31 || toIndex(xEnd, yEnd) < 0 || toIndex(xEnd, yEnd) > 31) { if (finish) return false; System.out.println("illegal coordinates"); return false; } if (!vID.validateIDs()) { if (finish) return false; System.out.println("ValidID"); return false; } if (!vDistance.validateDistance()) { if (finish) return false; System.out.println("validDistnace"); return false; } if (!vSkip.skipValidation()) { if (finish) return false; System.out.println("validSkip"); return false; } return true; } /** * Converts a point to an index of a black tile on the checker board, such that * (1, 0) is index 0, (3, 0) is index 1, ... (7, 7) is index 31. * * @param x the x-coordinate on the board (from 0 to 7 inclusive). * @param y the y-coordinate on the board (from 0 to 7 inclusive). * @return the index of the black tile or -1 if the point is not a black tile. * @see {@link #toIndex(Point)}, {@link #toPoint(int)} */ public static int toIndex(int x, int y) { // Invalid (x, y) (i.e. not in board, or white tile) if (!MoveValidation.isValidPoint(x, y)) { return -1; } return x * 4 + y / 2; } /** * Checks if a point corresponds to a black tile on the checker board. * * @param testPoint the point to check. * @return true if and only if the point is on the board, specifically on a * black tile. */ public static boolean isValidPoint(int x, int y) { // Check that it is on the board if (x < 0 || x > Consts.COLS - 1 || y < 0 || y > Consts.COLS - 1) { return false; } // Check that it is on a black tile if (x % 2 == y % 2) { return false; } return true; } public int getDirectionNum() { return direction; } public int Direction() { direction = 0; int d1 = 0, d2 = 0, d3 = 0; int dx = xEnd - xStart; int dy = yEnd - yStart; int i = xStart, j = yStart; int c = 0; // check if the road to the target is clear int r = 0; if ((Math.abs(dx) == Math.abs(dy)) && (Math.abs(dx) + Math.abs(dy) == 8) && myBoard.getMyBoard()[yStart][xStart].isQueen()) { while ((i != xEnd && j != yEnd) && r != 20) { r++; if (Math.abs(dx) == Math.abs(dy)) { if (dx > 0 && dy > 0) { i++; j++; } if (dx < 0 && dy > 0) { i--; j++; } if (dx > 0 && dy < 0) { j--; i++; } if (dx < 0 && dy < 0) { i--; j--; } } else { if (Math.abs(dx) + Math.abs(dy) == 8) { if (i != 0 && i != 7) { if (dx > 0 && dy > 0) { i++; j--; } if (dx < 0 && dy > 0) { i--; j--; } if (dx > 0 && dy < 0) { j++; i++; } if (dx < 0 && dy < 0) { i--; j++; } } else { if (dx > 0 && dy > 0) { i--; j++; } if (dx < 0 && dy > 0) { j++; i++; } if (dx > 0 && dy < 0) { i--; j--; } if (dx < 0 && dy < 0) { i++; j--; } } } } if (i == -1) i = 7; if (i == 8) i = 0; if (j == -1) j = 7; if (j == 8) j = 0; dy = yEnd - j; dx = xEnd - i; if ((!isP1 && (myBoard.getMyBoard()[j][i] instanceof WhiteSoldier) || isP1 && (myBoard.getMyBoard()[j][i] instanceof BlackSoldier))) { c++; } } if (c == 1) { d1 = 1; } dx = xEnd - xStart; dy = yEnd - yStart; i = xStart; j = yStart; c = 0; // check if the road to the target is clear r = 0; while ((i != xEnd && j != yEnd) && r != 20) { r++; if (Math.abs(dx) + Math.abs(dy) == 8) { if (i != 0 && i != 7) { if (dx > 0 && dy > 0) { i++; j--; } if (dx < 0 && dy > 0) { i--; j--; } if (dx > 0 && dy < 0) { j++; i++; } if (dx < 0 && dy < 0) { i--; j++; } } else { if (dx > 0 && dy > 0) { i--; j++; } if (dx < 0 && dy > 0) { j++; i++; } if (dx > 0 && dy < 0) { i--; j--; } if (dx < 0 && dy < 0) { i++; j--; } } } else if (Math.abs(dx) == Math.abs(dy)) { if (dx > 0 && dy > 0) { i++; j++; } if (dx < 0 && dy > 0) { i--; j++; } if (dx > 0 && dy < 0) { j--; i++; } if (dx < 0 && dy < 0) { i--; j--; } } if (i == -1) i = 7; if (i == 8) i = 0; if (j == -1) j = 7; if (j == 8) j = 0; dy = yEnd - j; dx = xEnd - i; if ((!isP1 && (myBoard.getMyBoard()[j][i] instanceof WhiteSoldier) || isP1 && (myBoard.getMyBoard()[j][i] instanceof BlackSoldier))) { c++; } } if (c == 1) d2 = 2; dx = xEnd - xStart; dy = yEnd - yStart; i = xStart; j = yStart; c = 0; // check if the road to the target is clear r = 0; while ((i != xEnd && j != yEnd) && r != 20) { r++; if (Math.abs(dx) + Math.abs(dy) == 8) { if (dx > 0 && dy > 0) { i--; j++; } if (dx < 0 && dy > 0) { j++; i++; } if (dx > 0 && dy < 0) { i--; j--; } if (dx < 0 && dy < 0) { i++; j--; } } else if (Math.abs(dx) == Math.abs(dy)) { if (dx > 0 && dy > 0) { i++; j++; } if (dx < 0 && dy > 0) { i--; j++; } if (dx > 0 && dy < 0) { j--; i++; } if (dx < 0 && dy < 0) { i--; j--; } } if (i == -1) i = 7; if (i == 8) i = 0; if (j == -1) j = 7; if (j == 8) j = 0; dy = yEnd - j; dx = xEnd - i; if ((!isP1 && (myBoard.getMyBoard()[j][i] instanceof WhiteSoldier) || isP1 && (myBoard.getMyBoard()[j][i] instanceof BlackSoldier))) { c++; } } if (c == 1) d3 = 3; // System.out.println("d1 :"+d1+" d2 :"+d2+" d3 :"+d3+" rows"+xStart); if (d1 != 0) { direction = d1; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation() && thisIsSkip()) { return direction; } direction = 0; } if (d2 != 0) { direction = d2; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation() && thisIsSkip()) { return direction; } direction = 0; } if (d3 != 0) { direction = d3; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation() && thisIsSkip()) { return direction; } } if (d1 != 0) { direction = d1; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation()) { return direction; } direction = 0; } if (d2 != 0) { direction = d2; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation()) { return direction; } direction = 0; } if (d3 != 0) { direction = d3; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); if (moveValidation()) { return direction; } direction = 0; vDistance.setDirectionNum(direction); vSkip.setDirectionnNum(direction); } } return direction; } private boolean thisIsSkip() { int dx = xEnd - xStart; int dy = yEnd - yStart; int i = xStart, j = yStart; boolean isSkip = false; // check if the road to the target is clear int c = 0, r = 0; int d=direction; boolean flag=d==3; while ((i != xEnd && j != yEnd) && r != 20) { r++; if (Math.abs(dx) == Math.abs(dy) && d != 2 && d != 3) { if (dx > 0 && dy > 0) { i++; j++; } if (dx < 0 && dy > 0) { i--; j++; } if (dx > 0 && dy < 0) { j--; i++; } if (dx < 0 && dy < 0) { i--; j--; } } else { if (Math.abs(dx) + Math.abs(dy) == 8) { if (i != 0 && i != 7 && d != 3&&flag!=true) { if (dx > 0 && dy > 0) { i++; j--; } if (dx < 0 && dy > 0) { i--; j--; } if (dx > 0 && dy < 0) { j++; i++; } if (dx < 0 && dy < 0) { i--; j++; } } else { if (dx > 0 && dy > 0) { i--; j++; } if (dx < 0 && dy > 0) { j++; i++; } if (dx > 0 && dy < 0) { i--; j--; } if (dx < 0 && dy < 0) { i++; j--; } } } } d=-1; if (i == -1) i = 7; if (i == 8) i = 0; if (j == -1) j = 7; if (j == 8) j = 0; dy = yEnd - j; dx = xEnd - i; if (!isP1 && (myBoard.getMyBoard()[j][i] instanceof WhiteSoldier) || isP1 && (myBoard.getMyBoard()[j][i] instanceof BlackSoldier)) { c++; isSkip = true; } } return isSkip && c == 1; } public int getDirectionnNum() { return direction; } public void setDirectionnNum(int directionnNum) { this.direction = directionnNum; } }
[ "69629529+nagwan192@users.noreply.github.com" ]
69629529+nagwan192@users.noreply.github.com
2a050a5e834f55fe7f4ae6cc5375df53e5209079
8eb9486e00433ec6c6e9857ca87c5ddaeae16b96
/zxing-client-core-extract/src/test/java/com/google/zxing/client/android/ExampleUnitTest.java
9b663d4fc863531ee96fd9d899ce94de5a363361
[]
no_license
woodyhi/zxing-android
6c1ec2e519a3643c77d41948fb7e0d6c3297b054
f9ea2339c8c7e773ebf9c34faff697ae07e20220
refs/heads/master
2021-05-02T12:54:17.966487
2019-02-26T03:06:42
2019-02-26T03:06:42
120,749,592
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.google.zxing.client.android; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "545329942@qq.com" ]
545329942@qq.com
a0043b3b87ca76b6c61edb448f21368cf9917707
b6026d7eab1c82f602d11954cfefa27933bf9803
/pet-clinic-web/src/main/java/guru/springframework/sfgpetclinic/controller/indexController.java
c55804f1691b7af0605adfb7cfa64b944e677a58
[]
no_license
RuslonPy/PetClinic
0e8ccd44235339148a36e36a326d70cc84a3366d
0d8030b0c7a33ab9c79d6fd9b186ae4c93cc52df
refs/heads/main
2023-04-11T01:49:41.517385
2021-04-28T11:24:34
2021-04-28T11:24:34
362,441,695
0
0
null
null
null
null
UTF-8
Java
false
false
478
java
package guru.springframework.sfgpetclinic.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class indexController { @RequestMapping({"", "/", "index", "index.html"}) public String index(Model model) { return "index"; } @RequestMapping("/oups") public String oupsHandler() { return "notimplemented"; } }
[ "bruslon2707@gmail.com" ]
bruslon2707@gmail.com
6164340cb72209b028788bfb6649352e133e31e1
a26e4ff1278d67c992485c421a51b82a54221e71
/rt-common/src/main/java/com/rt/common/utils/HtmlCleanEditor.java
c9284091f9d994a5e14d3ccecbc56f3f17935026
[]
no_license
502051565/dragonGame
639df5bf505cb195c227b9569cefa80fbc2c74b2
2f19cd9b9a8ef8add2405aafc60cfdcdb3695224
refs/heads/master
2022-09-21T09:06:39.958006
2019-08-16T06:27:00
2019-08-16T06:27:00
202,118,346
0
0
null
2022-09-01T23:11:34
2019-08-13T10:14:21
Java
UTF-8
Java
false
false
10,416
java
package com.rt.common.utils; import org.apache.commons.lang.StringUtils; import org.jsoup.Jsoup; import org.jsoup.safety.Whitelist; import java.beans.PropertyEditorSupport; public class HtmlCleanEditor extends PropertyEditorSupport { public static final Whitelist DEFAULT_WHITELIST = Whitelist.none(); public static final Whitelist RELAXED_WHITELIST; static { Whitelist relaxedWhitelist = new Whitelist(); relaxedWhitelist.addTags("a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "command", "datalist", "dd", "del", "details", "dir", "div", "dfn", "dialog", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "isindex", "kbd", "keygen", "label", "legend", "li", "link", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp"); relaxedWhitelist.addAttributes("a", "charset", "coords", "download", "href", "hreflang", "media", "name", "rel", "rev", "shape", "target", "type"); relaxedWhitelist.addAttributes("code", "object", "applet", "align", "alt", "archive", "codebase", "height", "hspace", "name", "vspace", "width"); relaxedWhitelist.addAttributes("area", "alt", "coords", "href", "nohref", "shape", "target"); relaxedWhitelist.addAttributes("audio", "autoplay", "controls", "loop", "muted", "preload", "src"); relaxedWhitelist.addAttributes("base", "href", "target"); relaxedWhitelist.addAttributes("basefont", "color", "face", "size"); relaxedWhitelist.addAttributes("bdi", "dir"); relaxedWhitelist.addAttributes("bdo", "dir"); relaxedWhitelist.addAttributes("blockquote", "cite"); relaxedWhitelist.addAttributes("body", "alink", "background", "bgcolor", "link", "text", "vlink"); relaxedWhitelist.addAttributes("button", "autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "type", "value"); relaxedWhitelist.addAttributes("canvas", "height", "width"); relaxedWhitelist.addAttributes("caption", "align"); relaxedWhitelist.addAttributes("col", "align", "char", "charoff", "span", "valign", "width"); relaxedWhitelist.addAttributes("colgroup", "align", "char", "charoff", "span", "valign", "width"); relaxedWhitelist.addAttributes("command", "checked", "disabled", "icon", "label", "radiogroup", "type"); relaxedWhitelist.addAttributes("del", "cite", "datetime"); relaxedWhitelist.addAttributes("details", "open"); relaxedWhitelist.addAttributes("dir", "compact"); relaxedWhitelist.addAttributes("div", "align"); relaxedWhitelist.addAttributes("dialog", "open"); relaxedWhitelist.addAttributes("embed", "height", "src", "type", "width"); relaxedWhitelist.addAttributes("fieldset", "disabled", "form", "name"); relaxedWhitelist.addAttributes("font", "color", "face", "size"); relaxedWhitelist.addAttributes("form", "accept", "accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"); relaxedWhitelist.addAttributes("frame", "frameborder", "longdesc", "marginheight", "marginwidth", "name", "noresize", "scrolling", "src"); relaxedWhitelist.addAttributes("frameset", "cols", "rows"); relaxedWhitelist.addAttributes("h1", "align"); relaxedWhitelist.addAttributes("h2", "align"); relaxedWhitelist.addAttributes("h3", "align"); relaxedWhitelist.addAttributes("h4", "align"); relaxedWhitelist.addAttributes("h5", "align"); relaxedWhitelist.addAttributes("h6", "align"); relaxedWhitelist.addAttributes("head", "profile"); relaxedWhitelist.addAttributes("hr", "align", "noshade", "size", "width"); relaxedWhitelist.addAttributes("html", "manifest", "xmlns"); relaxedWhitelist.addAttributes("iframe", "align", "frameborder", "height", "longdesc", "marginheight", "marginwidth", "name", "sandbox", "scrolling", "seamless", "src", "srcdoc", "width"); relaxedWhitelist.addAttributes("img", "alt", "src", "align", "border", "height", "hspace", "ismap", "longdesc", "usemap", "vspace", "width"); relaxedWhitelist.addAttributes("input", "accept", "align", "alt", "autocomplete", "autofocus", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "type", "value", "width"); relaxedWhitelist.addAttributes("ins", "cite", "datetime"); relaxedWhitelist.addAttributes("keygen", "autofocus", "challenge", "disabled", "form", "keytype", "name"); relaxedWhitelist.addAttributes("label", "for", "form"); relaxedWhitelist.addAttributes("legend", "align"); relaxedWhitelist.addAttributes("li", "type", "value"); relaxedWhitelist.addAttributes("link", "charset", "href", "hreflang", "media", "rel", "rev", "sizes", "target", "type"); relaxedWhitelist.addAttributes("map", "id", "name"); relaxedWhitelist.addAttributes("menu", "label", "type"); relaxedWhitelist.addAttributes("menuitem", "checked", "default", "disabled", "icon", "open", "label", "radiogroup", "type"); relaxedWhitelist.addAttributes("meta", "content", "http-equiv", "name", "scheme"); relaxedWhitelist.addAttributes("meter", "form", "high", "low", "max", "min", "optimum", "value"); relaxedWhitelist.addAttributes("object", "align", "archive", "border", "classid", "codebase", "codetype", "data", "declare", "form", "height", "hspace", "name", "standby", "type", "usemap", "vspace", "width"); relaxedWhitelist.addAttributes("ol", "compact", "reversed", "start", "type"); relaxedWhitelist.addAttributes("optgroup", "label", "disabled"); relaxedWhitelist.addAttributes("option", "disabled", "label", "selected", "value"); relaxedWhitelist.addAttributes("output", "for", "form", "name"); relaxedWhitelist.addAttributes("p", "align"); relaxedWhitelist.addAttributes("param", "name", "type", "value", "valuetype"); relaxedWhitelist.addAttributes("pre", "width"); relaxedWhitelist.addAttributes("progress", "max", "value"); relaxedWhitelist.addAttributes("q", "cite"); relaxedWhitelist.addAttributes("section", "cite"); relaxedWhitelist.addAttributes("select", "autofocus", "disabled", "form", "multiple", "name", "required", "size"); relaxedWhitelist.addAttributes("source", "media", "src", "type"); relaxedWhitelist.addAttributes("style", "type", "media"); relaxedWhitelist.addAttributes("table", "align", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "rules", "summary", "width"); relaxedWhitelist.addAttributes("tbody", "align", "char", "charoff", "valign"); relaxedWhitelist.addAttributes("td", "abbr", "align", "axis", "bgcolor", "char", "charoff", "colspan", "headers", "height", "nowrap", "rowspan", "scope", "valign", "width"); relaxedWhitelist.addAttributes("textarea", "autofocus", "cols", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "wrap"); relaxedWhitelist.addAttributes("tfoot", "align", "char", "charoff", "valign"); relaxedWhitelist.addAttributes("th", "abbr", "align", "axis", "bgcolor", "char", "charoff", "colspan", "headers", "height", "nowrap", "rowspan", "scope", "valign", "width"); relaxedWhitelist.addAttributes("thead", "align", "char", "charoff", "valign"); relaxedWhitelist.addAttributes("time", "datetime", "pubdate"); relaxedWhitelist.addAttributes("title", "dir", "lang", "xml:lang"); relaxedWhitelist.addAttributes("tr", "align", "bgcolor", "char", "charoff", "valign"); relaxedWhitelist.addAttributes("track", "default", "kind", "label", "src", "srclang"); relaxedWhitelist.addAttributes("ul", "compact", "type"); relaxedWhitelist.addAttributes("video", "autoplay", "controls", "height", "loop", "muted", "poster", "preload", "src", "width"); relaxedWhitelist.addAttributes(":all", "accesskey", "class", "contenteditable", "contextmenu", "data-*", "dir", "draggable", "dropzone", "hidden", "id", "lang", "spellcheck", "style", "tabindex", "title", "translate"); relaxedWhitelist.addProtocols("a", "href", "http", "https", "ftp", "mailto"); relaxedWhitelist.addProtocols("area", "href", "http", "https"); relaxedWhitelist.addProtocols("base", "href", "http", "https"); relaxedWhitelist.addProtocols("link", "href", "http", "https"); relaxedWhitelist.addProtocols("audio", "src", "http", "https"); relaxedWhitelist.addProtocols("embed", "src", "http", "https"); relaxedWhitelist.addProtocols("frame", "src", "http", "https"); relaxedWhitelist.addProtocols("iframe", "src", "http", "https"); relaxedWhitelist.addProtocols("img", "src", "http", "https"); relaxedWhitelist.addProtocols("input", "src", "http", "https"); relaxedWhitelist.addProtocols("source", "src", "http", "https"); relaxedWhitelist.addProtocols("track", "src", "http", "https"); relaxedWhitelist.addProtocols("video", "src", "http", "https"); relaxedWhitelist.addProtocols("body", "background", "http", "https"); RELAXED_WHITELIST = relaxedWhitelist; } private boolean trim; private boolean emptyAsNull; private Whitelist whitelist = DEFAULT_WHITELIST; public HtmlCleanEditor(boolean trim, boolean emptyAsNull) { this.trim = trim; this.emptyAsNull = emptyAsNull; } public HtmlCleanEditor(boolean trim, boolean emptyAsNull, Whitelist whitelist) { this.trim = trim; this.emptyAsNull = emptyAsNull; this.whitelist = whitelist; } @Override public String getAsText() { Object value = getValue(); return value != null ? value.toString() : StringUtils.EMPTY; } @Override public void setAsText(String text) { if (text != null) { String value = Jsoup.clean(text, whitelist); value = trim ? value.trim() : value; if (emptyAsNull && StringUtils.isEmpty(text)) { value = null; } setValue(value); } else { setValue(null); } } }
[ "502051565" ]
502051565
64d1ed372a10b87fc6cb8756746683c1b4db00c7
30acca1e5cc8f5ba677396745c250812b7595272
/src/main/java/com/example/dobri/SimpleEchoer/EchoerService.java
f2a6adf46e5498560df41c0a262060e7c4f92515
[]
no_license
DobrinTs/SimpleEchoer
e347c1cc661c7d313f23f7eb9a34fb85eb1af194
4d8e88c8db92854df19adacefa995cd3b3fe3044
refs/heads/master
2020-04-30T22:05:13.692098
2019-04-02T10:57:29
2019-04-02T10:57:29
177,109,740
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.example.dobri.SimpleEchoer; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; @Path("echo") @Produces(MediaType.APPLICATION_JSON) public class EchoerService { @GET @Path("/") public EchoMessage getEchoMessage(@Context HttpServletRequest request, @QueryParam("text") String text) { String user = request.getRemoteUser(); EchoMessage message = new EchoMessage(user, text); return message; } }
[ "i509199@c02t80lfgtdy.dhcp.sofl.sap.corp" ]
i509199@c02t80lfgtdy.dhcp.sofl.sap.corp
104db083da98be9a2639627db39d935deba6bd15
aa0b5ca75dcf4cee8a4f1b26310e536bb7c11dc0
/java/appoperation/src/test/java/com/example/appoperation/RocketMQTest.java
c2cd4b970d7fe9e9846ca89b0c4869824071a967
[]
no_license
asiafrank/learn
fc50267af2de743b75ef052aea448292bb8b6216
0c5098afa5a1b9e00aa68c9f93e594540e7a62dd
refs/heads/master
2022-10-21T18:28:33.829430
2021-03-04T03:05:27
2021-03-04T03:05:27
125,231,597
1
0
null
2022-10-12T20:27:35
2018-03-14T15:10:08
C++
UTF-8
Java
false
false
5,365
java
package com.example.appoperation; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.rocketmq.acl.common.AclClientRPCHook; import org.apache.rocketmq.acl.common.SessionCredentials; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.client.producer.LocalTransactionState; import org.apache.rocketmq.client.producer.TransactionListener; import org.apache.rocketmq.client.producer.TransactionMQProducer; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.MessageExt; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; import java.util.concurrent.TimeUnit; /** * RocketMQ 消息实验 * @author zhangxiaofan 2021/01/26-14:00 */ public class RocketMQTest { private static final Logger log = LoggerFactory.getLogger(RocketMQTest.class); private final String produceMqGroupName = "producer-group"; private final String consumeMqGroupName = "consumer-groups"; private final String rocketNameServerAddr = "10.0.0.1:9876;10.0.0.2:9876"; private final String rocketAccessKey = "accessKey"; private final String rocketSecretKey = "secretKey"; private final String topic = "my-mq-topic"; private final ObjectMapper mapper = new ObjectMapper(); @Test @Ignore public void produceMsg() throws JsonProcessingException, MQClientException, InterruptedException { AclClientRPCHook aclRpcHook = new AclClientRPCHook(new SessionCredentials(rocketAccessKey, rocketSecretKey)); TransactionMQProducer producer = new TransactionMQProducer(produceMqGroupName, aclRpcHook); producer.setNamesrvAddr(rocketNameServerAddr); producer.setTransactionListener(new TransactionListener() { @Override public LocalTransactionState executeLocalTransaction(Message msg, Object arg) { try { // do something log.info("execute local transaction"); return LocalTransactionState.COMMIT_MESSAGE; } catch (Exception e) { e.printStackTrace(); return LocalTransactionState.ROLLBACK_MESSAGE; } } @Override public LocalTransactionState checkLocalTransaction(MessageExt msg) { try { log.info("check local transaction"); return LocalTransactionState.COMMIT_MESSAGE; } catch (Exception e) { e.printStackTrace(); return LocalTransactionState.ROLLBACK_MESSAGE; } } }); producer.start(); log.info("producer started"); Msg m = new Msg(); m.setContent("Hello World"); byte[] msgBytes = mapper.writeValueAsBytes(m); Message msg = new Message(topic, "helloTag",msgBytes); producer.sendMessageInTransaction(msg, null); TimeUnit.MINUTES.sleep(30); producer.shutdown(); } @Test @Ignore public void consumeMsg() throws MQClientException, InterruptedException { AclClientRPCHook aclRpcHook = new AclClientRPCHook(new SessionCredentials(rocketAccessKey, rocketSecretKey)); // Instantiate with specified consumer group name. DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("", consumeMqGroupName, aclRpcHook); // Specify name server addresses. consumer.setNamesrvAddr(rocketNameServerAddr); // Subscribe one more more topics to consume. consumer.subscribe(topic, "*"); // Register callback to execute on arrival of messages fetched from brokers. consumer.registerMessageListener(new MessageListenerConcurrently() { @Override public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { try { for (MessageExt msg : msgs) { byte[] body = msg.getBody(); Msg m = mapper.readValue(body, Msg.class); log.info("msg tag:{}, content: {}", msg.getTags(), m.getContent()); } } catch (IOException e) { e.printStackTrace(); return ConsumeConcurrentlyStatus.RECONSUME_LATER; } return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; } }); //Launch the consumer instance. consumer.start(); log.info("consumer started"); TimeUnit.MINUTES.sleep(30); consumer.shutdown(); } public static class Msg { private String content; public String getContent() { return content; } public void setContent(String content) { this.content = content; } } }
[ "zhangxfdev@gmail.com" ]
zhangxfdev@gmail.com
3b5732cc9ac7408e42292867a61a102b5467bd62
1f47217ad740b03b5ca7c965a01788dee3c0fbf7
/JLibrary06/lib/XML/JAXB/jaxb/src/com/sun/xml/bind/api/package-info.java
864c4449e0133c42d80d356d5475c2baf1bf83f8
[]
no_license
amitabha66/JLibrary06
bee7fddca01188991af968a5678fe1d89dce7ee3
f19056cee7a88318315f9c25f8618aface8f0683
refs/heads/master
2021-01-19T07:03:19.133486
2016-06-23T16:41:59
2016-06-23T16:41:59
61,802,950
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
/** * <h1>Runtime API for the JAX-WS RI</h1>. * * This API is designed for the use by the JAX-WS RI runtime. The API is is subject to * change without notice. * * <p> * In an container environment, such as in J2SE/J2EE, if a new version with * a modified runtime API is loaded into a child class loader, it will still be bound * against the old runtime API in the base class loader. * * <p> * So the compatibility of this API has to be managed carefully. */ package com.sun.xml.bind.api;
[ "amitabha66@gmail.com" ]
amitabha66@gmail.com
a85a87b59fe95975198384887a4617478a07ef03
b9a51deb97fc6a2dffcc7f36f8aa121541fd1608
/src/main/java/org/docx4j/math/CTEqArrPr.java
74d9d95b398045c9fa4e8be057f585ab8da41e2f
[ "Apache-2.0" ]
permissive
vansuca/docx4j
c592ea04e5736edef46a4a3e7ffab84cbc0b206f
72d061bd2606b58b8de7b36d203b58232a552e49
refs/heads/master
2020-12-30T19:23:31.287757
2012-11-28T02:08:47
2012-11-28T02:08:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,432
java
/* * Copyright 2010-2012, Plutext Pty Ltd. * * This file is part of pptx4j, a component of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.docx4j.math; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jvnet.jaxb2_commons.ppp.Child; /** * <p>Java class for CT_EqArrPr complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="CT_EqArrPr"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="baseJc" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_YAlign" minOccurs="0"/> * &lt;element name="maxDist" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_OnOff" minOccurs="0"/> * &lt;element name="objDist" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_OnOff" minOccurs="0"/> * &lt;element name="rSpRule" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_SpacingRule" minOccurs="0"/> * &lt;element name="rSp" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_UnSignedInteger" minOccurs="0"/> * &lt;element name="ctrlPr" type="{http://schemas.openxmlformats.org/officeDocument/2006/math}CT_CtrlPr" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CT_EqArrPr", propOrder = { "baseJc", "maxDist", "objDist", "rSpRule", "rSp", "ctrlPr" }) public class CTEqArrPr implements Child { protected CTYAlign baseJc; protected CTOnOff maxDist; protected CTOnOff objDist; protected CTSpacingRule rSpRule; protected CTUnSignedInteger rSp; protected CTCtrlPr ctrlPr; @XmlTransient private Object parent; /** * Gets the value of the baseJc property. * * @return * possible object is * {@link CTYAlign } * */ public CTYAlign getBaseJc() { return baseJc; } /** * Sets the value of the baseJc property. * * @param value * allowed object is * {@link CTYAlign } * */ public void setBaseJc(CTYAlign value) { this.baseJc = value; } /** * Gets the value of the maxDist property. * * @return * possible object is * {@link CTOnOff } * */ public CTOnOff getMaxDist() { return maxDist; } /** * Sets the value of the maxDist property. * * @param value * allowed object is * {@link CTOnOff } * */ public void setMaxDist(CTOnOff value) { this.maxDist = value; } /** * Gets the value of the objDist property. * * @return * possible object is * {@link CTOnOff } * */ public CTOnOff getObjDist() { return objDist; } /** * Sets the value of the objDist property. * * @param value * allowed object is * {@link CTOnOff } * */ public void setObjDist(CTOnOff value) { this.objDist = value; } /** * Gets the value of the rSpRule property. * * @return * possible object is * {@link CTSpacingRule } * */ public CTSpacingRule getRSpRule() { return rSpRule; } /** * Sets the value of the rSpRule property. * * @param value * allowed object is * {@link CTSpacingRule } * */ public void setRSpRule(CTSpacingRule value) { this.rSpRule = value; } /** * Gets the value of the rSp property. * * @return * possible object is * {@link CTUnSignedInteger } * */ public CTUnSignedInteger getRSp() { return rSp; } /** * Sets the value of the rSp property. * * @param value * allowed object is * {@link CTUnSignedInteger } * */ public void setRSp(CTUnSignedInteger value) { this.rSp = value; } /** * Gets the value of the ctrlPr property. * * @return * possible object is * {@link CTCtrlPr } * */ public CTCtrlPr getCtrlPr() { return ctrlPr; } /** * Sets the value of the ctrlPr property. * * @param value * allowed object is * {@link CTCtrlPr } * */ public void setCtrlPr(CTCtrlPr value) { this.ctrlPr = value; } /** * Gets the parent object in the object tree representing the unmarshalled xml document. * * @return * The parent object. */ public Object getParent() { return this.parent; } public void setParent(Object parent) { this.parent = parent; } /** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); } }
[ "jason@plutext.org" ]
jason@plutext.org
8a10968a48d7b56ca4c5f1fcf5ebc3196c793ed8
256bea185b7749b7f0a22d9232c8840c5a70694a
/J2LLVM/example_classes/Max_Array.java
3b16c6b31a03b0e15e9bc8a762de5fb47a048f3c
[]
no_license
quend/java-to-llvm-compiler
1a824d3c22e88f4b83c62c3a620459ab4fd1366d
fd5d754484324cc02916c3d65aa2fc5de873d74f
refs/heads/master
2020-04-05T02:19:13.286482
2012-03-18T10:11:22
2012-03-18T10:11:22
37,330,726
2
0
null
null
null
null
UTF-8
Java
false
false
602
java
public class Obj_Int{ int n; public Obj_Int(int i){ n = i; } public int getInt(){ return n; } } public class Max_Array{ int max ( Obj_Int[] a, int n) { int i, max, c; i = 0; max = -10000; while(i < n) { c = a[i].getInt(); if(c > max) max = c; i = i +1; } return max; } public void main () { Obj_Int[] a; int i, n; a = new Obj_Int[5]; i = 0; while(i < 5) { printf ("Enter an integer value: "); scanf ("%d", &n); a[i] = new Obj_Int(n); i = i +1; } printf ("max: %d\n", max(a, 5)); } }
[ "nataraj.sundar@gmail.com" ]
nataraj.sundar@gmail.com
f5297de9f9bde139c379949e60fc9e16cbbb9ca7
b532007f452aef7fe7582210d746d6d3d33b4f26
/src/main/java/com/bjpowernode/crm/workbench/bean/CustomerRemark.java
b279234de0e78ad7d61afa0b323e6e0649a93703
[]
no_license
chengshengyao/crm
40bb703e54ae45256c9c07b528bda9ed1799fa5a
55184c1de41eefd92011fff6b99d0ad909f4b092
refs/heads/master
2023-04-01T03:48:07.435091
2021-03-23T06:21:16
2021-03-23T06:21:16
348,162,192
0
0
null
null
null
null
UTF-8
Java
false
false
2,264
java
package com.bjpowernode.crm.workbench.bean; import tk.mybatis.mapper.annotation.NameStyle; import tk.mybatis.mapper.code.Style; import javax.persistence.Id; import javax.persistence.Table; @Table(name = "tbl_customer_remark") @NameStyle(Style.normal) public class CustomerRemark { @Id private String id; private String noteContent; private String createBy; private String createTime; private String editBy; private String editTime; private String editFlag; private String customerId; @Override public String toString() { return "CustomerRemark{" + "id='" + id + '\'' + ", noteContent='" + noteContent + '\'' + ", createBy='" + createBy + '\'' + ", createTime='" + createTime + '\'' + ", editBy='" + editBy + '\'' + ", editTime='" + editTime + '\'' + ", editFlag='" + editFlag + '\'' + ", customerId='" + customerId + '\'' + '}'; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNoteContent() { return noteContent; } public void setNoteContent(String noteContent) { this.noteContent = noteContent; } public String getCreateBy() { return createBy; } public void setCreateBy(String createBy) { this.createBy = createBy; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getEditBy() { return editBy; } public void setEditBy(String editBy) { this.editBy = editBy; } public String getEditTime() { return editTime; } public void setEditTime(String editTime) { this.editTime = editTime; } public String getEditFlag() { return editFlag; } public void setEditFlag(String editFlag) { this.editFlag = editFlag; } public String getCustomerId() { return customerId; } public void setCustomerId(String customerId) { this.customerId = customerId; } }
[ "3113547732@QQ.COM" ]
3113547732@QQ.COM
3a29fca6b24c89818d4fa7cf1667f2a68e2a99fb
cd764337c772013c6eb6429615c982be0967eb96
/BruceCoreLib/src/main/java/com/bruce/core/net/callback/StringCallback.java
434d6b28b1d7da9b5cc0886ab91b06c3803e86ba
[ "Apache-2.0" ]
permissive
weileng11/BruceTestDemo
166abd9b1c0852bf89483b5d297cda2594ced9f9
2eb9c05f255a1166251e73023be383ab908b8722
refs/heads/master
2021-01-21T12:20:21.094992
2017-09-14T02:58:51
2017-09-14T02:58:51
102,065,790
1
0
null
null
null
null
UTF-8
Java
false
false
460
java
package com.bruce.core.net.callback; import java.io.IOException; import okhttp3.Response; /** * Created by zhy on 15/12/14. */ public abstract class StringCallback extends Callback<String> { /** * 以String 方式返回回调 * @param response * @return * @throws IOException */ @Override public String parseNetworkResponse(Response response) throws IOException { return response.body().string(); } }
[ "275762645@qq.com" ]
275762645@qq.com
b6ebb8c62bcd771a1ec018db1487a9c3129ea9b0
f8a4ec362624bb27559180a2d12b9b40d9ce21f2
/DatosPersonaList/app/src/test/java/com/gandalfran/datospersonalist/ExampleUnitTest.java
c8a9cb7f2b0d275efba521ff3102363a1451419a
[]
no_license
GandalFran/USAL-MII-DAAM-lectures
0535126d0ff1bf3e6f8e3eb73dc060bd6fe67ce6
5317d4a001d2ca04b058c3dc8758096781122d4b
refs/heads/main
2023-07-14T11:32:05.639335
2021-08-24T08:43:45
2021-08-24T08:43:45
357,465,448
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.gandalfran.datospersonalist; 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); } }
[ "franpintosantos@usal.es" ]
franpintosantos@usal.es
5d316e2c240c17aefafab04bcf1939c7d7f48353
b1589ba088e49e2aa1b9f4e197af6b40995e636d
/src/sdn_competition/PcapReader_Main.java
bd1beefe4b2d13596d2dff9454f0860220adf13b
[]
no_license
alsmadi/SDN-Competition
464655744b93ca2e8f59acd58757a609d73678de
1f3bb9c1ef5486e5bfd0cee6d25e1d7fca903752
refs/heads/master
2021-01-10T14:24:10.699858
2016-03-30T03:05:18
2016-03-30T03:05:18
54,274,643
0
0
null
null
null
null
UTF-8
Java
false
false
29,806
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 sdn_competition; /** * * @author IAlsmadi */ import java.io.IOException; import java.util.Vector; import java.util.*; import jpcap.JpcapCaptor; import jpcap.NetworkInterface; import jpcap.PacketReceiver; import jpcap.packet.IPPacket; import jpcap.packet.Packet; import jpcap.packet.*; import org.jnetpcap.*; import java.nio.charset.Charset; import org.jnetpcap.packet.*; import org.jnetpcap.util.PcapPacketArrayList; import org.jnetpcap.protocol.lan.Ethernet; import org.jnetpcap.protocol.network.Ip4; import org.jnetpcap.protocol.tcpip.Tcp; import org.jnetpcap.protocol.tcpip.Udp; import java.io.*; import java.nio.charset.StandardCharsets; import org.jnetpcap.packet.*; import org.jnetpcap.protocol.lan.Ethernet; import org.jnetpcap.protocol.network.Icmp; import org.jnetpcap.protocol.network.Ip4; import org.jnetpcap.protocol.network.Ip6; import org.jnetpcap.protocol.network.Arp; import java.io.EOFException; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.nio.ByteBuffer; import java.net.*; //import com.opensoc.pcap.Constants; //import com.opensoc.pcap.OpenSocEthernetDecoder; //import com.opensoc.pcap.PacketInfo; //import com.opensoc.pcap.PcapByteInputStream; //import org.jnetpcap.*; public class PcapReader_Main{ public static double toDouble(byte[] bytes) { return ByteBuffer.wrap(bytes).getDouble(); } public static void readFile(String filename) { //System.out.println("path"+System.getProperty(java.library.path)); System.out.println("Reading file "+filename); JpcapCaptor jpcap = null; // third argument is true for promiscuous mode try { jpcap = JpcapCaptor.openFile(filename); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Could not read pcap file "+filename); e.printStackTrace(); } // we only consider network layer traffic // this of course means we don't see things like ARP poisoning try { jpcap.setFilter("ip", true); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Error in setting packet capture filter"); e.printStackTrace(); } final Data d = Data.getData(); final Vector<SimplePacket> packet_set = new Vector<SimplePacket>(); jpcap.loopPacket(-1, new PacketReceiver(){ public void receivePacket(Packet p) { if(p instanceof IPPacket) packet_set.add(new SimplePacket((IPPacket)p)); } }); d.addPackets(packet_set.iterator()); } static void process(){ double totalIterations = 1000000; double parallelism = 64; double targetEvents = 1000000; File fin = new File("tests/southbound.pcap"); File fout = new File(fin.getAbsolutePath() + ".parsed"); try{ byte[] pcapBytes = FileUtils.readFileToByteArray(fin); } catch(Exception ex){ } long startTime = System.currentTimeMillis(); for (int i = 0; i < totalIterations; i++) { // List<PacketInfo> list = parse(pcapBytes); //for (PacketInfo packetInfo : list) { // System.out.println(packetInfo.getJsonIndexDoc()); // } } long endTime = System.currentTimeMillis(); System.out.println("Time taken to process " + totalIterations + " events :" + (endTime - startTime) + " milliseconds"); System.out .println("With parallelism of " + parallelism + " estimated time to process " + targetEvents + " events: " + (((((endTime - startTime) / totalIterations) * targetEvents) / parallelism) / 1000) + " seconds"); System.out.println("With parallelism of " + parallelism + " estimated # of events per second: " + ((parallelism * 1000 * totalIterations) / (endTime - startTime)) + " events"); System.out.println("Expected Parallelism to process " + targetEvents + " events in a second: " + (targetEvents / ((1000 * totalIterations) / (endTime - startTime)))); } private final Charset UTF8_CHARSET = Charset.forName("UTF-8"); String decodeUTF8(byte[] bytes) { return new String(bytes, UTF8_CHARSET); } static void readBinary1(String file1){ // StringBuilder sb = new StringBuilder(); OutputStream os=null; OutputStream os1=null; OutputStream os2=null; OutputStream os3=null; OutputStream os33=null; OutputStream os4=null; OutputStream os5=null; OutputStream os6=null; OutputStream os7=null; OutputStream os8=null; OutputStream os9=null; OutputStream os10=null; OutputStream os11=null; try{ BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file1),"UTF-8")); String line = null; // os = new FileOutputStream("out2.txt"); os = new FileOutputStream("C:\\Users\\ialsmadi\\Desktop\\Project\\out2.txt"); os3 = new FileOutputStream("controller1.txt"); os33 = new FileOutputStream("controller2.txt"); os1 = new FileOutputStream("controller.txt"); os2 = new FileOutputStream("ports.txt"); os4 = new FileOutputStream("hosts.txt"); os5= new FileOutputStream("openvswitch.txt"); os6= new FileOutputStream("openflow.txt"); os7= new FileOutputStream("ovs-ofctl.txt"); os8= new FileOutputStream("ovs-vsctl.txt"); os9= new FileOutputStream("OFP-messages.txt"); os10= new FileOutputStream("ofp_port.txt"); os11=new FileOutputStream("OFP_actions"); // os1 = new FileOutputStream("controller.txt"); // os2 = new FileOutputStream("ports.txt"); //Writer w = new OutputStreamWriter(os, "UTF-8"); while( (line = reader.readLine()) != null){ // System.out.println(line); byte[] bytes = line.getBytes(); os.write(bytes); os.write('\n'); os.flush(); if(line.contains("controller")){ os1.write(bytes); os1.write('\n'); os1.flush(); } if(line.contains("OFPAT_")){ os11.write(bytes); os11.write('\n'); os11.flush(); } if(line.contains("ofp_header") || line.contains("OFPT")){ os9.write(bytes); os9.write('\n'); os9.flush(); } if(line.contains("port")){ os2.write(bytes); os2.write('\n'); os2.flush(); } if(line.contains("ofp_port")){ os10.write(bytes); os10.write('\n'); os10.flush(); } if(line.contains("ovs-ofctl")){ os7.write(bytes); os7.write('\n'); os7.flush(); } if(line.contains("host")){ os4.write(bytes); os4.write('\n'); os4.flush(); } if(line.contains("openflow")){ os6.write(bytes); os6.write('\n'); os6.flush(); } if(line.contains("openvswitch")){ os5.write(bytes); os5.write('\n'); os5.flush(); } if(line.contains("tcp:192.168.1.1:6633")){ os3.write(bytes); os3.write('\n'); os3.flush(); } if(line.contains("ovs-vsctl")){ os8.write(bytes); os8.write('\n'); os8.flush(); } if(line.contains("tcp:192.168.1.1")){ os33.write(bytes); os33.write('\n'); os33.flush(); } // sb.append(line); } // w.close(); os.close(); os1.close(); os2.close(); os4.close(); os3.close(); os33.close(); os5.close(); os6.close(); os7.close(); os8.close(); os9.close(); os10.close(); os11.close(); // writeToFile("Memory_Dump.txt", sb); } catch( FileNotFoundException e2 ) { e2.printStackTrace(); try{ os.close(); os1.close(); os2.close(); os4.close(); os3.close(); os33.close(); os5.close(); os6.close(); os7.close(); os8.close(); os9.close(); os10.close(); os11.close(); } catch(Exception ex){ } } catch(IOException e){ e.printStackTrace(); try{ os.close(); os1.close(); os2.close(); os4.close(); os3.close(); os33.close(); os5.close(); os6.close(); os7.close(); os8.close(); os9.close(); os10.close(); os11.close(); } catch(Exception ex){ } } } static void readBinary(String file1){ try { StringBuilder sb = new StringBuilder(); File file = new File(file1); DataInputStream input = new DataInputStream( new FileInputStream( file ) ); try { // List<String> lines = IOUtils.readLines(input); while( true ) { String temp= input.readUTF(); System.out.println(temp); sb.append( temp ); } } catch( EOFException eof ) { } catch( IOException e ) { e.printStackTrace(); } // System.out.println(sb.toString()); writeToFile("Memory_Dump.txt", sb); } catch( FileNotFoundException e2 ) { e2.printStackTrace(); } } public static void main(String[] args) { // readBinary1("ram.raw"); readBinary1("C:\\Users\\ialsmadi\\Desktop\\Project\\ram.raw"); process(); final StringBuilder SB = new StringBuilder(); final StringBuilder SBIP4 = new StringBuilder(); final StringBuilder SBIP6 = new StringBuilder(); final StringBuilder SBICMP = new StringBuilder(); final StringBuilder SBTCP = new StringBuilder(); final StringBuilder SBETH = new StringBuilder(); final StringBuilder SBARP = new StringBuilder(); final StringBuilder SBUDP = new StringBuilder(); final StringBuilder SBSrcDst = new StringBuilder(); final StringBuilder SBPayLoad = new StringBuilder(); final StringBuilder SBPackets = new StringBuilder(); PcapFile p1 = new PcapFile("tests/southbound.pcap"); PcapPacketArrayList p2= p1.readOfflineFiles(); final Tcp tcp = new Tcp(); Ip4 ip = new Ip4(); final Udp udp = new Udp(); final Payload basePayload = new Payload(); final Ip6 ip6 = new Ip6(); Ethernet eth = new Ethernet(); Arp arp = new Arp(); final Icmp icmp = new Icmp(); Icmp.DestinationUnreachable unreach = new Icmp.DestinationUnreachable(); int counter=1; String temp=""; for (PcapPacket entry : p2) { if(entry.hasHeader(Payload.ID)){ SBPayLoad.append(System.getProperty("line.separator")); SBPayLoad.append("Frame number..."+counter +"..."); String payloadAsString = entry.getUTF8String(0, entry.size()); byte[] data = entry.getByteArray(0, entry.size()); //byte[] data = payload.data(); //System.out.println("seq=" + (tcp.seq()-ISN)); String datastr = new String(data); if (datastr.length() !=0) { System.out.print(" data: " + datastr); } //hasData = true; String sdata= new String(data); SBPayLoad.append(sdata); SBPayLoad.append(payloadAsString); } if (entry.hasHeader(ip6)){ Ip6 ip6_header = entry.getHeader(new Ip6()); SBIP6.append(System.getProperty("line.separator")); SBIP6.append("Frame number..."+counter +"..."); SBIP6.append(ip6_header); // Ip4 ip4_header = entry.getHeader(new Ip4()); int source = ip6_header.sourceToIntHash(); SBIP6.append(source); int dest = ip6_header.destinationToIntHash(); SBIP6.append(dest); double sourceIP = toDouble(ip6_header.source()); SBIP6.append(sourceIP); double destIP = toDouble(ip6_header.destination()); SBIP6.append(destIP); SBSrcDst.append(System.getProperty("line.separator")); SBSrcDst.append("Frame number..."+counter +"..."); double sport = toDouble(ip6_header.source()); SBIP6.append(destIP); double dport = toDouble(ip6_header.destination()); SBSrcDst.append(source+","+sourceIP+","+sport+","+dest+","+destIP+","+dport); SBIP6.append(source); sourceIP = toDouble(ip6_header.source()); SBIP6.append(source); destIP = toDouble(ip6_header.destination()); SBIP6.append(source); sport = toDouble(ip6_header.source()); SBIP6.append(source); dport = toDouble(ip6_header.destination()); SBIP6.append(source); String key = "" + source + dest + sport + dport; SBIP6.append(source); } if (entry.hasHeader(arp)){ Arp arp_header = entry.getHeader(new Arp()); SBARP.append(System.getProperty("line.separator")); SBARP.append("Frame number..."+counter +"..."); SBARP.append(arp_header); // Ip4 ip4_header = entry.getHeader(new Ip4()); // System.out.println("ARP decode header:\t" + arp.decodeHeader()); System.out.println("ARP hardware type:\t" + arp. hardwareType()); System.out.println("ARP hw type descr:\t" + arp.hardwareTypeDescription()); System.out.println("ARP hw type enum:\t" + arp.hardwareTypeEnum()); System.out.println("ARP hlen:\t-\t" + arp.hlen()); System.out.println("ARP operation:\t-\t" + arp.operation()); System.out.println("ARP plen:\t-\t" + arp.plen()); System.out.println("ARP protocol type:\t" + arp.protocolType()); System.out.println("ARP prtcl type descr:\t" + arp.protocolTypeDescription()); System.out.println("ARP prtcl type enum:\t" + arp.protocolTypeEnum()); // System.out.println("ARP sha:\t-\t" + toDouble(mac(arp.sha())); System.out.println("ARP sha length:\t-\t" + arp.shaLength()); //System.out.println("ARP spa:\t-\t" + FormatUtils.ip(arp.spa())); System.out.println("ARP spa length:\t-\t" + arp.spaLength()); System.out.println("ARP spa offset:\t-\t" + arp.spaOffset()); //System.out.println("ARP tha:\t-\t" + FormatUtils.mac(arp.tha())); System.out.println("ARP tha length:\t-\t" + arp.thaLength()); System.out.println("ARP tha offset:\t-\t" + arp.thaOffset()); //System.out.println("ARP tpa:\t-\t" + FormatUtils.ip(arp.tpa())); System.out.println("ARP tpa length:\t-\t" + arp.tpaLength()); System.out.println("ARP tpa offset:\t-\t" + arp.tpaOffset()); // String state = arp_header.getState(); SBARP.append(arp. hardwareType()); // int dest = arp_header.destinationToIntHash(); SBARP.append(arp.hardwareTypeDescription()); // double sourceIP = toDouble(arp_header.source()); SBARP.append(arp.hardwareTypeEnum()); // double destIP = toDouble(arp_header.destination()); SBARP.append(arp.hlen()); // double sport = toDouble(arp_header.source()); SBARP.append(arp.protocolType()); // double dport = toDouble(arp_header.destination()); SBARP.append(arp.protocolTypeDescription()); // String key = "" + source + dest + sport + dport; SBARP.append(arp.spaLength()); } if (entry.hasHeader(ip)){ if (entry.hasHeader(icmp)){ Ip4 ip4_header = entry.getHeader(new Ip4()); SBICMP.append(System.getProperty("line.separator")); SBICMP.append("Frame number..."+counter +"..."); int source = ip4_header.sourceToInt(); SBICMP.append(source); int dest = ip4_header.destinationToInt(); SBICMP.append(dest); long sourceIP = ip4_header.sourceToInt(); SBICMP.append(sourceIP); long destIP = ip4_header.destinationToInt(); SBSrcDst.append(System.getProperty("line.separator")); SBSrcDst.append("Frame number..."+counter +"..."); SBSrcDst.append(sourceIP+","+destIP); SBICMP.append(destIP); String key = "" + source + dest; SBICMP.append(key); } // Tcp tcp_header = entry.getHeader(new Tcp()); Ip4 ip4_header = entry.getHeader(new Ip4()); SBIP4.append(System.getProperty("line.separator")); SBIP4.append("Frame number..."+counter +"..."); SBIP4.append(ip4_header); int source = ip4_header.sourceToInt(); SBIP4.append(source); int dest = ip4_header.destinationToInt(); SBIP4.append(dest); long sourceIP = ip4_header.sourceToInt(); SBIP4.append(sourceIP); long destIP = ip4_header.destinationToInt(); SBIP4.append(destIP); byte[] sport = ip4_header.source(); SBIP4.append(sport); byte[] dport = ip4_header.destination(); SBIP4.append(dport); String key = "" + source + dest + sport + dport; SBIP4.append(key); if (entry.hasHeader(udp)) { SBUDP.append(System.getProperty("line.separator")); SBUDP.append("Frame number..."+counter +"..."); System.out.printf("tcp.dst_port=%d%n", udp.destination()); System.out.printf("tcp.src_port=%d%n", udp.source()); // System.out.printf("tcp.ack=%x%n", udp.ack()); temp="udp.dst_port=%d%n"+ udp.destination()+ "udp.src_port=%d%n"+ udp.source()+ // "tcp.ack=%x%n"+ udp.ack(); SB.append(temp); SBUDP.append(temp); } } if (entry.hasHeader(eth)){ // Tcp tcp_header = entry.getHeader(new Tcp()); Ethernet eth_header = entry.getHeader(new Ethernet()); SBETH.append(System.getProperty("line.separator")); SBETH.append("Frame number..."+counter +"..."); SBETH.append(eth_header); int checksum = eth_header.checksum(); SBETH.append(checksum); int checksumofset = eth_header.checksumOffset(); SBETH.append(checksumofset); long dstLG = eth_header.destination_IG(); SBETH.append(dstLG); long dstLG1 = eth_header.destination_LG(); SBETH.append(dstLG1); byte[] sport = eth_header.source(); SBETH.append(sport); byte[] dport = eth_header.destination(); SBETH.append(dport); String key = "" + dstLG + dstLG1 + sport + dport; SBETH.append(key); } if (entry.hasHeader(udp)){ Udp udp_header = entry.getHeader(new Udp()); SBUDP.append(System.getProperty("line.separator")); SBUDP.append("Frame number..."+counter +"..."); //Ip4 ip4_header = entry.getHeader(new Ip4()); int hlength = udp_header.getHeaderLength(); SBUDP.append(hlength); int length = udp_header.getLength(); SBUDP.append(length); int offset = udp_header.getOffset(); SBUDP.append(offset); byte[] content=udp_header.getPayload(); SBUDP.append(content); int contentSize=udp_header.getPayloadLength(); SBUDP.append(contentSize); // int dest = udp_header.destinationT // long sourceIP = udp_header.sourceToInt(); // long destIP = udp_header.destinationToInt(); int sport = udp_header.source(); SBUDP.append(sport); int dport = udp_header.destination(); SBUDP.append(dport); String key = "" + sport + dport; SBUDP.append(key); } SB.append("Packet number..."+counter); if (entry.hasHeader(tcp)) { /* * Now get our tcp header definition (accessor) peered with actual * memory that holds the tcp header within the packet. */ // entry.getHeader(tcp); SBTCP.append(System.getProperty("line.separator")); SBTCP.append("Frame number..."+counter +"..."); System.out.printf("tcp.dst_port=%d%n", tcp.destination()); SBTCP.append(tcp.destination()); System.out.printf("tcp.src_port=%d%n", tcp.source()); SBTCP.append(tcp.source()); System.out.printf("tcp.ack=%x%n", tcp.ack()); SBTCP.append(tcp.ack()); temp="tcp.dst_port=%d%n"+ tcp.destination()+ "tcp.src_port=%d%n"+ tcp.source()+ "tcp.ack=%x%n"+ tcp.ack(); SB.append(temp); } if (entry.hasHeader(tcp)) { SBTCP.append(System.getProperty("line.separator")); SBTCP.append("Frame number..."+counter +"..."); System.out.printf("tcp.dst_port=%d%n", tcp.destination()); System.out.printf("tcp.src_port=%d%n", tcp.source()); System.out.printf("tcp.ack=%x%n", tcp.ack()); temp="tcp.dst_port=%d%n"+ tcp.destination()+ "tcp.src_port=%d%n"+ tcp.source()+ "tcp.ack=%x%n"+ tcp.ack(); SB.append(temp); SBTCP.append(temp); } if (entry.hasHeader(ip) && entry.hasHeader(tcp)) { SBTCP.append(System.getProperty("line.separator")); SBTCP.append("Frame number..."+counter +"..."); // Do processing, both ip and tcp have been initialized System.out.printf("tcp.dst_port=%d%n", tcp.destination()); System.out.printf("tcp.src_port=%d%n", tcp.source()); System.out.printf("tcp.ack=%x%n", tcp.ack()); temp="tcp.dst_port=%d%n"+ tcp.destination()+ "tcp.src_port=%d%n"+ tcp.source()+ "tcp.ack=%x%n"+ tcp.ack(); SB.append(temp); SBTCP.append(temp); } // Udp udp = new Udp(); if (entry.hasHeader(ip) && entry.hasHeader(udp)) { SBUDP.append(System.getProperty("line.separator")); SBUDP.append("Frame number..."+counter +"..."); // Do processing, both ip and tcp have been initialized System.out.printf("tcp.dst_port=%d%n", udp.destination()); System.out.printf("tcp.src_port=%d%n", udp.source()); // System.out.printf("tcp.ack=%x%n", udp.ack()); temp="udp.dst_port=%d%n"+ udp.destination()+ "udp.src_port=%d%n"+ udp.source()+ // "tcp.ack=%x%n"+ udp.ack(); SB.append(temp); SBUDP.append(temp); SB.append(entry.toString()); System.out.println("Item : " + entry.toString() + " Count : " + entry.getHeaderCount()); } if (tcp.getPayloadLength() > 0 && !entry.hasHeader(basePayload)) { System.out.println("Invalid packet! No payload header detected, but TCP-PayloadLength = " + tcp.getPayloadLength()); System.out.println("------------------------------------------------------------"); System.out.println(entry.toString()); System.out.println("------------------------------------------------------------"); System.out.println(entry.toHexdump()); } boolean isSyn = false, isFin = false, hasData = false; int ISN = 0; if (entry.hasHeader(eth) && entry.hasHeader(ip) && entry.hasHeader(tcp)) { // tcpCount++; //System.out.print("" + (packetCount -1) + ": "); // pld: new SBPackets.append(System.getProperty("line.separator")); SBPackets.append("Frame number..."+counter +"..."); System.out.print("TCP packet: "); InetAddress sourceIP = inetAddress(ip.source()); InetAddress destIP = inetAddress(ip.destination()); SBSrcDst.append(System.getProperty("line.separator")); SBSrcDst.append("Frame number..."+counter +"..."); // SBSrcDst.append(sourceIP+","+destIP); int srcport = tcp.source(); int dstport = tcp.destination(); SBSrcDst.append(sourceIP+","+srcport+","+destIP+","+dstport); srcport = tcp.source(); dstport = tcp.destination(); PSocket src = new PSocket(sourceIP, srcport); PSocket dest =new PSocket(destIP, dstport); System.out.print( src + " ==> " + dest); SBPackets.append(src + " ==> " + dest); if (tcp.flags_SYN()) { //synCount++; if (tcp.flags_ACK()){ System.out.print(" SYN/ACK, "); SBPackets.append(" SYN/ACK, "); } else { System.out.print(" first SYN, "); SBPackets.append(" first SYN, "); } ISN = (int) tcp.seq(); System.out.print("ISN=" + ISN); SBPackets.append("ISN=" + ISN); isSyn = true; } if (tcp.flags_FIN()) { System.out.print(" FIN"); SBPackets.append("FIN"); isFin = true; } if (tcp.flags_RST()) { System.out.print(" RST"); // should handle better? SBPackets.append("RST"); isFin = true; } if (entry.hasHeader(basePayload) && tcp.getPayloadLength() != 0 ) { byte[] data = basePayload.getByteArray(0, basePayload.size()); //byte[] data = payload.data(); //System.out.println("seq=" + (tcp.seq()-ISN)); String datastr = new String(data); if (datastr.length() !=0) { System.out.print(" data: " + datastr); } hasData = true; } if (!isSyn && !isFin && !hasData){ System.out.print(" ACK only"); SBPackets.append(" ACK only"); } System.out.println(); } else { SBPackets.append(System.getProperty("line.separator")); SBPackets.append("Frame number..."+counter +"..."); System.out.println("... not a TCP packet"); SBPackets.append(" ... not a TCP packet"); } counter++; } writeToFile("Flow_Dump.txt", SB); writeToFile("IPv4.txt", SBIP4); writeToFile("IPv6.txt", SBIP6); writeToFile("TCP.txt", SBTCP); writeToFile("UDP.txt", SBUDP); writeToFile("ICMP.txt", SBICMP); writeToFile("Eth.txt", SBETH); writeToFile("ARP.txt", SBARP); writeToFile("PayLoad.txt", SBPayLoad); writeToFile("Packets.txt",SBPackets); writeToFile("SrcDst.txt",SBSrcDst); //writeToFile("IPv6.txt", SBIP6); /* File file = new File("Flow_Dump.txt"); BufferedWriter writer=null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write(SB.toString()); } catch(Exception ex){ } finally { if (writer != null) try{writer.close(); } catch(Exception ex){ } }*/ Data d = Data.getData(); //readFile("tests/southbound.pcap"); System.out.println("Data now has "+d.getIPGraph().getNodeCount()+" nodes!"); } /** * inetAddress(byte[] buf): converts an array of four bytes to an InetAddress */ private static InetAddress inetAddress(byte[] buf) { InetAddress addr = null; try { addr = InetAddress.getByAddress(buf); } catch (UnknownHostException uhe) {} return addr; } static void writeToFile(String name, StringBuilder SB){ File file = new File(name); BufferedWriter writer=null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write(SB.toString()); } catch(Exception ex){ } finally { if (writer != null) try{writer.close(); } catch(Exception ex){ } } } }
[ "alsmadi@gmail.com" ]
alsmadi@gmail.com
fcf35977d3518187195145c2e86ffb4f08ca1dc6
5e1479f79a94f4ae91090dfbdcc55dac82476b1b
/tu-masterline/src/nl/miraclebenelux/domaincontacts/server/ContactDAO.java
254ba57517cf7001a509d7c811454c466136fea2
[]
no_license
Jeff-Lewis/google-apps-contacts
934a08719d956c25cca4463d63ce6a1af28ea756
f6d3158a51f7e26be3b4254fbc8476ebd9171041
refs/heads/master
2021-01-22T21:13:17.838286
2010-03-20T19:20:18
2010-03-20T19:20:18
40,226,922
0
0
null
null
null
null
UTF-8
Java
false
false
1,060
java
package nl.miraclebenelux.domaincontacts.server; import nl.miraclebenelux.domaincontacts.client.Contact; import nl.miraclebenelux.domaincontacts.client.ContactDetails; import nl.miraclebenelux.domaincontacts.client.ContactOperation; import nl.miraclebenelux.domaincontacts.client.Group; import java.util.ArrayList; public interface ContactDAO { String addContact(String Domain, ContactDetails contact); String removeContact(String domain, ArrayList<ContactOperation> ids); String updateContact(String domain, ContactDetails contact); ContactDetails retrieveContact(String Domain, String Id); ArrayList<Contact> listContacts(String Domain); ArrayList<String> listDomains(boolean admin); String syncContacts(String fromDomain, String toDomain, int startindx); String syncContacts(String fromDomain, ArrayList<String> ids, String toDomain); boolean login(String username, String password, String domain); ArrayList<Group> listGroups(String domain); }
[ "anjo.kolk@miraclebenelux.nl" ]
anjo.kolk@miraclebenelux.nl
c41af5d4f365676cb92d7f51dcc6e26924fafb7f
e2aa9d76c301be01d06cd5f250c969c6325abfad
/src/id/co/mik/utility/applet/usergroup/UserGroupApplet.java
f6f2b01089185cd62f181e8d209791682a618910
[]
no_license
robertjulius/Applet-User-Group
624810865f8ddf75b4c6cf7c948f0e35e6a6dd92
c26f4fd42a57eb9c5bb24eb36e0e85ceb1a9baa9
refs/heads/master
2020-04-07T18:14:35.214563
2013-01-31T02:32:20
2013-01-31T02:32:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,386
java
package id.co.mik.utility.applet.usergroup; import id.co.mik.utility.applet.utils.ExceptionViewer; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.TreeMap; import javax.swing.BorderFactory; import javax.swing.JApplet; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.tree.DefaultTreeCellRenderer; public class UserGroupApplet extends JApplet { private static final long serialVersionUID = 1L; private JLabel lblCollapseAll; private JLabel lblExpandAll; private JTree tree; public void collapseAll() { for (int i = 0; i < tree.getRowCount(); i++) { tree.collapseRow(i); } } public void createCheckBoxTree() { try { // String privilegeIds = getParameter("privilegeIds"); String privilegeIds = "012,021"; String[] initialPrivilegeIds = privilegeIds.split(","); TreeMap<String, Privilege> treeMap = PrivilegeUtils.getAllMenus(); Object[] objects = TreeNodeUtils.generateCheckBoxTreeNode(treeMap); ArrayList<Privilege> selectedList = PrivilegeUtils .getPrivileges(initialPrivilegeIds); this.tree = new CheckBoxTree<String, Privilege>(objects, selectedList); } catch (Exception e) { ExceptionViewer.showException(null, e); } } public void createConfirmTree() { String privilegeIds = getParameter("privilegeIds"); String[] initialPrivilegeIds = privilegeIds.split(","); TreeMap<String, Privilege> treeMap = PrivilegeUtils .generateReadOnlyTree(initialPrivilegeIds); Object[] objects = TreeNodeUtils.generateCommonTreeNode(treeMap); this.tree = new JTree(objects); ((DefaultTreeCellRenderer) this.tree.getCellRenderer()) .setOpenIcon(null); ((DefaultTreeCellRenderer) this.tree.getCellRenderer()) .setClosedIcon(null); } public void expandAll() { for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } } public String getSelected() { if (tree instanceof CheckBoxTree) { String string = ""; ArrayList<?> list = ((CheckBoxTree<?, ?>) tree).getAllSelected(); for (Object object : list) { Privilege privilege = (Privilege) object; string += "," + privilege.getId(); } return string.replaceFirst(",", ""); } else { ExceptionViewer.showException(null, new Exception( "Method getSelected only can be used for CheckBoxTree")); return null; } } @Override public void start() { createCheckBoxTree(); initComponent(); expandAll(); } @Override public void init() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { ExceptionViewer.showException(null, e); } catch (InstantiationException e) { ExceptionViewer.showException(null, e); } catch (IllegalAccessException e) { ExceptionViewer.showException(null, e); } catch (UnsupportedLookAndFeelException e) { ExceptionViewer.showException(null, e); } } public void initComponent() { lblExpandAll = new JLabel("Expand All"); lblExpandAll.setForeground(Color.BLUE); lblExpandAll.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { UserGroupApplet.this.expandAll(); } @Override public void mouseEntered(MouseEvent e) { lblExpandAll.setCursor(Cursor .getPredefinedCursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { lblExpandAll.setCursor(Cursor .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); lblCollapseAll = new JLabel("Collapse All"); lblCollapseAll.setForeground(Color.BLUE); lblCollapseAll.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { UserGroupApplet.this.collapseAll(); } @Override public void mouseEntered(MouseEvent e) { lblCollapseAll.setCursor(Cursor .getPredefinedCursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { lblCollapseAll.setCursor(Cursor .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); JPanel topPanel = new JPanel(); ((FlowLayout) topPanel.getLayout()).setAlignment(FlowLayout.LEFT); topPanel.setBackground(Color.WHITE); topPanel.add(lblExpandAll); topPanel.add(new JLabel(" | ")); topPanel.add(lblCollapseAll); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setPreferredSize(new Dimension(300, 1000)); mainPanel.setBackground(Color.WHITE); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0)); mainPanel.add(topPanel, BorderLayout.NORTH); mainPanel.add(tree, BorderLayout.CENTER); tree.setBackground(Color.WHITE); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(mainPanel); JPanel contentPane = (JPanel) getContentPane(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(BorderFactory.createLoweredBevelBorder()); contentPane.add(scrollPane); } }
[ "robert.julius.ext@idjkt008.wincor-nixdorf.com" ]
robert.julius.ext@idjkt008.wincor-nixdorf.com
13157f2a4fc69ea5e309df7991e820278f1098dc
972279f242af1169a83d36d12687915e712fb316
/FrontalLabDAO/src/main/java/com/ifi/lab/LabDAO/dao/Idex/IdexKeyDAO.java
8db0f0141ed6de7fa235049e7b6c266f66eccac9
[]
no_license
kiemkhach/webbase
777de125ff0516b7a30c52c09caa43be141d9b96
c44ffa3efca14334da82f82190b146105fe7f4a5
refs/heads/master
2020-12-24T12:40:18.987496
2016-11-09T06:04:43
2016-11-09T06:04:43
72,966,322
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package com.ifi.lab.LabDAO.dao.Idex; import java.util.List; import com.ifi.lab.LabDAO.model.Idex.IdexKey; public interface IdexKeyDAO { List<IdexKey> getAll(); List<IdexKey> findByType(Integer type); }
[ "vuminhduc2788@gmail.com" ]
vuminhduc2788@gmail.com
e0c15bb287323c7b2edcfb210bf789740be2d314
2dc49cf29e46534df5b1f6148042b093de7f5e6c
/kafka/src/main/java/Producer.java
dbe4408fdb3c976983849f994c8775c5dbd418a5
[]
no_license
inzheneher/testForEverythingModules
7b2ff4a3dc777cd031a9a22d49ae58308c19bb35
010b3c55ec6b08c66ba36b45c5a51de47fd07e1e
refs/heads/master
2022-09-15T02:46:58.145891
2022-05-13T03:14:22
2022-05-13T03:14:22
220,903,931
0
0
null
2022-05-13T03:14:56
2019-11-11T04:56:37
Java
UTF-8
Java
false
false
1,866
java
import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.streams.StreamsConfig; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Properties; /** * inzheneher created on 24/12/2020 inside the package - PACKAGE_NAME */ public class Producer { private final org.apache.kafka.clients.producer.Producer<String, String> producer; public Producer() { final Properties props; props = new Properties(); props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("enable.auto.commit", "true"); producer = new KafkaProducer<>(props); } public void getMessagesFromFileAndSendToTopic() { try { final BufferedReader br = new BufferedReader( new FileReader( "/home/inzheneher/WORK/TEST/testForEverythingModules/kafka/src/main/resources/sample-transaction-log.txt" )); String line = br.readLine(); while (line != null) { final String[] record = line.split(":"); final String key = record[0]; final String value = record[1]; producer.send(new ProducerRecord<>("output-topic", key, value)); if (key.equals("apples")) { producer.send(new ProducerRecord<>("input-topic", key, value)); } line = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } producer.close(); } }
[ "amelnikov@eastbanctech.com" ]
amelnikov@eastbanctech.com
2dee2f7729751977de4ced029401d5a98a5c77ba
973ec598d727b0015b67524aa413821288a185b6
/src/第二章链表问题/问题4翻转单向链表和双向链表/反转单向链表.java
89f5954a833f1e89edcea1ae9fb3b96b201920a3
[]
no_license
XZZMemory/CodingInterviewGuide
d2d3ce494c5a79bfc132bee8f49bb24214df850d
fb3cee7d168503aedeebd7c734e65e9a6d167205
refs/heads/master
2021-06-27T14:53:04.820315
2019-06-19T07:20:05
2019-06-19T07:20:05
150,551,905
0
0
null
null
null
null
UTF-8
Java
false
false
667
java
package 第二章链表问题.问题4翻转单向链表和双向链表; import 第二章链表问题.Node; /** * created by memory * on 2018/10/18 上午10:34 */ public class 反转单向链表 { public static void main(String[] args) { Node head=Node.creatLinkWithoutHead(new int[]{1,2,3,4}); Node headReverse=reverseList(head); } public static Node reverseList(Node head) { Node pre=null; Node next=null; while (head!=null) { next=head.next; head.next=pre; pre=head; head=next; } return pre; } }
[ "1933850821@qq.com" ]
1933850821@qq.com
78cc4104f695584419830fdc94d8d7b5e2eb00b5
33cdc2b46c67441f421e06c27afe2fd6adc16803
/src/main/java/com/b1a9idps/springasyncdemo/service/AsyncService.java
610ef514d40b5fc23a27a7bc2b142f7827a91b99
[]
no_license
b1a9id/spring-async-demo
6b85f4e9750ab96132be7d104ad29561ddba1de9
c8cd4d78123df9e89a8344ed9ddb75f827816107
refs/heads/main
2023-06-18T03:16:38.512829
2021-07-09T09:59:51
2021-07-09T09:59:51
381,528,994
0
0
null
2021-06-30T15:09:15
2021-06-30T00:15:50
Java
UTF-8
Java
false
false
181
java
package com.b1a9idps.springasyncdemo.service; import com.b1a9idps.springasyncdemo.dto.request.AsyncRequest; public interface AsyncService { void save(AsyncRequest request); }
[ "ruchitate@coiney.com" ]
ruchitate@coiney.com
41b71bda98b077b9bbbae7b5994ba19b1f8ddaa1
986b63a712612ee7dc32420240d76a048a1a59e2
/src/body/Body.java
ddbc43097a0d308d539ff7d3aed038013d326043
[]
no_license
xelav/MostAwesomestEngineEver
5a6b557910f4045a84a78184170c740c568a9e8a
9899eef6afbe07707ad4e303d8cffe76081be889
refs/heads/master
2023-04-25T07:10:32.055985
2021-05-11T07:43:58
2021-05-11T07:43:58
22,783,408
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
2,231
java
package body; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.MathUtils; import com.me.maee.MAE; import com.me.maee.Utils; import com.me.maee.Vec; import java.lang.Math;; public abstract class Body { protected AABB aabb; protected Vec pos; protected Vec vel; //private float angle; //protected boolean isStatic; public static ShapeRenderer renderer; // should be protected! public float mass; //protected ShapeRenderer posRenderer; public boolean collide; public byte type; public abstract void draw(); public abstract void update(float deltaTime); protected abstract float defineSquare(); protected abstract void rotate(float angle); protected abstract AABB buildAABB(); /////////// protected void setVelocity(Vec NewVel){ vel = NewVel; } protected void setPosition (Vec NewPos){ //if (vel != null){ //if (NewPos.y == 180){ //System.out.println(vel.y); //} //} //System.out.println(NewPos.y); this.pos = NewPos; } protected void setRenderer(){ renderer = new ShapeRenderer(); } public Vec getPosition (){ return pos; } public Vec getVelocity(){ return vel; } /////////// public void applyImpulse(float x, float y, Vec normal, float impulse){ // applyImpulse - улучшенная версия applyForce; учитывает также точку приложения и массу // normal - единичный вектор, отвечающий ТОЛЬКО за направление Utils.getUnitVector(normal); Vec Vel = getVelocity(); Vel.x += impulse*normal.x/mass; Vel.y += impulse*normal.y/mass; setVelocity(Vel); } public void setCollision(boolean collide){ this.collide = collide; //if (collide == false) System.out.println(""+this.collide); } public void setColor(){ //System.out.println(""+collide); if (collide) renderer.setColor(0.9f, 0.2f, 0.2f, 1); else renderer.setColor(1, 1, 1, 1); } public void setColorRed(){ System.out.println("ok"); renderer.setColor(0.3f, 0.3f, 0.3f, 1); } protected float defineMass(){ float mass=defineSquare(); return mass; } public AABB getRect(){ return aabb; //return buildAABB(); } }
[ "xelav.rus@gmail.com" ]
xelav.rus@gmail.com
a1cf4f49e9473d58c2b16a51490408faa8030107
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/lakeformation/src/main/java/com/huaweicloud/sdk/lakeformation/v1/model/ListDatabaseNamesRequest.java
3c2d5c1c93307f9b84eba29fceab1cc2ea20e597
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
3,214
java
package com.huaweicloud.sdk.lakeformation.v1.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; /** * Request Object */ public class ListDatabaseNamesRequest { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "instance_id") private String instanceId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "catalog_name") private String catalogName; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "database_pattern") private String databasePattern; public ListDatabaseNamesRequest withInstanceId(String instanceId) { this.instanceId = instanceId; return this; } /** * 实例Id * @return instanceId */ public String getInstanceId() { return instanceId; } public void setInstanceId(String instanceId) { this.instanceId = instanceId; } public ListDatabaseNamesRequest withCatalogName(String catalogName) { this.catalogName = catalogName; return this; } /** * catalog名字 * @return catalogName */ public String getCatalogName() { return catalogName; } public void setCatalogName(String catalogName) { this.catalogName = catalogName; } public ListDatabaseNamesRequest withDatabasePattern(String databasePattern) { this.databasePattern = databasePattern; return this; } /** * 数据库名字通配符 * @return databasePattern */ public String getDatabasePattern() { return databasePattern; } public void setDatabasePattern(String databasePattern) { this.databasePattern = databasePattern; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ListDatabaseNamesRequest that = (ListDatabaseNamesRequest) obj; return Objects.equals(this.instanceId, that.instanceId) && Objects.equals(this.catalogName, that.catalogName) && Objects.equals(this.databasePattern, that.databasePattern); } @Override public int hashCode() { return Objects.hash(instanceId, catalogName, databasePattern); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ListDatabaseNamesRequest {\n"); sb.append(" instanceId: ").append(toIndentedString(instanceId)).append("\n"); sb.append(" catalogName: ").append(toIndentedString(catalogName)).append("\n"); sb.append(" databasePattern: ").append(toIndentedString(databasePattern)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
6218dafdd86ee47c5166d4406ab791a3c2164d96
8411d30dc751956554fd97c70b48b7415d148de4
/src/test/java/org/kasource/commons/reflection/filter/fields/FieldClassFieldFilterTest.java
b578df99635ea344ebbaec9ac08049a295cea270
[]
no_license
wigforss/Ka-Commons
66b7d471271aebac0334b7a6ab6de11bd24f1a1c
d3f33a631a55c9f6de3d606cb2b7526535aa3498
refs/heads/master
2021-01-20T15:37:16.314765
2014-01-14T23:13:15
2014-01-14T23:13:15
4,138,920
0
1
null
null
null
null
UTF-8
Java
false
false
1,609
java
package org.kasource.commons.reflection.filter.fields; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.lang.reflect.Field; import org.easymock.classextension.EasyMock; import org.junit.Test; import org.junit.runner.RunWith; import org.kasource.commons.reflection.filter.classes.ClassFilter; import org.unitils.UnitilsJUnit4TestClassRunner; import org.unitils.easymock.EasyMockUnitils; import org.unitils.easymock.annotation.Mock; import org.unitils.inject.annotation.InjectIntoByType; import org.unitils.inject.annotation.TestedObject; @RunWith(UnitilsJUnit4TestClassRunner.class) public class FieldClassFieldFilterTest { @InjectIntoByType @Mock private ClassFilter classFilter; @TestedObject private FieldClassFieldFilter filter = new FieldClassFieldFilter(classFilter); @Test public void passTrue() throws SecurityException, NoSuchFieldException { EasyMock.expect(classFilter.passFilter(int.class)).andReturn(true); EasyMockUnitils.replay(); Field field = MyClass.class.getField("number"); assertTrue(filter.passFilter(field)); } @Test public void passFalse() throws SecurityException, NoSuchFieldException { EasyMock.expect(classFilter.passFilter(int.class)).andReturn(false); EasyMockUnitils.replay(); Field field = MyClass.class.getField("number"); assertFalse(filter.passFilter(field)); } private static class MyClass { @SuppressWarnings("unused") public int number; } }
[ "rikard.wigforss@gmail.com" ]
rikard.wigforss@gmail.com
1b5fedf4fe3006b27c90d6b7046d4daa04ae0b30
25d24176409e28bb89e872f080564fb2b9cc684d
/SnakeAndLadderGame/src/com/game/model/Dice.java
6d9da00712edc810a356d1b1e8acb614e8f9fe8e
[]
no_license
Amitbhave/SnakeAndLadderGame
d148b6668e51022f7620082013146903215d43fb
180e16b0865f2e4919dffaf22838d3977e5f004f
refs/heads/master
2021-01-17T14:58:58.322275
2016-10-07T14:34:33
2016-10-07T14:34:33
69,738,867
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
/** * */ package com.game.model; import java.util.Random; /** * @author Amit * */ public class Dice { /** * Return value on dice * * @return number */ public static int throwDice() { Random random = new Random(); int num = random.nextInt(6) + 1; return num; } }
[ "noreply@github.com" ]
noreply@github.com
5a0d042df25714c7d2518ccda946765e6046834c
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-cloudformation/src/main/java/com/amazonaws/services/cloudformation/model/transform/ImportStacksToStackSetResultStaxUnmarshaller.java
1f06efe2640f30e48d1c0490d45ae789cae09d2f
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
2,578
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.cloudformation.model.transform; import javax.xml.stream.events.XMLEvent; import javax.annotation.Generated; import com.amazonaws.services.cloudformation.model.*; import com.amazonaws.transform.Unmarshaller; import com.amazonaws.transform.StaxUnmarshallerContext; import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*; /** * ImportStacksToStackSetResult StAX Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ImportStacksToStackSetResultStaxUnmarshaller implements Unmarshaller<ImportStacksToStackSetResult, StaxUnmarshallerContext> { public ImportStacksToStackSetResult unmarshall(StaxUnmarshallerContext context) throws Exception { ImportStacksToStackSetResult importStacksToStackSetResult = new ImportStacksToStackSetResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return importStacksToStackSetResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("OperationId", targetDepth)) { importStacksToStackSetResult.setOperationId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return importStacksToStackSetResult; } } } } private static ImportStacksToStackSetResultStaxUnmarshaller instance; public static ImportStacksToStackSetResultStaxUnmarshaller getInstance() { if (instance == null) instance = new ImportStacksToStackSetResultStaxUnmarshaller(); return instance; } }
[ "" ]
f9c8de321e4bb0942595ecadf95c105f0e0005c1
4eb92caac68068cd88f5d700de81087bfbc1074c
/src/main/java/com/doronzehavi/newsitemweb/service/NewsItemService.java
27140924f8f0160ff4b1080bff9df15e98235bce
[]
no_license
doronz/NewsItemWeb
7d097fb6de083cb73ec5836231f6f71dae323d5b
1b6d80f4255bdec817a3577569b6f56c408313fb
refs/heads/master
2021-01-20T01:43:25.365171
2017-05-13T04:49:03
2017-05-13T04:49:03
89,320,462
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.doronzehavi.newsitemweb.service; import com.doronzehavi.newsitemweb.model.item.NewsItem; import org.springframework.data.domain.Page; import java.util.List; public interface NewsItemService { public Page<NewsItem> fetchNewsItemsByPage(int pageNumber); }
[ "doron1zehavi@gmail.com" ]
doron1zehavi@gmail.com
a94c9042ed37468fef57f67bf456cd03f45cbeb0
48fc0bc9aa5923af3e7affbfa149baa99e5e2afc
/lab9/Resizable.java
63192fed6596b60d254da0ee6c40921e8c3ef534
[]
no_license
mary-jean-cugal/CMSC22
489d61d537993f9c969e59002d592739035c64e8
12ed7481997a872838c1d550d5fd9097465942d0
refs/heads/master
2021-11-25T09:35:53.394092
2016-12-08T15:50:14
2016-12-08T15:50:14
68,385,149
1
0
null
null
null
null
UTF-8
Java
false
false
72
java
package ex2; public interface Resizable { void resize(int percent); }
[ "noreply@github.com" ]
noreply@github.com
a3350d72b2f22865e81a1a36efecbb6b25d39dd3
ff9e597cd6067a3b37f934d5c68cfbf8325eb822
/src/main/java/com/lsc/test/util/ScriptUtil.java
69cea09b0dbe059d647ca8e05415a78e19cfc6fc
[]
no_license
luo-shicheng/gtmdhxy
5e652856597bbf2d5f512286264b19f1ac1dc01d
9d7eeaa5f8923a7a5203f3ac7c70be914e694fba
refs/heads/master
2022-05-27T12:23:38.233291
2022-03-31T15:05:23
2022-03-31T15:05:23
202,082,753
0
0
null
null
null
null
UTF-8
Java
false
false
4,714
java
package com.lsc.test.util; import com.fasterxml.jackson.databind.ObjectMapper; import org.omg.CORBA.MARSHAL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; public class ScriptUtil { private static final Logger logger = LoggerFactory.getLogger(ScriptUtil.class); public static final SimpleDateFormat HOUR_MIN_SEC_MILLSEC = new SimpleDateFormat("HH:mm:ss SSS"); public static final SimpleDateFormat YEAR_MONTH_DAY_HOUR_MIN_SEC_MILLSEC = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); /** * 脚本执行,日志文件实时输出 * * @param command 命令行 * @param scriptFile 脚本文件 * @param params 脚本参数 */ public static int exec(String command, String scriptFile, String... params) { List<String> cmdarray = new ArrayList<>(); cmdarray.add(command); cmdarray.add(scriptFile); if (params != null && params.length > 0) { Collections.addAll(cmdarray, params); } String[] cmdArrayFinal = cmdarray.toArray(new String[0]); // process-exec return exec(cmdArrayFinal); } /** * 脚本执行,日志文件实时输出 * * @param command 完整命令行,只能是String或String[]或List<String> */ @SuppressWarnings("unchecked") public static int exec(Object command) { Thread inputThread = null; Thread errThread = null; Process process; try { if (command instanceof String) { process = Runtime.getRuntime().exec((String) command); } else if (command instanceof String[]) { process = Runtime.getRuntime().exec((String[]) command); } else if (command instanceof List) { ProcessBuilder pb = new ProcessBuilder(); pb.command((List<String>) command); process = pb.start(); } else { logger.warn("当前命令类型 {} 格式不支持", command.getClass().getName()); return -1; } } catch (Exception e) { logger.warn("生成脚本命令异常", e); return -1; } long start = System.currentTimeMillis(); try { inputThread = new Thread(() -> { try (InputStream is = process.getInputStream()) { log(is); } catch (Exception e) { logger.warn("打印输入流信息失败"); } }); errThread = new Thread(() -> { try (InputStream is = process.getErrorStream()) { log(is); } catch (Exception e) { logger.warn("打印错误流信息失败"); } }); final Thread thread1 = inputThread; final Thread thread2 = errThread; Thread daemon = new Thread(() -> { while (System.currentTimeMillis() - start < 5 * 1000) { try{ Thread.sleep(5000); }catch (Exception e){ } } logger.warn("命令 {} 超时,强行干掉当前命令", command); kill(process, thread1, thread2); }); inputThread.start(); errThread.start(); daemon.setDaemon(true); daemon.start(); return process.waitFor(); } catch (Exception e) { logger.warn("执行脚本命令异常", e); return -1; } finally { kill(process, inputThread, errThread); } } private static void log(InputStream is) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); String line; while ((line = in.readLine()) != null) { logger.info(line); } in.close(); } private static void kill(Process process, Thread inputThread, Thread errThread) { if (inputThread != null && inputThread.isAlive()) { inputThread.interrupt(); } if (errThread != null && errThread.isAlive()) { errThread.interrupt(); } if (process.isAlive()) { process.destroy(); } } public static void main(String[] args) throws Exception{ ObjectMapper o =new ObjectMapper(); } }
[ "695788857@qq.com" ]
695788857@qq.com
a3149f011d4ce4b51475f2745e37f8c1033b78ad
81e352be93a6bf120d1774f0df8179d22d99f48b
/app/src/main/java/com/rishabh/github/instagrabber/database/DBController.java
d76a7f17cc566777ec87424009b9a30f58d22ad7
[ "MIT" ]
permissive
rrishabhj/InstaImageDownloader
b0e56d184e5523cee38b77319a3c53b9022f29ed
6cf72c1f6df6ce6c3b75a9de982855425fd82dcd
refs/heads/master
2021-06-24T17:53:39.755919
2017-09-14T17:22:23
2017-09-14T17:22:23
71,039,358
19
5
null
null
null
null
UTF-8
Java
false
false
4,745
java
package com.rishabh.github.instagrabber.database; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.util.ArrayList; import java.util.List; public class DBController { // Database fields private DBhelper dbHelper; private Context context; private SQLiteDatabase database; public DBController(Context context) { dbHelper = new DBhelper(context); } public void close() { dbHelper.close(); } public void addimage(InstaImage img) { database = dbHelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(DBhelper.COL_IMG_NAME, img.get_name()); values.put(DBhelper.COL_IMG_INSTA_URL , img.get_instaImageURL()); values.put(DBhelper.COL_IMG_PHONE_URL, img.get_phoneImageURL()); values.put(DBhelper.COL_IMG_CAPTION, img.get_caption()); database.insert(DBhelper.TABLE_NAME, null, values); System.out.println("Record Added"); database.close(); } public InstaImage getInstaImage(int _id) { database = dbHelper.getReadableDatabase(); Cursor cursor = database.query(DBhelper.TABLE_NAME, DBhelper.columns, DBhelper.COL_IMG_ID + " =?", new String[]{String.valueOf(_id)}, null, null, null); if (cursor != null) { cursor.moveToFirst(); } InstaImage img = new InstaImage(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2), cursor.getString(3),cursor.getString(4)); return img; } public int getTotalImages(){ SQLiteDatabase db = dbHelper.getWritableDatabase(); ArrayList<InstaImage> imageList = new ArrayList<InstaImage>(); // Select All Query String selectQuery = "SELECT * FROM " + DBhelper.TABLE_NAME; Cursor cursor = db.rawQuery(selectQuery, null); return cursor.getCount(); } // Getting All Employees public ArrayList<InstaImage> getAllInstaImages() { SQLiteDatabase db = dbHelper.getWritableDatabase(); ArrayList<InstaImage> imageList = new ArrayList<InstaImage>(); // Select All Query String selectQuery = "SELECT * FROM " + DBhelper.TABLE_NAME; Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { InstaImage img = new InstaImage(); img.set_id(Integer.parseInt(cursor.getString(0))); img.set_name(cursor.getString(1)); img.set_instaImageURL(cursor.getString(2)); img.set_phoneImageURL(cursor.getString(3)); img.set_caption(cursor.getString(4)); // Adding contact to list imageList.add(img); } while (cursor.moveToNext()); } // return contact list return imageList; } //// Updating single employee //public int updateEmployee(InstaImage emp) { // SQLiteDatabase db = dbHelper.getWritableDatabase(); // // ContentValues values = new ContentValues(); // // values.put(DBhelper.COL_EMP_NAME, emp.get_name()); // values.put(DBhelper.COL_EMP_ADDRESS, emp.get_address()); // values.put(DBhelper.COL_EMP_PHONE, emp.get_phone()); // // // updating row // return db.update(DBhelper.TABLE_NAME, values, DBhelper.COL_EMP_ID + " = ?", // new String[]{String.valueOf(emp.get_id())}); //} public boolean isURLPresent(String postURL){ boolean flag=false; SQLiteDatabase db = dbHelper.getWritableDatabase(); // Select All Query String selectQuery = "SELECT * FROM " + DBhelper.TABLE_NAME; Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { if(cursor.getString(2).equals(postURL)){ flag=true; break; } } while (cursor.moveToNext()); } return flag; } public void clearTable() { database = dbHelper.getWritableDatabase(); database.delete(DBhelper.TABLE_NAME, null,null); } // Deleting single employee public void deleteInstaImage(InstaImage img) { SQLiteDatabase db = dbHelper.getWritableDatabase(); db.delete(DBhelper.TABLE_NAME, DBhelper.COL_IMG_ID + " = ?", new String[]{String.valueOf(img.get_id())}); System.out.println("Record Deleted"); db.close(); } }
[ "rishabhjindal4@gmail.com" ]
rishabhjindal4@gmail.com
39fed9ac0e820883427296f470ce2fea3c2f70dc
b9bfebe568f1afd9b90f83f3067e2aa1f266a8ee
/FlyweightPattern/src/zrc/flyweightpattern/ConcreteWebSite.java
ae90d587dc554073ac3234edd30fa519f1a3a2a8
[]
no_license
ZrcLeibniz/Java
fa7c737840d33e572e5d8d87951b6ccd609a38af
cfc3119712844dd8856009101575c819874d89f0
refs/heads/master
2023-06-21T01:49:48.132730
2021-07-23T07:07:42
2021-07-23T07:07:42
267,491,828
0
0
null
2020-10-13T02:18:30
2020-05-28T04:20:10
Java
GB18030
Java
false
false
320
java
package zrc.flyweightpattern; public class ConcreteWebSite extends WebSite { private String type = ""; @Override public void use(User user) { System.out.println("网站的发布形式为:" + type + "目前是" + user + "在用"); } public ConcreteWebSite(String type) { super(); this.type = type; } }
[ "2834511920@qq.com" ]
2834511920@qq.com
e52b74dfd3a46af2eeb90b7da8a6decb491d3479
15918c210d5918afae8f1176109fcbcc73aae934
/src/main/java/com/project/platform/renting/core/service/impl/ShoppingCartServiceImpl.java
b02540d5eaed2e1b58f0021487bdadabd87b3b5f
[]
no_license
egibra/RentProject
d2596f890a6627b807fd4cc972bf78f12f394002
ee4accf9eb3d5550f9a893d326edf121ce16cf24
refs/heads/master
2021-06-30T15:30:37.339185
2017-09-21T12:58:55
2017-09-21T12:58:55
104,348,179
0
0
null
null
null
null
UTF-8
Java
false
false
1,389
java
package com.project.platform.renting.core.service.impl; import com.project.platform.renting.core.model.ShoppingCart; import com.project.platform.renting.core.model.User; import com.project.platform.renting.core.repository.ShoppingCartRepository; import com.project.platform.renting.core.service.GenericCrudServiceImpl; import com.project.platform.renting.core.service.ShoppingCartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class ShoppingCartServiceImpl extends GenericCrudServiceImpl<ShoppingCart, ShoppingCartRepository> implements ShoppingCartService{ @Autowired public ShoppingCartServiceImpl(ShoppingCartRepository repository) { super(repository); } @Override public List<ShoppingCart> findByEmail(String email) { return repository.findByUserEmail(email); } @Override public void saveShoppingList(List<ShoppingCart> shoppingCart) { repository.save(shoppingCart); } @Override public ShoppingCart findByEmailAndProductId(String email, int id) { return repository.findByUserEmailAndProductId(email, id); } @Override public void delete(User user) { repository.deleteByUser(user); } }
[ "egidijus.brazaitis@gmail.com" ]
egidijus.brazaitis@gmail.com
4605049f92a116e725c1f7e4c2f24cecfa3b00da
5e7bc3cbaceaba8be2cb9de951198c5283844173
/super/PCore/src/main/java/com/fast/dev/core/mvc/MVCResponseConfiguration.java
4470374f2fdd9616e32fb34dd78b37cbd55df843
[]
no_license
lianshufeng/Fast
abbb162db05b4b0ece3db60a7eea0c38c686462a
0b29400c2ec88db033729e9dd645db9aa792d06f
refs/heads/master
2022-07-08T23:30:13.190635
2021-05-26T05:41:10
2021-05-26T05:41:10
130,854,753
9
1
null
2022-06-25T07:26:27
2018-04-24T12:58:53
Java
UTF-8
Java
false
false
2,222
java
package com.fast.dev.core.mvc; import com.fast.dev.core.endpoints.SuperEndpoints; import com.fast.dev.core.util.result.InvokerExceptionResolver; import com.fast.dev.core.util.result.InvokerResult; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; @Configuration public class MVCResponseConfiguration { /** * 通用的异常捕获 * * @return */ @Bean @ConditionalOnMissingBean public InvokerExceptionResolver invokerExceptionResolver() { return new InvokerExceptionResolver(); } @Bean public ResponseBodyAdvice responseBodyAdvice() { return new UserApiResponseBodyAdvice(); } @RestControllerAdvice public class UserApiResponseBodyAdvice implements ResponseBodyAdvice<Object> { @Override public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) { return true; } @Override public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { if (body instanceof InvokerResult) { return body; } String path = request.getURI().getPath(); return StringUtils.hasText(path) && (path.indexOf("manager") > -1 || path.indexOf(SuperEndpoints.DefaultEndPointName) > -1 || path.indexOf("openapi") > -1) ? body : InvokerResult.notNull(body); } } }
[ "251708339@qq.com" ]
251708339@qq.com
f3d37f2e2c242b21a218c119386e08166ef865d6
5aa4d6e75dff32e54ccaa4b10709e7846721af05
/samples/j2ee/snippets/com.ibm.sbt.automation.test/src/main/java/com/ibm/sbt/test/js/authentication/OAuth20Popup.java
a841332fde1d9ac4f41bf20c48f4ce3117eba5a9
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
gnuhub/SocialSDK
6bc49880e34c7c02110b7511114deb8abfdee924
02cc3ac4d131b7a094f6983202c1b5e0043b97eb
refs/heads/master
2021-01-16T20:08:07.509051
2014-07-09T08:53:03
2014-07-09T08:53:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,385
java
/* * � Copyright IBM Corp. 2013 * * 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.ibm.sbt.test.js.authentication; import static org.junit.Assert.assertTrue; import org.junit.Test; import com.ibm.sbt.automation.core.test.BaseAuthServiceTest; /** * @author mwallace * * @date 6 Mar 2013 */ public class OAuth20Popup extends BaseAuthServiceTest { @Test public void testOAuth20AutoDetect() { setAuthType(AuthType.AUTO_DETECT); boolean result = checkExpected("Authentication_API_OAuth20Popup", "Successfully logged in"); assertTrue(getExpectedErrorMsg(), result); } @Test public void testOAuth20() { setAuthType(AuthType.OAUTH10); boolean result = checkExpected("Authentication_API_OAuth20_Popup", "Successfully logged in"); assertTrue(getExpectedErrorMsg(), result); } }
[ "LORENZOB@ie.ibm.com" ]
LORENZOB@ie.ibm.com
eecadda22dc6a9db9930bbc3c69ebad27855aadf
f385cfaa11515a28f0de2c4a0f4818612914a722
/mytraining/mytrainingfulfilmentprocess/testsrc/com/rcyber/fulfilmentprocess/test/actions/SplitOrder.java
70da58c5bb374b205716d56a73e4aecbdc286a3b
[]
no_license
PoojaSapreRC/HybrisRepository
09dae3d50954acca7a0a6ecb078c21da3ae307fa
b30f6ed6538fcb2a3b11774ba747a4a2137b91e9
refs/heads/main
2023-05-29T23:18:26.998234
2021-06-04T11:49:34
2021-06-04T11:49:34
373,798,134
0
0
null
null
null
null
UTF-8
Java
false
false
2,622
java
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package com.rcyber.fulfilmentprocess.test.actions; import de.hybris.platform.core.Registry; import de.hybris.platform.orderprocessing.model.OrderProcessModel; import de.hybris.platform.ordersplitting.model.ConsignmentProcessModel; import de.hybris.platform.processengine.BusinessProcessService; import de.hybris.platform.processengine.enums.ProcessState; import de.hybris.platform.processengine.model.BusinessProcessModel; import de.hybris.platform.processengine.model.BusinessProcessParameterModel; import com.rcyber.fulfilmentprocess.constants.MytrainingFulfilmentProcessConstants; import java.util.Arrays; import org.apache.log4j.Logger; /** * */ public class SplitOrder extends TestActionTemp { private static final Logger LOG = Logger.getLogger(SplitOrder.class); private int subprocessCount = 1; public void setSubprocessCount(final int subprocessCount) { this.subprocessCount = subprocessCount; } @Override public String execute(final BusinessProcessModel process) throws Exception { LOG.info("Process: " + process.getCode() + " in step " + getClass()); final BusinessProcessParameterModel warehouseCounter = new BusinessProcessParameterModel(); warehouseCounter.setName(MytrainingFulfilmentProcessConstants.CONSIGNMENT_COUNTER); warehouseCounter.setProcess(process); warehouseCounter.setValue(Integer.valueOf(subprocessCount)); save(warehouseCounter); final BusinessProcessParameterModel params = new BusinessProcessParameterModel(); params.setName(MytrainingFulfilmentProcessConstants.PARENT_PROCESS); params.setValue(process.getCode()); for (int i = 0; i < subprocessCount; i++) { final ConsignmentProcessModel consProcess = modelService.create(ConsignmentProcessModel.class); consProcess.setParentProcess((OrderProcessModel) process); consProcess.setCode(process.getCode() + "_" + i); consProcess.setProcessDefinitionName("consignment-process-test"); params.setProcess(consProcess); consProcess.setContextParameters(Arrays.asList(params)); consProcess.setState(ProcessState.CREATED); modelService.save(consProcess); getBusinessProcessService().startProcess(consProcess); LOG.info("Subprocess: " + process.getCode() + "_" + i + " started"); } //getQueueService().actionExecuted(process, this); return "OK"; } /** * @return the businessProcessService */ @Override public BusinessProcessService getBusinessProcessService() { return (BusinessProcessService) Registry.getApplicationContext().getBean("businessProcessService"); } }
[ "poojasaprerc@gmail.com" ]
poojasaprerc@gmail.com
a574e39417d2b51220ec1239e990fda42391abc8
761beb0deb7168c4d7a1e55ec2ee825841f63242
/hitalk_compiler/src/main/java/org/ltc/hitalk/term/IntTerm.java
027f0ce81806f80e40d8a159adf3fd83deeb560d
[]
no_license
Stranger2015/HiTalk
b2e96781f112fe55a1318dd4e55e6c9ba07d80a6
662e7a871a1755a4644a45702b6493882bf62897
refs/heads/master
2021-06-26T16:19:51.412711
2020-10-20T10:47:18
2020-10-20T10:47:18
164,804,160
2
1
null
null
null
null
UTF-8
Java
false
false
1,296
java
package org.ltc.hitalk.term; import org.ltc.hitalk.NumberTerm; import org.ltc.hitalk.compiler.IVafInterner; import java.util.List; /** * */ public class IntTerm extends NumberTerm implements ITerm { /** * Creates a new number with the specified value. * * @param value The value of the number. */ public IntTerm(int value) { super(value); } /** * */ @Override public void free() { } @Override public void accept(ITermVisitor visitor) { visitor.visit(this); } @Override public List<ITerm> acceptTransformer(ITermTransformer transformer) { return transformer.transform(this); } public String toString(IVafInterner interner, boolean printVarName, boolean printBindings) { return toString(); } public boolean structuralEquals(ITerm<?> term) { return false; } public int getInt() { return image; } @Override public boolean isNumber() { return true; } @Override public boolean isConstant() { return true; } @Override public boolean isGround () { return true; } /** * @return */ @Override public boolean isJavaObject() { return false; } }
[ "anton.danilov@gmail.com" ]
anton.danilov@gmail.com
d9edce80105d9f7275641a098e62e9ca3b6760ea
19d1c558a7b78ecb345e60271dadb52bee7dcb38
/src/ljx/ashin/io/OioServer.java
67dcaf3aa43e7297f0503ef11a32624602382031
[]
no_license
ashin-person/NetProgram
32f9f150d2bd097d1edd8948a9b4cc86d50b1b1f
01b98fb8546b7219d3f8afa9533011ad21ec2489
refs/heads/master
2021-01-23T06:10:04.980539
2017-09-17T15:10:19
2017-09-17T15:10:19
102,493,299
0
0
null
null
null
null
UTF-8
Java
false
false
1,238
java
package ljx.ashin.io; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; /** * 传统的IO通讯 * Created by AshinLiang on 2017/9/14. */ public class OioServer { /** * 端口 */ private int port; public OioServer(int port){ this.port = port; initServer(); } /** * 初始化客户端 */ private void initServer(){ try { ServerSocket serverSocket = new ServerSocket(this.port); System.out.println("服务器启动成功"); Socket socket = serverSocket.accept();//阻塞点 System.out.println("有新的客户端进来了"); while (true){ InputStream inputStream = socket.getInputStream(); byte[] data = new byte[1024]; int len = inputStream.read(data);//阻塞点 String msg = new String(data,0,len); System.out.println("接收到的客户端信息为:"+msg); } } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { OioServer oioServer = new OioServer(8765); } }
[ "1123842546@qq.com" ]
1123842546@qq.com
d07d04a3dbc82b1a588bc763a089ac870e100aab
a2b16ab32aef72f1e0d4b14d66af5e51008c61c5
/src/LavaLampJenkins/LampConfigReader.java
5c60552585921bbd2b2237c86c0ddeabb2356d84
[]
no_license
Philur/LLJ
8839a0db2210ea980f5a3987fb097b23ca05de6a
984b6e007eb59b7d37b16f11cf196957bcf4e759
refs/heads/master
2021-01-10T19:54:00.953505
2014-11-05T12:24:14
2014-11-05T12:24:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,808
java
package LavaLampJenkins; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import org.joda.time.LocalTime; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.List; public class LampConfigReader { /** * Read a LampConfig object from an XML file * * @param configIs Configuration file * @return The MyData object */ public static LampConfig read(InputStream configIs) throws IOException { SAXBuilder builder = new SAXBuilder(); try { Document doc = builder.build(configIs); Element root = doc.getRootElement(); List<Lamp> lamps = parseLamps(root); return new LampConfig( new URL(root.getChild("jenkinsUrl").getText()), Integer.parseInt(root.getChild("pollTimeMsec").getText()), LocalTime.parse(root.getChild("turnOn").getText()), LocalTime.parse(root.getChild("turnOff").getText()), root.getChild("activeHolidays").getText().equals("true"), lamps); } catch (JDOMException e) { throw new IOException("Malformed XML file", e); } } private static List<Lamp> parseLamps(Element lampsElement) { Element lampCommandElement = lampsElement.getChild("lamps"); List<Element> list = lampCommandElement.getChildren(); List<Lamp> result = new ArrayList<Lamp>(); for (Element cmdElement : list) { result.add(new Lamp( cmdElement.getChild("name").getText(), cmdElement.getChild("description").getText(), cmdElement.getChild("onCommand").getText(), cmdElement.getChild("offCommand").getText(), parseJobNames(cmdElement.getChild("jobs")), parseActions(cmdElement.getChild("actions")) )); } return result; } private static List<Action> parseActions(Element actionsElement) { List<Action> result = new ArrayList<Action>(); List<Element> list = actionsElement.getChildren(); for (Element e : list) { result.add(new Action( e.getText().equals("on"), EventType.valueOf(e.getName()) ) ); } return result; } private static List<String> parseJobNames(Element jobsElement) { List<String> result = new ArrayList<String>(); List<Element> list = jobsElement.getChildren(); for (Element jobElement : list) { result.add(jobElement.getText()); } return result; } }
[ "philur@yahoo.com" ]
philur@yahoo.com
1d33e409989d656b4a77f1450d3b501cca1f8985
2d53d6f8d3e0e389bba361813e963514fdef3950
/Sql_injection/s02/CWE89_SQL_Injection__Environment_executeQuery_81_goodG2B.java
fdf9d686bbf69573b13d30c4f42869f9b9f6ef62
[]
no_license
apobletts/ml-testing
6a1b95b995fdfbdd68f87da5f98bd969b0457234
ee6bb9fe49d9ec074543b7ff715e910110bea939
refs/heads/master
2021-05-10T22:55:57.250937
2018-01-26T20:50:15
2018-01-26T20:50:15
118,268,553
0
2
null
null
null
null
UTF-8
Java
false
false
2,800
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE89_SQL_Injection__Environment_executeQuery_81_goodG2B.java Label Definition File: CWE89_SQL_Injection.label.xml Template File: sources-sinks-81_goodG2B.tmpl.java */ /* * @description * CWE: 89 SQL Injection * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded string * Sinks: executeQuery * GoodSink: Use prepared statement and executeQuery (properly) * BadSink : data concatenated into SQL statement used in executeQuery(), which could result in SQL Injection * Flow Variant: 81 Data flow: data passed in a parameter to an abstract method * * */ package testcases.CWE89_SQL_Injection.s02; import testcasesupport.*; import javax.servlet.http.*; import java.sql.*; import java.util.logging.Level; public class CWE89_SQL_Injection__Environment_executeQuery_81_goodG2B extends CWE89_SQL_Injection__Environment_executeQuery_81_base { public void action(String data ) throws Throwable { Connection dbConnection = null; Statement sqlStatement = null; ResultSet resultSet = null; try { dbConnection = IO.getDBConnection(); sqlStatement = dbConnection.createStatement(); /* POTENTIAL FLAW: data concatenated into SQL statement used in executeQuery(), which could result in SQL Injection */ resultSet = sqlStatement.executeQuery("select * from users where name='"+data+"'"); IO.writeLine(resultSet.getRow()); /* Use ResultSet in some way */ } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error getting database connection", exceptSql); } finally { try { if (resultSet != null) { resultSet.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing ResultSet", exceptSql); } try { if (sqlStatement != null) { sqlStatement.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Statement", exceptSql); } try { if (dbConnection != null) { dbConnection.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql); } } } }
[ "anna.pobletts@praetorian.com" ]
anna.pobletts@praetorian.com
7feb84e467feb53735c5fb5ccbae0bf1472f85e4
9517b70b7cd19c7bd2912add5f4ce81a18537ef7
/core/src/com/bsencan/openchess/screens/TestScreen.java
0ecf0deb05dbec945fcbf1bfafc6d1b990a5494c
[ "Apache-2.0" ]
permissive
quanvh3/Openchess
44ec33714759a6c09ecad86dae44a26c6066cfeb
e1aeac1062af1cfab39f1fc4ca1fb5412f022174
refs/heads/master
2021-01-10T04:46:23.930362
2016-01-22T03:33:38
2016-01-22T03:33:38
50,155,535
0
0
null
null
null
null
UTF-8
Java
false
false
1,956
java
/* * Copyright 2013 Baris Sencan (baris.sencan@me.com) * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package com.bsencan.openchess.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.ui.Dialog; import com.bsencan.openchess.Assets; import com.bsencan.openchess.OpenChess; import com.bsencan.openchess.view.MainMenuRenderer; /** * Game's main menu screen. Any touch event causes a transition to game screen. * * @author Baris Sencan */ public class TestScreen implements Screen { private MainMenuRenderer renderer; @Override public void render(float delta) { this.renderer.render(delta); if (Gdx.input.justTouched()) { } } @Override public void resize(int width, int height) { this.renderer.setSize(width, height); } @Override public void show() { Assets.loadMainMenu(); Assets.menuMusic.setLooping(true); Assets.menuMusic.play(); this.renderer = new MainMenuRenderer(); this.renderer .setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } @Override public void hide() { this.renderer.dispose(); Assets.disposeMainMenu(); } @Override public void pause() { Assets.menuMusic.pause(); } @Override public void resume() { Assets.menuMusic.play(); } @Override public void dispose() { } // Never called automatically. }
[ "dungtv1@smartosc.com" ]
dungtv1@smartosc.com
5b6c89e3b5375f683c51663c852f53816c2a494f
ce2db0964af9b13984cc9cc83a673300d45414a4
/asciidoc-confluence-publisher-maven-plugin/src/main/java/org/sahli/asciidoc/confluence/publisher/maven/plugin/AsciidocConfluencePublisherMojo.java
b9d5d6cf8ac1b2edc373723f988a89da9360bddd
[ "Apache-2.0" ]
permissive
spring-cloud-aws-buildmaster/confluence-publisher
ab195d35344e83cf83771a93a1b88ea42c9d8dc6
84613cfd0b3afceb008b7f8f56fe2018560d041d
refs/heads/master
2021-01-19T12:40:29.987522
2017-08-19T13:51:34
2017-08-19T13:51:34
99,602,748
0
0
null
2017-08-07T17:26:50
2017-08-07T17:26:50
null
UTF-8
Java
false
false
6,111
java
/* * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.sahli.asciidoc.confluence.publisher.maven.plugin; import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher; import org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient; import org.sahli.asciidoc.confluence.publisher.client.metadata.ConfluencePublisherMetadata; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.List; import java.util.Map; import static java.util.Arrays.asList; import static org.apache.commons.io.FileUtils.copyInputStreamToFile; import static org.sahli.asciidoc.confluence.publisher.maven.plugin.AsciidocConfluenceConverter.convertAndBuildConfluencePages; /** * @author Alain Sahli * @author Christian Stettler */ @Mojo(name = "publish") public class AsciidocConfluencePublisherMojo extends AbstractMojo { private static final String TEMPLATES_CLASSPATH_PATTERN = "org/sahli/asciidoc/confluence/publisher/converter/templates/*"; @Parameter(defaultValue = "${project.build.directory}/confluence-publisher") private File generatedDocOutputPath; @Parameter(defaultValue = "${project.build.directory}/asciidoc2confluence-templates", readonly = true) private File asciidocConfluenceTemplates; @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") @Parameter(defaultValue = "${plugin.artifactMap}", required = true, readonly = true) private Map<String, Artifact> pluginArtifactMap; @Parameter private File asciidocRootFolder; @Parameter private String rootConfluenceUrl; @Parameter(required = true) private String spaceKey; @Parameter private String ancestorId; @Parameter private String username; @Parameter private String password; @SuppressWarnings("ResultOfMethodCallIgnored") @Override public void execute() throws MojoExecutionException, MojoFailureException { try { extractTemplatesFromJar(); this.generatedDocOutputPath.mkdirs(); ConfluencePublisherMetadata confluencePublisherMetadata = convertAndBuildConfluencePages(this.asciidocRootFolder.getAbsolutePath(), this.generatedDocOutputPath.getAbsolutePath(), this.asciidocConfluenceTemplates.getAbsolutePath(), this.spaceKey, this.ancestorId); publish(confluencePublisherMetadata); } catch (Exception e) { getLog().error("Publishing to Confluence failed: " + e.getMessage()); throw new MojoExecutionException("Publishing to Confluence failed", e); } } private void publish(ConfluencePublisherMetadata confluencePublisherMetadata) { ConfluenceRestClient confluenceRestClient = new ConfluenceRestClient(this.rootConfluenceUrl, httpClient(), this.username, this.password); ConfluencePublisher confluencePublisher = new ConfluencePublisher(confluencePublisherMetadata, confluenceRestClient, this.generatedDocOutputPath.getAbsolutePath()); confluencePublisher.publish(); } private void extractTemplatesFromJar() { try { createTemplatesTargetFolder(); copyTemplatesToTarget(templateResources()); } catch (IOException e) { throw new RuntimeException(e); } } private List<Resource> templateResources() throws IOException { Artifact artifact = this.pluginArtifactMap.get("org.sahli.asciidoc.confluence.publisher:asciidoc-confluence-publisher-converter"); URLClassLoader templateClassLoader = new URLClassLoader(new URL[]{artifact.getFile().toURI().toURL()}); PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver(new DefaultResourceLoader(templateClassLoader)); return asList(pathMatchingResourcePatternResolver.getResources(TEMPLATES_CLASSPATH_PATTERN)); } @SuppressWarnings("ResultOfMethodCallIgnored") private void createTemplatesTargetFolder() { this.asciidocConfluenceTemplates.mkdir(); } private void copyTemplatesToTarget(List<Resource> resources) { resources.forEach(templateResource -> { try { copyInputStreamToFile(templateResource.getInputStream(), new File(this.asciidocConfluenceTemplates, templateResource.getFilename())); } catch (IOException e) { throw new RuntimeException("Could not write template to target file", e); } }); } private static CloseableHttpClient httpClient() { RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout(20 * 1000) .setConnectTimeout(20 * 1000) .build(); return HttpClients.custom() .setDefaultRequestConfig(requestConfig) .build(); } }
[ "sahli.alain@gmail.com" ]
sahli.alain@gmail.com
425aa61501a7b92ad2ba9f60c06b0acbb80e7965
d32993ea1ea7b42d0dbc85305b50c5ea2a4d2e45
/src/main/java/com/crcb/utils/BaseMap.java
01fd281c3bfd63d946e84f5146d8cf7cc86bfa0f
[]
no_license
qiuren2017/springboot_quartz_schedule
631a2d533bcaa17890911a4d45fbd0daf0b8c3b8
6e34d20b1ed72af63a9d190801a2cc4427e12d4b
refs/heads/master
2022-12-20T12:22:27.517671
2020-09-29T09:35:20
2020-09-29T09:35:20
284,419,526
0
0
null
2020-08-02T14:09:17
2020-08-02T08:11:42
Java
UTF-8
Java
false
false
10,000
java
package com.crcb.utils; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Locale; /** * @Classname BaseMap * @Description 封装后的HashMap,方便获取值 * @Date 2020/3/18 13:45 * @Created by gangye */ public class BaseMap extends HashMap<String,Object> implements Serializable { /** * */ private static final long serialVersionUID = 1L; public BaseMap() { } @Override public Object put(String key, Object value){ if(value instanceof java.sql.Date){ java.sql.Date sdate = (java.sql.Date)value; java.util.Date udate = new Date(); udate.setTime(sdate.getTime()); super.put(key, udate); }else{ super.put(key, value); } return value; } public void convertsInt(String...keys){ for(String key: keys){ if(this.containsKey(key)) { Object value = this.getInt(key); this.setProperty(key, value); } } } public void convertsLike(String...keys){ for(String key: keys){ if(this.containsKey(key)) { Object value = this.getLikeValue(key); this.setProperty(key, value); } } } public void dateBefore(String key, int before) { Date date = this.getDate(key); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, before); date = cal.getTime(); this.setProperty(key, date); } public void setBeginDateTimeBefore(String key, Date value, int before) { Date date = value; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, 0-before); date = cal.getTime(); this.setProperty(key, date); String dateStr = this.getDateString(key); dateStr += " 00:00:00"; this.setProperty(key, dateStr); } public void setEndDateTimeBefore(String key, Date value, int before) { Date date = value; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, 0-before); date = cal.getTime(); this.setProperty(key, date); String dateStr = this.getTomorrowDateString(key); dateStr += " 00:00:00"; this.setProperty(key, dateStr); } public void setBeginDateTime(String key) { this.setBeginDateTimeStr(key); this.convertsDateTime(key); } public void setBeginDateTimeStr(String key) { String value = this.getDateString(key); value += " 00:00:00"; this.setProperty(key, value); } public void setEndDateTime(String key) { this.setEndDateTimeStr(key); this.convertsDateTime(key); } public void setEndDateTimeStr(String key) { String value = this.getTomorrowDateString(key); value += " 00:00:00"; this.setProperty(key, value); } public void setProperty(String key,Object value){ this.put(key, value); } public BaseMap set(String key,Object value){ this.put(key, value); return this; } public void setKeys(String...keys){ for(String key : keys){ this.setProperty(key, null); } } public String getLeftLikeValue(String key) { String value = this.getString(key); try { value = java.net.URLDecoder.decode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } value = value+"%"; return value; } public String getLikeValue(String key) { String value = this.getString(key); if(value == null) return null; try { value = java.net.URLDecoder.decode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } value = "%"+value+"%"; return value; } public void emptyAllValues(){ for(String key : this.keySet()){ this.put(key, null); } } /** * 多个参数判断是否为空 * @author guoyu */ public Boolean isEmpty(String... keys){ if(keys == null){ return true; } for (String key : keys) { if(isEmpty(key)) return true; } return false; } public Boolean isEmpty(String key){ if(super.containsKey(key)){ Object value = super.get(key); if(value == null){ return true; }else if("".equals(String.valueOf(value).trim())){ return true; } return false; } return true; } public Boolean isNotEmpty(String key){ return !this.isEmpty(key); } public Object getObject(String key){ return super.get(key); } public <T> T getClsObject(String key, Class<T> objClass){ return (T)this.get(key); } public String getString(String key) { if(!this.containsKey(key) || super.get(key) == null) return null; return super.get(key).toString(); } public BigDecimal getDecimal(String key) { return new BigDecimal(super.get(key).toString()); } public Integer getInt(String key){ Object value = this.get(key); if("".equals(value) || value == null)return null; return Integer.parseInt(value.toString()); } public Long getLong(String key){ Object value = this.get(key); if("".equals(value) || value == null)return null; return Long.parseLong(value.toString()); } public Double getDouble(String key){ Object value = this.get(key); if("".equals(value) || value == null)return null; return Double.parseDouble(this.getString(key)); } public Short getShort(String key){ Object value = this.get(key); if("".equals(value) || value == null)return null; return Short.parseShort(this.getString(key)); } public Byte getByte(String key){ Object value = this.get(key); if("".equals(value) || value == null)return null; return Byte.parseByte(this.getString(key)); } public Character getCharacter(String key){ Object value = this.get(key); if("".equals(value) || value == null) { return null; } if(this.getString(key).length() > 1) { return null; } return Character.valueOf(this.getString(key).charAt(0)); } public Float getFloat(String key){ return Float.parseFloat(this.getString(key)); } public Boolean getBool(String key){ return Boolean.parseBoolean(this.getString(key)); } public void convertsDateTime(String...keys){ for(String key: keys){ if(this.isEmpty(key)) continue; Object value = this.get(key); String datePattern = "yyyy-MM-dd HH:mm:ss"; value = this.getDate(key, datePattern); this.setProperty(key, value); } } public void convertsDate(String...keys){ for(String key: keys){ if(this.isEmpty(key)) continue; Object value = this.get(key); String datePattern = "yyyy-MM-dd"; value = this.getDate(key, datePattern); this.setProperty(key, value); } } public Date getDate(String key,String datePattern){ if(datePattern == null) datePattern = "yyyy-MM-dd"; SimpleDateFormat df = new SimpleDateFormat(datePattern, Locale.UK); Object value = super.get(key); if(value == null){ return null; }else if(value instanceof Date){ return (Date)value; }else if(value instanceof String){ try { return df.parse(this.getString(key)); } catch (ParseException e) { throw new RuntimeException(e); } } return (Date)value; } public Date getDate(String key){ return this.getDate(key, null); } public String getDateString(String key){ return this.getDateString(key, null); } public String getDateString(String key,String datePattern){ if(datePattern == null) datePattern = "yyyy-MM-dd"; SimpleDateFormat df = new SimpleDateFormat(datePattern, Locale.UK); Object value = super.get(key); if(value == null || "".equals(value)){ return ""; }else if(value instanceof Date){ return df.format(value); }else if(value instanceof String){ try { Date date = df.parse(this.getString(key)); return df.format(date); } catch (ParseException e) { throw new RuntimeException(e); } } return null; } public String getTomorrowDateString(String key) { String datePattern = "yyyy-MM-dd"; SimpleDateFormat df = new SimpleDateFormat(datePattern, Locale.UK); Object value = super.get(key); Date date = new Date(); if(value == null || "".equals(value)) { return ""; }else if(value instanceof Date){ date = (Date)value; }else if(value instanceof String){ try { date = df.parse(this.getString(key)); } catch (ParseException e) { throw new RuntimeException(e); } } Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) + 1); return df.format(cal.getTime()); } }
[ "710467930@qq.com" ]
710467930@qq.com
f9c066cf2c260c62c1cd5826c36f1dc7972c79ff
f055928a5011d8b3768036e4d2c6a47a89da9dd5
/level_1/WebBrowser/app/src/test/java/su/strannik/webbrowser/ExampleUnitTest.java
7fe4d1595247c3a59b667dcef42feb8e00f10b56
[]
no_license
strannik-mas/android
0f52df9cf6c785c7d8f965093a8f5157d0a51ea8
bba445068764fe52b3106262d8f70b9ea0cd6a47
refs/heads/master
2023-07-12T05:11:32.299841
2023-06-26T19:41:38
2023-06-26T19:41:38
241,197,227
0
0
null
2020-02-18T22:29:30
2020-02-17T20:05:50
Java
UTF-8
Java
false
false
383
java
package su.strannik.webbrowser; 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); } }
[ "s211211@ukr.net" ]
s211211@ukr.net
37eef6707c4e8ddd614dd844562a5d44d82ca3c2
c61a85ba787f4e74a7154a05c07e0aa4af9b67e7
/quiz1/r06922152/BloodPressureSensor.java
567862256eddffc96aa584a0e9ace69e69bc43e2
[]
no_license
yuan3675/SED2017FALL
bdaa5489f158a84b8e67be250f04cfc7e6d3eebc
bf703cbc7ad71ddd726220d6cae4b868556fc395
refs/heads/master
2021-09-03T17:13:02.322205
2018-01-10T16:29:30
2018-01-10T16:29:30
108,546,725
0
0
null
null
null
null
UTF-8
Java
false
false
1,354
java
import java.io.File; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; public class BloodPressureSensor extends Sensor { private String sensorName; private String datasetPath; private ArrayList<Integer> monitor_time = new ArrayList<Integer>(); private ArrayList<Double> monitor_value = new ArrayList<Double>(); public BloodPressureSensor(String name, String dataset) { this.sensorName = name; this.datasetPath = dataset; } public double read(int times) throws Exception{ File dataFile = new File(this.datasetPath); BufferedReader reader = new BufferedReader(new FileReader(dataFile)); String line = ""; for (int i = 0; i < times; i++){ line = reader.readLine(); } reader.close(); if(line == null)line = "-1"; double value = Double.parseDouble(line); return value; } public String getSensorType(){ return "BloodPressureSensor"; } public String getSensorName() { return this.sensorName; } public String getDatasetPath() { return this.datasetPath; } public void setMonitorTime(int time){ this.monitor_time.add(time); } public void setMonitorValue(double value){ this.monitor_value.add(value); } public ArrayList<Integer> getMonitorTime(){ return this.monitor_time; } public ArrayList<Double> getMonitorValue(){ return this.monitor_value; } }
[ "yuan3675@gmail.com" ]
yuan3675@gmail.com
60fd865cbf08763937e8eee8e59b781a6f8da1da
9f998aff7299c05d3ab95b750752aa3c9eaf64cb
/app/src/main/java/com/example/weather/Model/MyList.java
779ea2e09c40f4d762101869e2a18a7cafe1a095
[]
no_license
chunxiding/WeatherApp
01886bc5002bb6cbcc9c6d07003bd6b0516afa1e
27a8a84f2d6349d3fdacd623ae4e5dc027eb5e0f
refs/heads/master
2020-07-28T10:32:06.130222
2019-09-25T16:22:38
2019-09-25T16:22:38
209,394,382
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package com.example.weather.Model; import java.util.List; public class MyList { public int dt; public Main main; public List<Weather> weather; public Clouds clouds; public Wind wind; public Rain rain; public Sys sys; public String dt_txt; }
[ "chunxiding@gmail.com" ]
chunxiding@gmail.com
1ad40f00f7953c246886ae095c3b68faa176fdad
70ddcde65ef13aa35cff6326cb5ddb8f0fc8eb8b
/src/test/java/com/bruno/minhasfinancas/service/LancamentoServiceTest.java
3d0680c512687b95a424dc2f117a3f82bded700b
[]
no_license
brunoavs91/minhasfinancas-api
1afbe4adead1a852bdc4a338573631c2196b8ce2
75989e1bd88d009f6a6a55fb27cf9839a0b9cf37
refs/heads/main
2023-02-27T22:34:13.960886
2021-02-08T00:53:48
2021-02-08T00:53:48
332,837,828
0
0
null
null
null
null
UTF-8
Java
false
false
2,152
java
package com.bruno.minhasfinancas.service; import java.util.List; import org.assertj.core.api.Assertions; import org.assertj.core.util.Arrays; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import com.bruno.minhasfinancas.enums.StatusLancamento; import com.bruno.minhasfinancas.model.entity.Lancamento; import com.bruno.minhasfinancas.model.repository.LancamentoRepository; import com.bruno.minhasfinancas.model.repository.LancamentoRepositoryTest; import com.bruno.minhasfinancas.service.impl.LancamentoServiceImpl; @SpringBootTest @ExtendWith(SpringExtension.class) @ActiveProfiles("test") public class LancamentoServiceTest { @SpyBean LancamentoServiceImpl service; @Mock LancamentoRepository repository; @Test public void salvarLancamento() { Lancamento lancamento = LancamentoRepositoryTest.criarLancamentoTest(); Mockito.doNothing().when(service).validar(lancamento); Lancamento lancamentoSalvo = LancamentoRepositoryTest.criarLancamentoTest(); lancamentoSalvo.setId(1L); lancamentoSalvo.setStatus(StatusLancamento.PENDENTE); Mockito.when(repository.save(lancamento)).thenReturn(lancamentoSalvo); Lancamento lancamentoTest = service.salvar(lancamentoSalvo); Assertions.assertThat(lancamentoTest.getId()).isEqualTo(lancamentoSalvo.getId()); Assertions.assertThat(lancamentoTest.getStatus()).isEqualTo(StatusLancamento.PENDENTE); service.salvar(lancamento); } public void salvarLancamentoErroValidacao() { } // public void deveFiltrarLancamento() { // Lancamento lancamento = LancamentoRepositoryTest.criarLancamentoTest(); // lancamento.setId(1L); // List<Object> lista = Arrays.asList(lancamento); // List<Lancamento> resultado = service.buscar(lancamento); // // Assertions // .assertThat(lista) // .isNotEmpty() // .hasSize(1); // } }
[ "brunoav91@gmail.com" ]
brunoav91@gmail.com
3f5dfa0be84e4602373fa7a2c31179e042dbdb74
8b55e1f0f904cfbee059c94b14471fb82e9848cb
/src/main/java/com/k/算法/leetcode_cn/easy/linkedlist/合并两个有序链表.java
e140dd6168874422e4496ffd1356abfcc8c516cd
[]
no_license
1061235166/javabasis
bc219bcd5af614578ac0f7487d0f7a8123d9a6a4
41252cfdd35eb289c06ba759779a0c0272c73de9
refs/heads/master
2023-06-28T03:54:56.595015
2023-06-14T15:33:51
2023-06-14T15:33:51
132,997,209
0
0
null
2022-10-04T23:45:44
2018-05-11T06:14:07
Java
UTF-8
Java
false
false
478
java
package com.k.算法.leetcode_cn.easy.linkedlist; /** * 将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例: 输入:1->2->4, 1->3->4 输出:1->1->2->3->4->4 * created by k * 2018/12/5 16:22 **/ public class 合并两个有序链表 { public static void main(String[] args) { } public static ListNode mergeTwoLists(ListNode l1, ListNode l2) { return null; } }
[ "wangyk@shuaiche.com" ]
wangyk@shuaiche.com
ab4ed9722398705473c811f67e6f879eb82c5beb
b2dbc69d0a79cd4d42c9b135996d7a580010a34b
/app/src/main/java/com/example/osbg/pot/infrastructure/db/entities/ContactEntity.java
1a14b4daef1d3a6bdcacb99a035f335b4aaf5e36
[]
no_license
ProcessofThings/POT-Mobile-TrustModule
8d2eab5851d6dcdecfda781230344b6479628d94
1e8e001a14cfae511cd18a0c7957fd599c41ce55
refs/heads/master
2020-04-01T14:51:04.781465
2018-08-23T13:06:50
2018-08-23T13:06:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package com.example.osbg.pot.infrastructure.db.entities; import android.arch.persistence.room.Entity; import android.arch.persistence.room.Index; import android.support.annotation.NonNull; import com.example.osbg.pot.domain_models.Contact; @Entity(primaryKeys = {"contactkey"}, tableName = "contacts", indices = {@Index(value = {"contactkey"}, unique = true)}) // foreignKeys = @ForeignKey(entity = Message.class, // parentColumns = "id", // childColumns = "contactkey")) public class ContactEntity { @NonNull public String contactkey; public String name; public String pubid; public String senderkey; public String aeskey; public ContactEntity(String contactkey, String name, String pubid, String senderkey, String aeskey){ this.contactkey = contactkey; this.name = name; this.pubid = pubid; this.senderkey = senderkey; this.aeskey = aeskey; } public ContactEntity(Contact contact){ this.contactkey = contact.getContactkey(); this.name = contact.getName(); this.pubid = contact.getPubid(); this.senderkey = contact.getSenderkey(); this.aeskey = contact.getAeskey(); } }
[ "v.velev27@gmai.com" ]
v.velev27@gmai.com
a5ee7075b55fe8885f5405aaeaa4f5c019a0ea6a
76f160d2ce370d529bc82166ab4ce0d216dfa6be
/src/jichu/duixiang/Login.java
6a29163ceb7c11b1d97fb3b0fef54cf68d1d2119
[]
no_license
opure/Hello-Git
2fd4c5da7c0abd9045bd257137882f0710421617
539ed293f755e4c732d193704ce3dd2464d681ba
refs/heads/master
2020-04-13T04:33:05.105742
2015-11-03T09:13:50
2015-11-03T09:13:50
25,292,685
0
0
null
null
null
null
GB18030
Java
false
false
1,035
java
package jichu.duixiang; class Check{ public boolean validatge(String name,String password){ if(name.equals("caohao")&&password.equals("caohao")){ return true; } else{ return false; } } } class Operate{ private String info[]; public Operate(String info[]){ this.info=info; } public String login2(){ Check check=new Check(); this.isExit(); String str=null; String name=this.info[0]; String password=this.info[1]; if(check.validatge(name, password)){ str="欢迎"+name+"光临"; } else{ str="登陆密码"+password+"错误"; } return str; } public void isExit(){ if(this.info.length!=2){ System.out.println("输入的格式不正确"); System.out.print("格式如下"); System.exit(1); } } } public class Login { public static void main(String[] args) { Operate a=new Operate(args); System.out.println(a.login2()); } }
[ "caohao201308@hotmail.com" ]
caohao201308@hotmail.com
193a406f654196a343f8891a7ed95d01d45ce17e
6e77e4f93cf556e3a8bc122761d60ae62681b3d3
/android/app/src/main/java/com/phone/AdminReceiver.java
4f43458c00cc1ba40f40c15b21df4c6ada3db314
[]
no_license
Abinaabzz/access-your-phone
9c88724d11039027d45cc8693a99797f1e4f9813
16d992849ea8d3e4310548eeb7027588181a6b14
refs/heads/master
2020-12-28T14:17:54.825300
2020-07-08T11:10:58
2020-07-08T11:10:58
238,366,398
0
0
null
null
null
null
UTF-8
Java
false
false
1,731
java
package com.example.phone; import android.app.admin.DeviceAdminReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.widget.Toast; public class AdminReceiver extends DeviceAdminReceiver { static SharedPreferences getSamplePreferences(Context context) { return context.getSharedPreferences( DeviceAdminReceiver.class.getName(), 0); } static String PREF_PASSWORD_QUALITY = "password_quality"; static String PREF_PASSWORD_LENGTH = "password_length"; static String PREF_MAX_FAILED_PW = "max_failed_pw"; void showToast(Context context, CharSequence msg) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } @Override public void onEnabled(Context context, Intent intent) { showToast(context, "Sample Device Admin: enabled"); } @Override public CharSequence onDisableRequested(Context context, Intent intent) { return "This is an optional message to warn the user about disabling."; } @Override public void onDisabled(Context context, Intent intent) { showToast(context, "Sample Device Admin: disabled"); } @Override public void onPasswordChanged(Context context, Intent intent) { showToast(context, "Sample Device Admin: pw changed"); } @Override public void onPasswordFailed(Context context, Intent intent) { showToast(context, "Sample Device Admin: pw failed"); } @Override public void onPasswordSucceeded(Context context, Intent intent) { showToast(context, "Sample Device Admin: pw succeeded"); } }
[ "noreply@github.com" ]
noreply@github.com
54405f803b134213f94cfb51847a30ac3d3a80f4
4dda2b528aa7d7e56a85b612e930531f57e810b3
/app/src/main/java/com/HyKj/UKeBao/viewModel/BaseFragmentViewModel.java
be37ae08eee9de71ba4bf086d0ab8fe45b395950
[]
no_license
qianggezaicunjin/UKeBao
d80cc5fcdfc872ea19326afda34409468a4da37a
cd8f4d4c60d1a844f685202e4f80e5a33f5c4e97
refs/heads/master
2021-01-10T23:06:05.066975
2016-12-21T03:21:18
2016-12-21T03:21:20
70,440,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,897
java
package com.HyKj.UKeBao.viewModel; import android.content.Intent; import com.HyKj.UKeBao.model.BaseFragmentModel; import com.HyKj.UKeBao.util.LogUtil; import com.HyKj.UKeBao.view.activity.BaseFragmentActivity; import com.iflytek.cloud.SpeechSynthesizer; import org.json.JSONObject; /** * Created by Administrator on 2016/9/22. */ public class BaseFragmentViewModel extends BaseViewModel { private BaseFragmentActivity mActivity; private BaseFragmentModel mModel; private static String ACTION_NAME = "BAIDU_TUISONG_TOUCHUAN"; public BaseFragmentViewModel(BaseFragmentModel model, BaseFragmentActivity activity) { mModel = model; mActivity = activity; } public void getContent(String data) { try { JSONObject obj = new JSONObject(data); String voiceContext = obj.getString("voiceContext"); String type = obj.getString("type"); if (type.equals("1")) { Intent intent = new Intent(); intent.setAction(ACTION_NAME); intent.putExtra("voiceContext", voiceContext); //发送广播通知界面更新 mActivity.sendBroadcast(intent); //判断语音合成类是否存在 if (mActivity.mSynthesizerPlayer == null) { mActivity.mSynthesizerPlayer = SpeechSynthesizer.createSynthesizer(mActivity, null); BaseFragmentActivity.getVoice(voiceContext); } else { //将服务器返回的推送信息利用语音合成读取出来 BaseFragmentActivity.getVoice(voiceContext); } }else { mActivity.toast("网络错误~请重试"); } } catch (Exception e) { LogUtil.d("解析出现异常" + e.toString()); } } }
[ "498133565@qq.com" ]
498133565@qq.com
e6bfb30bb583b57423466a2b14c47ccb1fa8ba9b
2a6bceef7053ae9b92b9a5ce327000ac9e90b8c4
/domain/src/main/java/com/tmw/tracking/DomainUtils.java
2a1fdd869fa6b34bdc14d45ba2b415e5addd794b
[]
no_license
PavelZhelnov/tracking
0fe057baff9758f8fd13065cad0005f2239fb93d
b34a2e3658e9de3128b64cc52ac33a3e1f253a09
refs/heads/master
2020-07-24T00:06:37.342800
2017-03-11T11:50:58
2017-03-11T11:50:58
73,798,024
0
0
null
null
null
null
UTF-8
Java
false
false
3,144
java
package com.tmw.tracking; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateUtils; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.Query; import javax.persistence.TypedQuery; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.TimeZone; public class DomainUtils { public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; public static final String DATE_FORMAT_WITH_TZ = "yyyy-MM-dd'T'HH:mm:ss.S"; public static final TimeZone DEFAULT_TIMEZONE = TimeZone.getTimeZone("UTC"); public static final List<String> MUST_BE_SELECTED_DIVISIONS = new ArrayList<String>(){{add("60");}{add("G0");}}; public static String errorToString(final Throwable e){ final Writer writer = new StringWriter(); final PrintWriter printWriter = new PrintWriter(writer); e.printStackTrace(printWriter); return writer.toString(); } public static boolean isLong(final String value){ try { Long.valueOf(value); return true; } catch (NumberFormatException e){ return false; } } public static boolean isInteger(final String value) { try { Integer.valueOf(value); return true; } catch (NumberFormatException e) { return false; } } public static <T> List<T> getLimitResult(EntityManager entityManager, Class<T> cls, final String sql, final Integer start, final Integer count) { final TypedQuery<T> query = entityManager.createQuery(sql, cls); if(count != null) query.setMaxResults(count); if(start != null) query.setFirstResult(start); return query.getResultList(); } public static Integer getRowCount(EntityManager entityManager, Class entity, final String where) { final Query query = entityManager.createQuery("select count(*) from " + entity.getName() + (StringUtils.isBlank(where) ? "" : " " + where)); try { return ((Number) query.getSingleResult()).intValue(); } catch(NoResultException e) { return 0; } } public static String getTimeAsString(final Date date){ if(date == null)return null; final Calendar current = Calendar.getInstance(); current.setTime(new Date()); Date transformed = DateUtils.setYears(date, current.get(Calendar.YEAR)); transformed = DateUtils.setMonths(transformed, current.get(Calendar.MONTH)); transformed = DateUtils.setDays(transformed, current.get(Calendar.DAY_OF_MONTH)); final SimpleDateFormat timeDateFormat = new SimpleDateFormat("HH:mm"); //if(store != null && StringUtils.isNotBlank(store.getTimeZone())) // timeDateFormat.setTimeZone(TimeZone.getTimeZone(store.getTimeZone())); return timeDateFormat.format(transformed); } }
[ "pzhelnov@provectus.com" ]
pzhelnov@provectus.com
b445ed0f05ef91666443c51c1cd546d130378a3f
69adf3d4bf56563e4eeefa4d12f07ff53fba6fb3
/StarflightPersistenceAPI/src/main/java/gal/cor/persistence/dao/apis/IDaoTVA.java
c184213dfbb5d3d4652361f51dbd2d270fd2a426
[]
no_license
yourstarship/milleniumfalcon
5e437e71f51d857f67d09a1d15a4206832513729
2c775730e7025c38030abc9833bf74121f06f367
refs/heads/master
2021-01-10T21:59:09.284390
2016-11-28T11:11:59
2016-11-28T11:11:59
39,201,464
0
0
null
null
null
null
UTF-8
Java
false
false
730
java
package gal.cor.persistence.dao.apis; import java.util.Collection; import java.util.List; import java.util.Map; import gal.cor.persistence.entities.TVA; public interface IDaoTVA { void creerTVA(TVA t); void supprimerTVA(TVA t); TVA mettreAjourTVA(TVA t); TVA rechercherParId(TVA t); //Requetes personnalis�es List<TVA> rechercherParRequeteNommee(String requeteNommee); List<TVA> rechercherParRequeteNommee(String requeteNommee, Map<String,Object> parametres,int nbreMaxElements); List<TVA> rechercherParRequeteNommee(String requeteNommee, Map<String,Object> parametres); List<TVA> rechercherParRequeteNommee(String requeteNommee, int nbreMaxElements); Collection<TVA> obtenirTousTVA(); }
[ "m.alexandre@broceliande.net" ]
m.alexandre@broceliande.net
f944da779e7fd9f64d2f1def4e5cb2792b7f4f80
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/flink/2017/4/ExecutionJobVertex.java
2e5de64ca9298843c8c911322b2cad4ce67af4c8
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
26,535
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.flink.runtime.executiongraph; import org.apache.flink.api.common.Archiveable; import org.apache.flink.api.common.ExecutionConfig; import org.apache.flink.api.common.JobID; import org.apache.flink.api.common.accumulators.Accumulator; import org.apache.flink.api.common.accumulators.AccumulatorHelper; import org.apache.flink.api.common.time.Time; import org.apache.flink.configuration.Configuration; import org.apache.flink.core.io.InputSplit; import org.apache.flink.core.io.InputSplitAssigner; import org.apache.flink.core.io.InputSplitSource; import org.apache.flink.core.io.LocatableInputSplit; import org.apache.flink.runtime.JobException; import org.apache.flink.runtime.accumulators.StringifiedAccumulatorResult; import org.apache.flink.runtime.concurrent.Future; import org.apache.flink.runtime.execution.ExecutionState; import org.apache.flink.runtime.instance.SimpleSlot; import org.apache.flink.runtime.instance.SlotProvider; import org.apache.flink.runtime.jobgraph.IntermediateDataSet; import org.apache.flink.runtime.jobgraph.IntermediateDataSetID; import org.apache.flink.runtime.jobgraph.JobEdge; import org.apache.flink.runtime.jobgraph.JobVertex; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.configuration.JobManagerOptions; import org.apache.flink.runtime.jobgraph.OperatorID; import org.apache.flink.runtime.jobmanager.scheduler.CoLocationGroup; import org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup; import org.apache.flink.runtime.state.KeyGroupRangeAssignment; import org.apache.flink.util.Preconditions; import org.apache.flink.util.SerializedValue; import org.slf4j.Logger; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class ExecutionJobVertex implements AccessExecutionJobVertex, Archiveable<ArchivedExecutionJobVertex> { /** Use the same log for all ExecutionGraph classes */ private static final Logger LOG = ExecutionGraph.LOG; public static final int VALUE_NOT_SET = -1; private final Object stateMonitor = new Object(); private final ExecutionGraph graph; private final JobVertex jobVertex; /** * The IDs of all operators contained in this execution job vertex. * * The ID's are stored depth-first post-order; for the forking chain below the ID's would be stored as [D, E, B, C, A]. * A - B - D * \ \ * C E * This is the same order that operators are stored in the {@code StreamTask}. */ private final List<OperatorID> operatorIDs; /** * The alternative IDs of all operators contained in this execution job vertex. * * The ID's are in the same order as {@link ExecutionJobVertex#operatorIDs}. */ private final List<OperatorID> userDefinedOperatorIds; private final ExecutionVertex[] taskVertices; private final IntermediateResult[] producedDataSets; private final List<IntermediateResult> inputs; private final int parallelism; private final boolean[] finishedSubtasks; private final SlotSharingGroup slotSharingGroup; private final CoLocationGroup coLocationGroup; private final InputSplit[] inputSplits; private final boolean maxParallelismConfigured; private int maxParallelism; private volatile int numSubtasksInFinalState; /** * Serialized task information which is for all sub tasks the same. Thus, it avoids to * serialize the same information multiple times in order to create the * TaskDeploymentDescriptors. */ private SerializedValue<TaskInformation> serializedTaskInformation; private InputSplitAssigner splitAssigner; public ExecutionJobVertex( ExecutionGraph graph, JobVertex jobVertex, int defaultParallelism, Time timeout) throws JobException { this(graph, jobVertex, defaultParallelism, timeout, System.currentTimeMillis()); } public ExecutionJobVertex( ExecutionGraph graph, JobVertex jobVertex, int defaultParallelism, Time timeout, long createTimestamp) throws JobException { if (graph == null || jobVertex == null) { throw new NullPointerException(); } this.graph = graph; this.jobVertex = jobVertex; int vertexParallelism = jobVertex.getParallelism(); int numTaskVertices = vertexParallelism > 0 ? vertexParallelism : defaultParallelism; this.parallelism = numTaskVertices; final int configuredMaxParallelism = jobVertex.getMaxParallelism(); this.maxParallelismConfigured = (VALUE_NOT_SET != configuredMaxParallelism); // if no max parallelism was configured by the user, we calculate and set a default setMaxParallelismInternal(maxParallelismConfigured ? configuredMaxParallelism : KeyGroupRangeAssignment.computeDefaultMaxParallelism(parallelism)); this.serializedTaskInformation = null; this.taskVertices = new ExecutionVertex[numTaskVertices]; this.operatorIDs = Collections.unmodifiableList(jobVertex.getOperatorIDs()); this.userDefinedOperatorIds = Collections.unmodifiableList(jobVertex.getUserDefinedOperatorIDs()); this.inputs = new ArrayList<>(jobVertex.getInputs().size()); // take the sharing group this.slotSharingGroup = jobVertex.getSlotSharingGroup(); this.coLocationGroup = jobVertex.getCoLocationGroup(); // setup the coLocation group if (coLocationGroup != null && slotSharingGroup == null) { throw new JobException("Vertex uses a co-location constraint without using slot sharing"); } // create the intermediate results this.producedDataSets = new IntermediateResult[jobVertex.getNumberOfProducedIntermediateDataSets()]; for (int i = 0; i < jobVertex.getProducedDataSets().size(); i++) { final IntermediateDataSet result = jobVertex.getProducedDataSets().get(i); this.producedDataSets[i] = new IntermediateResult( result.getId(), this, numTaskVertices, result.getResultType()); } Configuration jobConfiguration = graph.getJobConfiguration(); int maxPriorAttemptsHistoryLength = jobConfiguration != null ? jobConfiguration.getInteger(JobManagerOptions.MAX_ATTEMPTS_HISTORY_SIZE) : JobManagerOptions.MAX_ATTEMPTS_HISTORY_SIZE.defaultValue(); // create all task vertices for (int i = 0; i < numTaskVertices; i++) { ExecutionVertex vertex = new ExecutionVertex( this, i, this.producedDataSets, timeout, createTimestamp, maxPriorAttemptsHistoryLength); this.taskVertices[i] = vertex; } // sanity check for the double referencing between intermediate result partitions and execution vertices for (IntermediateResult ir : this.producedDataSets) { if (ir.getNumberOfAssignedPartitions() != parallelism) { throw new RuntimeException("The intermediate result's partitions were not correctly assigned."); } } // set up the input splits, if the vertex has any try { @SuppressWarnings("unchecked") InputSplitSource<InputSplit> splitSource = (InputSplitSource<InputSplit>) jobVertex.getInputSplitSource(); if (splitSource != null) { Thread currentThread = Thread.currentThread(); ClassLoader oldContextClassLoader = currentThread.getContextClassLoader(); currentThread.setContextClassLoader(graph.getUserClassLoader()); try { inputSplits = splitSource.createInputSplits(numTaskVertices); if (inputSplits != null) { splitAssigner = splitSource.getInputSplitAssigner(inputSplits); } } finally { currentThread.setContextClassLoader(oldContextClassLoader); } } else { inputSplits = null; } } catch (Throwable t) { throw new JobException("Creating the input splits caused an error: " + t.getMessage(), t); } finishedSubtasks = new boolean[parallelism]; } /** * Returns a list containing the IDs of all operators contained in this execution job vertex. * * @return list containing the IDs of all contained operators */ public List<OperatorID> getOperatorIDs() { return operatorIDs; } /** * Returns a list containing the alternative IDs of all operators contained in this execution job vertex. * * @return list containing alternative the IDs of all contained operators */ public List<OperatorID> getUserDefinedOperatorIDs() { return userDefinedOperatorIds; } public void setMaxParallelism(int maxParallelismDerived) { Preconditions.checkState(!maxParallelismConfigured, "Attempt to override a configured max parallelism. Configured: " + this.maxParallelism + ", argument: " + maxParallelismDerived); setMaxParallelismInternal(maxParallelismDerived); } private void setMaxParallelismInternal(int maxParallelism) { if (maxParallelism == ExecutionConfig.PARALLELISM_AUTO_MAX) { maxParallelism = KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM; } Preconditions.checkArgument(maxParallelism > 0 && maxParallelism <= KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM, "Overriding max parallelism is not in valid bounds (1..%s), found: %s", KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM, maxParallelism); this.maxParallelism = maxParallelism; } public ExecutionGraph getGraph() { return graph; } public JobVertex getJobVertex() { return jobVertex; } @Override public String getName() { return getJobVertex().getName(); } @Override public int getParallelism() { return parallelism; } @Override public int getMaxParallelism() { return maxParallelism; } public boolean isMaxParallelismConfigured() { return maxParallelismConfigured; } public JobID getJobId() { return graph.getJobID(); } @Override public JobVertexID getJobVertexId() { return jobVertex.getID(); } @Override public ExecutionVertex[] getTaskVertices() { return taskVertices; } public IntermediateResult[] getProducedDataSets() { return producedDataSets; } public InputSplitAssigner getSplitAssigner() { return splitAssigner; } public SlotSharingGroup getSlotSharingGroup() { return slotSharingGroup; } public CoLocationGroup getCoLocationGroup() { return coLocationGroup; } public List<IntermediateResult> getInputs() { return inputs; } public SerializedValue<TaskInformation> getSerializedTaskInformation() throws IOException { if (null == serializedTaskInformation) { int parallelism = getParallelism(); int maxParallelism = getMaxParallelism(); if (LOG.isDebugEnabled()) { LOG.debug("Creating task information for " + generateDebugString()); } serializedTaskInformation = new SerializedValue<>( new TaskInformation( jobVertex.getID(), jobVertex.getName(), parallelism, maxParallelism, jobVertex.getInvokableClassName(), jobVertex.getConfiguration())); } return serializedTaskInformation; } public boolean isInFinalState() { return numSubtasksInFinalState == parallelism; } @Override public ExecutionState getAggregateState() { int[] num = new int[ExecutionState.values().length]; for (ExecutionVertex vertex : this.taskVertices) { num[vertex.getExecutionState().ordinal()]++; } return getAggregateJobVertexState(num, parallelism); } private String generateDebugString() { return "ExecutionJobVertex" + "(" + jobVertex.getName() + " | " + jobVertex.getID() + ")" + "{" + "parallelism=" + parallelism + ", maxParallelism=" + getMaxParallelism() + ", maxParallelismConfigured=" + maxParallelismConfigured + '}'; } //--------------------------------------------------------------------------------------------- public void connectToPredecessors(Map<IntermediateDataSetID, IntermediateResult> intermediateDataSets) throws JobException { List<JobEdge> inputs = jobVertex.getInputs(); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Connecting ExecutionJobVertex %s (%s) to %d predecessors.", jobVertex.getID(), jobVertex.getName(), inputs.size())); } for (int num = 0; num < inputs.size(); num++) { JobEdge edge = inputs.get(num); if (LOG.isDebugEnabled()) { if (edge.getSource() == null) { LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via ID %s.", num, jobVertex.getID(), jobVertex.getName(), edge.getSourceId())); } else { LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via predecessor %s (%s).", num, jobVertex.getID(), jobVertex.getName(), edge.getSource().getProducer().getID(), edge.getSource().getProducer().getName())); } } // fetch the intermediate result via ID. if it does not exist, then it either has not been created, or the order // in which this method is called for the job vertices is not a topological order IntermediateResult ires = intermediateDataSets.get(edge.getSourceId()); if (ires == null) { throw new JobException("Cannot connect this job graph to the previous graph. No previous intermediate result found for ID " + edge.getSourceId()); } this.inputs.add(ires); int consumerIndex = ires.registerConsumer(); for (int i = 0; i < parallelism; i++) { ExecutionVertex ev = taskVertices[i]; ev.connectSource(num, ires, edge, consumerIndex); } } } //--------------------------------------------------------------------------------------------- // Actions //--------------------------------------------------------------------------------------------- public void scheduleAll(SlotProvider slotProvider, boolean queued) { final ExecutionVertex[] vertices = this.taskVertices; // kick off the tasks for (ExecutionVertex ev : vertices) { ev.scheduleForExecution(slotProvider, queued); } } /** * Acquires a slot for all the execution vertices of this ExecutionJobVertex. The method returns * pairs of the slots and execution attempts, to ease correlation between vertices and execution * attempts. * * <p>If this method throws an exception, it makes sure to release all so far requested slots. * * @param resourceProvider The resource provider from whom the slots are requested. */ public ExecutionAndSlot[] allocateResourcesForAll(SlotProvider resourceProvider, boolean queued) { final ExecutionVertex[] vertices = this.taskVertices; final ExecutionAndSlot[] slots = new ExecutionAndSlot[vertices.length]; // try to acquire a slot future for each execution. // we store the execution with the future just to be on the safe side for (int i = 0; i < vertices.length; i++) { // we use this flag to handle failures in a 'finally' clause // that allows us to not go through clumsy cast-and-rethrow logic boolean successful = false; try { // allocate the next slot (future) final Execution exec = vertices[i].getCurrentExecutionAttempt(); final Future<SimpleSlot> future = exec.allocateSlotForExecution(resourceProvider, queued); slots[i] = new ExecutionAndSlot(exec, future); successful = true; } finally { if (!successful) { // this is the case if an exception was thrown for (int k = 0; k < i; k++) { ExecutionGraphUtils.releaseSlotFuture(slots[k].slotFuture); } } } } // all good, we acquired all slots return slots; } public void cancel() { for (ExecutionVertex ev : getTaskVertices()) { ev.cancel(); } } public void fail(Throwable t) { for (ExecutionVertex ev : getTaskVertices()) { ev.fail(t); } } public void waitForAllVerticesToReachFinishingState() throws InterruptedException { synchronized (stateMonitor) { while (numSubtasksInFinalState < parallelism) { stateMonitor.wait(); } } } public void resetForNewExecution() { if (!(numSubtasksInFinalState == 0 || numSubtasksInFinalState == parallelism)) { throw new IllegalStateException("Cannot reset vertex that is not in final state"); } synchronized (stateMonitor) { // check and reset the sharing groups with scheduler hints if (slotSharingGroup != null) { slotSharingGroup.clearTaskAssignment(); } // reset vertices one by one. if one reset fails, the "vertices in final state" // fields will be consistent to handle triggered cancel calls for (int i = 0; i < parallelism; i++) { taskVertices[i].resetForNewExecution(); if (finishedSubtasks[i]) { finishedSubtasks[i] = false; numSubtasksInFinalState--; } } if (numSubtasksInFinalState != 0) { throw new RuntimeException("Bug: resetting the execution job vertex failed."); } // set up the input splits again try { if (this.inputSplits != null) { // lazy assignment @SuppressWarnings("unchecked") InputSplitSource<InputSplit> splitSource = (InputSplitSource<InputSplit>) jobVertex.getInputSplitSource(); this.splitAssigner = splitSource.getInputSplitAssigner(this.inputSplits); } } catch (Throwable t) { throw new RuntimeException("Re-creating the input split assigner failed: " + t.getMessage(), t); } // Reset intermediate results for (IntermediateResult result : producedDataSets) { result.resetForNewExecution(); } } } //--------------------------------------------------------------------------------------------- // Notifications //--------------------------------------------------------------------------------------------- void vertexFinished(int subtask) { subtaskInFinalState(subtask); } void vertexCancelled(int subtask) { subtaskInFinalState(subtask); } void vertexFailed(int subtask, Throwable error) { subtaskInFinalState(subtask); } private void subtaskInFinalState(int subtask) { synchronized (stateMonitor) { if (!finishedSubtasks[subtask]) { finishedSubtasks[subtask] = true; if (numSubtasksInFinalState+1 == parallelism) { // call finalizeOnMaster hook try { getJobVertex().finalizeOnMaster(getGraph().getUserClassLoader()); } catch (Throwable t) { getGraph().fail(t); } numSubtasksInFinalState++; // we are in our final state stateMonitor.notifyAll(); // tell the graph graph.jobVertexInFinalState(); } else { numSubtasksInFinalState++; } } } } // -------------------------------------------------------------------------------------------- // Accumulators / Metrics // -------------------------------------------------------------------------------------------- public StringifiedAccumulatorResult[] getAggregatedUserAccumulatorsStringified() { Map<String, Accumulator<?, ?>> userAccumulators = new HashMap<String, Accumulator<?, ?>>(); for (ExecutionVertex vertex : taskVertices) { Map<String, Accumulator<?, ?>> next = vertex.getCurrentExecutionAttempt().getUserAccumulators(); if (next != null) { AccumulatorHelper.mergeInto(userAccumulators, next); } } return StringifiedAccumulatorResult.stringifyAccumulatorResults(userAccumulators); } // -------------------------------------------------------------------------------------------- // Static / pre-assigned input splits // -------------------------------------------------------------------------------------------- private List<LocatableInputSplit>[] computeLocalInputSplitsPerTask(InputSplit[] splits) throws JobException { final int numSubTasks = getParallelism(); // sanity check if (numSubTasks > splits.length) { throw new JobException("Strictly local assignment requires at least as many splits as subtasks."); } // group the splits by host while preserving order per host Map<String, List<LocatableInputSplit>> splitsByHost = new HashMap<String, List<LocatableInputSplit>>(); for (InputSplit split : splits) { // check that split has exactly one local host if(!(split instanceof LocatableInputSplit)) { throw new JobException("Invalid InputSplit type " + split.getClass().getCanonicalName() + ". " + "Strictly local assignment requires LocatableInputSplit"); } LocatableInputSplit lis = (LocatableInputSplit) split; if (lis.getHostnames() == null) { throw new JobException("LocatableInputSplit has no host information. " + "Strictly local assignment requires exactly one hostname for each LocatableInputSplit."); } else if (lis.getHostnames().length != 1) { throw new JobException("Strictly local assignment requires exactly one hostname for each LocatableInputSplit."); } String hostName = lis.getHostnames()[0]; if (hostName == null) { throw new JobException("For strictly local input split assignment, no null host names are allowed."); } List<LocatableInputSplit> hostSplits = splitsByHost.get(hostName); if (hostSplits == null) { hostSplits = new ArrayList<LocatableInputSplit>(); splitsByHost.put(hostName, hostSplits); } hostSplits.add(lis); } int numHosts = splitsByHost.size(); if (numSubTasks < numHosts) { throw new JobException("Strictly local split assignment requires at least as " + "many parallel subtasks as distinct split hosts. Please increase the parallelism " + "of DataSource "+this.getJobVertex().getName()+" to at least "+numHosts+"."); } // get list of hosts in deterministic order List<String> hosts = new ArrayList<String>(splitsByHost.keySet()); Collections.sort(hosts); @SuppressWarnings("unchecked") List<LocatableInputSplit>[] subTaskSplitAssignment = (List<LocatableInputSplit>[]) new List<?>[numSubTasks]; final int subtasksPerHost = numSubTasks / numHosts; final int hostsWithOneMore = numSubTasks % numHosts; int subtaskNum = 0; // we go over all hosts and distribute the hosts' input splits // over the subtasks for (int hostNum = 0; hostNum < numHosts; hostNum++) { String host = hosts.get(hostNum); List<LocatableInputSplit> splitsOnHost = splitsByHost.get(host); int numSplitsOnHost = splitsOnHost.size(); // the number of subtasks to split this over. // NOTE: if the host has few splits, some subtasks will not get anything. int subtasks = Math.min(numSplitsOnHost, hostNum < hostsWithOneMore ? subtasksPerHost + 1 : subtasksPerHost); int splitsPerSubtask = numSplitsOnHost / subtasks; int subtasksWithOneMore = numSplitsOnHost % subtasks; int splitnum = 0; // go over the subtasks and grab a subrange of the input splits for (int i = 0; i < subtasks; i++) { int numSplitsForSubtask = (i < subtasksWithOneMore ? splitsPerSubtask + 1 : splitsPerSubtask); List<LocatableInputSplit> splitList; if (numSplitsForSubtask == numSplitsOnHost) { splitList = splitsOnHost; } else { splitList = new ArrayList<LocatableInputSplit>(numSplitsForSubtask); for (int k = 0; k < numSplitsForSubtask; k++) { splitList.add(splitsOnHost.get(splitnum++)); } } subTaskSplitAssignment[subtaskNum++] = splitList; } } return subTaskSplitAssignment; } public static ExecutionState getAggregateJobVertexState(int[] verticesPerState, int parallelism) { if (verticesPerState == null || verticesPerState.length != ExecutionState.values().length) { throw new IllegalArgumentException("Must provide an array as large as there are execution states."); } if (verticesPerState[ExecutionState.FAILED.ordinal()] > 0) { return ExecutionState.FAILED; } if (verticesPerState[ExecutionState.CANCELING.ordinal()] > 0) { return ExecutionState.CANCELING; } else if (verticesPerState[ExecutionState.CANCELED.ordinal()] > 0) { return ExecutionState.CANCELED; } else if (verticesPerState[ExecutionState.RUNNING.ordinal()] > 0) { return ExecutionState.RUNNING; } else if (verticesPerState[ExecutionState.FINISHED.ordinal()] > 0) { return verticesPerState[ExecutionState.FINISHED.ordinal()] == parallelism ? ExecutionState.FINISHED : ExecutionState.RUNNING; } else { // all else collapses under created return ExecutionState.CREATED; } } public static Map<JobVertexID, ExecutionJobVertex> includeLegacyJobVertexIDs( Map<JobVertexID, ExecutionJobVertex> tasks) { Map<JobVertexID, ExecutionJobVertex> expanded = new HashMap<>(2 * tasks.size()); // first include all new ids expanded.putAll(tasks); // now expand and add legacy ids for (ExecutionJobVertex executionJobVertex : tasks.values()) { if (null != executionJobVertex) { JobVertex jobVertex = executionJobVertex.getJobVertex(); if (null != jobVertex) { List<JobVertexID> alternativeIds = jobVertex.getIdAlternatives(); for (JobVertexID jobVertexID : alternativeIds) { ExecutionJobVertex old = expanded.put(jobVertexID, executionJobVertex); Preconditions.checkState(null == old || old.equals(executionJobVertex), "Ambiguous jobvertex id detected during expansion to legacy ids."); } } } } return expanded; } public static Map<OperatorID, ExecutionJobVertex> includeAlternativeOperatorIDs( Map<OperatorID, ExecutionJobVertex> operatorMapping) { Map<OperatorID, ExecutionJobVertex> expanded = new HashMap<>(2 * operatorMapping.size()); // first include all existing ids expanded.putAll(operatorMapping); // now expand and add user-defined ids for (ExecutionJobVertex executionJobVertex : operatorMapping.values()) { if (executionJobVertex != null) { JobVertex jobVertex = executionJobVertex.getJobVertex(); if (jobVertex != null) { for (OperatorID operatorID : jobVertex.getUserDefinedOperatorIDs()) { if (operatorID != null) { expanded.put(operatorID, executionJobVertex); } } } } } return expanded; } @Override public ArchivedExecutionJobVertex archive() { return new ArchivedExecutionJobVertex(this); } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
27d7a2acb4cf4640297d7f66bc76d868318ebd28
abe0eac5e783c76936c39a2badb6cdc84d3c8380
/src/main/java/br/com/minhascompras/controller/AbstractMB.java
c8fcf8558a258eebe990f01511ee6a4302d7e29e
[]
no_license
rpsouza441/MinhasCompras
b49a2b62f773dc3595da7ac03699d96a4ea294e0
c02f847c048c78db3012c96fa7ac30a7bab54702
refs/heads/master
2020-06-05T16:42:17.300787
2014-02-05T11:56:49
2014-02-05T11:56:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
package br.com.minhascompras.controller; import org.primefaces.context.RequestContext; import br.com.minhascompras.util.JSFMessageUtil; public class AbstractMB { private static final String KEEP_DIALOG_OPENED = "KEEP_DIALOG_OPENED"; public AbstractMB() { super(); } protected void displayErrorMessageToUser(String message) { JSFMessageUtil messageUtil = new JSFMessageUtil(); messageUtil.sendErrorMessageToUser(message); } protected void displayInfoMessageToUser(String message) { JSFMessageUtil messageUtil = new JSFMessageUtil(); messageUtil.sendInfoMessageToUser(message); } protected void closeDialog() { getRequestContext().addCallbackParam(KEEP_DIALOG_OPENED, false); } protected void keepDialogOpen() { getRequestContext().addCallbackParam(KEEP_DIALOG_OPENED, true); } protected RequestContext getRequestContext() { return RequestContext.getCurrentInstance(); } }
[ "rpsouza@hotmail.co.uk" ]
rpsouza@hotmail.co.uk
ac735bd2f5a22004807f0f3b42dc2fae71834ec6
084a12e5a5db9d99583d101c773300225382149d
/src/main/java/com/nobblecrafts/xpto/controller/JsonController.java
4702cff91d445c3f34bbf7943e0da7b8c7f2ea1f
[]
no_license
andrerrcosta/SqlThymeleafRestSpring
061ba00b951902be11a1d94ef07cbab0a0fa6398
1e14823acfb5ece24bed66faa48ceff8dcc1bae1
refs/heads/master
2023-06-29T05:49:27.507261
2021-08-02T20:42:26
2021-08-02T20:42:26
391,480,206
0
0
null
null
null
null
UTF-8
Java
false
false
5,117
java
package com.nobblecrafts.xpto.controller; import java.util.Arrays; import java.util.List; import com.nobblecrafts.xpto.model.CidadeModel; import com.nobblecrafts.xpto.model.CidadesPorEstadoModel; import com.nobblecrafts.xpto.model.DistantCityModel; import com.nobblecrafts.xpto.model.PostResponse; import com.nobblecrafts.xpto.service.CidadeService; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import lombok.RequiredArgsConstructor; @RestController @RequestMapping("api") @RequiredArgsConstructor public class JsonController { private final CidadeService service; /** * 2. Retornar somente as cidades que são capitais ordenadas por nome; */ @GetMapping("capitals") public ResponseEntity<Page<CidadeModel>> getCapitals(Pageable pageable) { var output = service.getCapitals(pageable); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 3. Retornar o nome do estado com a maior e menor quantidade de cidades e a * quantidade de cidades; */ @GetMapping("states-more-less-cities") public ResponseEntity<List<CidadesPorEstadoModel>> getStatesWithMoreAndLessCities() { var more = service.getStateWithLargestNumberOfCities(); var less = service.getStateWithLessCities(); return new ResponseEntity<>(Arrays.asList(more, less), HttpStatus.OK); } /** * 4. Retornar a quantidade de cidades por estado; */ @GetMapping("quantity-cities-per-state") public ResponseEntity<CidadesPorEstadoModel> getQuantityOfCitiesPerState(@RequestParam("state") String state) { var output = service.getNumberOfCitiesPerState(state); // log.info("output {}", output.getCidades(), output.getEstado()); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 5. Obter os dados da cidade informando o id do IBGE; */ @GetMapping("search-city-by-id") public ResponseEntity<CidadeModel> getCityById(@RequestParam("ibgeId") Long ibgeId) { var output = service.getCityById(ibgeId); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 6. Retornar o nome das cidades baseado em um estado selecionado; */ @GetMapping("get-cities-by-state") public ResponseEntity<Page<CidadeModel>> getCityByState(@RequestParam("state") String state, Pageable pageable) { var output = service.getCitiesByState(state, pageable); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 7. Permitir adicionar uma nova Cidade; */ @PostMapping("add-city") public ResponseEntity<CidadeModel> addCity(@RequestBody CidadeModel model) { var output = service.addCity(model); return new ResponseEntity<>(output, HttpStatus.CREATED); } /** * 8. Permitir deletar uma cidade; */ @DeleteMapping("delete-city") public ResponseEntity<PostResponse> deleteCity(@RequestParam Long ibgeId) { service.deleteCity(ibgeId); return new ResponseEntity<>(PostResponse.builder().message("Cidade Deletada").build(), HttpStatus.NO_CONTENT); } /** * 9. Permitir selecionar uma coluna (do CSV) e através dela entrar com uma * string para filtrar. retornar assim todos os objetos que contenham tal * string; */ @GetMapping("filter-by-column") public ResponseEntity<Page<CidadeModel>> filterByColumn(@RequestParam("column") String column, @RequestParam("keyword") String keyword, Pageable pageable) { var output = service.getCitiesByColumnValue(column, keyword, pageable); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 10. Retornar a quantidade de registro baseado em uma coluna. Não deve contar * itens iguais; */ @GetMapping("get-records-by-column") public ResponseEntity<Long> getRecordsByColumn(@RequestParam("column") String column, @RequestParam("keyword") String keyword) { var output = service.getNumberOfCitiesByColumnValue(column, keyword); return new ResponseEntity<>(output, HttpStatus.OK); } /** * 11. Retornar a quantidade de registros total; */ @GetMapping("get-total-of-records") public ResponseEntity<Long> getTotalOfRecords() { var total = service.getNumberOfCities(); return new ResponseEntity<>(total, HttpStatus.OK); } /** * 12. Dentre todas as cidades, obter as duas cidades mais distantes uma da * outra com base na localização (distância em KM em linha reta); * */ @GetMapping("most-distant-cities") public ResponseEntity<List<DistantCityModel>> getMostDistantCities() { var output = service.getMostDistantCities(); return new ResponseEntity<>(output, HttpStatus.OK); } }
[ "andrerrcosta@gmail.com" ]
andrerrcosta@gmail.com
1fbe5fb1ddfb221a7c6af4620a9794fa59ec6b01
128a75c5455097d5cfc33628433f2a8d49e826a7
/tools/substance-tools/src/main/java/org/pushingpixels/tools/substance/flamingo/docrobot/skins/Twilight.java
9762aa8cfa29f7fe0609ad2f5fcf38c65cff0565
[ "BSD-3-Clause" ]
permissive
ankaufma/radiance
ac280665939c46b4017ed79ca6c0b212965939b0
536d42b0484a7d153069516ea6027b41739f65f9
refs/heads/master
2020-03-27T01:25:36.310738
2018-08-22T01:49:35
2018-08-22T01:49:35
145,709,324
0
0
BSD-3-Clause
2018-08-22T12:57:23
2018-08-22T12:57:23
null
UTF-8
Java
false
false
2,128
java
/* * Copyright (c) 2005-2018 Substance Kirill Grouchnikov. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * o Neither the name of Substance Kirill Grouchnikov nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.pushingpixels.tools.substance.flamingo.docrobot.skins; import org.pushingpixels.substance.api.skin.TwilightSkin; import org.pushingpixels.tools.substance.flamingo.docrobot.SkinRobot; /** * Screenshot robot for {@link TwilightSkin}. * * @author Kirill Grouchnikov */ public class Twilight extends SkinRobot { /** * Creates the screenshot robot. */ public Twilight() { super( new TwilightSkin(), "/Users/kirillg/Projects/substance-flamingo/www/images/screenshots/skins/twilight"); } }
[ "kirill.grouchnikov@gmail.com" ]
kirill.grouchnikov@gmail.com
28daf2f790b1d6cd3b15dcf3d2b1798bac3f7bbc
e90293ff112537dbd082a77504ad07910bfb54ac
/Java/chapter10/src/chapter10/Chainge_Window/RootController.java
39b6d50c7ec8a9d52f9cc92517237d69a4c0b78b
[]
no_license
genesis011/Java_Study
09a2c49429512d2d3f4631d251e879c487c17030
ce0a693838096b17a4b1a708eb20fef1aed00854
refs/heads/master
2020-07-18T07:04:05.170205
2019-10-11T08:40:47
2019-10-11T08:40:47
206,201,001
0
0
null
null
null
null
UHC
Java
false
false
1,263
java
package chapter10.Chainge_Window; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.StackPane; public class RootController extends Object implements Initializable { @FXML private Button buttonLogin; @Override public void initialize(URL arg0, ResourceBundle arg1) { buttonLogin.setOnAction((e)-> { handleButtonLoginAction(e); }); } //로그인 화묜을 보여주는 이벤트 처리함수 private void handleButtonLoginAction(ActionEvent e) { // root.fxml에 있는 제일 바깥쪽(최상위)에 있는 루트 컨테이너 객체값을 가져온다.(StackPane객체) StackPane stackPane=null; AnchorPane anchorPane=null; try { // login.fxml 로더(login.fxml 모두 객체화시키고) 최상위의 있는 루트 컨테이너객체값을 stackPane=(StackPane) buttonLogin.getScene().getRoot(); anchorPane=FXMLLoader.load(getClass().getResource("login.fxml")); stackPane.getChildren().add(anchorPane); } catch (IOException e1) { e1.printStackTrace(); } } }
[ "universe.sns@gmail.com" ]
universe.sns@gmail.com
23c05f93619294fb03c43d9a3a12209f7c29d7bc
2a3f4fc05f69e2f8b18b3fd532c2d6a328f43652
/barcode-library/src/main/java/com/ansh/barcode/util/DocumentType.java
5c1108ad3fd2c5d190cfe6226e2df75358fb8fb5
[]
no_license
jeevanvns/barcode-scanner
1930453674a65f27c19280db1c3e92c77bdd2298
f1753b975b62b6f1748065cca48a7cc45b700f62
refs/heads/master
2021-09-06T21:54:04.568677
2018-02-12T07:11:47
2018-02-12T07:11:47
109,097,597
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package com.ansh.barcode.util; /** * Created by Jeevan Gupta on 01-11-2017. * {@link DocumentType} */ public class DocumentType { public static String BOARDING_PASS = "boarding_pass"; }
[ "jeevan@refundme.in" ]
jeevan@refundme.in
d390cb8b741efcf421fdfdf1997c008a6e53dca9
9baa67efe3cee7b64691a9de0a618754942234eb
/ZFJD/src/com/ushine/common/utils/FileUtils.java
b526df99da4b0c161788bd0fed46733f0fe6ca1e
[]
no_license
wangbailin88/ZFJDDemo
71ffbbd2ed4ac18db1809c223ffc74e85dc5d12e
cfd395c0e4fa5d211e80e01238100be61258ffcd
refs/heads/master
2020-06-23T16:57:05.404646
2016-11-24T06:23:28
2016-11-24T06:23:28
74,643,770
1
0
null
null
null
null
UTF-8
Java
false
false
1,989
java
package com.ushine.common.utils; import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 文件工具类 * @author Franklin * */ public class FileUtils { private static final Logger logger = LoggerFactory.getLogger(FileUtils.class); public static void createDir(String dir) throws Exception { File fileDir = new File(dir); // 检查文件夹是否存在 if(!fileDir.isDirectory()) { fileDir.mkdir(); } else { logger.warn("文件夹已经存在, 创建操作失败: " + dir); } } /** * 将文件移动到指定的文件夹,如果目标文件夹 * 不存在,自动创建 * @param dir String 目标文件夹 * @param files File[] 需要移动的文件 * @return File[] 移动后的文件 */ public static File[] renameToDir(String dir, File[] files) throws Exception { File[] newFiles = new File[files.length]; File fileDir = new File(dir); // 检查文件夹是否存在 if(!fileDir.isDirectory()) { fileDir.mkdir(); } // 循环移动文件 for(int i=0; i<files.length; i++) { File file = new File(fileDir + "/" + files[i].getName()); files[i].renameTo(file); newFiles[i] = file; } return newFiles; } /** * 删除指定文件 * @param files File[] 需要删除的文件 */ public static void deleteFiles(File[] files) throws Exception { for(File file : files) { if(file.exists()){ file.delete(); } else { logger.warn("没有找到指定文件, 删除操作失败: " + file.getPath()); } } } /** * 删除指定的文件夹 * @param dir */ public static void deleteDir(String dir) throws Exception { File tDir = new File(dir); if (!tDir.isDirectory()) { logger.warn("没有找到指定文件夹, 删除操作失败: " + tDir.getPath()); return; } File[] tmpFiles = tDir.listFiles(); for(File file : tmpFiles) { if(file.isDirectory()) { deleteDir(file.getPath()); } file.delete(); } tDir.delete(); } }
[ "834829402@qq.com" ]
834829402@qq.com
35ee2dfee5f16a0bd8be139b2ad486f9598f9970
f50e38ef27c73a4961626b016b98b5891617e82a
/Collections/src/Map.java
51402a75a2df8b3eff6739e447db2bbc1ad5ae6b
[]
no_license
tejag7/eclipse
816f39d16610db79c4600f37c1ca41bc502741a6
4706fa355b57f40805cb76cd59a3e7e423d214de
refs/heads/master
2020-03-22T02:09:39.257878
2018-07-02T16:17:17
2018-07-02T16:17:17
139,353,229
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
import java.util.HashMap; public class Map { public static void main(String[] args) { HashMap<Integer,String> HM = new HashMap<Integer,String>(); HM.put(1, "theja"); HM.put(2, "theja"); HM.put(3, "theja"); for(Map.Entry m:HM.entrySet()) { System.out.print(m.getkey(),m.getValue()); } } }
[ "tejag0537@gmail.com" ]
tejag0537@gmail.com
1cf12602235b2a069a2889f380be22a2afc55bb8
9c6d2de9e85c679c9b9bae0c91f84fae0d410053
/2015-02/Individual Projects/Grupo 1/Proyecto Instancia 2/Generador/generado/androidApplication/app/src/main/java/co/edu/uniandes/proyectoautomatizacion/pojo/ImagenSliderItem.java
acb98939c5fc360c4feccba47bdd10ec55f5e11a
[]
no_license
phillipus85/ETLMetricsDataset
902b526900b8c91889570b15538fa92df0db980f
7756381f9d580911b1dff9048f3cff002b110b19
refs/heads/master
2021-06-21T12:02:38.368652
2017-07-12T05:13:21
2017-07-12T05:13:21
79,398,957
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package co.edu.uniandes.proyectoautomatizacion.pojo; import java.io.Serializable; /** * Created by juandavid on 5/8/15. */ public class ImagenSliderItem implements Serializable { private String imagen; private String url; private String tipo; public String getImagen() { return imagen; } public void setImagen(String imagen) { this.imagen = imagen; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } }
[ "n.bonet2476@uniandes.edu.co" ]
n.bonet2476@uniandes.edu.co
9a53c4946c1a48dc9e3ccbf349b7d98bc80ab4bd
25052216308feeab27f677595a8c0a1dad7829cc
/core/src/main/java/com/git/hui/fix/core/endpoint/BasicHttpServer.java
c4eecdbd3abf4b93d18e0cd4015a6a14b39d633d
[]
no_license
hwthwt/quick-fix
c6cf340a6c39078a683c074ea3181975beee3961
af8e91d665b0927cd98fb71af0b7d67f99a83f0f
refs/heads/master
2020-07-08T06:32:20.842315
2019-08-19T09:54:50
2019-08-19T09:54:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
package com.git.hui.fix.core.endpoint; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.*; /** * Created by @author yihui in 13:46 18/12/30. */ public class BasicHttpServer { private static ExecutorService bootstrapExecutor = Executors.newSingleThreadExecutor(); private static ExecutorService taskExecutor; private static final String PORT_NAME = "quick.fix.port"; static void startHttpServer() { int nThreads = Runtime.getRuntime().availableProcessors(); taskExecutor = new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(100), new ThreadPoolExecutor.DiscardPolicy()); int port = Integer.parseInt(System.getProperty(PORT_NAME, "9999")); while (true) { try { ServerSocket serverSocket = new ServerSocket(port); bootstrapExecutor.submit(new ServerThread(serverSocket)); System.out.println("FixEndpoint is : " + port); break; } catch (Exception e) { try { //重试 TimeUnit.SECONDS.sleep(10); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } } bootstrapExecutor.shutdown(); } private static class ServerThread implements Runnable { private ServerSocket serverSocket; public ServerThread(ServerSocket s) throws IOException { this.serverSocket = s; } @Override public void run() { while (true) { try { Socket socket = this.serverSocket.accept(); HttpTask eventTask = new HttpTask(socket); taskExecutor.submit(eventTask); } catch (Exception e) { e.printStackTrace(); try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } } } } }
[ "bangzewu@126.com" ]
bangzewu@126.com
f08522a521f6d249bf96eb9c73f9505a9cf52729
2a43293eb4db6c4680e95376c4686fddec5013d6
/web-services/SpringRestIntegeration/src/main/java/com/nt/service/RestUserService.java
4d9a80d0edea8086c6638283431c3311990b2bf3
[]
no_license
MDWASIMHAIDER/WebServices
2cfb99bd345f3b80931f46118dbc5f7cf6ca6358
13ad0e68f3d539452dc3d63af876df895b8f54da
refs/heads/master
2022-12-23T22:37:52.737163
2020-03-08T13:35:01
2020-03-08T13:35:01
245,820,110
0
0
null
2022-12-16T00:35:05
2020-03-08T13:31:48
JavaScript
UTF-8
Java
false
false
252
java
package com.nt.service; import com.nt.domain.RestUser; public interface RestUserService { public boolean add(RestUser user); public RestUser get(String uid); public boolean update(String uid,RestUser user); public boolean delete(String uid); }
[ "wasim.haider91@gmail.com" ]
wasim.haider91@gmail.com
39c425b0b044cd73d9613263cc2fffdf2497144c
46fe6c4ff360d94a25f36e65358bb63b5874d057
/chapter6/src/main/java/com/testng/demo10/TestMultiThreading.java
45cabaacb408e0cf9e0026879877ef127a987ad5
[]
no_license
jing123678/selenium-webdriver
e84b3462764ca067e8af9c999abb58b9bb0bd6d5
b3234f948adb3655abc9425ba7a78488e2b8ff77
refs/heads/master
2023-03-20T01:51:09.773078
2020-06-27T12:13:44
2020-06-27T12:13:44
492,526,551
1
0
null
2022-05-15T15:29:08
2022-05-15T15:29:07
null
UTF-8
Java
false
false
434
java
package com.testng.demo10; import org.testng.annotations.Test; /** * @description 多线程测试,没有关联的用例可以使用多线程减少执行时间 * @author rongrong * @version 1.0 * @date 2020/6/26 14:23 */ public class TestMultiThreading { @Test(invocationCount = 10,threadPoolSize = 4) public void testMultiThreading(){ System.out.println("Thread id :"+Thread.currentThread().getId()); } }
[ "2250454190@qq.com" ]
2250454190@qq.com
30eff49ef36613bbaa5b9e6c8d31a4cc55340d7f
93c109cd1c7d87e7754a04c3b42ff09b5407ffaf
/src/main/java/com/cedric/strideup/services/update/UpdateMgmt.java
f99a37d406781e5e4b186297a221ccb2ca236959
[]
no_license
cedric102/StrideUp
54a6a794ce7c262ab510cf0f7af623d52d943c58
382b6bd6cd9fe3569a9a160fcab12346f14e5b7c
refs/heads/main
2023-04-25T11:45:07.427787
2021-05-18T15:28:04
2021-05-18T15:28:04
367,633,802
0
0
null
null
null
null
UTF-8
Java
false
false
1,969
java
package com.cedric.strideup.services.update; import com.cedric.strideup.models_dao.DataString; import com.cedric.strideup.repositories.DataStringRepo; import com.cedric.strideup.services.GetAPI; import org.json.JSONObject; public class UpdateMgmt { private GetAPI getAPI; public UpdateMgmt(){ getAPI = new GetAPI(); } public JSONObject saveToDB_IfAbsent( String dst , DataStringRepo dataStringRepo ){ JSONObject ds = new JSONObject(dst); // Check if the parkCode exist in the Internal Database DataString dsExists = dataStringRepo.findByParkCode( ds.getString("parkCode") ); if( dsExists != null ) return null; // Check if the parkCode exist in the Remote API getAPI.constructParam_ParkCode( ds.getString("parkCode") ); JSONObject json = getAPI.getAPIFlex(); int jsonSize = json.getJSONArray("data").length(); if( jsonSize == 1 ) return null; // Save the new Park in the Internal Database DataString d = new DataString( ds.getString("parkCode") , ds.getString("states") , dst ); dataStringRepo.save( d ); return ds; } public JSONObject saveToDB_IfPresent( String dst , DataStringRepo dataStringRepo ){ JSONObject ds = new JSONObject(dst); DataString dsExists = dataStringRepo.findByParkCode( ds.getString("parkCode") ); JSONObject json; // Seach if the entity already exists if( dsExists == null ) { getAPI.constructParam_ParkCode( ds.getString("parkCode") ); json = getAPI.getAPIFlex(); int jsonSize = json.getJSONArray("data").length(); if( jsonSize != 1 ) return null; } // Update the new entity DataString d = new DataString( ds.getString("parkCode") , ds.getString("states") , dst ); dataStringRepo.save( d ); return ds; } }
[ "carteroncedric@gmail.com" ]
carteroncedric@gmail.com
a7ce79b77bcd36624c9b84b8e9b0b6d63421d901
6282a9991dd10babf8654593b183762e2792364c
/backEnd/src/test/java/com/esprit/dari/DariApplicationTests.java
93a876f0107c95f2402691a0c72a6dfd6e7b5b04
[]
no_license
khalilslama-dev/PiDari
89b945144c897b8e5649e10041d76daac2f10d11
92e0e072cdbb14cf776c715d63de5bdc8327ff3d
refs/heads/master
2023-03-16T06:32:08.451283
2021-03-03T20:38:02
2021-03-03T20:38:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
214
java
package com.esprit.dari; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DariApplicationTests { @Test void contextLoads() { } }
[ "houssemeddine.marsaoui@esprit.tn" ]
houssemeddine.marsaoui@esprit.tn
e423d61666f88a4aad588c63405cf862dd506a3c
a464211147d0fd47d2be533a5f0ced0da88f75f9
/EvoSuiteTests/evosuite_3/evosuite-tests/org/mozilla/javascript/xml/XMLObject_ESTest_scaffolding.java
f26d66a003720ff149559a7ba2c8d346d2555748
[ "MIT" ]
permissive
LASER-UMASS/Swami
63016a6eccf89e4e74ca0ab775e2ef2817b83330
5bdba2b06ccfad9d469f8122c2d39c45ef5b125f
refs/heads/master
2022-05-19T12:22:10.166574
2022-05-12T13:59:18
2022-05-12T13:59:18
170,765,693
11
5
NOASSERTION
2022-05-12T13:59:19
2019-02-14T22:16:01
HTML
UTF-8
Java
false
false
4,633
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Aug 02 04:09:04 GMT 2018 */ package org.mozilla.javascript.xml; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class XMLObject_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.mozilla.javascript.xml.XMLObject"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(XMLObject_ESTest_scaffolding.class.getClassLoader() , "org.mozilla.javascript.EcmaError", "org.mozilla.javascript.SlotMapContainer", "org.mozilla.javascript.SymbolScriptable", "org.mozilla.javascript.xml.XMLObject", "org.mozilla.javascript.Symbol", "org.mozilla.javascript.Callable", "org.mozilla.javascript.RhinoException", "org.mozilla.javascript.ExternalArrayData", "org.mozilla.javascript.NativeObject", "org.mozilla.javascript.IdFunctionCall", "org.mozilla.javascript.IdFunctionObject", "org.mozilla.javascript.Function", "org.mozilla.javascript.SlotMap", "org.mozilla.javascript.IdScriptableObject", "org.mozilla.javascript.Context", "org.mozilla.javascript.ConstProperties", "org.mozilla.javascript.EvaluatorException", "org.mozilla.javascript.JavaScriptException", "org.mozilla.javascript.FunctionObject", "org.mozilla.javascript.IdFunctionObjectES6", "org.mozilla.javascript.ThreadSafeSlotMapContainer", "org.mozilla.javascript.ScriptableObject$KeyComparator", "org.mozilla.javascript.Scriptable", "org.mozilla.javascript.ScriptableObject", "org.mozilla.javascript.debug.DebuggableObject", "org.mozilla.javascript.BaseFunction" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(XMLObject_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.mozilla.javascript.ScriptableObject$KeyComparator", "org.mozilla.javascript.ScriptableObject", "org.mozilla.javascript.IdScriptableObject", "org.mozilla.javascript.xml.XMLObject", "org.mozilla.javascript.UniqueTag", "org.mozilla.javascript.Scriptable" ); } }
[ "mmotwani@cs.umass.edu" ]
mmotwani@cs.umass.edu
2573865a788cc8889423145b5b2338b28295394a
ffec14daa3b93580217f874cca553a085fda3898
/app/src/test/java/com/kk/mopub_chocolate/ExampleUnitTest.java
0b7a2e224798932708a3e0550b6e5b2477269f89
[]
no_license
kkawai/mopub_chocolate
23f320eea52e8b1db4529e2954bcf0a259647b3d
88b23ce2b027c381af92f114f58352c7dab69b85
refs/heads/master
2020-05-07T21:31:05.189226
2019-05-28T22:29:56
2019-05-28T22:29:56
180,907,688
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package com.kk.mopub_chocolate; 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); } }
[ "kkawai2@gmail.com" ]
kkawai2@gmail.com
ea43cb98e79afe976d3ec3bc2f9cf9a992d2d7a0
95c49f466673952b465e19a5ee3ae6eff76bee00
/src/main/java/com/zhihu/android/api/model/InternalNotification.java
5b08ade23d7f3011413c1d8533b5841c630c52c3
[]
no_license
Phantoms007/zhihuAPK
58889c399ae56b16a9160a5f48b807e02c87797e
dcdbd103436a187f9c8b4be8f71bdf7813b6d201
refs/heads/main
2023-01-24T01:34:18.716323
2020-11-25T17:14:55
2020-11-25T17:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
package com.zhihu.android.api.model; import com.fasterxml.jackson.p518a.JsonProperty; import com.zhihu.android.level.model.ActionsKt; public class InternalNotification { @JsonProperty(mo29184a = "data") public Content data; @JsonProperty(mo29184a = "today_show_residual") public int todayRestCount; public static class Content { public static final int ANSWER = 4; public static final int ARTICLE = 2; public static final int COLLECTION = 1; public static final int COLUMN = 3; public static final String GROUP_A = "1"; public static final String GROUP_B = "2"; public static final String GROUP_NONE = "0"; public static final int QUESTION = 0; public static final int ROUNDTABLE = 6; public static final int TOPIC = 5; @JsonProperty(mo29184a = "dp_group") public String dpGroup; @JsonProperty(mo29184a = "expire_at") public long expireAt; @JsonProperty(mo29184a = "hot_icon") public String hotIcon; @JsonProperty(mo29184a = "hot_icon_night") public String hotIconNight; @JsonProperty(mo29184a = "hot_text") public String hotText; @JsonProperty(mo29184a = "icon") public String icon; @JsonProperty(mo29184a = "id") /* renamed from: id */ public long f40297id; @JsonProperty(mo29184a = "is_dp") public boolean isDp; @JsonProperty(mo29184a = "message") public String message; @JsonProperty(mo29184a = "start_at") public long startAt; @JsonProperty(mo29184a = "tag") public Tag tag; @JsonProperty(mo29184a = ActionsKt.ACTION_CONTENT_TYPE) public int targetType; @JsonProperty(mo29184a = "url") public String url; } public static class Tag { @JsonProperty(mo29184a = "id") /* renamed from: id */ public long f40298id; @JsonProperty(mo29184a = "img_url") public String imgUrl; @JsonProperty(mo29184a = "info") public String info; } }
[ "seasonpplp@qq.com" ]
seasonpplp@qq.com
8c55e6f4be6b302133f717891b41ebd2769d9381
6c7642f140c0bea2ca15b45fc10d7a19cb4beaef
/app/src/test/java/jkbd/activity/SplashActivity.java
4471250713cf2dda63e3360a4b4928b195b10479
[]
no_license
LBZ-lucky/New-JKBD
b84c062f3e298f0f772fa85b84ac2defde897efc
183399407eb208ccfdd05dff61b90bcdf2f1476c
refs/heads/master
2020-12-03T04:15:18.445328
2017-07-06T12:51:22
2017-07-06T12:51:22
95,840,118
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package jkbd.activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import cn.ucai.jkbd.R; /** * Created by clawpo on 2017/6/27. */ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); mCountDownTimer.start(); } CountDownTimer mCountDownTimer = new CountDownTimer(2000,1000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { Intent intent = new Intent(SplashActivity.this,MainActivity.class); startActivity(intent); SplashActivity.this.finish(); } }; }
[ "1421809084@qq.com" ]
1421809084@qq.com