blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e951e2d756d290223f1fc8a9b750aa2aec5cf2a | 17,695,265,260,826 | c5b30e5514d105db76cdb0cc48b24e77736e14c8 | /PlayerClient/app/src/main/java/com/example/josep/playerclient/PlayerClient.java | 2e6f35d7e44d8c8f3dee3088458c28bb9f15f1e2 | [] | no_license | josephp27/MP5 | https://github.com/josephp27/MP5 | 7241bb9fc943a0a3fcd9a002f8f83a1425c4e2fe | bd4e199f1a9bde6c6f1e8a8d12f8ce8d345cfe18 | refs/heads/master | 2019-01-06T09:32:29.069000 | 2016-11-30T23:46:04 | 2016-11-30T23:46:04 | 75,177,504 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.josep.playerclient;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import com.example.josep.audioserver.AudioPlayer;
import java.util.ArrayList;
public class PlayerClient extends AppCompatActivity {
//init vars for bound and intent adapter current track, etc
private AudioPlayer mAudioPlayerService;
private boolean mIsBound = false;
private boolean paused = true;
private Intent i;
private ArrayAdapter<String> adapter;
private ArrayList<String> log = new ArrayList<String>();
private int currTrack = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_client);
//setup listview and set adapter to arraylist log
ListView l1 = (ListView) findViewById(R.id.lv1);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, log);
l1.setAdapter(adapter);
//setup pause
final Button pause = (Button) findViewById(R.id.pause);
pause.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound and a track has been selected and not paused, pause
if (mIsBound) {
if(currTrack > 0 & !paused) {
mAudioPlayerService.pause();
//add pause to front of list to display at top and update adapter
log.add(0, "Pause Track " + currTrack);
adapter.notifyDataSetChanged();
paused = true;
}
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup stop
Button stop = (Button) findViewById(R.id.stop);
stop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound stop and a track was selected stop it
if (mIsBound) {
if(currTrack > 0) {
mAudioPlayerService.stop();
//add stop to top of list and update adapter
log.add(0, "Stop");
adapter.notifyDataSetChanged();
}
//set track to none
currTrack = -1;
}
else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 1
Button t1 = (Button) findViewById(R.id.t1);
t1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound set play on track, update curr track to 1
if (mIsBound) {
mAudioPlayerService.play(1);
currTrack = 1;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 2
Button t2 = (Button) findViewById(R.id.t2);
t2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound start track 2 and set curr to 2
if (mIsBound) {
mAudioPlayerService.play(2);
currTrack = 2;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 3
Button t3 = (Button) findViewById(R.id.t3);
t3.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound play track 3 and update curr track to 3
if (mIsBound) {
mAudioPlayerService.play(3);
currTrack = 3;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else{
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
}
@Override
protected void onResume() {
super.onResume();
if (!mIsBound) {
//if not bound create explicit intent
boolean b = false;
i = new Intent(AudioPlayer.class.getName());
ResolveInfo info = getPackageManager().resolveService(i, PackageManager.MATCH_ALL);
i.setComponent(new ComponentName(info.serviceInfo.packageName, info.serviceInfo.name));
//bind service
b = getApplicationContext().bindService(i, this.mConnection, Context.BIND_AUTO_CREATE);
//if success output or failed ow
if (b) {
Log.i("Client", "bindService() succeeded!");
} else {
Log.i("Client", "bindService() failed!");
}
}
}
//when destroyed, unbind the service
@Override
protected void onDestroy(){
super.onDestroy();
if(mIsBound)
getApplicationContext().unbindService(this.mConnection);
}
//part of bind service sets up connection
private final ServiceConnection mConnection = new ServiceConnection() {
//gets the binder and sets bound to true
public void onServiceConnected(ComponentName className, IBinder iservice) {
mAudioPlayerService = AudioPlayer.Stub.asInterface(iservice);
mIsBound = true;
}
//on disconnect set to null and bound to false
public void onServiceDisconnected(ComponentName className) {
mAudioPlayerService = null;
mIsBound = false;
}
};
}
| UTF-8 | Java | 7,866 | java | PlayerClient.java | Java | [] | null | [] | package com.example.josep.playerclient;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import com.example.josep.audioserver.AudioPlayer;
import java.util.ArrayList;
public class PlayerClient extends AppCompatActivity {
//init vars for bound and intent adapter current track, etc
private AudioPlayer mAudioPlayerService;
private boolean mIsBound = false;
private boolean paused = true;
private Intent i;
private ArrayAdapter<String> adapter;
private ArrayList<String> log = new ArrayList<String>();
private int currTrack = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_client);
//setup listview and set adapter to arraylist log
ListView l1 = (ListView) findViewById(R.id.lv1);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, log);
l1.setAdapter(adapter);
//setup pause
final Button pause = (Button) findViewById(R.id.pause);
pause.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound and a track has been selected and not paused, pause
if (mIsBound) {
if(currTrack > 0 & !paused) {
mAudioPlayerService.pause();
//add pause to front of list to display at top and update adapter
log.add(0, "Pause Track " + currTrack);
adapter.notifyDataSetChanged();
paused = true;
}
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup stop
Button stop = (Button) findViewById(R.id.stop);
stop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound stop and a track was selected stop it
if (mIsBound) {
if(currTrack > 0) {
mAudioPlayerService.stop();
//add stop to top of list and update adapter
log.add(0, "Stop");
adapter.notifyDataSetChanged();
}
//set track to none
currTrack = -1;
}
else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 1
Button t1 = (Button) findViewById(R.id.t1);
t1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound set play on track, update curr track to 1
if (mIsBound) {
mAudioPlayerService.play(1);
currTrack = 1;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 2
Button t2 = (Button) findViewById(R.id.t2);
t2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound start track 2 and set curr to 2
if (mIsBound) {
mAudioPlayerService.play(2);
currTrack = 2;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else {
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
//setup track 3
Button t3 = (Button) findViewById(R.id.t3);
t3.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
//if bound play track 3 and update curr track to 3
if (mIsBound) {
mAudioPlayerService.play(3);
currTrack = 3;
paused = false;
//add to top of list and update adapter
log.add(0, "Play Track " + currTrack);
adapter.notifyDataSetChanged();
}else{
Log.i("Client", "Service was not bound!");
}
} catch (RemoteException e) {
Log.e("Client", e.toString());
}
}
});
}
@Override
protected void onResume() {
super.onResume();
if (!mIsBound) {
//if not bound create explicit intent
boolean b = false;
i = new Intent(AudioPlayer.class.getName());
ResolveInfo info = getPackageManager().resolveService(i, PackageManager.MATCH_ALL);
i.setComponent(new ComponentName(info.serviceInfo.packageName, info.serviceInfo.name));
//bind service
b = getApplicationContext().bindService(i, this.mConnection, Context.BIND_AUTO_CREATE);
//if success output or failed ow
if (b) {
Log.i("Client", "bindService() succeeded!");
} else {
Log.i("Client", "bindService() failed!");
}
}
}
//when destroyed, unbind the service
@Override
protected void onDestroy(){
super.onDestroy();
if(mIsBound)
getApplicationContext().unbindService(this.mConnection);
}
//part of bind service sets up connection
private final ServiceConnection mConnection = new ServiceConnection() {
//gets the binder and sets bound to true
public void onServiceConnected(ComponentName className, IBinder iservice) {
mAudioPlayerService = AudioPlayer.Stub.asInterface(iservice);
mIsBound = true;
}
//on disconnect set to null and bound to false
public void onServiceDisconnected(ComponentName className) {
mAudioPlayerService = null;
mIsBound = false;
}
};
}
| 7,866 | 0.494661 | 0.489957 | 215 | 34.586048 | 23.63995 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539535 | false | false | 13 |
cc8c5681d45955b6c1cff220e36190a7ec95fe9c | 17,463,337,072,962 | 14d5ab02b5ccd4764c6fc1d7a0454c9b7c5d0d1e | /concurrent/src/main/java/com/learn/concurrent/communication/PrintSequence2.java | 634b16b1fe797332ebef03715d947400c794b9a5 | [] | no_license | WuQuDeRen/learn_all | https://github.com/WuQuDeRen/learn_all | 10dd5a91a099c6009af90374d42dfe6e2d3e1ace | 961f285fc6779782daa9b19750f6276e6e8ac779 | refs/heads/master | 2022-12-27T22:25:40.503000 | 2019-09-01T11:35:47 | 2019-09-01T11:35:47 | 137,453,165 | 0 | 0 | null | false | 2022-12-16T09:49:32 | 2018-06-15T07:06:23 | 2019-09-01T11:35:45 | 2022-12-16T09:49:29 | 5,213 | 0 | 0 | 23 | Java | false | false | package com.learn.concurrent.communication;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
//
public class PrintSequence2 {
// 这个共享变量很重要,是控制 先后顺序的关键点之一
private static int flag = 1;
private static final Lock lock = new ReentrantLock(false);
private static Condition condition = lock.newCondition();
public static void main(String[] args) {
new Thread(() -> {
String[] strings = Help.buildCharArr(26);
for (int i = 0; i < strings.length; i++) {
lock.lock();
try {
while (flag != 2) {
condition.await();
}
Help.print(strings, i, i+1);
flag = 1;
condition.signal();
} catch(Exception e) {
} finally {
lock.unlock();
}
}
}).start();
new Thread(() -> {
String[] strings = Help.buildNoArr(52);
for (int i = 0; i < strings.length; i+=2) {
lock.lock();
try {
while (flag != 1) {
condition.await();
}
Help.print(strings, i, i+2);
flag = 2;
condition.signal();
} catch (Exception e) {} finally {
lock.unlock();
}
}
}).start();
}
}
| UTF-8 | Java | 1,618 | java | PrintSequence2.java | Java | [] | null | [] | package com.learn.concurrent.communication;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
//
public class PrintSequence2 {
// 这个共享变量很重要,是控制 先后顺序的关键点之一
private static int flag = 1;
private static final Lock lock = new ReentrantLock(false);
private static Condition condition = lock.newCondition();
public static void main(String[] args) {
new Thread(() -> {
String[] strings = Help.buildCharArr(26);
for (int i = 0; i < strings.length; i++) {
lock.lock();
try {
while (flag != 2) {
condition.await();
}
Help.print(strings, i, i+1);
flag = 1;
condition.signal();
} catch(Exception e) {
} finally {
lock.unlock();
}
}
}).start();
new Thread(() -> {
String[] strings = Help.buildNoArr(52);
for (int i = 0; i < strings.length; i+=2) {
lock.lock();
try {
while (flag != 1) {
condition.await();
}
Help.print(strings, i, i+2);
flag = 2;
condition.signal();
} catch (Exception e) {} finally {
lock.unlock();
}
}
}).start();
}
}
| 1,618 | 0.438931 | 0.429389 | 51 | 29.82353 | 17.24416 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607843 | false | false | 13 |
9aca3d7a74f1916d94128332765e6d557005bd7a | 30,459,908,132,835 | 80b3a7ce965686803aa16e2302c167b619357a8a | /block-nonblock/src/main/java/com/camon/akka/blocknonblock/BlockingMain.java | f3bcbcfa002e5c2effa050c4bdfde7a3646f5d8a | [] | no_license | camon85/akka | https://github.com/camon85/akka | 4f3ae871d33f6752809a9287f77f97c210db66a5 | b8706955deea67d403594bd98d5fdda008908f60 | refs/heads/master | 2020-01-23T21:04:01.887000 | 2016-11-27T17:39:55 | 2016-11-27T17:39:55 | 74,579,659 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.camon.akka.blocknonblock;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.camon.akka.blocknonblock.actor.BlockingActor;
/**
* 아카의 Future를 이용해서 blocking 동작을 보여주는 메인 클래스
*/
public class BlockingMain {
public static void main(String[] args) {
ActorSystem actorSystem = ActorSystem.create("BlockingSystem");
ActorRef blockingActor = actorSystem.actorOf(Props.create(BlockingActor.class), "blockingActor");
blockingActor.tell(10, ActorRef.noSender());
blockingActor.tell("hello", ActorRef.noSender());
}
}
| UTF-8 | Java | 645 | java | BlockingMain.java | Java | [] | null | [] | package com.camon.akka.blocknonblock;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.camon.akka.blocknonblock.actor.BlockingActor;
/**
* 아카의 Future를 이용해서 blocking 동작을 보여주는 메인 클래스
*/
public class BlockingMain {
public static void main(String[] args) {
ActorSystem actorSystem = ActorSystem.create("BlockingSystem");
ActorRef blockingActor = actorSystem.actorOf(Props.create(BlockingActor.class), "blockingActor");
blockingActor.tell(10, ActorRef.noSender());
blockingActor.tell("hello", ActorRef.noSender());
}
}
| 645 | 0.733884 | 0.730579 | 19 | 30.842106 | 28.377647 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false | 13 |
eb8e323b6cfcc2ef7b249ecd5d861b0a1abddfb6 | 26,585,847,587,731 | a418fb98b7869a0612d20739e325856315fa6259 | /src/main/java/com/crab/web/restcontroller/BaseController.java | 2a269fa7501d83a94d91e64ca9e6f232e09bd458 | [] | no_license | lzh-boy/crab | https://github.com/lzh-boy/crab | 175c0e5debc8425e44c6063298411ca05b995968 | 92a91da54a97ab5865aeb2d5d1600770b21280c4 | refs/heads/master | 2020-03-08T15:29:21.260000 | 2018-04-04T10:30:05 | 2018-04-04T10:30:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.crab.web.restcontroller;
import com.crab.common.exception.BusinessException;
import com.crab.model.bo.UserMsgBO;
import com.crab.utils.PublicUtils;
import com.crab.utils.ThreadLocalMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import java.util.List;
import static com.crab.constants.AuthConstant.USER_MSG_KEY;
/**
* Created by lyh on 2017/12/29.
*/
public class BaseController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected UserMsgBO getUserMsgByToken() throws BusinessException {
Object o = ThreadLocalMap.get(USER_MSG_KEY);
if (PublicUtils.isNull(o)) {
throw new BusinessException("token验证失败!");
}
return (UserMsgBO)o;
}
/**
* Hibernate Validator校验结果处理
* @author <a href="lyhluo@163.com"/>罗迎豪</a>
* @date
*/
protected void handleBindingResult(BindingResult bindingResult) throws BusinessException {
List<ObjectError> allErrors = bindingResult.getAllErrors();
if (allErrors.isEmpty()) {
return;
}
String defaultMessage = allErrors.get(0).getDefaultMessage();
throw new BusinessException(defaultMessage);
}
}
| UTF-8 | Java | 1,351 | java | BaseController.java | Java | [
{
"context": "ants.AuthConstant.USER_MSG_KEY;\n\n/**\n * Created by lyh on 2017/12/29.\n */\n\npublic class BaseController {",
"end": 467,
"score": 0.9994449019432068,
"start": 464,
"tag": "USERNAME",
"value": "lyh"
},
{
"context": "Hibernate Validator校验结果处理\n * @author <a href=\... | null | [] | package com.crab.web.restcontroller;
import com.crab.common.exception.BusinessException;
import com.crab.model.bo.UserMsgBO;
import com.crab.utils.PublicUtils;
import com.crab.utils.ThreadLocalMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import java.util.List;
import static com.crab.constants.AuthConstant.USER_MSG_KEY;
/**
* Created by lyh on 2017/12/29.
*/
public class BaseController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected UserMsgBO getUserMsgByToken() throws BusinessException {
Object o = ThreadLocalMap.get(USER_MSG_KEY);
if (PublicUtils.isNull(o)) {
throw new BusinessException("token验证失败!");
}
return (UserMsgBO)o;
}
/**
* Hibernate Validator校验结果处理
* @author <a href="<EMAIL>"/>罗迎豪</a>
* @date
*/
protected void handleBindingResult(BindingResult bindingResult) throws BusinessException {
List<ObjectError> allErrors = bindingResult.getAllErrors();
if (allErrors.isEmpty()) {
return;
}
String defaultMessage = allErrors.get(0).getDefaultMessage();
throw new BusinessException(defaultMessage);
}
}
| 1,344 | 0.70566 | 0.695094 | 46 | 27.804348 | 24.849651 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413043 | false | false | 13 |
c5c42a018beddb924f2a610923287f145597f4ec | 33,612,414,064,524 | 38c638309fad69cca62951345cc45280661b72a8 | /OOPTestPro/src/com/JiMingdd/School.java | 6eab6219c99dcbe70a0ec3c1d6e3d3bd1c9dcca4 | [] | no_license | jmgddn/Archive | https://github.com/jmgddn/Archive | 96d795d26e702cb54dba7b4bcc674a227ecbf134 | db024866cbe67a9bdf2900d40f8d9bda81930a7c | refs/heads/master | 2016-09-13T03:15:41.678000 | 2016-07-19T12:05:35 | 2016-07-19T12:05:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.JiMingdd;
public class School {
//定义类的成员 public 可省,但在其他包的类中不能调用(处于同一包中的其他类,可以调用),因为是对外部隐藏的
//定义 属性(成员变量)
public String name;
public int countOfClassRooms;
public int countOfPCRooms;
//定义方法
public void des(){
String name="Hello World"; //局部变量 优先级高于成员变量
System.out.printf("中心名称:%s\n中心教室数目:%d\n中心机房数目:%d\n",name,countOfClassRooms,countOfPCRooms);
}
}
| GB18030 | Java | 567 | java | School.java | Java | [
{
"context": "Rooms;\n\t//定义方法\n\tpublic void des(){\n\t\tString name=\"Hello World\"; //局部变量 优先级高于成员变量\n\t\tSystem.out.printf(\"中心名称:%s",
"end": 258,
"score": 0.9354352951049805,
"start": 247,
"tag": "NAME",
"value": "Hello World"
}
] | null | [] | package com.JiMingdd;
public class School {
//定义类的成员 public 可省,但在其他包的类中不能调用(处于同一包中的其他类,可以调用),因为是对外部隐藏的
//定义 属性(成员变量)
public String name;
public int countOfClassRooms;
public int countOfPCRooms;
//定义方法
public void des(){
String name="<NAME>"; //局部变量 优先级高于成员变量
System.out.printf("中心名称:%s\n中心教室数目:%d\n中心机房数目:%d\n",name,countOfClassRooms,countOfPCRooms);
}
}
| 562 | 0.736148 | 0.736148 | 14 | 26.071428 | 24.722645 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 13 |
4df8c879b7c45b2f54b7a14d04f6a3d97107fe19 | 29,497,835,447,107 | 3cacd015da22cb75c431df76b504e98a57bfe25c | /server/jvue-api/src/main/java/net/ccfish/jvue/autogen/model/JvueRole.java | 2cfcab3866dcf1611e00c259b1ce554facbbfa36 | [
"MIT"
] | permissive | ccfish86/jvue-admin | https://github.com/ccfish86/jvue-admin | 618723d4562ae2d6b463d10bfe53d06df935ddab | ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c | refs/heads/master | 2023-02-19T01:50:50.341000 | 2023-02-17T06:44:06 | 2023-02-17T06:44:06 | 119,806,737 | 32 | 15 | MIT | false | 2023-02-17T06:44:07 | 2018-02-01T08:33:00 | 2023-02-17T06:42:25 | 2023-02-17T06:44:06 | 1,979 | 25 | 13 | 0 | Java | false | false | package net.ccfish.jvue.autogen.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.ibatis.type.JdbcType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import net.ccfish.common.entity.BaseEntity;
import tk.mybatis.mapper.annotation.ColumnType;
@Table(name = "jvue_role")
@ApiModel("JvueRole(角色)")
public class JvueRole extends BaseEntity implements Serializable {
/**
* ID
*/
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id", insertable = false, updatable = false)
@ApiModelProperty(value ="ID",required = false)
@ColumnType(jdbcType=JdbcType.INTEGER)
private Integer id;
/**
* 角色名
*/
@ApiModelProperty(value ="角色名",required = false)
@ColumnType(jdbcType=JdbcType.VARCHAR)
private String name;
/**
* 是否启用
*/
@ApiModelProperty(value ="是否启用",required = false)
@ColumnType(jdbcType=JdbcType.INTEGER)
private Integer enabled;
private static final long serialVersionUID = 1L;
/**
* 获取ID
*
* @return id - ID
*/
public Integer getId() {
return id;
}
/**
* 设置ID
*
* @param id ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取角色名
*
* @return name - 角色名
*/
public String getName() {
return name;
}
/**
* 设置角色名
*
* @param name 角色名
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取是否启用
*
* @return enabled - 是否启用
*/
public Integer getEnabled() {
return enabled;
}
/**
* 设置是否启用
*
* @param enabled 是否启用
*/
public void setEnabled(Integer enabled) {
this.enabled = enabled;
}
public enum FieldEnum {
ID("id","id"),
NAME("name","name"),
ENABLED("enabled","enabled");
private String javaFieldName;
private String dbFieldName;
FieldEnum(String javaFieldName, String dbFieldName) {
this.javaFieldName = javaFieldName;
this.dbFieldName = dbFieldName;
}
public String javaFieldName() {
return javaFieldName;
}
public String dbFieldName() {
return dbFieldName;
}
}
} | UTF-8 | Java | 2,686 | java | JvueRole.java | Java | [] | null | [] | package net.ccfish.jvue.autogen.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.ibatis.type.JdbcType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import net.ccfish.common.entity.BaseEntity;
import tk.mybatis.mapper.annotation.ColumnType;
@Table(name = "jvue_role")
@ApiModel("JvueRole(角色)")
public class JvueRole extends BaseEntity implements Serializable {
/**
* ID
*/
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id", insertable = false, updatable = false)
@ApiModelProperty(value ="ID",required = false)
@ColumnType(jdbcType=JdbcType.INTEGER)
private Integer id;
/**
* 角色名
*/
@ApiModelProperty(value ="角色名",required = false)
@ColumnType(jdbcType=JdbcType.VARCHAR)
private String name;
/**
* 是否启用
*/
@ApiModelProperty(value ="是否启用",required = false)
@ColumnType(jdbcType=JdbcType.INTEGER)
private Integer enabled;
private static final long serialVersionUID = 1L;
/**
* 获取ID
*
* @return id - ID
*/
public Integer getId() {
return id;
}
/**
* 设置ID
*
* @param id ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取角色名
*
* @return name - 角色名
*/
public String getName() {
return name;
}
/**
* 设置角色名
*
* @param name 角色名
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取是否启用
*
* @return enabled - 是否启用
*/
public Integer getEnabled() {
return enabled;
}
/**
* 设置是否启用
*
* @param enabled 是否启用
*/
public void setEnabled(Integer enabled) {
this.enabled = enabled;
}
public enum FieldEnum {
ID("id","id"),
NAME("name","name"),
ENABLED("enabled","enabled");
private String javaFieldName;
private String dbFieldName;
FieldEnum(String javaFieldName, String dbFieldName) {
this.javaFieldName = javaFieldName;
this.dbFieldName = dbFieldName;
}
public String javaFieldName() {
return javaFieldName;
}
public String dbFieldName() {
return dbFieldName;
}
}
} | 2,686 | 0.563424 | 0.563035 | 122 | 19.081966 | 17.057083 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352459 | false | false | 13 |
112780d4b84d27996c667d05631103f79b5def1c | 10,703,058,519,022 | f93853d8a9dd7fbe12533e0abfef04cbc5c92a88 | /womki1.1/controller/servlets/Aktualisieren.java | 16caa74cd2755b1952d0ec28394c232ac00a4e91 | [] | no_license | dasDome/TurnOnlineGame | https://github.com/dasDome/TurnOnlineGame | 54bdc39a1172a8eb700cf53bc06e4b7f85a2a02d | d8287d35a536a1d647d5633a241a6cce2f92266b | refs/heads/master | 2021-05-15T21:31:49.770000 | 2017-10-11T08:09:47 | 2017-10-11T08:09:47 | 106,524,759 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package servlets;
import java.io.IOException;
import game.character.Figur;
import game.management.WorldOfMKIBean;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
public class Aktualisieren {
public static void aktualisieren(WorldOfMKIBean game, HttpServletRequest request) throws ServletException, IOException{
KarteAktualisieren2.aktualisierenKarte(game, request);
//RequestDispatcher dispatcher=request.getRequestDispatcher("KarteAktualisieren");
//dispatcher.forward(request, null);
Figur f=(Figur)request.getSession().getAttribute("figur");
if(game.getsieg()){
request.getSession().setAttribute("sieg", true);
}else{
request.getSession().setAttribute("sieg", false);
}
for(Figur figur: game.getFiguren()){
if(figur.equals(f)){
request.getSession().setAttribute("figur", figur);
}
}
if(game.aktiverSpieler() != null){
String name = game.aktiverSpieler();
if(name.equals(f.getName())){
request.getSession().setAttribute("dran", true);
}
else{
request.getSession().setAttribute("dran", false);
}
}
KarteAktualisieren2.aktualisierenKarte(game, request);
}
}
| UTF-8 | Java | 1,225 | java | Aktualisieren.java | Java | [] | null | [] | package servlets;
import java.io.IOException;
import game.character.Figur;
import game.management.WorldOfMKIBean;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
public class Aktualisieren {
public static void aktualisieren(WorldOfMKIBean game, HttpServletRequest request) throws ServletException, IOException{
KarteAktualisieren2.aktualisierenKarte(game, request);
//RequestDispatcher dispatcher=request.getRequestDispatcher("KarteAktualisieren");
//dispatcher.forward(request, null);
Figur f=(Figur)request.getSession().getAttribute("figur");
if(game.getsieg()){
request.getSession().setAttribute("sieg", true);
}else{
request.getSession().setAttribute("sieg", false);
}
for(Figur figur: game.getFiguren()){
if(figur.equals(f)){
request.getSession().setAttribute("figur", figur);
}
}
if(game.aktiverSpieler() != null){
String name = game.aktiverSpieler();
if(name.equals(f.getName())){
request.getSession().setAttribute("dran", true);
}
else{
request.getSession().setAttribute("dran", false);
}
}
KarteAktualisieren2.aktualisierenKarte(game, request);
}
}
| 1,225 | 0.733061 | 0.731429 | 46 | 25.630434 | 26.253246 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.326087 | false | false | 13 |
dcccceb7627f6fec1c9af012fe2d978e01620510 | 7,189,775,270,992 | aa32082f13c0703fbf78efbbd4fa34c7b2dfbda6 | /crawler-model/src/main/java/zx/soft/oversea/model/twitter/TwitterMapper.java | b5642f0981a8f624aa6e00c20ecdd8e56427f7fc | [] | no_license | Company-Works/oversea-crawler | https://github.com/Company-Works/oversea-crawler | e1d4826393f0f6e6d55a9504646571a52ec976e5 | dd97a4a95f06447efc0351afdd6a516c45ef2f07 | refs/heads/master | 2016-08-13T01:45:44.298000 | 2016-01-15T08:53:15 | 2016-01-15T08:53:15 | 45,368,455 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package zx.soft.oversea.model.twitter;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import zx.soft.oversea.model.pojo.TwitterToken;
import zx.soft.oversea.model.pojo.TwitterUser;
import zx.soft.oversea.model.pojo.TwitterUserInfo;
import java.util.List;
/**
* Created by jimbo on 10/28/15.
*/
public interface TwitterMapper {
@Select("SELECT `tokenkey`,`tokensecret`,`sinceId` FROM `twitterTokens`")
List<TwitterToken> getTokens();
@Select("SELECT COUNT(1) FROM `twitterTokens`")
int getTokensNum();
@Select("SELECT `user_id` AS userId ,`screen_name` AS screenName ,`since_id` AS sinceId FROM `user_monitor_twitter`")
List<TwitterUser> getTwitterUser();
@Select("SELECT COUNT(1) FROM `user_monitor_twitter`")
int getTwitterUserNum();
@Insert("INSERT `user_info_twitter`(`id`,`name`,`screen_name`,`profile_image_url`,`created_at`,"
+ "`location`,`url`,`favourites_count`,`utc_offset`,`listed_count`,`followers_count`,"
+ "`lang`,`description`,`verified`,`time_zone`,`statuses_count`,`friends_count`,`lasttime`) "
+ "VALUES (#{id},#{name},#{screen_name},#{profile_image_url},#{created_at},"
+ "#{location},#{url},#{favourites_count},#{utc_offset},#{listed_count},#{followers_count},"
+ "#{lang},#{description},#{verified},#{time_zone},#{statuses_count},#{friends_count},now())")
void insertTwitterUser(TwitterUserInfo userInfo);
@Update("UPDATE `user_monitor_twitter` SET `since_id` = #{sinceId} WHERE `screen_name`= #{screenName}")
void updateUserSinceId(@Param("screenName") String screenName,@Param("sinceId") long sinceId);
}
| UTF-8 | Java | 1,780 | java | TwitterMapper.java | Java | [
{
"context": "erInfo;\n\nimport java.util.List;\n\n/**\n * Created by jimbo on 10/28/15.\n */\npublic interface TwitterMapper {",
"end": 413,
"score": 0.9996340274810791,
"start": 408,
"tag": "USERNAME",
"value": "jimbo"
}
] | null | [] | package zx.soft.oversea.model.twitter;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import zx.soft.oversea.model.pojo.TwitterToken;
import zx.soft.oversea.model.pojo.TwitterUser;
import zx.soft.oversea.model.pojo.TwitterUserInfo;
import java.util.List;
/**
* Created by jimbo on 10/28/15.
*/
public interface TwitterMapper {
@Select("SELECT `tokenkey`,`tokensecret`,`sinceId` FROM `twitterTokens`")
List<TwitterToken> getTokens();
@Select("SELECT COUNT(1) FROM `twitterTokens`")
int getTokensNum();
@Select("SELECT `user_id` AS userId ,`screen_name` AS screenName ,`since_id` AS sinceId FROM `user_monitor_twitter`")
List<TwitterUser> getTwitterUser();
@Select("SELECT COUNT(1) FROM `user_monitor_twitter`")
int getTwitterUserNum();
@Insert("INSERT `user_info_twitter`(`id`,`name`,`screen_name`,`profile_image_url`,`created_at`,"
+ "`location`,`url`,`favourites_count`,`utc_offset`,`listed_count`,`followers_count`,"
+ "`lang`,`description`,`verified`,`time_zone`,`statuses_count`,`friends_count`,`lasttime`) "
+ "VALUES (#{id},#{name},#{screen_name},#{profile_image_url},#{created_at},"
+ "#{location},#{url},#{favourites_count},#{utc_offset},#{listed_count},#{followers_count},"
+ "#{lang},#{description},#{verified},#{time_zone},#{statuses_count},#{friends_count},now())")
void insertTwitterUser(TwitterUserInfo userInfo);
@Update("UPDATE `user_monitor_twitter` SET `since_id` = #{sinceId} WHERE `screen_name`= #{screenName}")
void updateUserSinceId(@Param("screenName") String screenName,@Param("sinceId") long sinceId);
}
| 1,780 | 0.688202 | 0.683708 | 40 | 43.5 | 37.969727 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.35 | false | false | 13 |
7831d2420595126ab99efc5572e659f27695868e | 2,362,232,021,875 | f299f907ef8ba02396902beb77638fb5630c5b8e | /Java/Spring Framework/Spring Boot/Templates and Examples/Spring Boot + Security (registration, autologin)/spring-boot-security-registration-autologin/src/main/java/root/SecurityConfiguration.java | 18873bd55366151107f797b8ff587c409382ceea | [] | no_license | KaiDevNotes/notes | https://github.com/KaiDevNotes/notes | 0e434bd7bb61fd99af2295255105c45b749fc5aa | ca8bbf41c85adc948dfa91947ae50942ad83eab1 | refs/heads/master | 2023-04-30T00:37:25.648000 | 2023-04-14T07:55:43 | 2023-04-26T04:39:37 | 72,666,713 | 0 | 1 | null | false | 2022-12-16T08:03:38 | 2016-11-02T17:56:08 | 2021-10-26T07:06:33 | 2022-12-16T08:03:34 | 27,292 | 0 | 1 | 45 | Java | false | false | package root;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import root.domain.User;
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Autowired
private AuthenticationSuccessHandler authenticationSuccessHandler;
@Override
protected void configure(HttpSecurity http) throws Exception
{
http.authorizeRequests()
.antMatchers("/", "/login", "/registration", "/static/**").permitAll()
.antMatchers("/admin/**").hasAnyRole(User.Role.ADMIN.name())
.antMatchers("/user/**").hasAnyRole(User.Role.USER.name())
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.successHandler(authenticationSuccessHandler)
.failureUrl("/login?error")
.permitAll()
.and()
.logout()
.logoutSuccessUrl("/")
.permitAll()
.and()
.exceptionHandling().accessDeniedPage("/403");
}
}
| UTF-8 | Java | 1,457 | java | SecurityConfiguration.java | Java | [] | null | [] | package root;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import root.domain.User;
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Autowired
private AuthenticationSuccessHandler authenticationSuccessHandler;
@Override
protected void configure(HttpSecurity http) throws Exception
{
http.authorizeRequests()
.antMatchers("/", "/login", "/registration", "/static/**").permitAll()
.antMatchers("/admin/**").hasAnyRole(User.Role.ADMIN.name())
.antMatchers("/user/**").hasAnyRole(User.Role.USER.name())
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.successHandler(authenticationSuccessHandler)
.failureUrl("/login?error")
.permitAll()
.and()
.logout()
.logoutSuccessUrl("/")
.permitAll()
.and()
.exceptionHandling().accessDeniedPage("/403");
}
}
| 1,457 | 0.641043 | 0.638984 | 38 | 37.342106 | 29.773067 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 13 |
fc62a125af0d43f220b3c157ff8c011f695bc25c | 13,417,477,881,077 | 924236acc6a15670fc8ae1bdf8020533c68447fe | /src/Fabryka/Soldier.java | 3b2ad2c3f6b98c763c3126dfcc4b82d69a1eb058 | [] | no_license | jcieszynska/wzorce-projektowe | https://github.com/jcieszynska/wzorce-projektowe | b2a7ffd4913f883807e2f6959f91dbcb82da94f7 | c71f1169dd24d3864157a91102f72d1ef15e9f68 | refs/heads/master | 2023-05-28T05:37:43.368000 | 2021-06-04T18:24:49 | 2021-06-04T18:24:49 | 356,659,798 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Fabryka;
public class Soldier extends Unit{
public Soldier(int hp, int experience, int power) {
super(hp, experience, power);
}
}
| UTF-8 | Java | 155 | java | Soldier.java | Java | [] | null | [] | package Fabryka;
public class Soldier extends Unit{
public Soldier(int hp, int experience, int power) {
super(hp, experience, power);
}
}
| 155 | 0.670968 | 0.670968 | 7 | 21.142857 | 19.65 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false | 13 |
519874f19e2049dbb29333f4ced9030c50e1abce | 5,514,738,008,836 | b72342fad80bccf60ec2878bb4b417cc5ebbd053 | /src/scau/info/volunteertime/activity/settings/SettingsFragment.java | add70218cffbac9344b4a697ef452d01e329de9f | [] | no_license | VolunteerTime/VolunteerTime | https://github.com/VolunteerTime/VolunteerTime | 6cb086985dfa7b0bb283ed943834b1ad26535f1b | f5d41c9c37f595da479afe073148ac3674fa7cc4 | refs/heads/master | 2020-12-25T04:18:41.880000 | 2014-12-04T06:02:58 | 2014-12-04T06:02:58 | 22,062,701 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 华南农业大学信息学院蔡超敏2014版权所有
*
* 文件创建时间:2014-11-25
*/
package scau.info.volunteertime.activity.settings;
import scau.info.volunteertime.R;
import scau.info.volunteertime.activity.LoadActivity;
import scau.info.volunteertime.activity.login.Login;
import scau.info.volunteertime.activity.settings.SlideSwitch.OnSwitchChangedListener;
import scau.info.volunteertime.application.Ding9App;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import cn.trinea.android.common.service.impl.ImageCache;
import cn.trinea.android.common.util.ToastUtils;
/**
* @author 蔡超敏
*
*/
public class SettingsFragment extends Fragment {
private SlideSwitch pushSwitcher;
private Button cleanBufferBt;
private Button aboutBt;
private Button logoutBt;
private Button feedBackBt;
private Ding9App ding9App;
private Button resetPasswordBt;
// 设置信息推送
private Context mcontext;
// 独立sharePreference
private SharedPreferences sharedPreferences;
public SettingsFragment() {
mcontext = this.getActivity();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_settings, container,
false);
ding9App = (Ding9App) getActivity().getApplication();
pushSwitcher = (SlideSwitch) rootView.findViewById(R.id.push_switcher);
cleanBufferBt = (Button) rootView.findViewById(R.id.clean_buffer_bt);
aboutBt = (Button) rootView.findViewById(R.id.about_bt);
logoutBt = (Button) rootView.findViewById(R.id.logout_bt);
feedBackBt = (Button) rootView.findViewById(R.id.feed_back_bt);
resetPasswordBt = (Button) rootView
.findViewById(R.id.reset_password_bt);
mcontext = this.getActivity();
sharedPreferences = mcontext.getSharedPreferences(
LoadActivity.SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
resetPasswordBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent toAboutIntent = new Intent(getActivity(),
ResetPasswordActivity.class);
getActivity().startActivity(toAboutIntent);
}
});
cleanBufferBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ImageCache IMAGE_CACHE;// 图片缓存
Ding9App ding9App;// Application
ding9App = (Ding9App) getActivity().getApplicationContext();
IMAGE_CACHE = ding9App.IMAGE_CACHE;
IMAGE_CACHE.clear();
ToastUtils.show(getActivity(), "已清除缓存~");
}
});
pushSwitcher.setText("打开", "关闭");
int tempPushStatus = sharedPreferences.getInt("PUSH_STATUS",
SlideSwitch.SWITCH_ON);
if (tempPushStatus == SlideSwitch.SWITCH_ON) {
pushSwitcher.setStatus(true);
} else {
pushSwitcher.setStatus(false);
}
pushSwitcher.setOnSwitchChangedListener(new OnSwitchChangedListener() {
@Override
public void onSwitchChanged(SlideSwitch obj, int status) {
// TODO Auto-generated method stub
if (status == SlideSwitch.SWITCH_ON) {
ToastUtils.show(getActivity(), "打开");
// 独立sharePreference
sharedPreferences.edit()
.putInt("PUSH_STATUS", SlideSwitch.SWITCH_ON)
.commit();
// 设置信息推送打开
Intent intent = new Intent(mcontext, MessagesService.class);
mcontext.startService(intent);
} else {
ToastUtils.show(getActivity(), "关闭");
// 独立sharePreference
sharedPreferences.edit()
.putInt("PUSH_STATUS", SlideSwitch.SWITCH_OFF)
.commit();
;
// // 设置信息推送关闭
Intent intent = new Intent(mcontext, MessagesService.class);
mcontext.stopService(intent);
}
}
});
aboutBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent toAboutIntent = new Intent(getActivity(),
AboutActivity.class);
getActivity().startActivity(toAboutIntent);
}
});
feedBackBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent toFeedBackIntent = new Intent(getActivity(),
FeedBackActivity.class);
startActivity(toFeedBackIntent);
}
});
String userId = ding9App.getUserId();
if (userId == null || userId.equals("")) {
logoutBt.setVisibility(View.GONE);
} else {
logoutBt.setVisibility(View.VISIBLE);
logoutBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ding9App.setUserId("");
SharedPreferences sp = getActivity().getSharedPreferences(
LoadActivity.SHAREDPREFERENCES_NAME,
Context.MODE_PRIVATE);
sp.edit().putBoolean(LoadActivity.SHARE_ISCHECK, false)
.commit();
ToastUtils.show(getActivity(), "退出成功~");
// logoutBt.setVisibility(View.GONE);
Intent intent = new Intent(getActivity(), Login.class);
startActivity(intent);
getActivity().finish();
ding9App.getMainActivity().finish();
}
});
}
return rootView;
}
} | UTF-8 | Java | 5,563 | java | SettingsFragment.java | Java | [
{
"context": "/**\r\n * Copyright (c) 华南农业大学信息学院蔡超敏2014版权所有\r\n * \r\n * 文件创建时间:2014-11-25\r\n */\r\npackage ",
"end": 35,
"score": 0.9527850151062012,
"start": 32,
"tag": "NAME",
"value": "蔡超敏"
},
{
"context": "ndroid.common.util.ToastUtils;\r\n\r\n/**\r\n * @author 蔡超敏\r\n * \r\n *... | null | [] | /**
* Copyright (c) 华南农业大学信息学院蔡超敏2014版权所有
*
* 文件创建时间:2014-11-25
*/
package scau.info.volunteertime.activity.settings;
import scau.info.volunteertime.R;
import scau.info.volunteertime.activity.LoadActivity;
import scau.info.volunteertime.activity.login.Login;
import scau.info.volunteertime.activity.settings.SlideSwitch.OnSwitchChangedListener;
import scau.info.volunteertime.application.Ding9App;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import cn.trinea.android.common.service.impl.ImageCache;
import cn.trinea.android.common.util.ToastUtils;
/**
* @author 蔡超敏
*
*/
public class SettingsFragment extends Fragment {
private SlideSwitch pushSwitcher;
private Button cleanBufferBt;
private Button aboutBt;
private Button logoutBt;
private Button feedBackBt;
private Ding9App ding9App;
private Button resetPasswordBt;
// 设置信息推送
private Context mcontext;
// 独立sharePreference
private SharedPreferences sharedPreferences;
public SettingsFragment() {
mcontext = this.getActivity();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_settings, container,
false);
ding9App = (Ding9App) getActivity().getApplication();
pushSwitcher = (SlideSwitch) rootView.findViewById(R.id.push_switcher);
cleanBufferBt = (Button) rootView.findViewById(R.id.clean_buffer_bt);
aboutBt = (Button) rootView.findViewById(R.id.about_bt);
logoutBt = (Button) rootView.findViewById(R.id.logout_bt);
feedBackBt = (Button) rootView.findViewById(R.id.feed_back_bt);
resetPasswordBt = (Button) rootView
.findViewById(R.id.reset_password_bt);
mcontext = this.getActivity();
sharedPreferences = mcontext.getSharedPreferences(
LoadActivity.SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
resetPasswordBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent toAboutIntent = new Intent(getActivity(),
ResetPasswordActivity.class);
getActivity().startActivity(toAboutIntent);
}
});
cleanBufferBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ImageCache IMAGE_CACHE;// 图片缓存
Ding9App ding9App;// Application
ding9App = (Ding9App) getActivity().getApplicationContext();
IMAGE_CACHE = ding9App.IMAGE_CACHE;
IMAGE_CACHE.clear();
ToastUtils.show(getActivity(), "已清除缓存~");
}
});
pushSwitcher.setText("打开", "关闭");
int tempPushStatus = sharedPreferences.getInt("PUSH_STATUS",
SlideSwitch.SWITCH_ON);
if (tempPushStatus == SlideSwitch.SWITCH_ON) {
pushSwitcher.setStatus(true);
} else {
pushSwitcher.setStatus(false);
}
pushSwitcher.setOnSwitchChangedListener(new OnSwitchChangedListener() {
@Override
public void onSwitchChanged(SlideSwitch obj, int status) {
// TODO Auto-generated method stub
if (status == SlideSwitch.SWITCH_ON) {
ToastUtils.show(getActivity(), "打开");
// 独立sharePreference
sharedPreferences.edit()
.putInt("PUSH_STATUS", SlideSwitch.SWITCH_ON)
.commit();
// 设置信息推送打开
Intent intent = new Intent(mcontext, MessagesService.class);
mcontext.startService(intent);
} else {
ToastUtils.show(getActivity(), "关闭");
// 独立sharePreference
sharedPreferences.edit()
.putInt("PUSH_STATUS", SlideSwitch.SWITCH_OFF)
.commit();
;
// // 设置信息推送关闭
Intent intent = new Intent(mcontext, MessagesService.class);
mcontext.stopService(intent);
}
}
});
aboutBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent toAboutIntent = new Intent(getActivity(),
AboutActivity.class);
getActivity().startActivity(toAboutIntent);
}
});
feedBackBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent toFeedBackIntent = new Intent(getActivity(),
FeedBackActivity.class);
startActivity(toFeedBackIntent);
}
});
String userId = ding9App.getUserId();
if (userId == null || userId.equals("")) {
logoutBt.setVisibility(View.GONE);
} else {
logoutBt.setVisibility(View.VISIBLE);
logoutBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ding9App.setUserId("");
SharedPreferences sp = getActivity().getSharedPreferences(
LoadActivity.SHAREDPREFERENCES_NAME,
Context.MODE_PRIVATE);
sp.edit().putBoolean(LoadActivity.SHARE_ISCHECK, false)
.commit();
ToastUtils.show(getActivity(), "退出成功~");
// logoutBt.setVisibility(View.GONE);
Intent intent = new Intent(getActivity(), Login.class);
startActivity(intent);
getActivity().finish();
ding9App.getMainActivity().finish();
}
});
}
return rootView;
}
} | 5,563 | 0.699501 | 0.694696 | 178 | 28.410112 | 21.462151 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.960674 | false | false | 13 |
d5cb2058d9abdf5a04b9943d4f26c252c5efbaae | 3,169,685,883,347 | 736d52af62202656e6623ffe92528d1315f9980c | /batik/classes/org/apache/batik/ext/awt/image/GammaTransfer.java | 6a473b9151f1571e4440774d7571f13cf6f56024 | [
"Apache-2.0"
] | permissive | anthonycanino1/entbench-pi | https://github.com/anthonycanino1/entbench-pi | 1548ef975c7112881f053fd8930b3746d0fbf456 | 0fa0ae889aec3883138a547bdb8231e669c6eda1 | refs/heads/master | 2020-02-26T14:32:23.975000 | 2016-08-15T17:37:47 | 2016-08-15T17:37:47 | 65,744,715 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.apache.batik.ext.awt.image;
public class GammaTransfer implements org.apache.batik.ext.awt.image.TransferFunction {
public byte[] lutData;
public float amplitude;
public float exponent;
public float offset;
public GammaTransfer(float amplitude, float exponent, float offset) {
super(
);
this.
amplitude =
amplitude;
this.
exponent =
exponent;
this.
offset =
offset;
}
private void buildLutData() { lutData = (new byte[256]);
int j;
int v;
for (j = 0; j <= 255; j++) { v = (int) java.lang.Math.
round(
255 *
(amplitude *
java.lang.Math.
pow(
j /
255.0F,
exponent) +
offset));
if (v >
255) {
v =
(byte)
255;
}
else
if (v <
0) {
v =
(byte)
0;
}
lutData[j] =
(byte)
(v &
255);
} }
public byte[] getLookupTable() { buildLutData(
);
return lutData;
}
public static final java.lang.String jlc$CompilerVersion$jl7 =
"2.7.0";
public static final long jlc$SourceLastModified$jl7 =
1471109864000L;
public static final java.lang.String jlc$ClassType$jl7 =
("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" +
"EK/YvPlvYVGLz/wcAAA=");
public static final java.lang.String jlc$CompilerVersion$jl5 =
"2.7.0";
public static final long jlc$SourceLastModified$jl5 =
1471109864000L;
public static final java.lang.String jlc$ClassType$jl5 =
("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" +
"JwAA");
}
| UTF-8 | Java | 17,188 | java | GammaTransfer.java | Java | [
{
"context": "inal java.lang.String jlc$ClassType$jl7 =\n (\"H4sIAAAAAAAAAL1ZaYwcxRWumV3vvd7D1+Jjfa1Ba8wM96ElgHe9i5eM7ZXX\" +\n \"rJQ1MK7pqdltb093u7t6d9bEQJAinEixiDFXAv",
"end": 3231,
"score": 0.8868787884712219,
"start": 3171,
"tag": "KEY",
"value": "H4sIAAAAAAAAAL1ZaYwcxRWumV3vv... | null | [] | package org.apache.batik.ext.awt.image;
public class GammaTransfer implements org.apache.batik.ext.awt.image.TransferFunction {
public byte[] lutData;
public float amplitude;
public float exponent;
public float offset;
public GammaTransfer(float amplitude, float exponent, float offset) {
super(
);
this.
amplitude =
amplitude;
this.
exponent =
exponent;
this.
offset =
offset;
}
private void buildLutData() { lutData = (new byte[256]);
int j;
int v;
for (j = 0; j <= 255; j++) { v = (int) java.lang.Math.
round(
255 *
(amplitude *
java.lang.Math.
pow(
j /
255.0F,
exponent) +
offset));
if (v >
255) {
v =
(byte)
255;
}
else
if (v <
0) {
v =
(byte)
0;
}
lutData[j] =
(byte)
(v &
255);
} }
public byte[] getLookupTable() { buildLutData(
);
return lutData;
}
public static final java.lang.String jlc$CompilerVersion$jl7 =
"2.7.0";
public static final long jlc$SourceLastModified$jl7 =
1471109864000L;
public static final java.lang.String jlc$ClassType$jl7 =
("<KEY>" +
"<KEY>" +
"<KEY>Puawr<KEY>1673uvao5+SObZFulm" +
"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" +
"EK/YvPlvYVGLz/wcAAA=");
public static final java.lang.String jlc$CompilerVersion$jl5 =
"2.7.0";
public static final long jlc$SourceLastModified$jl5 =
1471109864000L;
public static final java.lang.String jlc$ClassType$jl5 =
("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" +
"JwAA");
}
| 17,051 | 0.69502 | 0.58151 | 258 | 65.620155 | 16.773546 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.112403 | false | false | 13 |
a2730ac7a5656f11486831867c4472ca13c2acd0 | 12,902,081,761,233 | a58bc818c322477fa4905f10ccf13aebe59d91be | /src/com/faruk/androidsamples/Activity1.java | bf214ad576a050d82be8e6dea97a359f31a527f0 | [] | no_license | faruktoptas/AndroidSamples | https://github.com/faruktoptas/AndroidSamples | 67fb085b569bfb25bd339db9334d76744958edba | 5dcd35adc70622fa6c34466d24fa42a3100d7a5e | refs/heads/master | 2016-08-07T14:11:19.184000 | 2013-06-04T14:22:23 | 2013-06-04T14:22:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.faruk.androidsamples;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Activity1 extends Activity{
TextView txt1;
Button btnSendBack;
EditText edit1;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_activity1);
TextView txt1 = (TextView)findViewById(R.id.textView1);
Button btnSendBack = (Button)findViewById(R.id.button1);
final EditText edit1 = (EditText)findViewById(R.id.editText1);
Intent i = getIntent();
String extra = i.getStringExtra("name");
txt1.setText(extra);
btnSendBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent();
String backString = edit1.getText().toString();
i.putExtra("data", backString);
setResult(100,i);
finish();
}
});
}
}
| UTF-8 | Java | 1,091 | java | Activity1.java | Java | [] | null | [] | package com.faruk.androidsamples;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Activity1 extends Activity{
TextView txt1;
Button btnSendBack;
EditText edit1;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_activity1);
TextView txt1 = (TextView)findViewById(R.id.textView1);
Button btnSendBack = (Button)findViewById(R.id.button1);
final EditText edit1 = (EditText)findViewById(R.id.editText1);
Intent i = getIntent();
String extra = i.getStringExtra("name");
txt1.setText(extra);
btnSendBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent();
String backString = edit1.getText().toString();
i.putExtra("data", backString);
setResult(100,i);
finish();
}
});
}
}
| 1,091 | 0.737855 | 0.724106 | 44 | 23.795454 | 18.596895 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.159091 | false | false | 13 |
240d57d6a3794f4a15b53ce5d3a1998f8b7abc5d | 23,648,089,971,058 | 83e0f6d519b032f41f6f52a2910bc9ac40164bc8 | /Krish_SE_Training_Microservices/006_config-consumer/src/main/java/com/sameera/lmscloud/configconsumer/model/MemberProfileConfiguration.java | 7dd7f4ad677e9819d04b2af37a24ffb4c2df83a5 | [] | no_license | sameera12345/Krish_SE_Training | https://github.com/sameera12345/Krish_SE_Training | a429b0a87bdeddc6d3db6566cdbf615a8a8e1c48 | 65b25153a2d451f01134aec4f4e6a19cf93d3796 | refs/heads/main | 2023-03-05T15:34:31.225000 | 2021-02-15T10:35:29 | 2021-02-15T10:35:29 | 338,751,308 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sameera.lmscloud.configconsumer.model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class MemberProfileConfiguration {
@Autowired
Environment environment;
public String getSubjectModel(){
return environment.getProperty("course.subject.model");
}
public String getMinNoOfSubjectsRole(){
return environment.getProperty("member.role.min");
}
}
| UTF-8 | Java | 532 | java | MemberProfileConfiguration.java | Java | [] | null | [] | package com.sameera.lmscloud.configconsumer.model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class MemberProfileConfiguration {
@Autowired
Environment environment;
public String getSubjectModel(){
return environment.getProperty("course.subject.model");
}
public String getMinNoOfSubjectsRole(){
return environment.getProperty("member.role.min");
}
}
| 532 | 0.768797 | 0.768797 | 20 | 25.6 | 23.595339 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 13 |
54dd236a1f6f195266d5cc45d3807a8127f1c31c | 22,634,477,698,448 | 0dd4e0f159307a34415e22873b1440fd1e946813 | /siu/siu-frontend/siu-portal/src/main/java/pt/devhub/siu/service/ServiceProcessor.java | d3afa88eab6244d3125f7ee89cc036dbbc179bcc | [] | no_license | antjori/amun | https://github.com/antjori/amun | bc6e3b34ee9bb297232db2e89834068126459f5f | b225684c4609ac2508c5b7c4fb8aa54d3ea3bb5e | refs/heads/master | 2021-05-01T10:31:35.608000 | 2020-10-13T09:41:08 | 2020-10-13T09:41:08 | 24,385,517 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pt.devhub.siu.service;
import pt.devhub.siu.common.response.IResponse;
/**
* The service processor interface, containing the signature of the method that
* allows the process of the requests.
*/
@FunctionalInterface
public interface ServiceProcessor {
public IResponse processRequest();
}
| UTF-8 | Java | 304 | java | ServiceProcessor.java | Java | [] | null | [] | package pt.devhub.siu.service;
import pt.devhub.siu.common.response.IResponse;
/**
* The service processor interface, containing the signature of the method that
* allows the process of the requests.
*/
@FunctionalInterface
public interface ServiceProcessor {
public IResponse processRequest();
}
| 304 | 0.782895 | 0.782895 | 13 | 22.384615 | 23.450565 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 13 |
c6a6bbd02aa014ab48de30082ccafb628cf5406a | 31,679,678,835,949 | c15930325da0a357dd453a47d481e6c3a387ecea | /src/main/java/ru/innopolis/stc16/innobazaar/service/UserService.java | 84fb6cc5ef082f896a9747770f90ef7d649e6d36 | [] | no_license | iskhakovaks/stc16 | https://github.com/iskhakovaks/stc16 | 0a530549d35710b0a19386a638f20e52c29dce56 | 8bb9d10d10d079a2e7f8a88a884bdc2495583b75 | refs/heads/master | 2020-06-12T11:00:12.015000 | 2019-08-13T18:20:31 | 2019-08-13T18:20:31 | 194,277,297 | 0 | 7 | null | false | 2020-01-21T22:07:28 | 2019-06-28T13:20:04 | 2019-08-13T18:20:53 | 2020-01-21T22:07:27 | 3,696 | 0 | 5 | 3 | Java | false | false | package ru.innopolis.stc16.innobazaar.service;
import ru.innopolis.stc16.innobazaar.entity.User;
import java.util.List;
public interface UserService {
public List<User> getAllUser();
public void saveUser(User user);
public User getUser(Long id);
public User getUserByUsername(String username);
public void deleteUser(Long id);
public User updateUserProfile(User user);
public User updateUserLinks(User user);
public User getAuthenticatedUser();
}
| UTF-8 | Java | 490 | java | UserService.java | Java | [] | null | [] | package ru.innopolis.stc16.innobazaar.service;
import ru.innopolis.stc16.innobazaar.entity.User;
import java.util.List;
public interface UserService {
public List<User> getAllUser();
public void saveUser(User user);
public User getUser(Long id);
public User getUserByUsername(String username);
public void deleteUser(Long id);
public User updateUserProfile(User user);
public User updateUserLinks(User user);
public User getAuthenticatedUser();
}
| 490 | 0.742857 | 0.734694 | 24 | 19.416666 | 20.161673 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false | 13 |
13ec797c3e80291075727f3937e24bcc68599942 | 5,334,349,443,481 | 668584d63f6ed8f48c8609c3a142f8bdf1ba1a40 | /prj/test/unit/coherence-tests/src/test/java/com/tangosol/internal/net/service/extend/proxy/CacheServiceProxyDependenciesTest.java | 183dd4b032d9f99dff63e0bf463af013d9ba18e1 | [
"EPL-1.0",
"Classpath-exception-2.0",
"LicenseRef-scancode-unicode",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-protobuf",
"CDDL-1.1",
"W3C",
"APSL-1.0",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain"... | permissive | oracle/coherence | https://github.com/oracle/coherence | 34c48d36674e69974a693925c18f097175052c5f | b1a009a406e37fdc5479366035d8c459165324e1 | refs/heads/main | 2023-08-31T14:53:40.437000 | 2023-08-31T02:04:15 | 2023-08-31T02:04:15 | 242,776,849 | 416 | 96 | UPL-1.0 | false | 2023-08-07T04:27:39 | 2020-02-24T15:51:04 | 2023-07-07T09:20:15 | 2023-08-07T04:10:10 | 8,736,774 | 396 | 73 | 7 | Java | false | false | /*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.internal.net.service.extend.proxy;
import com.tangosol.util.AssertionException;
import junit.framework.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.util.Random;
/**
* Unit tests for CacheServiceProxyDependenciesTest.
*
* @author pfm 2011.09.26
*/
public class CacheServiceProxyDependenciesTest
{
// ----- tests ----------------------------------------------------------
/**
* Test the setters and getters plus the clone.
*/
@Test
public void testAccessAndClone()
{
DefaultCacheServiceProxyDependencies deps1 = new DefaultCacheServiceProxyDependencies();
deps1.validate();
System.out.println(deps1.toString());
populate(deps1).validate();
System.out.println(deps1.toString());
DefaultCacheServiceProxyDependencies deps2 = new DefaultCacheServiceProxyDependencies(deps1);
assertCloneEquals(deps1, deps2);
deps2.validate();
}
/**
* Method description
*/
@Test
public void badTransferThreshold()
{
try
{
DefaultCacheServiceProxyDependencies dependencies = populate(new DefaultCacheServiceProxyDependencies());
dependencies.setTransferThreshold(-1);
dependencies.validate();
}
catch (IllegalArgumentException e)
{
return;
}
catch (AssertionException e)
{
return;
}
Assert.fail();
}
// ----- helpers --------------------------------------------------------
/**
* Assert that the two CacheServiceProxyDependencies are equal.
*
* @param deps1 the first CacheServiceProxyDependencies object
* @param deps2 the second CacheServiceProxyDependencies object
*/
public static void assertCloneEquals(CacheServiceProxyDependencies deps1, CacheServiceProxyDependencies deps2)
{
ServiceProxyDependenciesTest.assertCloneEquals(deps1, deps2);
assertEquals(deps1.isReadOnly(), deps2.isReadOnly());
assertEquals(deps1.isLockEnabled(), deps2.isLockEnabled());
assertEquals(deps1.getTransferThreshold(), deps2.getTransferThreshold());
}
/**
* Populate the dependencies and test the getters.
*
* @param deps the DefaultCacheServiceProxyDependencies to populate
*
* @return the DefaultCacheServiceProxyDependencies that was passed in
*/
public static DefaultCacheServiceProxyDependencies populate(DefaultCacheServiceProxyDependencies deps)
{
ServiceProxyDependenciesTest.populate(deps);
boolean flag = !deps.isReadOnly();
deps.setReadOnly(flag);
assertEquals(flag, deps.isReadOnly());
deps.setLockEnabled(flag = !deps.isLockEnabled());
assertEquals(flag, deps.isLockEnabled());
long n = new Random().nextInt(1000);
deps.setTransferThreshold(n);
assertEquals(n, deps.getTransferThreshold());
return deps;
}
}
| UTF-8 | Java | 3,290 | java | CacheServiceProxyDependenciesTest.java | Java | [
{
"context": "r CacheServiceProxyDependenciesTest.\n *\n * @author pfm 2011.09.26\n */\npublic class CacheServiceProxyDep",
"end": 482,
"score": 0.9996216297149658,
"start": 479,
"tag": "USERNAME",
"value": "pfm"
}
] | null | [] | /*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.internal.net.service.extend.proxy;
import com.tangosol.util.AssertionException;
import junit.framework.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.util.Random;
/**
* Unit tests for CacheServiceProxyDependenciesTest.
*
* @author pfm 2011.09.26
*/
public class CacheServiceProxyDependenciesTest
{
// ----- tests ----------------------------------------------------------
/**
* Test the setters and getters plus the clone.
*/
@Test
public void testAccessAndClone()
{
DefaultCacheServiceProxyDependencies deps1 = new DefaultCacheServiceProxyDependencies();
deps1.validate();
System.out.println(deps1.toString());
populate(deps1).validate();
System.out.println(deps1.toString());
DefaultCacheServiceProxyDependencies deps2 = new DefaultCacheServiceProxyDependencies(deps1);
assertCloneEquals(deps1, deps2);
deps2.validate();
}
/**
* Method description
*/
@Test
public void badTransferThreshold()
{
try
{
DefaultCacheServiceProxyDependencies dependencies = populate(new DefaultCacheServiceProxyDependencies());
dependencies.setTransferThreshold(-1);
dependencies.validate();
}
catch (IllegalArgumentException e)
{
return;
}
catch (AssertionException e)
{
return;
}
Assert.fail();
}
// ----- helpers --------------------------------------------------------
/**
* Assert that the two CacheServiceProxyDependencies are equal.
*
* @param deps1 the first CacheServiceProxyDependencies object
* @param deps2 the second CacheServiceProxyDependencies object
*/
public static void assertCloneEquals(CacheServiceProxyDependencies deps1, CacheServiceProxyDependencies deps2)
{
ServiceProxyDependenciesTest.assertCloneEquals(deps1, deps2);
assertEquals(deps1.isReadOnly(), deps2.isReadOnly());
assertEquals(deps1.isLockEnabled(), deps2.isLockEnabled());
assertEquals(deps1.getTransferThreshold(), deps2.getTransferThreshold());
}
/**
* Populate the dependencies and test the getters.
*
* @param deps the DefaultCacheServiceProxyDependencies to populate
*
* @return the DefaultCacheServiceProxyDependencies that was passed in
*/
public static DefaultCacheServiceProxyDependencies populate(DefaultCacheServiceProxyDependencies deps)
{
ServiceProxyDependenciesTest.populate(deps);
boolean flag = !deps.isReadOnly();
deps.setReadOnly(flag);
assertEquals(flag, deps.isReadOnly());
deps.setLockEnabled(flag = !deps.isLockEnabled());
assertEquals(flag, deps.isLockEnabled());
long n = new Random().nextInt(1000);
deps.setTransferThreshold(n);
assertEquals(n, deps.getTransferThreshold());
return deps;
}
}
| 3,290 | 0.631307 | 0.617629 | 116 | 27.362068 | 28.970079 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387931 | false | false | 13 |
eae4c3febc89a2aaa59dd1ba75659afe80ecf73d | 15,994,458,214,589 | 7272b4786bea580e0541de103ddf8ebbce27684f | /SHDD-Android/src/com/sparcedge/shdd/android/CordovaActivity.java | e06392fa16fa2a460407c0a5027a90aaccef3c8d | [] | no_license | dostraco/SuperHappyDevDay | https://github.com/dostraco/SuperHappyDevDay | f35a98f5de39dc82733a8f3c620f7817c996107c | 1b3d18a3ed26579c274fa1655d1a4183b2039c80 | refs/heads/master | 2016-09-05T12:46:29.288000 | 2012-09-06T21:39:10 | 2012-09-06T21:39:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sparcedge.shdd.android;
import android.os.Bundle;
import org.apache.cordova.DroidGap;
public class CordovaActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/jQueryMobileTemplate.html");
}
} | UTF-8 | Java | 346 | java | CordovaActivity.java | Java | [] | null | [] | package com.sparcedge.shdd.android;
import android.os.Bundle;
import org.apache.cordova.DroidGap;
public class CordovaActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/jQueryMobileTemplate.html");
}
} | 346 | 0.745665 | 0.745665 | 13 | 25.692308 | 23.994822 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 13 |
13dee374932e4b42100593dee8d62b62fa81b9f5 | 15,994,458,210,687 | 45dec48607f08a8079cec6c022d1adee98d2a4de | /space/bridge/src/com/bridge/Test.java | 53e33562b0f330dfd7acd895f1ae574bdcf8c24c | [] | no_license | SunJunya/Design_pattern | https://github.com/SunJunya/Design_pattern | b1ea54a67a5d68f2b656127a832a8cd15c335304 | fdb9e1403bfecbc8a03ef17922a4e2427e51d13c | refs/heads/master | 2022-10-08T17:38:49.244000 | 2020-06-10T16:16:04 | 2020-06-10T16:16:04 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bridge;
//定义邮局接口
interface IPost{
public void post();
}
//平信邮寄类
class SimplePost implements IPost{
public void post() {
System.out.println("this is simple post");
}
}
//挂号邮寄类
class MarkPost implements IPost{
@Override
public void post() {
System.out.println("this is mark post");
}
}
//抽象事物类
abstract class AbstractThing {
private IPost obj;
public AbstractThing(IPost obj){
this.obj=obj;
}
public void post(){
obj.post();
}
}
//具体事务类 Letter Parcel
class Letter extends AbstractThing{
public Letter(IPost obj) {
super(obj);
// TODO Auto-generated constructor stub
}
}
class Parcel extends AbstractThing{
public Parcel(IPost obj) {
super(obj);
// TODO Auto-generated constructor stub
}
}
public class Test {
public static void main(String[] args) {
IPost p=new SimplePost();
Letter letter=new Letter(p);
p.post();
}
}
| GB18030 | Java | 946 | java | Test.java | Java | [] | null | [] | package com.bridge;
//定义邮局接口
interface IPost{
public void post();
}
//平信邮寄类
class SimplePost implements IPost{
public void post() {
System.out.println("this is simple post");
}
}
//挂号邮寄类
class MarkPost implements IPost{
@Override
public void post() {
System.out.println("this is mark post");
}
}
//抽象事物类
abstract class AbstractThing {
private IPost obj;
public AbstractThing(IPost obj){
this.obj=obj;
}
public void post(){
obj.post();
}
}
//具体事务类 Letter Parcel
class Letter extends AbstractThing{
public Letter(IPost obj) {
super(obj);
// TODO Auto-generated constructor stub
}
}
class Parcel extends AbstractThing{
public Parcel(IPost obj) {
super(obj);
// TODO Auto-generated constructor stub
}
}
public class Test {
public static void main(String[] args) {
IPost p=new SimplePost();
Letter letter=new Letter(p);
p.post();
}
}
| 946 | 0.682327 | 0.682327 | 68 | 12.147058 | 13.871537 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.838235 | false | false | 13 |
eb2c2cb047440c2a1c5addeb2e2db1906132695d | 3,229,815,477,239 | 24f5f939258774359b70fb33b459742ecff45e54 | /src/main/java/upjs/sk/Prezencka/storage/SubjectResultSetExtractor.java | 2244e2333a25a77f8c1d5d9f218adb9ed76f6261 | [] | no_license | Olgittaa/paz_pezencka | https://github.com/Olgittaa/paz_pezencka | 77c6ae711dd5f1188ca46d91d75eb612dfa15f10 | ad511013ab21c385a4fab479ce3ac17fbbfc27c2 | refs/heads/master | 2022-08-23T09:23:55.140000 | 2019-11-05T10:32:04 | 2019-11-05T10:32:04 | 212,049,836 | 0 | 0 | null | false | 2022-06-21T02:05:15 | 2019-10-01T08:43:23 | 2019-11-05T10:32:26 | 2022-06-21T02:05:15 | 44 | 0 | 0 | 2 | Java | false | false | package upjs.sk.Prezencka.storage;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
public class SubjectResultSetExtractor implements ResultSetExtractor<List<Subject>> {
@Override
public List<Subject> extractData(ResultSet rs) throws SQLException, DataAccessException {
Subject s = null;
List<Subject> result = new ArrayList<Subject>();
while (rs.next()) {
long id = rs.getLong("id");
if (s == null || s.getId() != id) {
s = new Subject();
s.setId(id);
s.setName(rs.getString("name"));
result.add(s);
}
String studentName = rs.getString("student_name");
if (studentName != null) {
s.addStudent(studentName);
}
}
return result;
}
}
| UTF-8 | Java | 890 | java | SubjectResultSetExtractor.java | Java | [] | null | [] | package upjs.sk.Prezencka.storage;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
public class SubjectResultSetExtractor implements ResultSetExtractor<List<Subject>> {
@Override
public List<Subject> extractData(ResultSet rs) throws SQLException, DataAccessException {
Subject s = null;
List<Subject> result = new ArrayList<Subject>();
while (rs.next()) {
long id = rs.getLong("id");
if (s == null || s.getId() != id) {
s = new Subject();
s.setId(id);
s.setName(rs.getString("name"));
result.add(s);
}
String studentName = rs.getString("student_name");
if (studentName != null) {
s.addStudent(studentName);
}
}
return result;
}
}
| 890 | 0.679775 | 0.679775 | 34 | 24.17647 | 23.029993 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.088235 | false | false | 13 |
bdb38483c477d6d65971002c52d81519d9c9d712 | 20,435,454,402,393 | c43a842691f449d1cd4e80a8305a87c4733e9141 | /common/src/main/java/au/org/ala/delta/model/VariantItem.java | 502f8386a79f957bf09b17f7f263ee2f329bd345 | [] | no_license | AtlasOfLivingAustralia/open-delta | https://github.com/AtlasOfLivingAustralia/open-delta | 7588acd033a2c39bd4dfef44f2b57a4ebd4b5135 | 3188f6af29015efa1b4c1fde46c0ec3bf44da4cd | refs/heads/master | 2023-04-28T15:41:09.946000 | 2017-11-16T00:29:11 | 2017-11-16T00:29:11 | 50,964,310 | 13 | 10 | null | false | 2023-04-25T18:34:54 | 2016-02-03T01:16:10 | 2022-10-19T06:59:25 | 2023-04-25T18:34:54 | 32,278 | 11 | 11 | 71 | Java | false | false | /*******************************************************************************
* Copyright (C) 2011 Atlas of Living Australia
* All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
******************************************************************************/
package au.org.ala.delta.model;
import au.org.ala.delta.model.impl.ItemData;
/**
* A variant Item represents a variant of another Item.
* Any uncoded attributes of a variant Item are inherited from the Item's parent.
*
*/
public class VariantItem extends Item {
/** The Item to retrieve uncoded attributes from */
private Item _parent;
public VariantItem(Item parent, ItemData impl) {
super(impl);
_parent = parent;
}
/**
* @return true if the attribute for the supplied character is inherited from the parent Item.
*/
public boolean isInherited(Character character) {
Attribute attribute = doGetAttribute(character);
return ((attribute == null) || attribute.isInherited());
}
public boolean isVariant() {
return true;
}
public Attribute getParentAttribute(Character character) {
return _parent.doGetAttribute(character);
}
public Item getMasterItem() {
return _parent;
}
}
| UTF-8 | Java | 1,719 | java | VariantItem.java | Java | [] | null | [] | /*******************************************************************************
* Copyright (C) 2011 Atlas of Living Australia
* All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
******************************************************************************/
package au.org.ala.delta.model;
import au.org.ala.delta.model.impl.ItemData;
/**
* A variant Item represents a variant of another Item.
* Any uncoded attributes of a variant Item are inherited from the Item's parent.
*
*/
public class VariantItem extends Item {
/** The Item to retrieve uncoded attributes from */
private Item _parent;
public VariantItem(Item parent, ItemData impl) {
super(impl);
_parent = parent;
}
/**
* @return true if the attribute for the supplied character is inherited from the parent Item.
*/
public boolean isInherited(Character character) {
Attribute attribute = doGetAttribute(character);
return ((attribute == null) || attribute.isInherited());
}
public boolean isVariant() {
return true;
}
public Attribute getParentAttribute(Character character) {
return _parent.doGetAttribute(character);
}
public Item getMasterItem() {
return _parent;
}
}
| 1,719 | 0.629436 | 0.625945 | 57 | 28.157894 | 28.08745 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.701754 | false | false | 13 |
4495a781ca722d59551c321890a770dfebbb7785 | 9,749,575,819,366 | 815be69e2bc3b74c0d826cf21b6c7ffc1b65522d | /server/slcp/sql-server/src/main/java/com/zwp/slcp/sqlserver/mapper/MessageMapper.java | 963da655ff16d91d794563fa61296993ff2b43d1 | [] | no_license | simpleag/Student-Learning-Communication-Platform | https://github.com/simpleag/Student-Learning-Communication-Platform | 9119ea677c95528e3479f83b949414dcfe3dbbc6 | 9e5679e3c9b8f54fafb69a33972d8711ce144b6c | refs/heads/master | 2020-03-07T07:50:10.377000 | 2018-05-24T00:55:40 | 2018-05-24T00:55:40 | 127,360,006 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zwp.slcp.sqlserver.mapper;
import com.zwp.slcp.apicommon.entity.FullMessage;
import com.zwp.slcp.apicommon.entity.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MessageMapper {
int deleteByPrimaryKey(Long messageId);
int insert(Message record);
int insertSelective(Message record);
Message selectByPrimaryKey(Long messageId);
//用户收到的的私信
List<FullMessage> selectByReceiveUserId(@Param("messageAuthorId") Long messageAuthorId);
List<FullMessage> selectNewMessageByReceiveUserId(@Param("messageAuthorId") Long messageAuthorId);
//用户之间的私信
List<FullMessage> selectByUsersId(@Param("messageReceiveId") Long messageReceiveId, @Param("messageAuthorId") Long messageAuthorId);
int updateByPrimaryKeySelective(Message record);
int updateByPrimaryKey(Message record);
//根据接收者用户Id修改
int updateByReceiveUserId(Message record);
} | UTF-8 | Java | 1,073 | java | MessageMapper.java | Java | [] | null | [] | package com.zwp.slcp.sqlserver.mapper;
import com.zwp.slcp.apicommon.entity.FullMessage;
import com.zwp.slcp.apicommon.entity.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MessageMapper {
int deleteByPrimaryKey(Long messageId);
int insert(Message record);
int insertSelective(Message record);
Message selectByPrimaryKey(Long messageId);
//用户收到的的私信
List<FullMessage> selectByReceiveUserId(@Param("messageAuthorId") Long messageAuthorId);
List<FullMessage> selectNewMessageByReceiveUserId(@Param("messageAuthorId") Long messageAuthorId);
//用户之间的私信
List<FullMessage> selectByUsersId(@Param("messageReceiveId") Long messageReceiveId, @Param("messageAuthorId") Long messageAuthorId);
int updateByPrimaryKeySelective(Message record);
int updateByPrimaryKey(Message record);
//根据接收者用户Id修改
int updateByReceiveUserId(Message record);
} | 1,073 | 0.755122 | 0.755122 | 35 | 27.342857 | 32.227711 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.485714 | false | false | 13 |
eb07db7979000ff35a905a6977b4552344c479c2 | 11,768,210,452,129 | a01f7957b1cfd8ebd0ec294baa40edbe5ec3890e | /src/main/java/com/six/service/impl/ShopIndexServiceImpl.java | df11846b6a491e02dbc5ca57d15f4047cab26dfe | [] | no_license | yeyuqingcheng/SixShop | https://github.com/yeyuqingcheng/SixShop | e78130673403e98ecc83f9ea060e8f60d15f09db | bc1ff0c08cfd70a4aa8aa4df5c42875f55bbf2c3 | refs/heads/master | 2020-05-23T03:40:51.068000 | 2019-05-14T13:06:40 | 2019-05-14T13:06:40 | 183,168,316 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.six.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.six.dao.ShopIndexMapper;
import com.six.pojo.ShopBuyUser;
import com.six.pojo.ShopComment;
import com.six.pojo.ShopGoods;
import com.six.pojo.ShopGoodsCategory;
import com.six.pojo.ShopLike;
import com.six.pojo.ShopSellUser;
import com.six.service.ShopIndexService;
@Service
public class ShopIndexServiceImpl implements ShopIndexService {
@Autowired
private ShopIndexMapper shopIndexMapper;
//根据category_id查询shopGoodsCategory
@Override
public List<ShopGoodsCategory> selectShopGoodsCategoryByCategoryId(Integer category_id) {
List<ShopGoodsCategory> shopGoodsCategory2List = shopIndexMapper.selectShopGoodsCategoryByCategoryId(category_id);
if(shopGoodsCategory2List != null) {
return shopGoodsCategory2List;
}
else {
return null;
}
}
//根据name、category1_id、category1_id、category1_id、currentPageNo、pageSize分页模糊查询shopGoods
@Override
public List<ShopGoods> selectShopGoods(String name, Integer category1_id, Integer category2_id, Integer category3_id,
String orderName, String highOrLow, Integer currentPageNo, Integer pageSize) {
List<ShopGoods> shopGoodsList = shopIndexMapper.selectShopGoods(name, category1_id, category2_id, category3_id, orderName, highOrLow, currentPageNo, pageSize);
if(shopGoodsList != null) {
return shopGoodsList;
}
else {
return null;
}
}
//得到查询到的所有商品数
@Override
public List<ShopGoods> getShopGoodsCount(String name, Integer category1_id, Integer category2_id, Integer category3_id) {
List<ShopGoods> shopGoodsList = shopIndexMapper.getShopGoodsCount(name, category1_id, category2_id, category3_id);
if(shopGoodsList != null) {
return shopGoodsList;
}
else {
return null;
}
}
//根据id查询商品
@Override
public ShopGoods selectGoodsById(Integer id) {
ShopGoods shopGoods = shopIndexMapper.selectGoodsById(id);
if(shopGoods != null) {
return shopGoods;
}
else {
return null;
}
}
//根据id查询卖家
@Override
public ShopSellUser selectSellById(Integer id) {
ShopSellUser shopSellUser = shopIndexMapper.selectSellById(id);
if(shopSellUser != null) {
return shopSellUser;
}
else {
return null;
}
}
//根据id查询商品类型
@Override
public ShopGoodsCategory selectShopGoodsCategoryById(Integer id) {
ShopGoodsCategory shopGoodsCategory = shopIndexMapper.selectShopGoodsCategoryById(id);
if(shopGoodsCategory != null) {
return shopGoodsCategory;
}
else {
return null;
}
}
//根据goods_id查询shopComment
@Override
public List<ShopComment> selectShopCommentById(Integer goods_id) {
List<ShopComment> shopCommentsList = shopIndexMapper.selectShopCommentById(goods_id);
if(shopCommentsList != null) {
return shopCommentsList;
}
else {
return null;
}
}
//根据ShopComment中的buy_id查询shopBuyUser
@Override
public ShopBuyUser selectShopBuyUserByBuyId(Integer buy_id) {
ShopBuyUser shopBuyUser = shopIndexMapper.selectShopBuyUserByBuyId(buy_id);
if(shopBuyUser != null) {
return shopBuyUser;
}
else {
return null;
}
}
//根据buy_id和comment_id查询Like
@Override
public ShopLike selectShopLikeByBuyIdAndCommentId(Integer buy_id, Integer comment_id) {
ShopLike shopLike = shopIndexMapper.selectShopLikeByBuyIdAndCommentId(buy_id, comment_id);
if(shopLike != null) {
return shopLike;
}
else {
return null;
}
}
}
| UTF-8 | Java | 3,714 | java | ShopIndexServiceImpl.java | Java | [] | null | [] | package com.six.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.six.dao.ShopIndexMapper;
import com.six.pojo.ShopBuyUser;
import com.six.pojo.ShopComment;
import com.six.pojo.ShopGoods;
import com.six.pojo.ShopGoodsCategory;
import com.six.pojo.ShopLike;
import com.six.pojo.ShopSellUser;
import com.six.service.ShopIndexService;
@Service
public class ShopIndexServiceImpl implements ShopIndexService {
@Autowired
private ShopIndexMapper shopIndexMapper;
//根据category_id查询shopGoodsCategory
@Override
public List<ShopGoodsCategory> selectShopGoodsCategoryByCategoryId(Integer category_id) {
List<ShopGoodsCategory> shopGoodsCategory2List = shopIndexMapper.selectShopGoodsCategoryByCategoryId(category_id);
if(shopGoodsCategory2List != null) {
return shopGoodsCategory2List;
}
else {
return null;
}
}
//根据name、category1_id、category1_id、category1_id、currentPageNo、pageSize分页模糊查询shopGoods
@Override
public List<ShopGoods> selectShopGoods(String name, Integer category1_id, Integer category2_id, Integer category3_id,
String orderName, String highOrLow, Integer currentPageNo, Integer pageSize) {
List<ShopGoods> shopGoodsList = shopIndexMapper.selectShopGoods(name, category1_id, category2_id, category3_id, orderName, highOrLow, currentPageNo, pageSize);
if(shopGoodsList != null) {
return shopGoodsList;
}
else {
return null;
}
}
//得到查询到的所有商品数
@Override
public List<ShopGoods> getShopGoodsCount(String name, Integer category1_id, Integer category2_id, Integer category3_id) {
List<ShopGoods> shopGoodsList = shopIndexMapper.getShopGoodsCount(name, category1_id, category2_id, category3_id);
if(shopGoodsList != null) {
return shopGoodsList;
}
else {
return null;
}
}
//根据id查询商品
@Override
public ShopGoods selectGoodsById(Integer id) {
ShopGoods shopGoods = shopIndexMapper.selectGoodsById(id);
if(shopGoods != null) {
return shopGoods;
}
else {
return null;
}
}
//根据id查询卖家
@Override
public ShopSellUser selectSellById(Integer id) {
ShopSellUser shopSellUser = shopIndexMapper.selectSellById(id);
if(shopSellUser != null) {
return shopSellUser;
}
else {
return null;
}
}
//根据id查询商品类型
@Override
public ShopGoodsCategory selectShopGoodsCategoryById(Integer id) {
ShopGoodsCategory shopGoodsCategory = shopIndexMapper.selectShopGoodsCategoryById(id);
if(shopGoodsCategory != null) {
return shopGoodsCategory;
}
else {
return null;
}
}
//根据goods_id查询shopComment
@Override
public List<ShopComment> selectShopCommentById(Integer goods_id) {
List<ShopComment> shopCommentsList = shopIndexMapper.selectShopCommentById(goods_id);
if(shopCommentsList != null) {
return shopCommentsList;
}
else {
return null;
}
}
//根据ShopComment中的buy_id查询shopBuyUser
@Override
public ShopBuyUser selectShopBuyUserByBuyId(Integer buy_id) {
ShopBuyUser shopBuyUser = shopIndexMapper.selectShopBuyUserByBuyId(buy_id);
if(shopBuyUser != null) {
return shopBuyUser;
}
else {
return null;
}
}
//根据buy_id和comment_id查询Like
@Override
public ShopLike selectShopLikeByBuyIdAndCommentId(Integer buy_id, Integer comment_id) {
ShopLike shopLike = shopIndexMapper.selectShopLikeByBuyIdAndCommentId(buy_id, comment_id);
if(shopLike != null) {
return shopLike;
}
else {
return null;
}
}
}
| 3,714 | 0.736343 | 0.731327 | 133 | 24.977444 | 30.966988 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.87218 | false | false | 13 |
b7d6865087681f4f6fd5a037fd8552549026c0c8 | 28,535,762,761,844 | 36406fb880fae1e3d7726d2b34cab0806577f230 | /src/by/htp/account/entity/Customer.java | 0bf39cdcc1d7ff9918cf294ae87605b01ec159bc | [] | no_license | Kumishcha/Aggregation_and_composition | https://github.com/Kumishcha/Aggregation_and_composition | eee24b1b900bf5ae03ce1b12fdd91f14c4a0aeb1 | c29608543411c578b423583a30ca28429ae7240b | refs/heads/master | 2020-06-14T16:19:35.716000 | 2019-07-06T08:20:08 | 2019-07-06T08:20:08 | 195,054,015 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.htp.account.entity;
import java.util.List;
public class Customer {
private int id;
private String surname;
private String name;
private String middlename;
private List<BankAccount> accounts;
public Customer() {
}
public Customer(int id, String surname, String name, String middlename, List<BankAccount> accounts) {
this.id = id;
this.surname = surname;
this.name = name;
this.middlename = middlename;
this.accounts = accounts;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMiddlename() {
return middlename;
}
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
public List<BankAccount> getAccounts() {
return accounts;
}
public void setAccounts(List<BankAccount> accounts) {
this.accounts = accounts;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null)
return false;
if (getClass() != o.getClass())
return false;
Customer other = (Customer) o;
if (id != other.id)
return false;
if (surname == null) {
if (other.surname != null)
return false;
} else if (!surname.equals(other.surname))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (middlename == null) {
if (other.middlename != null)
return false;
} else if (!middlename.equals(other.middlename))
return false;
if (accounts == null) {
if (other.accounts != null)
return false;
} else if (!accounts.equals(other.accounts))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((surname == null) ? 0 : surname.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((middlename == null) ? 0 : middlename.hashCode());
result = prime * result + ((accounts == null) ? 0 : accounts.hashCode());
return result;
}
@Override
public String toString() {
return this.getClass().getSimpleName() +
" {id=" + id +
", surname='" + surname + '\'' +
", name='" + name + '\'' +
", middlename='" + middlename + '\'' +
", accounts=" + accounts +
'}';
}
}
| UTF-8 | Java | 3,134 | java | Customer.java | Java | [
{
"context": "'\" + surname + '\\'' +\n \", name='\" + name + '\\'' +\n \", middlename='\" + middl",
"end": 2997,
"score": 0.9603269100189209,
"start": 2993,
"tag": "NAME",
"value": "name"
},
{
"context": "+ name + '\\'' +\n \", middlename... | null | [] | package by.htp.account.entity;
import java.util.List;
public class Customer {
private int id;
private String surname;
private String name;
private String middlename;
private List<BankAccount> accounts;
public Customer() {
}
public Customer(int id, String surname, String name, String middlename, List<BankAccount> accounts) {
this.id = id;
this.surname = surname;
this.name = name;
this.middlename = middlename;
this.accounts = accounts;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMiddlename() {
return middlename;
}
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
public List<BankAccount> getAccounts() {
return accounts;
}
public void setAccounts(List<BankAccount> accounts) {
this.accounts = accounts;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null)
return false;
if (getClass() != o.getClass())
return false;
Customer other = (Customer) o;
if (id != other.id)
return false;
if (surname == null) {
if (other.surname != null)
return false;
} else if (!surname.equals(other.surname))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (middlename == null) {
if (other.middlename != null)
return false;
} else if (!middlename.equals(other.middlename))
return false;
if (accounts == null) {
if (other.accounts != null)
return false;
} else if (!accounts.equals(other.accounts))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((surname == null) ? 0 : surname.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((middlename == null) ? 0 : middlename.hashCode());
result = prime * result + ((accounts == null) ? 0 : accounts.hashCode());
return result;
}
@Override
public String toString() {
return this.getClass().getSimpleName() +
" {id=" + id +
", surname='" + surname + '\'' +
", name='" + name + '\'' +
", middlename='" + middlename + '\'' +
", accounts=" + accounts +
'}';
}
}
| 3,134 | 0.52074 | 0.518507 | 122 | 24.688524 | 19.912548 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434426 | false | false | 13 |
3dcc2cbf005d150eb359a1f853be92e7878715a6 | 17,248,588,705,182 | 48264d8ef3b81ba331a9da04ad5445674d04a84c | /src/main/java/br/gov/sp/fatec/lab5/service/ClienteService.java | 026caf2152acd592be7a690cc45d70a3b40f398b | [] | no_license | leticiaprudente/lab5-gitpod | https://github.com/leticiaprudente/lab5-gitpod | f1b2a0a7ec7bbfe1e2366d9fc38a3c74fcee74af | 40ee84ba3ce294a9874b520f97bb7a50f2353cb8 | refs/heads/master | 2023-01-03T03:59:17.187000 | 2020-10-29T03:05:19 | 2020-10-29T03:05:19 | 295,875,232 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.gov.sp.fatec.lab5.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import br.gov.sp.fatec.lab5.entity.Cliente;
import br.gov.sp.fatec.lab5.entity.ClientePF;
import br.gov.sp.fatec.lab5.exception.RegistroNaoEncontradoException;
import br.gov.sp.fatec.lab5.repository.ClienteRepository;
@Service //fica disponível para demais classes
public class ClienteService {
@Autowired
private ClienteRepository repository;
public Iterable<Cliente> findAll(){
return repository.findAll();
}
@PreAuthorize("hasRole('ROLE_ADMIN')")
public Cliente buscarUsuarioPorId(Long id){
Cliente cli = repository.findAById(id);
if(cli!= null){
return cli;
}throw new RegistroNaoEncontradoException("Id de usuário não encontrado");
//return repository.findById(id).orElse(null);
}
public void save(Cliente cliente){
repository.save(cliente);
}
public void delete(Long id) {
repository.deleteById(id);
}
public Cliente update(Cliente cliente) {
return repository.save(cliente);
}
@PreAuthorize("isAuthenticated()")
public Cliente buscarPorNome(String nome) {
Cliente cli = repository.findByNome(nome);
if(cli!= null){
return cli;
}throw new RegistroNaoEncontradoException("Nome não encontrado");
//return repository.findByNome(nome);
}
public static ClientePF cadastrarClientePF(String nome, String cpf, String endereco) {
return null;
}
} | UTF-8 | Java | 1,674 | java | ClienteService.java | Java | [] | null | [] | package br.gov.sp.fatec.lab5.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import br.gov.sp.fatec.lab5.entity.Cliente;
import br.gov.sp.fatec.lab5.entity.ClientePF;
import br.gov.sp.fatec.lab5.exception.RegistroNaoEncontradoException;
import br.gov.sp.fatec.lab5.repository.ClienteRepository;
@Service //fica disponível para demais classes
public class ClienteService {
@Autowired
private ClienteRepository repository;
public Iterable<Cliente> findAll(){
return repository.findAll();
}
@PreAuthorize("hasRole('ROLE_ADMIN')")
public Cliente buscarUsuarioPorId(Long id){
Cliente cli = repository.findAById(id);
if(cli!= null){
return cli;
}throw new RegistroNaoEncontradoException("Id de usuário não encontrado");
//return repository.findById(id).orElse(null);
}
public void save(Cliente cliente){
repository.save(cliente);
}
public void delete(Long id) {
repository.deleteById(id);
}
public Cliente update(Cliente cliente) {
return repository.save(cliente);
}
@PreAuthorize("isAuthenticated()")
public Cliente buscarPorNome(String nome) {
Cliente cli = repository.findByNome(nome);
if(cli!= null){
return cli;
}throw new RegistroNaoEncontradoException("Nome não encontrado");
//return repository.findByNome(nome);
}
public static ClientePF cadastrarClientePF(String nome, String cpf, String endereco) {
return null;
}
} | 1,674 | 0.7 | 0.697006 | 56 | 28.839285 | 24.323545 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 13 |
46bc3096ff059d646f2ddc8c86367ff5445c22df | 23,398,981,858,615 | e48c935475551ad57aa9794a11cb423b0a8f6c33 | /ggcloud-eventbus/ggcloud-eventbus-server/src/main/java/com/xzcode/ggcloud/eventbus/server/util/UuidUtil.java | f0fd1515c4682905e33481d9f4fcd1db3f0a572c | [] | no_license | xzcode/ggcloud | https://github.com/xzcode/ggcloud | 845eac12a7f2db6f6440b1b1faf3c6a2299989ac | 29ff95a659001fbdecf28d8f918af8dafb6f0e93 | refs/heads/master | 2023-06-09T02:11:01.283000 | 2020-04-17T03:12:41 | 2020-04-17T03:12:41 | 212,061,071 | 2 | 0 | null | false | 2023-05-26T22:16:38 | 2019-10-01T09:46:07 | 2021-01-20T09:31:32 | 2023-05-26T22:16:37 | 548 | 2 | 0 | 1 | Java | false | false | package com.xzcode.ggcloud.eventbus.server.util;
import java.util.UUID;
public class UuidUtil {
public static String newServiceId() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
}
| UTF-8 | Java | 205 | java | UuidUtil.java | Java | [] | null | [] | package com.xzcode.ggcloud.eventbus.server.util;
import java.util.UUID;
public class UuidUtil {
public static String newServiceId() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
}
| 205 | 0.712195 | 0.712195 | 11 | 17.636364 | 20.693752 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false | 13 |
8afae321614c4fc5b35daaa0fa2ced2e7d510437 | 23,398,981,859,878 | 15c5a41c39bf0afbf330a8d9d146db34b4e71c1b | /thumbing/record-server/src/main/java/com/thumbing/recordserver/handler/ChatDataHandler.java | 22a8593879822ffdfa1420a63dd2b787e1036559 | [] | no_license | wolisi12/thumbing | https://github.com/wolisi12/thumbing | 6f3266e6c36c8ef167f7d08f74b5481ae55a3413 | 0fe764b7fab52293c49cff95d4a562625e6a6b41 | refs/heads/master | 2023-03-21T20:30:57.768000 | 2020-12-05T03:01:10 | 2020-12-05T03:01:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thumbing.recordserver.handler;
import com.thumbing.recordserver.cache.ChatRecordCache;
import com.thumbing.recordserver.dto.output.ChatRecordDto;
import com.thumbing.recordserver.persistence.RecordPersistence;
import com.thumbing.recordserver.persistence.SessionPersistence;
import com.thumbing.shared.entity.mongo.record.ChatRecord;
import com.thumbing.shared.message.ChatDataMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* @Author: Stan Sai
* @Date: 2020/8/12 11:21
*/
@Component
public class ChatDataHandler {
@Autowired
private RecordPersistence recordPersistence;
@Autowired
private ChatRecordCache chatRecordCache;
@Autowired
private SessionPersistence sessionPersistence;
public void handleSession(ChatDataMsg msg) {
//todo:写入缓存
CompletableFuture completableFuture1 = CompletableFuture.runAsync(()->sessionPersistence.saveForFromUser(msg));
CompletableFuture completableFuture2 = CompletableFuture.runAsync(()->sessionPersistence.saveForToUser(msg));
CompletableFuture.allOf(completableFuture1,completableFuture2);
}
public void handleRecord(ChatDataMsg msg){
//todo:写入缓存
ChatRecordDto dto = new ChatRecordDto();
dto.setDataId(msg.getDataId());
dto.setContent(msg.getData());
dto.setFromId(msg.getFromUser());
dto.setToId(msg.getToUser());
dto.setTime(msg.getTime());
dto.setFromUserName(msg.getFromUserName());
dto.setToUserName(msg.getToUserName());
dto.setFromNickName(msg.getFromUserNickName());
dto.setToNickName(msg.getToUserNickName());
Long id1 = msg.getFromUser() < msg.getToUser() ? msg.getFromUser() : msg.getToUser();
Long id2 = id1.equals(msg.getFromUser()) ? msg.getToUser() : msg.getFromUser();
dto.setUserId1(id1);
dto.setUserId2(id2);
chatRecordCache.setRecord(dto);
//todo:写入mongo
ChatRecord record = new ChatRecord();
record.setDataId(msg.getDataId());
record.setContent(msg.getData());
record.setFromId(msg.getFromUser());
record.setToId(msg.getToUser());
record.setFromUserName(msg.getFromUserName());
record.setToUserName(msg.getToUserName());
record.setFromNickName(msg.getFromUserNickName());
record.setToNickName(msg.getToUserNickName());
record.setRead(false);
record.setCancel(false);
record.setCreateTime(msg.getTime());
record.setUserId1(id1);
record.setUserId2(id2);
recordPersistence.saveInDb(record);
}
}
| UTF-8 | Java | 2,735 | java | ChatDataHandler.java | Java | [
{
"context": "til.concurrent.CompletableFuture;\n\n/**\n * @Author: Stan Sai\n * @Date: 2020/8/12 11:21\n */\n@Component\npublic c",
"end": 580,
"score": 0.9998531341552734,
"start": 572,
"tag": "NAME",
"value": "Stan Sai"
}
] | null | [] | package com.thumbing.recordserver.handler;
import com.thumbing.recordserver.cache.ChatRecordCache;
import com.thumbing.recordserver.dto.output.ChatRecordDto;
import com.thumbing.recordserver.persistence.RecordPersistence;
import com.thumbing.recordserver.persistence.SessionPersistence;
import com.thumbing.shared.entity.mongo.record.ChatRecord;
import com.thumbing.shared.message.ChatDataMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* @Author: <NAME>
* @Date: 2020/8/12 11:21
*/
@Component
public class ChatDataHandler {
@Autowired
private RecordPersistence recordPersistence;
@Autowired
private ChatRecordCache chatRecordCache;
@Autowired
private SessionPersistence sessionPersistence;
public void handleSession(ChatDataMsg msg) {
//todo:写入缓存
CompletableFuture completableFuture1 = CompletableFuture.runAsync(()->sessionPersistence.saveForFromUser(msg));
CompletableFuture completableFuture2 = CompletableFuture.runAsync(()->sessionPersistence.saveForToUser(msg));
CompletableFuture.allOf(completableFuture1,completableFuture2);
}
public void handleRecord(ChatDataMsg msg){
//todo:写入缓存
ChatRecordDto dto = new ChatRecordDto();
dto.setDataId(msg.getDataId());
dto.setContent(msg.getData());
dto.setFromId(msg.getFromUser());
dto.setToId(msg.getToUser());
dto.setTime(msg.getTime());
dto.setFromUserName(msg.getFromUserName());
dto.setToUserName(msg.getToUserName());
dto.setFromNickName(msg.getFromUserNickName());
dto.setToNickName(msg.getToUserNickName());
Long id1 = msg.getFromUser() < msg.getToUser() ? msg.getFromUser() : msg.getToUser();
Long id2 = id1.equals(msg.getFromUser()) ? msg.getToUser() : msg.getFromUser();
dto.setUserId1(id1);
dto.setUserId2(id2);
chatRecordCache.setRecord(dto);
//todo:写入mongo
ChatRecord record = new ChatRecord();
record.setDataId(msg.getDataId());
record.setContent(msg.getData());
record.setFromId(msg.getFromUser());
record.setToId(msg.getToUser());
record.setFromUserName(msg.getFromUserName());
record.setToUserName(msg.getToUserName());
record.setFromNickName(msg.getFromUserNickName());
record.setToNickName(msg.getToUserNickName());
record.setRead(false);
record.setCancel(false);
record.setCreateTime(msg.getTime());
record.setUserId1(id1);
record.setUserId2(id2);
recordPersistence.saveInDb(record);
}
}
| 2,733 | 0.712339 | 0.702762 | 69 | 38.347828 | 25.294111 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.681159 | false | false | 13 |
7b5153f69f087b903b163bee46df697984def9e0 | 32,890,859,621,101 | e5351a5b783190e605ed2633968a9cd3ca21544f | /src/main/java/br/edu/ifba/paae/entidades/arquivo/Arquivo.java | 5a33ebb1237dc08fbbb95eb6149a33cc719445eb | [] | no_license | LeandroGamaCM/as | https://github.com/LeandroGamaCM/as | 55d33e91b063a8c484bc4a569cbc545b616f2872 | b9401d1c30ae56454e5d8ee24ede8f99057acabb | refs/heads/master | 2021-05-06T08:54:12.718000 | 2018-03-18T21:52:48 | 2018-03-18T21:52:48 | 114,021,577 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.edu.ifba.paae.entidades.arquivo;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "arquivo")
public class Arquivo implements Serializable {
private static final long serialVersionUID = 8243522996824697849L;
@Id
@GeneratedValue
private Integer id;
@Column(length = 1048576)
private byte[] contents;
private String nome;
// Getters e Setters
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public byte[] getContents() {
return contents;
}
public void setContents(byte[] contents) {
this.contents = contents;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + Objects.hashCode(this.id);
hash = 97 * hash + Arrays.hashCode(this.contents);
hash = 97 * hash + Objects.hashCode(this.nome);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Arquivo other = (Arquivo) obj;
if (!Objects.equals(this.nome, other.nome)) {
return false;
}
if (!Objects.equals(this.id, other.id)) {
return false;
}
if (!Arrays.equals(this.contents, other.contents)) {
return false;
}
return true;
}
}
| UTF-8 | Java | 1,978 | java | Arquivo.java | Java | [] | null | [] | package br.edu.ifba.paae.entidades.arquivo;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "arquivo")
public class Arquivo implements Serializable {
private static final long serialVersionUID = 8243522996824697849L;
@Id
@GeneratedValue
private Integer id;
@Column(length = 1048576)
private byte[] contents;
private String nome;
// Getters e Setters
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public byte[] getContents() {
return contents;
}
public void setContents(byte[] contents) {
this.contents = contents;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + Objects.hashCode(this.id);
hash = 97 * hash + Arrays.hashCode(this.contents);
hash = 97 * hash + Objects.hashCode(this.nome);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Arquivo other = (Arquivo) obj;
if (!Objects.equals(this.nome, other.nome)) {
return false;
}
if (!Objects.equals(this.id, other.id)) {
return false;
}
if (!Arrays.equals(this.contents, other.contents)) {
return false;
}
return true;
}
}
| 1,978 | 0.555612 | 0.538928 | 88 | 20.477272 | 17.141109 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.397727 | false | false | 13 |
201a4a592fe2545432fee6323db13cef058095b6 | 1,168,231,134,414 | de9ca05135ffbef0bb323bf2f2aab7f9bb171c16 | /identity-score-service/src/test/java/com/koc/finans/identity/score/service/service/IdentityScoreServiceTest.java | ba82ddf4f95ec93e3ea57ac5b91fe177404a581c | [] | no_license | zgnmgg/koc-finans-task | https://github.com/zgnmgg/koc-finans-task | 76c8aaa01c209a4ff9f83475202c793985a2dc55 | e89d8200c4494b46b921183dc83b906af9d6ce7e | refs/heads/main | 2023-03-21T14:55:49.906000 | 2021-02-28T21:49:21 | 2021-02-28T21:49:21 | 343,222,411 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.koc.finans.identity.score.service.service;
import com.koc.finans.identity.score.service.response.IdentityScoreResponse;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class IdentityScoreServiceTest {
@InjectMocks
private IdentityScoreService identityScoreService;
@Test
public void setScoreTest() {
IdentityScoreResponse response = identityScoreService.setScore();
Assertions.assertNotEquals(response.getScore(), 10);
}
} | UTF-8 | Java | 663 | java | IdentityScoreServiceTest.java | Java | [] | null | [] | package com.koc.finans.identity.score.service.service;
import com.koc.finans.identity.score.service.response.IdentityScoreResponse;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class IdentityScoreServiceTest {
@InjectMocks
private IdentityScoreService identityScoreService;
@Test
public void setScoreTest() {
IdentityScoreResponse response = identityScoreService.setScore();
Assertions.assertNotEquals(response.getScore(), 10);
}
} | 663 | 0.788839 | 0.785822 | 24 | 26.666666 | 25.125795 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false | 13 |
a63075f2f252e18678d2ac1cffd490c519844c2b | 3,770,981,350,150 | 75f9b38996e9fc9d7c63d3736c04418db8ca5e01 | /Server/src/main/java/com/borqs/server/market/sfs/FileStorageFactory.java | 9785a69f83f813147b0332fd041c920bd447d3e0 | [
"Apache-2.0"
] | permissive | wutongservice/virtualgoogdsman | https://github.com/wutongservice/virtualgoogdsman | f271ff6a9dc8296b9f595b2d9f3ed8d17c07800c | 30745aef93b2beda2f05f7f9171dc0b3ae5e31e5 | refs/heads/master | 2016-09-06T03:44:30.241000 | 2013-09-24T05:27:45 | 2013-09-24T05:27:45 | 13,052,614 | 0 | 2 | null | false | 2016-03-09T22:36:15 | 2013-09-24T02:23:44 | 2014-05-30T09:50:48 | 2016-03-09T22:36:15 | 1,764 | 0 | 2 | 1 | null | null | null | package com.borqs.server.market.sfs;
import com.borqs.server.market.deploy.DeploymentModeResolver;
public class FileStorageFactory {
public static FileStorage create(String localRoot, String ossAccessId, String ossAccessKey, String ossEndpoint, String ossBucket, String ossFileIdPrefix) {
String deployMode = DeploymentModeResolver.getDeploymentMode();
if ("release".equalsIgnoreCase(deployMode)) {
return new AliyunOssStorage(ossAccessId, ossAccessKey, ossEndpoint, ossBucket, ossFileIdPrefix);
} else {
return new LocalStorage(localRoot);
}
}
}
| UTF-8 | Java | 614 | java | FileStorageFactory.java | Java | [] | null | [] | package com.borqs.server.market.sfs;
import com.borqs.server.market.deploy.DeploymentModeResolver;
public class FileStorageFactory {
public static FileStorage create(String localRoot, String ossAccessId, String ossAccessKey, String ossEndpoint, String ossBucket, String ossFileIdPrefix) {
String deployMode = DeploymentModeResolver.getDeploymentMode();
if ("release".equalsIgnoreCase(deployMode)) {
return new AliyunOssStorage(ossAccessId, ossAccessKey, ossEndpoint, ossBucket, ossFileIdPrefix);
} else {
return new LocalStorage(localRoot);
}
}
}
| 614 | 0.736156 | 0.736156 | 15 | 39.933334 | 44.386887 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.933333 | false | false | 13 |
6288c0ec162427b91ecf268c1692671c20455b49 | 10,565,619,549,901 | 05cf4382a2a8ddb3a4f8c0cd792389fd1ddbd5eb | /spring_app14_jdbc/src/spring_app14_jdbc/TestMain.java | f66813415633fc0b56e96905691edc7318223123 | [] | no_license | lhy528/learnous | https://github.com/lhy528/learnous | 383460c546e598a87c25b63b695255ec0d50cc09 | feff16ed6b78717e772c3070aa7c6612790bbad1 | refs/heads/master | 2021-05-16T18:49:09.511000 | 2021-03-31T02:34:40 | 2021-03-31T02:34:40 | 250,425,437 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package spring_app14_jdbc;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class TestMain {
public static void main(String[] args) {
ApplicationContext context = new GenericXmlApplicationContext("app.xml");
DAO d = context.getBean("dao", DAO.class);
// 전체 데이터 조회
List<EmpDTO> list = d.sellectAll();
for(EmpDTO dto : list) {
System.out.println("사원번호"+dto.getEmpno()+" 사원이름"+dto.getEname()
+" sal"+dto.getSal()+" 부서번호"+dto.getDeptno());
}
}
}
| UTF-8 | Java | 644 | java | TestMain.java | Java | [] | null | [] | package spring_app14_jdbc;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class TestMain {
public static void main(String[] args) {
ApplicationContext context = new GenericXmlApplicationContext("app.xml");
DAO d = context.getBean("dao", DAO.class);
// 전체 데이터 조회
List<EmpDTO> list = d.sellectAll();
for(EmpDTO dto : list) {
System.out.println("사원번호"+dto.getEmpno()+" 사원이름"+dto.getEname()
+" sal"+dto.getSal()+" 부서번호"+dto.getDeptno());
}
}
}
| 644 | 0.688119 | 0.684819 | 22 | 25.545454 | 25.043104 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.636364 | false | false | 13 |
4c4d7b22970cef0413599237a28e60c533516187 | 4,054,449,181,180 | c84e94b807a0546b7eed7cb1bab92dede7355322 | /server/src/main/java/nl/tomvanzummeren/msnapi/messenger/service/LoginForm.java | f1c91aeb1366d35a6837d3d3863286e0b43b8f30 | [] | no_license | nikhilpatel1989/surf-and-chat | https://github.com/nikhilpatel1989/surf-and-chat | 5a40c8c90d2cba83b4de6a53962f537181479bb3 | bdbd9425328bfc50a831e1f30c13e9db13d5b357 | refs/heads/master | 2020-04-03T18:58:12.150000 | 2010-09-05T19:17:42 | 2010-09-05T19:17:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nl.tomvanzummeren.msnapi.messenger.service;
import static org.springframework.util.StringUtils.*;
/**
* @author Tom van Zummeren
*/
public class LoginForm {
private String email;
private String password;
private String displayName;
private String personalMessage;
public LoginForm() {
}
public boolean isValid() {
return hasText(email) && hasText(password);
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPersonalMessage() {
return personalMessage;
}
public void setPersonalMessage(String personalMessage) {
this.personalMessage = personalMessage;
}
}
| UTF-8 | Java | 1,078 | java | LoginForm.java | Java | [
{
"context": "pringframework.util.StringUtils.*;\n\n/**\n * @author Tom van Zummeren\n */\npublic class LoginForm {\n\n private String ",
"end": 139,
"score": 0.9998859763145447,
"start": 123,
"tag": "NAME",
"value": "Tom van Zummeren"
}
] | null | [] | package nl.tomvanzummeren.msnapi.messenger.service;
import static org.springframework.util.StringUtils.*;
/**
* @author <NAME>
*/
public class LoginForm {
private String email;
private String password;
private String displayName;
private String personalMessage;
public LoginForm() {
}
public boolean isValid() {
return hasText(email) && hasText(password);
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPersonalMessage() {
return personalMessage;
}
public void setPersonalMessage(String personalMessage) {
this.personalMessage = personalMessage;
}
}
| 1,068 | 0.648423 | 0.648423 | 56 | 18.25 | 18.499275 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.267857 | false | false | 13 |
1521a2f95678732a261863b384de1e2226d9a72f | 15,728,170,304,665 | 6746b714eac7087a9d4e3c77484434ff2ebfdae8 | /ourweb/src/team/adyn/dao/UsersDAO.java | 926816038e3f80ed3942ce1058d61374227c7276 | [] | no_license | xxialiang/111 | https://github.com/xxialiang/111 | 6a9810d1f763314f0b67d4dd3b6f8b87f69073ee | 2cd649a28fe3bb59bda00a97b83e462ae0f8b571 | refs/heads/master | 2022-07-06T21:54:15.822000 | 2020-03-28T02:43:56 | 2020-03-28T02:43:56 | 191,019,681 | 0 | 0 | null | false | 2022-06-21T02:58:12 | 2019-06-09T14:57:27 | 2020-03-28T02:43:59 | 2022-06-21T02:58:11 | 7,428 | 0 | 0 | 4 | JavaScript | false | false | package team.adyn.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import team.adyn.bean.Users;
public class UsersDAO {
public Users login(Connection con, Users user) throws Exception {
Users resultUser = null;
String sql = "select * from users where uname=? and password1=?";
PreparedStatement st = con.prepareStatement(sql);
st.setString(1, user.getUname());
st.setString(2, user.getPassword1());
ResultSet re = st.executeQuery();
if (re.next()) {
resultUser = new Users();
resultUser.setUname(re.getString("uname"));
resultUser.setPassword1(re.getString("password1"));
}
return resultUser;
}
public boolean register(Connection con, Users user) throws Exception {
boolean flag = false;
PreparedStatement st = null;
String sql = "insert into users(uname,password1,password2)values(?,?,?)";
st = con.prepareStatement(sql);
st.setString(1, user.getUname());
st.setString(2, user.getPassword1());
st.setString(3, user.getPassword2());
if (st.executeUpdate() > 0) {
flag = true;
}
return flag;
}
}
| UTF-8 | Java | 1,101 | java | UsersDAO.java | Java | [] | null | [] | package team.adyn.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import team.adyn.bean.Users;
public class UsersDAO {
public Users login(Connection con, Users user) throws Exception {
Users resultUser = null;
String sql = "select * from users where uname=? and password1=?";
PreparedStatement st = con.prepareStatement(sql);
st.setString(1, user.getUname());
st.setString(2, user.getPassword1());
ResultSet re = st.executeQuery();
if (re.next()) {
resultUser = new Users();
resultUser.setUname(re.getString("uname"));
resultUser.setPassword1(re.getString("password1"));
}
return resultUser;
}
public boolean register(Connection con, Users user) throws Exception {
boolean flag = false;
PreparedStatement st = null;
String sql = "insert into users(uname,password1,password2)values(?,?,?)";
st = con.prepareStatement(sql);
st.setString(1, user.getUname());
st.setString(2, user.getPassword1());
st.setString(3, user.getPassword2());
if (st.executeUpdate() > 0) {
flag = true;
}
return flag;
}
}
| 1,101 | 0.707539 | 0.694823 | 40 | 26.525 | 21.040422 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.225 | false | false | 13 |
214d426f220a75fee2d69eee5dc0442d9a240824 | 4,432,406,250,994 | b7df971a16c457ee26a34665a7dcf60a256a9ad9 | /src/masterModule/MstrMoModel.java | 88bb5fd7f09b2f31ecf3a162d6037fdac9bf0fb3 | [] | no_license | blueberryFields/Kapellmeister | https://github.com/blueberryFields/Kapellmeister | 88b85cbc49be71bea4ee8a4fe6f4c9693064e3e7 | b433c2971fda1ec36ca8709c7baa9171d1eeeb12 | refs/heads/master | 2021-06-28T03:38:36.892000 | 2019-04-12T07:06:31 | 2019-04-12T07:06:31 | 117,252,250 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package masterModule;
import javax.swing.JButton;
import arrangement.Scene;
import drumSequencer.DrumSequencerController;
import note.NoteGenerator;
import pattern.DrumPattern;
import pattern.StandardPattern;
import sequencerBase.SequencerControllerBase;
import sequencerBase.SoloMute;
import standardSequencer.StandardSequencerController;
/**
* The heart of the whole application, the core and most of the logic for the
* master module. This class contains all the sequencers and the arrangement
*/
public class MstrMoModel {
/**
* Contains up to 8 instances of sequencers
*/
private SequencerControllerBase[] sequencerArray = new SequencerControllerBase[8];
/**
* Contains the 8 available scenes in wich you can store information on which
* pattern to play in which scene
*/
private Scene[] scenes = new Scene[8];
/**
* Boolean that indicates if the program is running/playing
*/
private boolean running = false;
/**
* Clipboard for storing StandardPatterns you copy via the copy-functionality
*/
private StandardPattern standardClipBoard;
/**
* Clipboard for storing DrumPatterns you copy via the copy-functionality
*/
private DrumPattern drumClipBoard;
/**
* Constructor
*/
public MstrMoModel() {
for (int i = 0; i < scenes.length; i++) {
scenes[i] = new Scene("Scene " + (i + 1), i);
}
}
/**
* Checks the scenes for the next scene in turn that is set to active
*
* @param currentScene
* the scene currently playing
* @param loop
* is the song set to loop? In that case when there is no more active
* scenes following the currently playing this method will return the
* first one in the scenes array, else it will return -1 which
* indicates that the program shall stop playback
*
* @return the index of the next scene to be played or -1 which indicates that
* the program shall stop playback if there is no more scenes to be
* played
*/
public int getNextActiveScene(int currentScene, boolean loop) {
for (int i = currentScene + 1; i < scenes.length; i++) {
if (scenes[i].isActive()) {
return i;
}
}
if (loop) {
return getFirstActiveScene();
} else {
return -1;
}
}
/**
* Checks where in the scenes array the first active scene is, i.e. where to
* start playback. If there is no active scene -1 will be return
*
* @return index of the first active scene in order or -1 if theres in no one
*/
public int getFirstActiveScene() {
for (int i = 0; i < scenes.length; i++) {
if (scenes[i].isActive()) {
return i;
}
}
return -1;
}
/**
* Checks where in the scenes array the last active scene is
*
* @return index of the last active scene or -1 if there is no one
*/
public int getLastActiveScene() {
for (int i = scenes.length - 1; i >= 0; i--) {
if (scenes[i].isActive()) {
return i;
}
}
return -1;
}
/**
* When playing back this method is used to set which pattern each sequencer
* should play during the current scene
*
* @param currentScene
* index of the current playing scene
*/
public void setActivePatterns(int currentScene) {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i])
.choosePattern(scenes[currentScene].getPatternChoice(i));
}
}
}
/**
* This method is used to set the choice of pattern for a instrument in a given
* scene
*
* @param scene
* the scene to set the choice of pattern in
* @param sequencer
* the sequencer to choose pattern for
* @param patternChoice
* the choice of pattern for the given instrument in the given scene
*/
public void setPatternChoice(int scene, int sequencer, int patternChoice) {
scenes[scene].setPatternChoice(sequencer, patternChoice);
}
/**
* Creates a new instance of the standard sequencer in the sequencerArray.
*
* @param key
* the musical key from which to draw notes when generating patterns
* @param index
* which index in the sequencer array to put the new sequencer
* @param title
* a String containing the title of the new Sequencer
*/
public void createStandardSequencer(NoteGenerator key, int index, String title) {
sequencerArray[index] = new StandardSequencerController(key, title);
}
public void createDrumSequencer(int index, String title) {
sequencerArray[index] = new DrumSequencerController(title);
}
/**
* Creates a indivudal copy of the selected pattern and stores it in the
* clipboard
*
* @param index
* index of the pattern to be copied
*/
public void copyPattern(int index) {
if (sequencerArray[index] instanceof StandardSequencerController) {
standardClipBoard = ((StandardSequencerController) sequencerArray[index]).copyPattern();
}
if (sequencerArray[index] instanceof DrumSequencerController) {
drumClipBoard = ((DrumSequencerController) sequencerArray[index]).copyPattern();
}
}
/**
* replace the selected pattern with the pattern stored in the clipboard(if any)
*
* @param index
* index of the pattern to be replaced
*/
public void pastePattern(int index) {
if (standardClipBoard != null) {
if (sequencerArray[index] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[index]).pastePattern(standardClipBoard);
}
}
}
/**
* Tells all the sequencers in the sequencerArray to take one step forward in
* the tickgrid
*/
public void tick() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).tick();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).tick();
}
}
}
/**
* Sets all the sequencers in the sequencerArray in playMode
*/
public void start() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).playMode();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).playMode();
}
}
}
/**
* Sets all the sequencers in the sequencerArray in stopMode
*/
public void stop() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).stopMode();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).stopMode();
}
}
}
/**
* Changes key of the noteGEnerators in all of the sequencers in the
* sequencerArray
*
* @param key
* the new key to be passed to the sequencers
*/
public void changeKey(NoteGenerator key) {
for (int i = 0; i < sequencerArray.length; i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).setKey(key);
}
}
}
/**
* Checks the sequencerArray for the next free index
*
* @return the next free index in the sequencerArray
*/
public int nextIndex() {
int i = 0;
while (i < 8) {
if (sequencerArray[i] == null) {
break;
}
i++;
}
return i;
}
/**
* Checks the sequencerArray for the last used index
*
* @return the last index thats not null.
*/
public int lastUsedIndex() {
int index = -1;
for (int i = 0; i < sequencerArray.length; i++) {
if (sequencerArray[i] != null) {
index = i;
}
}
return index;
}
/**
* Removes the given sequencer from the sequencerArray and disposes all related
* Gui
*
* @param index
* index of the sequencer to be removed
*/
public void removeSequencer(int index) {
sequencerArray[index].disposeGui();
sequencerArray[index] = null;
orderSeqArr();
}
/**
* Goes through the sequencerArray and closes all eventual gaps
*/
public void orderSeqArr() {
for (int i = lastUsedIndex(); i > 0; i--) {
for (int j = lastUsedIndex(); j > 0; j--) {
if (sequencerArray[j] != null && sequencerArray[j - 1] == null) {
sequencerArray[j - 1] = sequencerArray[j];
sequencerArray[j] = null;
break;
}
}
}
}
/**
* shows the given sequencer gui if its not visible
*
* @param index
* index of the sequencer to show
*/
public void open(int index) {
sequencerArray[index].open();
}
/**
* If any sequencer is soloed this method will unsolo it and unmute the selected
* sequencer. If the selected sequencer is not muted and no sequencer is soloed
* the selected sequencer will be muted
*
* @param index
*/
public void mute(int index) {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i].getSoloMute() == SoloMute.SOLO) {
sequencerArray[i].unSoloMute();
}
}
sequencerArray[index].muteUnmute();
}
/**
* If the selected sequencer is not soloed this method will solo it and mute all
* the others. If already soloed it will be unsoloed
*
* @param index
*/
public void solo(int index) {
if (sequencerArray[index].getSoloMute() != SoloMute.SOLO) {
sequencerArray[index].solo();
for (int i = 0; i <= lastUsedIndex(); i++) {
if (i != index) {
sequencerArray[i].mute();
}
}
} else {
sequencerArray[index].solo();
for (int i = 0; i <= lastUsedIndex(); i++) {
if (i != index) {
sequencerArray[i].unSoloMute();
}
}
}
}
/**
* Renames the given sequencer
*
* @param title
* the new name of the sequencer
* @param index
* index of the sequencer to be renamed
*/
public void renameSequencer(String title, int index) {
sequencerArray[index].setTitle(title);
}
/**
* renames the given scene
*
* @param sceneNr
* index of the scene to be renamed
* @param newName
* the new name of the scene
*/
public void renameScene(int sceneNr, String newName) {
scenes[sceneNr].setName(newName);
}
/**
* Not really sure whats the intention with this method
*/
// public void killLastNote(int lastScene) {
// for (int i = 0; i <= lastUsedIndex(); i++) {
// sequencerArray[i].killLastNote(scenes[lastScene].getPatternChoice(i));
// }
// }
// The rest here is simple getters and setters
public Scene[] getScenes() {
return scenes;
}
public String[] getPatternNames(int index) {
return sequencerArray[index].getPatternNames();
}
public int getSceneLength(int sceneNr) {
return scenes[sceneNr].getLength();
}
public void setSceneLength(int scene, int length) {
scenes[scene].setLength(length);
}
public void setSceneActive(int scene, boolean active) {
scenes[scene].setActive(active);
}
public boolean isSceneActive(int scene) {
return scenes[scene].isActive();
}
public JButton getCopyButton(int index) {
return sequencerArray[index].getCopyButton();
}
public JButton getPasteButton(int index) {
return sequencerArray[index].getPasteButton();
}
public SoloMute getSoloMute(int index) {
return sequencerArray[index].getSoloMute();
}
public String getTitle(int index) {
return sequencerArray[index].getTitle();
}
public SequencerControllerBase[] getSeqArr() {
return sequencerArray;
}
public boolean isRunning() {
return running;
}
public void setRunning(boolean running) {
this.running = running;
}
}
| UTF-8 | Java | 11,629 | java | MstrMoModel.java | Java | [] | null | [] | package masterModule;
import javax.swing.JButton;
import arrangement.Scene;
import drumSequencer.DrumSequencerController;
import note.NoteGenerator;
import pattern.DrumPattern;
import pattern.StandardPattern;
import sequencerBase.SequencerControllerBase;
import sequencerBase.SoloMute;
import standardSequencer.StandardSequencerController;
/**
* The heart of the whole application, the core and most of the logic for the
* master module. This class contains all the sequencers and the arrangement
*/
public class MstrMoModel {
/**
* Contains up to 8 instances of sequencers
*/
private SequencerControllerBase[] sequencerArray = new SequencerControllerBase[8];
/**
* Contains the 8 available scenes in wich you can store information on which
* pattern to play in which scene
*/
private Scene[] scenes = new Scene[8];
/**
* Boolean that indicates if the program is running/playing
*/
private boolean running = false;
/**
* Clipboard for storing StandardPatterns you copy via the copy-functionality
*/
private StandardPattern standardClipBoard;
/**
* Clipboard for storing DrumPatterns you copy via the copy-functionality
*/
private DrumPattern drumClipBoard;
/**
* Constructor
*/
public MstrMoModel() {
for (int i = 0; i < scenes.length; i++) {
scenes[i] = new Scene("Scene " + (i + 1), i);
}
}
/**
* Checks the scenes for the next scene in turn that is set to active
*
* @param currentScene
* the scene currently playing
* @param loop
* is the song set to loop? In that case when there is no more active
* scenes following the currently playing this method will return the
* first one in the scenes array, else it will return -1 which
* indicates that the program shall stop playback
*
* @return the index of the next scene to be played or -1 which indicates that
* the program shall stop playback if there is no more scenes to be
* played
*/
public int getNextActiveScene(int currentScene, boolean loop) {
for (int i = currentScene + 1; i < scenes.length; i++) {
if (scenes[i].isActive()) {
return i;
}
}
if (loop) {
return getFirstActiveScene();
} else {
return -1;
}
}
/**
* Checks where in the scenes array the first active scene is, i.e. where to
* start playback. If there is no active scene -1 will be return
*
* @return index of the first active scene in order or -1 if theres in no one
*/
public int getFirstActiveScene() {
for (int i = 0; i < scenes.length; i++) {
if (scenes[i].isActive()) {
return i;
}
}
return -1;
}
/**
* Checks where in the scenes array the last active scene is
*
* @return index of the last active scene or -1 if there is no one
*/
public int getLastActiveScene() {
for (int i = scenes.length - 1; i >= 0; i--) {
if (scenes[i].isActive()) {
return i;
}
}
return -1;
}
/**
* When playing back this method is used to set which pattern each sequencer
* should play during the current scene
*
* @param currentScene
* index of the current playing scene
*/
public void setActivePatterns(int currentScene) {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i])
.choosePattern(scenes[currentScene].getPatternChoice(i));
}
}
}
/**
* This method is used to set the choice of pattern for a instrument in a given
* scene
*
* @param scene
* the scene to set the choice of pattern in
* @param sequencer
* the sequencer to choose pattern for
* @param patternChoice
* the choice of pattern for the given instrument in the given scene
*/
public void setPatternChoice(int scene, int sequencer, int patternChoice) {
scenes[scene].setPatternChoice(sequencer, patternChoice);
}
/**
* Creates a new instance of the standard sequencer in the sequencerArray.
*
* @param key
* the musical key from which to draw notes when generating patterns
* @param index
* which index in the sequencer array to put the new sequencer
* @param title
* a String containing the title of the new Sequencer
*/
public void createStandardSequencer(NoteGenerator key, int index, String title) {
sequencerArray[index] = new StandardSequencerController(key, title);
}
public void createDrumSequencer(int index, String title) {
sequencerArray[index] = new DrumSequencerController(title);
}
/**
* Creates a indivudal copy of the selected pattern and stores it in the
* clipboard
*
* @param index
* index of the pattern to be copied
*/
public void copyPattern(int index) {
if (sequencerArray[index] instanceof StandardSequencerController) {
standardClipBoard = ((StandardSequencerController) sequencerArray[index]).copyPattern();
}
if (sequencerArray[index] instanceof DrumSequencerController) {
drumClipBoard = ((DrumSequencerController) sequencerArray[index]).copyPattern();
}
}
/**
* replace the selected pattern with the pattern stored in the clipboard(if any)
*
* @param index
* index of the pattern to be replaced
*/
public void pastePattern(int index) {
if (standardClipBoard != null) {
if (sequencerArray[index] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[index]).pastePattern(standardClipBoard);
}
}
}
/**
* Tells all the sequencers in the sequencerArray to take one step forward in
* the tickgrid
*/
public void tick() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).tick();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).tick();
}
}
}
/**
* Sets all the sequencers in the sequencerArray in playMode
*/
public void start() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).playMode();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).playMode();
}
}
}
/**
* Sets all the sequencers in the sequencerArray in stopMode
*/
public void stop() {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).stopMode();
}
if (sequencerArray[i] instanceof DrumSequencerController) {
((DrumSequencerController) sequencerArray[i]).stopMode();
}
}
}
/**
* Changes key of the noteGEnerators in all of the sequencers in the
* sequencerArray
*
* @param key
* the new key to be passed to the sequencers
*/
public void changeKey(NoteGenerator key) {
for (int i = 0; i < sequencerArray.length; i++) {
if (sequencerArray[i] instanceof StandardSequencerController) {
((StandardSequencerController) sequencerArray[i]).setKey(key);
}
}
}
/**
* Checks the sequencerArray for the next free index
*
* @return the next free index in the sequencerArray
*/
public int nextIndex() {
int i = 0;
while (i < 8) {
if (sequencerArray[i] == null) {
break;
}
i++;
}
return i;
}
/**
* Checks the sequencerArray for the last used index
*
* @return the last index thats not null.
*/
public int lastUsedIndex() {
int index = -1;
for (int i = 0; i < sequencerArray.length; i++) {
if (sequencerArray[i] != null) {
index = i;
}
}
return index;
}
/**
* Removes the given sequencer from the sequencerArray and disposes all related
* Gui
*
* @param index
* index of the sequencer to be removed
*/
public void removeSequencer(int index) {
sequencerArray[index].disposeGui();
sequencerArray[index] = null;
orderSeqArr();
}
/**
* Goes through the sequencerArray and closes all eventual gaps
*/
public void orderSeqArr() {
for (int i = lastUsedIndex(); i > 0; i--) {
for (int j = lastUsedIndex(); j > 0; j--) {
if (sequencerArray[j] != null && sequencerArray[j - 1] == null) {
sequencerArray[j - 1] = sequencerArray[j];
sequencerArray[j] = null;
break;
}
}
}
}
/**
* shows the given sequencer gui if its not visible
*
* @param index
* index of the sequencer to show
*/
public void open(int index) {
sequencerArray[index].open();
}
/**
* If any sequencer is soloed this method will unsolo it and unmute the selected
* sequencer. If the selected sequencer is not muted and no sequencer is soloed
* the selected sequencer will be muted
*
* @param index
*/
public void mute(int index) {
for (int i = 0; i <= lastUsedIndex(); i++) {
if (sequencerArray[i].getSoloMute() == SoloMute.SOLO) {
sequencerArray[i].unSoloMute();
}
}
sequencerArray[index].muteUnmute();
}
/**
* If the selected sequencer is not soloed this method will solo it and mute all
* the others. If already soloed it will be unsoloed
*
* @param index
*/
public void solo(int index) {
if (sequencerArray[index].getSoloMute() != SoloMute.SOLO) {
sequencerArray[index].solo();
for (int i = 0; i <= lastUsedIndex(); i++) {
if (i != index) {
sequencerArray[i].mute();
}
}
} else {
sequencerArray[index].solo();
for (int i = 0; i <= lastUsedIndex(); i++) {
if (i != index) {
sequencerArray[i].unSoloMute();
}
}
}
}
/**
* Renames the given sequencer
*
* @param title
* the new name of the sequencer
* @param index
* index of the sequencer to be renamed
*/
public void renameSequencer(String title, int index) {
sequencerArray[index].setTitle(title);
}
/**
* renames the given scene
*
* @param sceneNr
* index of the scene to be renamed
* @param newName
* the new name of the scene
*/
public void renameScene(int sceneNr, String newName) {
scenes[sceneNr].setName(newName);
}
/**
* Not really sure whats the intention with this method
*/
// public void killLastNote(int lastScene) {
// for (int i = 0; i <= lastUsedIndex(); i++) {
// sequencerArray[i].killLastNote(scenes[lastScene].getPatternChoice(i));
// }
// }
// The rest here is simple getters and setters
public Scene[] getScenes() {
return scenes;
}
public String[] getPatternNames(int index) {
return sequencerArray[index].getPatternNames();
}
public int getSceneLength(int sceneNr) {
return scenes[sceneNr].getLength();
}
public void setSceneLength(int scene, int length) {
scenes[scene].setLength(length);
}
public void setSceneActive(int scene, boolean active) {
scenes[scene].setActive(active);
}
public boolean isSceneActive(int scene) {
return scenes[scene].isActive();
}
public JButton getCopyButton(int index) {
return sequencerArray[index].getCopyButton();
}
public JButton getPasteButton(int index) {
return sequencerArray[index].getPasteButton();
}
public SoloMute getSoloMute(int index) {
return sequencerArray[index].getSoloMute();
}
public String getTitle(int index) {
return sequencerArray[index].getTitle();
}
public SequencerControllerBase[] getSeqArr() {
return sequencerArray;
}
public boolean isRunning() {
return running;
}
public void setRunning(boolean running) {
this.running = running;
}
}
| 11,629 | 0.668673 | 0.665663 | 442 | 25.309956 | 25.847383 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.687783 | false | false | 13 |
615b21b9e15d33556b8b897b343dd3b13f829134 | 24,498,493,472,267 | 47c281458a14c58ad07f64b63861780fc95e0c62 | /modules/selenium/src/main/java/com/goate/selenium/staff/ChromeWebDriver.java | 308b13f7207471075aff15da331f3018acdbae7b | [
"MIT"
] | permissive | brian30040/GoaTE | https://github.com/brian30040/GoaTE | d267e5290d0f913bad38dff18cd5a3b42d5e7529 | 3deab75525075df523938ef5672d08beb6e332a7 | refs/heads/master | 2021-12-03T14:23:02.248000 | 2021-08-26T02:24:07 | 2021-08-26T02:24:07 | 172,131,737 | 0 | 0 | null | true | 2021-08-20T21:50:37 | 2019-02-22T20:42:13 | 2021-08-20T18:16:40 | 2021-08-20T21:50:35 | 70,880 | 0 | 0 | 0 | Java | false | false | package com.goate.selenium.staff;
import com.goate.selenium.annotations.Driver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* Returns a new chrome web driver.
* Created by Eric Angeli on 6/28/2017.
*/
@Driver(type = "chrome")
public class ChromeWebDriver extends GoateDriver {
@Override
protected DesiredCapabilities loadCapabilities() {
return DesiredCapabilities.chrome();
}
@Override
public WebDriver build() {
return new ChromeDriver(dc);
}
}
| UTF-8 | Java | 595 | java | ChromeWebDriver.java | Java | [
{
"context": "\n * Returns a new chrome web driver.\n * Created by Eric Angeli on 6/28/2017.\n */\n@Driver(type = \"chrome\")\npublic",
"end": 288,
"score": 0.9997966885566711,
"start": 277,
"tag": "NAME",
"value": "Eric Angeli"
}
] | null | [] | package com.goate.selenium.staff;
import com.goate.selenium.annotations.Driver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* Returns a new chrome web driver.
* Created by <NAME> on 6/28/2017.
*/
@Driver(type = "chrome")
public class ChromeWebDriver extends GoateDriver {
@Override
protected DesiredCapabilities loadCapabilities() {
return DesiredCapabilities.chrome();
}
@Override
public WebDriver build() {
return new ChromeDriver(dc);
}
}
| 590 | 0.732773 | 0.721008 | 24 | 23.791666 | 19.684975 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.291667 | false | false | 13 |
eeb3a7cecca8dee24b0a561caba8ffa6e49c06ff | 25,847,113,198,041 | d9857b123d5f9be51b9e3db8848cf4e905ae2a9b | /src/main/java/com/angrysamaritan/webtestsystem/exceptions/BadSignUpRequest.java | 7a4e21daee98eb02c0e44d53b6ed59791996f898 | [] | no_license | AngrySamaritan/webTestSystem | https://github.com/AngrySamaritan/webTestSystem | 5217667c041e689c511d60cb3cfdb3ff96d8c41b | b829c387a5eca2ce87fb7429054b4fe39ea18d0a | refs/heads/master | 2020-12-22T15:38:50.413000 | 2020-11-21T12:14:58 | 2020-11-21T12:14:58 | 236,838,237 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.angrysamaritan.webtestsystem.exceptions;
import org.springframework.validation.Errors;
public class BadSignUpRequest extends BadRequestException {
public BadSignUpRequest(Errors errors) {
super("Bad sign up request", errors);
}
}
| UTF-8 | Java | 260 | java | BadSignUpRequest.java | Java | [] | null | [] | package com.angrysamaritan.webtestsystem.exceptions;
import org.springframework.validation.Errors;
public class BadSignUpRequest extends BadRequestException {
public BadSignUpRequest(Errors errors) {
super("Bad sign up request", errors);
}
}
| 260 | 0.773077 | 0.773077 | 9 | 27.888889 | 24.029818 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 13 |
d72760fbd7bc33352ef04ad996f96f0c29b29247 | 4,105,988,742,695 | 447e12e9e07c8cd573d02bbd128fc05c8a6c1d46 | /Preferencias_Aplica_Bici/app/src/main/java/com/example/adrlop/preferencias_aplica_bici/PantallaOpciones.java | 746ca7d8fddd7b99edeb76bf3af6a0eb20f0fbd4 | [] | no_license | Admarlo/PMM | https://github.com/Admarlo/PMM | 4fb4f8b35a4c720774157b7fd156e29a4ea00a6b | 44ee38db52703c530de543ef73465037f70bbe58 | refs/heads/master | 2021-09-06T18:11:45.725000 | 2018-02-09T14:05:57 | 2018-02-09T14:05:57 | 108,096,191 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.adrlop.preferencias_aplica_bici;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PantallaOpciones extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
android.app.FragmentTransaction ft =getFragmentManager().beginTransaction();
ft.add(android.R.id.content,new SettingsFragment());
ft.commit();
}
}
| UTF-8 | Java | 570 | java | PantallaOpciones.java | Java | [] | null | [] | package com.example.adrlop.preferencias_aplica_bici;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PantallaOpciones extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
android.app.FragmentTransaction ft =getFragmentManager().beginTransaction();
ft.add(android.R.id.content,new SettingsFragment());
ft.commit();
}
}
| 570 | 0.761404 | 0.75614 | 17 | 32.529411 | 25.61047 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 13 |
3526b80921f0185119238e6dcb1a22b901ebc65a | 14,053,132,999,598 | 4fe73112332fa854b1ada078297376371f6eb5dd | /ceri-home/src/main/java/ceri/home/io/pcirlinc/PcIrLinc.java | a495fee39fe5cca7a770b4e2e2e41de462e85032 | [] | no_license | shineit/ceri | https://github.com/shineit/ceri | 3e777f0be9929467610503f62f5e037ce2ca4256 | 5399209f8b66fc578e896a418c0293856b58c114 | refs/heads/master | 2021-01-17T09:55:20.464000 | 2014-06-27T07:49:09 | 2014-06-27T07:49:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ceri.home.io.pcirlinc;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.NoSuchPortException;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class PcIrLinc implements Closeable {
private static final Logger logger = LogManager.getLogger();
private static final int BASE16 = 16;
private static final int RESPONSE_DATA_OFFSET = 5;
private static final byte[] EMPTY_RESPONSE = new byte[0];
private static final int PRESET_CMD_LEN = 6;
private static final int LEARN_CMD_EXTRA_LEN = 9;
private static final int READ_BUFFER_SIZE = 1024;
private static final byte[] LEARN_CMD = { 0x03, 0x12, 0x00, 0x00 };
private final SerialPort serialPort;
private final PcIrLincProperties properties;
public PcIrLinc(PcIrLincProperties properties) throws IOException {
this.properties = properties;
serialPort = openPort(properties.serialPort(), properties.baud(), properties.timeoutMs());
}
@Override
public void close() {
serialPort.close();
}
public static byte[] hexToBytes(String hex) {
byte[] data = new byte[hex.length() / 2];
for (int i = 0; i < data.length; i++)
data[i] = (byte) Integer.parseInt(hex.substring(i * 2, (i * 2) + 2), BASE16);
return data;
}
public static String bytesToHex(byte[] bytes) {
StringBuilder buffer = new StringBuilder(bytes.length * 2);
for (byte b : bytes) {
String s = Integer.toHexString(b);
if (s.length() < 2) buffer.append('0');
buffer.append(s);
}
return buffer.toString();
}
public void sendPreset(PcIrLincType type, short vendor, PcIrLincButton button)
throws IOException, InterruptedException {
logger.debug("Sending: {}, {}, {}", type, vendor, button);
int i = 0;
byte[] presetCmd = new byte[PRESET_CMD_LEN];
presetCmd[i++] = (byte) (presetCmd.length - 1);
presetCmd[i++] = 1;
presetCmd[i++] = (byte) ((type.id << 4) | (vendor >> 8));
presetCmd[i++] = (byte) (vendor & 0xff);
presetCmd[i++] = (byte) (button.id & 0xff);
presetCmd[i++] = 0;
serialPort.setRTS(true);
Thread.sleep(properties.delayMs());
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(presetCmd);
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response =
getResponse(serialPort.getInputStream(), properties.delayMs(), properties
.responseWaitMs());
verifyResponseCode(response);
}
public byte[] learnIr(int waitMs) throws IOException, InterruptedException {
serialPort.setRTS(true);
Thread.sleep(properties.delayMs());
logger.debug("Tx: {}", bytesToHex(LEARN_CMD));
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(LEARN_CMD);
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response = getResponse(serialPort.getInputStream(), properties.delayMs(), waitMs);
return getResponseData(response);
}
public void sendLearnedIr(byte[] code, int count) throws IOException, InterruptedException {
int i = 0;
byte[] buffer = new byte[code.length + LEARN_CMD_EXTRA_LEN];
buffer[i++] = (byte) (code.length + LEARN_CMD_EXTRA_LEN - 1);
buffer[i++] = 0x10;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = 0x10;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = (byte) code.length;
System.arraycopy(code, 0, buffer, i, code.length);
i += code.length;
buffer[i++] = 0;
serialPort.setRTS(true);
for (i = 0; i < count; i++) {
Thread.sleep(properties.delayMs());
logger.debug("Tx: {}", bytesToHex(buffer));
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(buffer);
}
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response =
getResponse(serialPort.getInputStream(), properties.delayMs(), properties
.responseWaitMs());
verifyResponseCode(response);
}
private SerialPort openPort(String port, int baud, int timeoutMs) throws IOException {
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(port);
CommPort commPort = portIdentifier.open(getClass().getName(), timeoutMs);
if (!(commPort instanceof SerialPort)) throw new IllegalArgumentException(port +
" is not a serial port");
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.getOutputStream().flush();
int available = serialPort.getInputStream().available();
serialPort.getInputStream().skip(available);
return serialPort;
} catch (NoSuchPortException e) {
throw new IOException(e);
} catch (PortInUseException e) {
throw new IOException(e);
} catch (UnsupportedCommOperationException e) {
throw new IOException(e);
}
}
private void verifyResponseCode(byte[] response) throws IOException {
if (response.length != 2) throw new IOException("Expected 2 byte response: " +
bytesToHex(response));
short code = (short) (response[1] << 8 | response[0]);
if (code != 1) throw new IOException("Error from device: " + code);
}
private byte[] getResponseData(byte[] response) throws IOException {
if (response.length <= RESPONSE_DATA_OFFSET - 1) throw new IOException(
"Response too short: " + bytesToHex(response));
byte dataLen = response[RESPONSE_DATA_OFFSET - 1];
if (response.length != dataLen + RESPONSE_DATA_OFFSET) throw new IOException(
"Response data length doesn't match: " + bytesToHex(response));
return Arrays.copyOfRange(response, RESPONSE_DATA_OFFSET, response.length);
}
private byte[] getResponse(InputStream in, int waitMs, int maxWaitMs) throws IOException,
InterruptedException {
long ms = System.currentTimeMillis();
while (true) {
if (in.available() > 0) break;
if (System.currentTimeMillis() > ms + maxWaitMs) break;
Thread.sleep(waitMs);
}
if (in.available() == 0) return EMPTY_RESPONSE;
byte[] buffer = new byte[READ_BUFFER_SIZE];
int count = in.read(buffer);
if (count == 0) return EMPTY_RESPONSE;
return Arrays.copyOf(buffer, count);
}
}
| UTF-8 | Java | 6,439 | java | PcIrLinc.java | Java | [] | null | [] | package ceri.home.io.pcirlinc;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.NoSuchPortException;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class PcIrLinc implements Closeable {
private static final Logger logger = LogManager.getLogger();
private static final int BASE16 = 16;
private static final int RESPONSE_DATA_OFFSET = 5;
private static final byte[] EMPTY_RESPONSE = new byte[0];
private static final int PRESET_CMD_LEN = 6;
private static final int LEARN_CMD_EXTRA_LEN = 9;
private static final int READ_BUFFER_SIZE = 1024;
private static final byte[] LEARN_CMD = { 0x03, 0x12, 0x00, 0x00 };
private final SerialPort serialPort;
private final PcIrLincProperties properties;
public PcIrLinc(PcIrLincProperties properties) throws IOException {
this.properties = properties;
serialPort = openPort(properties.serialPort(), properties.baud(), properties.timeoutMs());
}
@Override
public void close() {
serialPort.close();
}
public static byte[] hexToBytes(String hex) {
byte[] data = new byte[hex.length() / 2];
for (int i = 0; i < data.length; i++)
data[i] = (byte) Integer.parseInt(hex.substring(i * 2, (i * 2) + 2), BASE16);
return data;
}
public static String bytesToHex(byte[] bytes) {
StringBuilder buffer = new StringBuilder(bytes.length * 2);
for (byte b : bytes) {
String s = Integer.toHexString(b);
if (s.length() < 2) buffer.append('0');
buffer.append(s);
}
return buffer.toString();
}
public void sendPreset(PcIrLincType type, short vendor, PcIrLincButton button)
throws IOException, InterruptedException {
logger.debug("Sending: {}, {}, {}", type, vendor, button);
int i = 0;
byte[] presetCmd = new byte[PRESET_CMD_LEN];
presetCmd[i++] = (byte) (presetCmd.length - 1);
presetCmd[i++] = 1;
presetCmd[i++] = (byte) ((type.id << 4) | (vendor >> 8));
presetCmd[i++] = (byte) (vendor & 0xff);
presetCmd[i++] = (byte) (button.id & 0xff);
presetCmd[i++] = 0;
serialPort.setRTS(true);
Thread.sleep(properties.delayMs());
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(presetCmd);
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response =
getResponse(serialPort.getInputStream(), properties.delayMs(), properties
.responseWaitMs());
verifyResponseCode(response);
}
public byte[] learnIr(int waitMs) throws IOException, InterruptedException {
serialPort.setRTS(true);
Thread.sleep(properties.delayMs());
logger.debug("Tx: {}", bytesToHex(LEARN_CMD));
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(LEARN_CMD);
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response = getResponse(serialPort.getInputStream(), properties.delayMs(), waitMs);
return getResponseData(response);
}
public void sendLearnedIr(byte[] code, int count) throws IOException, InterruptedException {
int i = 0;
byte[] buffer = new byte[code.length + LEARN_CMD_EXTRA_LEN];
buffer[i++] = (byte) (code.length + LEARN_CMD_EXTRA_LEN - 1);
buffer[i++] = 0x10;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = 0x10;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = (byte) code.length;
System.arraycopy(code, 0, buffer, i, code.length);
i += code.length;
buffer[i++] = 0;
serialPort.setRTS(true);
for (i = 0; i < count; i++) {
Thread.sleep(properties.delayMs());
logger.debug("Tx: {}", bytesToHex(buffer));
serialPort.getOutputStream().flush();
serialPort.getOutputStream().write(buffer);
}
serialPort.setRTS(false);
Thread.sleep(properties.delayMs());
byte[] response =
getResponse(serialPort.getInputStream(), properties.delayMs(), properties
.responseWaitMs());
verifyResponseCode(response);
}
private SerialPort openPort(String port, int baud, int timeoutMs) throws IOException {
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(port);
CommPort commPort = portIdentifier.open(getClass().getName(), timeoutMs);
if (!(commPort instanceof SerialPort)) throw new IllegalArgumentException(port +
" is not a serial port");
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.getOutputStream().flush();
int available = serialPort.getInputStream().available();
serialPort.getInputStream().skip(available);
return serialPort;
} catch (NoSuchPortException e) {
throw new IOException(e);
} catch (PortInUseException e) {
throw new IOException(e);
} catch (UnsupportedCommOperationException e) {
throw new IOException(e);
}
}
private void verifyResponseCode(byte[] response) throws IOException {
if (response.length != 2) throw new IOException("Expected 2 byte response: " +
bytesToHex(response));
short code = (short) (response[1] << 8 | response[0]);
if (code != 1) throw new IOException("Error from device: " + code);
}
private byte[] getResponseData(byte[] response) throws IOException {
if (response.length <= RESPONSE_DATA_OFFSET - 1) throw new IOException(
"Response too short: " + bytesToHex(response));
byte dataLen = response[RESPONSE_DATA_OFFSET - 1];
if (response.length != dataLen + RESPONSE_DATA_OFFSET) throw new IOException(
"Response data length doesn't match: " + bytesToHex(response));
return Arrays.copyOfRange(response, RESPONSE_DATA_OFFSET, response.length);
}
private byte[] getResponse(InputStream in, int waitMs, int maxWaitMs) throws IOException,
InterruptedException {
long ms = System.currentTimeMillis();
while (true) {
if (in.available() > 0) break;
if (System.currentTimeMillis() > ms + maxWaitMs) break;
Thread.sleep(waitMs);
}
if (in.available() == 0) return EMPTY_RESPONSE;
byte[] buffer = new byte[READ_BUFFER_SIZE];
int count = in.read(buffer);
if (count == 0) return EMPTY_RESPONSE;
return Arrays.copyOf(buffer, count);
}
}
| 6,439 | 0.690169 | 0.678987 | 180 | 33.772221 | 24.852192 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.483333 | false | false | 13 |
5d85698c87a0f192d772b40051738b1c65da9b84 | 14,508,399,533,993 | 1adfe54f28887a279d2490c62df9786148e43fe1 | /easyboot-plus/src/main/java/com/github/doiteasy/easyboot/plus/ddd/support/DomainService.java | 80938121c5ea44add001f6016450f86f61767e4a | [] | no_license | doItEasy/easyboot | https://github.com/doItEasy/easyboot | 2d98178f573434fab411a1398a68d013e0d06e65 | 70a57968af2f4b9cd96d18d578fa736be20e4dcb | refs/heads/master | 2022-12-11T02:11:26.445000 | 2019-12-03T12:39:36 | 2019-12-03T12:39:36 | 215,254,478 | 1 | 0 | null | false | 2022-11-21T22:38:04 | 2019-10-15T09:05:33 | 2019-12-03T12:54:26 | 2022-11-21T22:38:01 | 445 | 1 | 0 | 6 | Java | false | false | package com.github.doiteasy.easyboot.plus.ddd.support;
public interface DomainService<T extends Entity> {
}
| UTF-8 | Java | 111 | java | DomainService.java | Java | [
{
"context": "package com.github.doiteasy.easyboot.plus.ddd.support;\n\n\npublic interface ",
"end": 24,
"score": 0.582018256187439,
"start": 21,
"tag": "USERNAME",
"value": "ite"
}
] | null | [] | package com.github.doiteasy.easyboot.plus.ddd.support;
public interface DomainService<T extends Entity> {
}
| 111 | 0.792793 | 0.792793 | 6 | 17.5 | 24.425055 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false | 13 |
c5e305c7211f616fd3a4270209213542e5b14289 | 13,408,887,911,117 | e06e220fbdc7c4db4ece33c10ae0e933879e3d15 | /src/simpleserver/Data.java | 9cfddf693e0b29233ea9dedffd7c178d52e76b9d | [] | no_license | TommyL123/RestAPI | https://github.com/TommyL123/RestAPI | 47b1c4a0d64cefff7959026c8477672e18a34eef | fabf2adde09a609d5656a56599545057a73c0800 | refs/heads/master | 2020-06-14T06:19:57.193000 | 2017-09-27T01:11:10 | 2017-09-27T01:11:10 | 194,931,754 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package simpleserver;
public class Data {
int postId;
int userId;
String data;
}
| UTF-8 | Java | 94 | java | Data.java | Java | [] | null | [] | package simpleserver;
public class Data {
int postId;
int userId;
String data;
}
| 94 | 0.659574 | 0.659574 | 7 | 12.428572 | 7.81678 | 21 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
38bf14ada937069be485ad6cb269fa4eef44e6b3 | 32,272,384,264,544 | 65a8ac12607f90cb730f9b35320e11d7278ff5a2 | /src/test/java/example/rest/junit/JSONService.java | 470c55a3cc59e7fd23121804516a869c76d8761e | [] | no_license | brandon-low/multi-bean | https://github.com/brandon-low/multi-bean | 7af2ecf68ae06275a1d1edf173cae3c8c93fde51 | 615e89a22ecdbe5c38e2d53500411e716ab67947 | refs/heads/master | 2020-03-18T11:54:12.262000 | 2019-04-03T09:46:39 | 2019-04-03T09:46:39 | 134,697,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package example.rest.junit;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
@Path("/json/product")
//@Path("jsonservice")
public class JSONService {
@GET
@Path("/get")
@Produces("application/json")
public Product getProductInJSON() {
System.out.println("Got a get about to send stuff back");
Product product = new Product();
product.setName("iPad 3");
product.setQty(999);
return product;
}
@POST
@Path("/post")
@Consumes("application/json")
public Response createProductInJSON(Product product) {
String result = "Product created : " + product;
System.out.println("Got a POST about to send stuff back :" + result);
return Response.status(201).entity(result).build();
}
private void dumpHeader(HttpHeaders headers) {
Set<String> headerKeys = headers.getRequestHeaders().keySet();
for(String header:headerKeys){
System.out.println(header+":"+ headers.getRequestHeader(header).get(0));
}
}
@GET
@Path("/getWithHeader")
@Produces("application/json")
public Product getProductInJSONWithHeader(@Context HttpHeaders headers) {
System.out.println("Got a get With Header about to send stuff back");
dumpHeader(headers);
Product product = new Product();
product.setName("iPad 3 header stuff");
product.setQty(999);
return product;
}
@POST
@Path("/postWithHeader")
@Consumes("application/json")
public Response createProductInJSONWithHeader(@Context HttpHeaders headers, Product product) {
String result = "Product created : " + product;
System.out.println("Got a POST about to send stuff back :" + result);
dumpHeader(headers);
return Response.status(201).entity(result).build();
}
}
| UTF-8 | Java | 1,926 | java | JSONService.java | Java | [] | null | [] | package example.rest.junit;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
@Path("/json/product")
//@Path("jsonservice")
public class JSONService {
@GET
@Path("/get")
@Produces("application/json")
public Product getProductInJSON() {
System.out.println("Got a get about to send stuff back");
Product product = new Product();
product.setName("iPad 3");
product.setQty(999);
return product;
}
@POST
@Path("/post")
@Consumes("application/json")
public Response createProductInJSON(Product product) {
String result = "Product created : " + product;
System.out.println("Got a POST about to send stuff back :" + result);
return Response.status(201).entity(result).build();
}
private void dumpHeader(HttpHeaders headers) {
Set<String> headerKeys = headers.getRequestHeaders().keySet();
for(String header:headerKeys){
System.out.println(header+":"+ headers.getRequestHeader(header).get(0));
}
}
@GET
@Path("/getWithHeader")
@Produces("application/json")
public Product getProductInJSONWithHeader(@Context HttpHeaders headers) {
System.out.println("Got a get With Header about to send stuff back");
dumpHeader(headers);
Product product = new Product();
product.setName("iPad 3 header stuff");
product.setQty(999);
return product;
}
@POST
@Path("/postWithHeader")
@Consumes("application/json")
public Response createProductInJSONWithHeader(@Context HttpHeaders headers, Product product) {
String result = "Product created : " + product;
System.out.println("Got a POST about to send stuff back :" + result);
dumpHeader(headers);
return Response.status(201).entity(result).build();
}
}
| 1,926 | 0.703011 | 0.695223 | 89 | 20.64045 | 22.783419 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.393258 | false | false | 13 |
bdb92d0ab50aeba2268e498f7b81a28947e69b97 | 4,810,363,422,810 | 173b434a4474e746bc093ecfd5142ef2b73905c4 | /rfid_jsf/src/main/java/br/com/acessorfid/validadores/CpfValidator.java | 417bc91edb452ffecc83a6160f40581addbda848 | [] | no_license | rfidacesso/rfidacesso | https://github.com/rfidacesso/rfidacesso | 24785aba5d72207b4648475d462d3585b1c3a9f1 | 9e8a119db4a3c933b1ba89b54d268beeaf2a1b57 | refs/heads/master | 2016-04-18T20:46:52.814000 | 2015-07-29T16:44:45 | 2015-07-29T16:44:45 | 39,403,821 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.acessorfid.validadores;
import javax.faces.bean.ManagedProperty;
import br.com.acessorfid.exceptions.CpfExistenteException;
import br.com.acessorfid.exceptions.CpfInvalidoException;
import br.com.acessorfid.exceptions.NegocioException;
import br.com.acessorfid.infra.util.StringUtil;
public class CpfValidator{
private static StringUtil sUtil = new StringUtil();
/**
* Valida CPF do usuário. Não aceita CPF's padrões como 11111111111 ou
* 22222222222
*
* @param cpf
* String valor com 11 dígitos
* @throws CpfInvalidoException
* @throws CpfExistenteException
*/
public static void validaCPF(String cpf, boolean isUsuarioExistente) throws NegocioException {
cpf = sUtil.retirarCaracteresNaoNumericos(cpf);
if(isUsuarioExistente){
throw new CpfExistenteException();
}
if (cpf == null || cpf.length() != 11 || isCPFPadrao(cpf))
throw new CpfInvalidoException();
try {
Long.parseLong(cpf);
} catch (NumberFormatException e) { // CPF não possui somente números
throw new CpfInvalidoException();
}
if(!calcDigVerif(cpf.substring(0, 9)).equals(cpf.substring(9, 11))){
throw new CpfInvalidoException();
}
}
/**
*
* @param cpf
* String valor a ser testado
* @return boolean indicando se o usuário entrou com um CPF padrão
*/
private static boolean isCPFPadrao(String cpf) {
if (cpf.equals("11111111111") || cpf.equals("22222222222")
|| cpf.equals("33333333333") || cpf.equals("44444444444")
|| cpf.equals("55555555555") || cpf.equals("66666666666")
|| cpf.equals("77777777777") || cpf.equals("88888888888")
|| cpf.equals("99999999999")) {
return true;
}
return false;
}
private static String calcDigVerif(String num) {
Integer primDig, segDig;
int soma = 0, peso = 10;
for (int i = 0; i < num.length(); i++)
soma += Integer.parseInt(num.substring(i, i + 1)) * peso--;
if (soma % 11 == 0 | soma % 11 == 1)
primDig = new Integer(0);
else
primDig = new Integer(11 - (soma % 11));
soma = 0;
peso = 11;
for (int i = 0; i < num.length(); i++)
soma += Integer.parseInt(num.substring(i, i + 1)) * peso--;
soma += primDig.intValue() * 2;
if (soma % 11 == 0 | soma % 11 == 1)
segDig = new Integer(0);
else
segDig = new Integer(11 - (soma % 11));
return primDig.toString() + segDig.toString();
}
}
| UTF-8 | Java | 2,398 | java | CpfValidator.java | Java | [] | null | [] | package br.com.acessorfid.validadores;
import javax.faces.bean.ManagedProperty;
import br.com.acessorfid.exceptions.CpfExistenteException;
import br.com.acessorfid.exceptions.CpfInvalidoException;
import br.com.acessorfid.exceptions.NegocioException;
import br.com.acessorfid.infra.util.StringUtil;
public class CpfValidator{
private static StringUtil sUtil = new StringUtil();
/**
* Valida CPF do usuário. Não aceita CPF's padrões como 11111111111 ou
* 22222222222
*
* @param cpf
* String valor com 11 dígitos
* @throws CpfInvalidoException
* @throws CpfExistenteException
*/
public static void validaCPF(String cpf, boolean isUsuarioExistente) throws NegocioException {
cpf = sUtil.retirarCaracteresNaoNumericos(cpf);
if(isUsuarioExistente){
throw new CpfExistenteException();
}
if (cpf == null || cpf.length() != 11 || isCPFPadrao(cpf))
throw new CpfInvalidoException();
try {
Long.parseLong(cpf);
} catch (NumberFormatException e) { // CPF não possui somente números
throw new CpfInvalidoException();
}
if(!calcDigVerif(cpf.substring(0, 9)).equals(cpf.substring(9, 11))){
throw new CpfInvalidoException();
}
}
/**
*
* @param cpf
* String valor a ser testado
* @return boolean indicando se o usuário entrou com um CPF padrão
*/
private static boolean isCPFPadrao(String cpf) {
if (cpf.equals("11111111111") || cpf.equals("22222222222")
|| cpf.equals("33333333333") || cpf.equals("44444444444")
|| cpf.equals("55555555555") || cpf.equals("66666666666")
|| cpf.equals("77777777777") || cpf.equals("88888888888")
|| cpf.equals("99999999999")) {
return true;
}
return false;
}
private static String calcDigVerif(String num) {
Integer primDig, segDig;
int soma = 0, peso = 10;
for (int i = 0; i < num.length(); i++)
soma += Integer.parseInt(num.substring(i, i + 1)) * peso--;
if (soma % 11 == 0 | soma % 11 == 1)
primDig = new Integer(0);
else
primDig = new Integer(11 - (soma % 11));
soma = 0;
peso = 11;
for (int i = 0; i < num.length(); i++)
soma += Integer.parseInt(num.substring(i, i + 1)) * peso--;
soma += primDig.intValue() * 2;
if (soma % 11 == 0 | soma % 11 == 1)
segDig = new Integer(0);
else
segDig = new Integer(11 - (soma % 11));
return primDig.toString() + segDig.toString();
}
}
| 2,398 | 0.662762 | 0.594561 | 92 | 24.97826 | 24.084534 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.130435 | false | false | 13 |
ea3b6993d0763887bc87092f79ccead151690ae3 | 16,879,221,501,889 | dfffc9a9265580507b649d5633d7fb60084c3fe3 | /src/tree/solution145/Solution145_version3.java | f90386b19086a2252be6d2507bbd77c7eacf4294 | [] | no_license | github-is-too-slow/01day | https://github.com/github-is-too-slow/01day | e4cd0084bb2005202c9eeebb516c7a31584733d1 | 92f69f328c91fb6f6978e5cccb2e46de5eae6130 | refs/heads/master | 2023-05-05T16:24:02.656000 | 2021-05-23T16:12:08 | 2021-05-23T16:12:08 | 369,589,070 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tree.solution145;
import tree.entity.TreeNode;
import java.util.LinkedList;
import java.util.List;
/**
* 二叉树的后序遍历,
* Morris版本,特点:
* O(n)时间复杂度,
* O(1)空间复杂度,利用已经存在的树指针
* @author Billion
* @create 2021-05-04 23:27
*/
public class Solution145_version3 {
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> res = new LinkedList<>();
//两个辅助指针
TreeNode p1 = root; //表示当前节点
TreeNode p2 = null; //表示当前节点的左节点
while(p1 != null){//当前节点为空,表示遍历完毕
p2 = p1.left;
//当前节点存在左子树时,去寻找当前节点在中序遍历下的前驱节点,
//当不存在左子树时,去访问当前节点右子树
if(p2 != null){
//寻找前驱节点,即:当前节点左子树中的最右节点
while (p2.right != null && p2.right != p1){
p2 = p2.right;
}
//此时要么p2.right == null,要么p2.right == p1
if(p2.right == null){//此时表明第一次访问前驱节点,
//令前驱节点指向当前节点
p2.right = p1;
//继续向左下访问
p1 = p1.left;
continue;
}else{//p2.right == p1,
//此时应当还原指针
p2.right = null;
// 表明第二次访问到当前节点,逆序输出从当前节点的左节点到前驱节点的序列
res.addAll(addPath(p1.left));
}
}
p1 = p1.right;
}
//最终循环结束,从root节点开始的最右路径没有访问
res.addAll(addPath(root));
return res;
}
//逆序输出从指定节点到最右子节点的序列
List<Integer> addPath(TreeNode node){
LinkedList<Integer> res = new LinkedList<>();
while(node != null){
res.addFirst(node.val);
node = node.right;
}
return res;
}
}
| UTF-8 | Java | 1,841 | java | Solution145_version3.java | Java | [
{
"context": ":\n * O(n)时间复杂度,\n * O(1)空间复杂度,利用已经存在的树指针\n * @author Billion\n * @create 2021-05-04 23:27\n */\npublic class Solu",
"end": 199,
"score": 0.6306866407394409,
"start": 192,
"tag": "NAME",
"value": "Billion"
}
] | null | [] | package tree.solution145;
import tree.entity.TreeNode;
import java.util.LinkedList;
import java.util.List;
/**
* 二叉树的后序遍历,
* Morris版本,特点:
* O(n)时间复杂度,
* O(1)空间复杂度,利用已经存在的树指针
* @author Billion
* @create 2021-05-04 23:27
*/
public class Solution145_version3 {
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> res = new LinkedList<>();
//两个辅助指针
TreeNode p1 = root; //表示当前节点
TreeNode p2 = null; //表示当前节点的左节点
while(p1 != null){//当前节点为空,表示遍历完毕
p2 = p1.left;
//当前节点存在左子树时,去寻找当前节点在中序遍历下的前驱节点,
//当不存在左子树时,去访问当前节点右子树
if(p2 != null){
//寻找前驱节点,即:当前节点左子树中的最右节点
while (p2.right != null && p2.right != p1){
p2 = p2.right;
}
//此时要么p2.right == null,要么p2.right == p1
if(p2.right == null){//此时表明第一次访问前驱节点,
//令前驱节点指向当前节点
p2.right = p1;
//继续向左下访问
p1 = p1.left;
continue;
}else{//p2.right == p1,
//此时应当还原指针
p2.right = null;
// 表明第二次访问到当前节点,逆序输出从当前节点的左节点到前驱节点的序列
res.addAll(addPath(p1.left));
}
}
p1 = p1.right;
}
//最终循环结束,从root节点开始的最右路径没有访问
res.addAll(addPath(root));
return res;
}
//逆序输出从指定节点到最右子节点的序列
List<Integer> addPath(TreeNode node){
LinkedList<Integer> res = new LinkedList<>();
while(node != null){
res.addFirst(node.val);
node = node.right;
}
return res;
}
}
| 1,841 | 0.633663 | 0.599391 | 61 | 20.52459 | 13.834628 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.52459 | false | false | 13 |
53f981bc59c0393410c83b031a2c474c18e99b87 | 1,614,907,721,577 | bbc12beb8154a8706543e7288a8f314c1c1c1618 | /src/main/java/com/myhome/exceptions/RecordNotFoundException.java | 0dced653313de589aaec938863831acd90631ca2 | [] | no_license | gsunilcse/myhome | https://github.com/gsunilcse/myhome | b122c2a8edf2d30464626627076fc460e875435e | 59f1e34cf00c0b71e9d18d542446f6b73879e0fd | refs/heads/master | 2020-07-26T22:58:28.689000 | 2019-09-16T18:37:55 | 2019-09-16T18:37:55 | 208,790,387 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.myhome.exceptions;
public class RecordNotFoundException extends Exception {
public RecordNotFoundException(String msg) {
// TODO Auto-generated constructor stub
super(msg);
}
}
| UTF-8 | Java | 198 | java | RecordNotFoundException.java | Java | [] | null | [] | package com.myhome.exceptions;
public class RecordNotFoundException extends Exception {
public RecordNotFoundException(String msg) {
// TODO Auto-generated constructor stub
super(msg);
}
}
| 198 | 0.777778 | 0.777778 | 10 | 18.799999 | 20.932272 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 13 |
6fd6848de17383aecc17eb8836560d8bbf73a507 | 31,542,239,836,978 | 1512bfa723bed07434c0804cdab0606ecca4c51c | /day_2/src/Customer.java | 10aa01106dcc280ad9af74177e19973572296c5b | [] | no_license | NamrataTtn/Assign | https://github.com/NamrataTtn/Assign | 4ad5f3f7d10eda5fab441d1fd47aa368516cfa01 | 5f71d78e80cefadb3ece4b19922ff31e751e9fca | refs/heads/master | 2020-04-21T11:32:22.919000 | 2019-03-27T07:54:50 | 2019-03-27T07:54:50 | 169,529,026 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Customer {
private String name;
private Boolean orderStatus;
private float cash;
private int token;
private int coffeeQuantity;
public Customer(String name, Boolean orderStatus, float cash, int token, int coffeeQuantity) {
this.name = name;
this.orderStatus = orderStatus;
this.cash = cash;
this.token = token;
this.coffeeQuantity = coffeeQuantity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Boolean orderStatus) {
this.orderStatus = orderStatus;
}
public float getCash() {
return cash;
}
public void setCash(float cash) {
this.cash = cash;
}
public int getToken() {
return token;
}
public void setToken(int token) {
this.token = token;
}
public int getCoffeeQuantity() {
return coffeeQuantity;
}
public void setCoffeeQuantity(int coffeeQuantity) {
this.coffeeQuantity = coffeeQuantity;
}
}
| UTF-8 | Java | 1,182 | java | Customer.java | Java | [] | null | [] | public class Customer {
private String name;
private Boolean orderStatus;
private float cash;
private int token;
private int coffeeQuantity;
public Customer(String name, Boolean orderStatus, float cash, int token, int coffeeQuantity) {
this.name = name;
this.orderStatus = orderStatus;
this.cash = cash;
this.token = token;
this.coffeeQuantity = coffeeQuantity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Boolean orderStatus) {
this.orderStatus = orderStatus;
}
public float getCash() {
return cash;
}
public void setCash(float cash) {
this.cash = cash;
}
public int getToken() {
return token;
}
public void setToken(int token) {
this.token = token;
}
public int getCoffeeQuantity() {
return coffeeQuantity;
}
public void setCoffeeQuantity(int coffeeQuantity) {
this.coffeeQuantity = coffeeQuantity;
}
}
| 1,182 | 0.612521 | 0.612521 | 56 | 20.107143 | 19.038193 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 13 |
6060d0b00c930b4285dcdce74e129ba5eba185cb | 747,324,326,443 | 9ed6b59e6fd94f54dfc2c210237effe6f75db1c0 | /Softwareprojekt/src/pti/model/service/MachineService.java | 028bd4098e29f4dc3fe93cd3fc7e537001886b92 | [] | no_license | MaksatRysbekov/akademische-projekte | https://github.com/MaksatRysbekov/akademische-projekte | 89580bc6af4957c03755ec6c2960ca5cf125ec0f | e7626e0809d12670b58a83dcf626f94f4e759509 | refs/heads/master | 2022-12-11T13:01:38.231000 | 2020-09-01T19:09:58 | 2020-09-01T19:09:58 | 292,084,856 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pti.model.service;
import pti.model.domain.Machine;
import java.util.List;
public interface MachineService {
Machine findById(Long id);
List<Machine> findAll();
Machine insert(Machine machine);
Machine update(Machine machine);
void delete(Machine machine);
List<Machine> findByOperative(boolean operative);
}
| UTF-8 | Java | 343 | java | MachineService.java | Java | [] | null | [] | package pti.model.service;
import pti.model.domain.Machine;
import java.util.List;
public interface MachineService {
Machine findById(Long id);
List<Machine> findAll();
Machine insert(Machine machine);
Machine update(Machine machine);
void delete(Machine machine);
List<Machine> findByOperative(boolean operative);
}
| 343 | 0.74344 | 0.74344 | 14 | 22.5 | 15.64677 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
e3fe663337707fd607437b59c0c61df73ad9779e | 18,245,021,099,283 | 110dae45e2eb54aa6ba6f3dd4095672316bb2364 | /app/src/main/java/blservice/IKeepupBLService.java | 0e2df2360c262aa567dba48a2f699d9c89fffe1f | [] | no_license | AssKicker0214/MobileOA | https://github.com/AssKicker0214/MobileOA | 89236d023278e4f53f0cf1aa363078efa9a5531d | 557ccc0e46e28c2b8b534bd2152e623623542f37 | refs/heads/master | 2021-01-17T12:39:09.299000 | 2016-06-20T08:51:21 | 2016-06-20T08:51:21 | 59,465,013 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package blservice;
import java.lang.reflect.Array;
import java.util.ArrayList;
import entity.Keepup;
/**
* Created by Ian on 2016/6/8.
*/
public interface IKeepupBLService {
public void getKeepup(String userid, int page);
public ArrayList<Keepup> getKeepup(int page);
public ArrayList<Keepup> getKeepupByCusID(String cusid);
}
| UTF-8 | Java | 346 | java | IKeepupBLService.java | Java | [
{
"context": "rayList;\n\nimport entity.Keepup;\n\n/**\n * Created by Ian on 2016/6/8.\n */\npublic interface IKeepupBLServic",
"end": 125,
"score": 0.84857177734375,
"start": 122,
"tag": "NAME",
"value": "Ian"
}
] | null | [] | package blservice;
import java.lang.reflect.Array;
import java.util.ArrayList;
import entity.Keepup;
/**
* Created by Ian on 2016/6/8.
*/
public interface IKeepupBLService {
public void getKeepup(String userid, int page);
public ArrayList<Keepup> getKeepup(int page);
public ArrayList<Keepup> getKeepupByCusID(String cusid);
}
| 346 | 0.742775 | 0.725434 | 17 | 19.352942 | 20.049765 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 13 |
9b8b614ae9efede65fe63febe705d9f217e5e0ae | 31,215,822,309,912 | 132415ac96fe5bf9d92c57e81fbbe917a01d5be3 | /media/java/android/media/tv/tuner/frontend/FrontendStatus.java | c265bb9e6050bfbb188236834f5e25edd85591b7 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | DotOS/android_frameworks_base | https://github.com/DotOS/android_frameworks_base | 68b7a271a124568bbcc1fb815586e6d8baffdc6c | 8817b78fd1fd97c03b7397cb6fee700cc58b2a1d | refs/heads/dot11 | 2022-10-25T21:40:03.140000 | 2021-11-21T12:39:11 | 2021-11-21T14:51:31 | 95,444,198 | 37 | 251 | NOASSERTION | false | 2021-09-22T12:51:12 | 2017-06-26T12:29:26 | 2021-09-19T19:06:13 | 2021-09-19T19:06:09 | 2,382,154 | 15 | 73 | 5 | Java | false | false | /*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv.tuner.frontend;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.hardware.tv.tuner.V1_0.Constants;
import android.media.tv.tuner.Lnb;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Frontend status.
*
* @hide
*/
@SystemApi
public class FrontendStatus {
/** @hide */
@IntDef({FRONTEND_STATUS_TYPE_DEMOD_LOCK, FRONTEND_STATUS_TYPE_SNR, FRONTEND_STATUS_TYPE_BER,
FRONTEND_STATUS_TYPE_PER, FRONTEND_STATUS_TYPE_PRE_BER,
FRONTEND_STATUS_TYPE_SIGNAL_QUALITY, FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH,
FRONTEND_STATUS_TYPE_SYMBOL_RATE, FRONTEND_STATUS_TYPE_FEC,
FRONTEND_STATUS_TYPE_MODULATION, FRONTEND_STATUS_TYPE_SPECTRAL,
FRONTEND_STATUS_TYPE_LNB_VOLTAGE, FRONTEND_STATUS_TYPE_PLP_ID,
FRONTEND_STATUS_TYPE_EWBS, FRONTEND_STATUS_TYPE_AGC, FRONTEND_STATUS_TYPE_LNA,
FRONTEND_STATUS_TYPE_LAYER_ERROR, FRONTEND_STATUS_TYPE_MER,
FRONTEND_STATUS_TYPE_FREQ_OFFSET, FRONTEND_STATUS_TYPE_HIERARCHY,
FRONTEND_STATUS_TYPE_RF_LOCK, FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO})
@Retention(RetentionPolicy.SOURCE)
public @interface FrontendStatusType {}
/**
* Lock status for Demod.
*/
public static final int FRONTEND_STATUS_TYPE_DEMOD_LOCK =
Constants.FrontendStatusType.DEMOD_LOCK;
/**
* Signal to Noise Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_SNR = Constants.FrontendStatusType.SNR;
/**
* Bit Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_BER = Constants.FrontendStatusType.BER;
/**
* Packages Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_PER = Constants.FrontendStatusType.PER;
/**
* Bit Error Ratio before FEC.
*/
public static final int FRONTEND_STATUS_TYPE_PRE_BER = Constants.FrontendStatusType.PRE_BER;
/**
* Signal Quality (0..100). Good data over total data in percent can be
* used as a way to present Signal Quality.
*/
public static final int FRONTEND_STATUS_TYPE_SIGNAL_QUALITY =
Constants.FrontendStatusType.SIGNAL_QUALITY;
/**
* Signal Strength.
*/
public static final int FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH =
Constants.FrontendStatusType.SIGNAL_STRENGTH;
/**
* Symbol Rate in symbols per second.
*/
public static final int FRONTEND_STATUS_TYPE_SYMBOL_RATE =
Constants.FrontendStatusType.SYMBOL_RATE;
/**
* Forward Error Correction Type.
*/
public static final int FRONTEND_STATUS_TYPE_FEC = Constants.FrontendStatusType.FEC;
/**
* Modulation Type.
*/
public static final int FRONTEND_STATUS_TYPE_MODULATION =
Constants.FrontendStatusType.MODULATION;
/**
* Spectral Inversion Type.
*/
public static final int FRONTEND_STATUS_TYPE_SPECTRAL = Constants.FrontendStatusType.SPECTRAL;
/**
* LNB Voltage.
*/
public static final int FRONTEND_STATUS_TYPE_LNB_VOLTAGE =
Constants.FrontendStatusType.LNB_VOLTAGE;
/**
* Physical Layer Pipe ID.
*/
public static final int FRONTEND_STATUS_TYPE_PLP_ID = Constants.FrontendStatusType.PLP_ID;
/**
* Status for Emergency Warning Broadcasting System.
*/
public static final int FRONTEND_STATUS_TYPE_EWBS = Constants.FrontendStatusType.EWBS;
/**
* Automatic Gain Control.
*/
public static final int FRONTEND_STATUS_TYPE_AGC = Constants.FrontendStatusType.AGC;
/**
* Low Noise Amplifier.
*/
public static final int FRONTEND_STATUS_TYPE_LNA = Constants.FrontendStatusType.LNA;
/**
* Error status by layer.
*/
public static final int FRONTEND_STATUS_TYPE_LAYER_ERROR =
Constants.FrontendStatusType.LAYER_ERROR;
/**
* Modulation Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_MER = Constants.FrontendStatusType.MER;
/**
* Difference between tuning frequency and actual locked frequency.
*/
public static final int FRONTEND_STATUS_TYPE_FREQ_OFFSET =
Constants.FrontendStatusType.FREQ_OFFSET;
/**
* Hierarchy for DVBT.
*/
public static final int FRONTEND_STATUS_TYPE_HIERARCHY = Constants.FrontendStatusType.HIERARCHY;
/**
* Lock status for RF.
*/
public static final int FRONTEND_STATUS_TYPE_RF_LOCK = Constants.FrontendStatusType.RF_LOCK;
/**
* PLP information in a frequency band for ATSC-3.0 frontend.
*/
public static final int FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO =
Constants.FrontendStatusType.ATSC3_PLP_INFO;
/** @hide */
@IntDef(value = {
DvbcFrontendSettings.MODULATION_UNDEFINED,
DvbcFrontendSettings.MODULATION_AUTO,
DvbcFrontendSettings.MODULATION_MOD_16QAM,
DvbcFrontendSettings.MODULATION_MOD_32QAM,
DvbcFrontendSettings.MODULATION_MOD_64QAM,
DvbcFrontendSettings.MODULATION_MOD_128QAM,
DvbcFrontendSettings.MODULATION_MOD_256QAM,
DvbsFrontendSettings.MODULATION_UNDEFINED,
DvbsFrontendSettings.MODULATION_AUTO,
DvbsFrontendSettings.MODULATION_MOD_QPSK,
DvbsFrontendSettings.MODULATION_MOD_8PSK,
DvbsFrontendSettings.MODULATION_MOD_16QAM,
DvbsFrontendSettings.MODULATION_MOD_16PSK,
DvbsFrontendSettings.MODULATION_MOD_32PSK,
DvbsFrontendSettings.MODULATION_MOD_ACM,
DvbsFrontendSettings.MODULATION_MOD_8APSK,
DvbsFrontendSettings.MODULATION_MOD_16APSK,
DvbsFrontendSettings.MODULATION_MOD_32APSK,
DvbsFrontendSettings.MODULATION_MOD_64APSK,
DvbsFrontendSettings.MODULATION_MOD_128APSK,
DvbsFrontendSettings.MODULATION_MOD_256APSK,
DvbsFrontendSettings.MODULATION_MOD_RESERVED,
IsdbsFrontendSettings.MODULATION_UNDEFINED,
IsdbsFrontendSettings.MODULATION_AUTO,
IsdbsFrontendSettings.MODULATION_MOD_BPSK,
IsdbsFrontendSettings.MODULATION_MOD_QPSK,
IsdbsFrontendSettings.MODULATION_MOD_TC8PSK,
Isdbs3FrontendSettings.MODULATION_UNDEFINED,
Isdbs3FrontendSettings.MODULATION_AUTO,
Isdbs3FrontendSettings.MODULATION_MOD_BPSK,
Isdbs3FrontendSettings.MODULATION_MOD_QPSK,
Isdbs3FrontendSettings.MODULATION_MOD_8PSK,
Isdbs3FrontendSettings.MODULATION_MOD_16APSK,
Isdbs3FrontendSettings.MODULATION_MOD_32APSK,
IsdbtFrontendSettings.MODULATION_UNDEFINED,
IsdbtFrontendSettings.MODULATION_AUTO,
IsdbtFrontendSettings.MODULATION_MOD_DQPSK,
IsdbtFrontendSettings.MODULATION_MOD_QPSK,
IsdbtFrontendSettings.MODULATION_MOD_16QAM,
IsdbtFrontendSettings.MODULATION_MOD_64QAM})
@Retention(RetentionPolicy.SOURCE)
public @interface FrontendModulation {}
private Boolean mIsDemodLocked;
private Integer mSnr;
private Integer mBer;
private Integer mPer;
private Integer mPerBer;
private Integer mSignalQuality;
private Integer mSignalStrength;
private Integer mSymbolRate;
private Long mInnerFec;
private Integer mModulation;
private Integer mInversion;
private Integer mLnbVoltage;
private Integer mPlpId;
private Boolean mIsEwbs;
private Integer mAgc;
private Boolean mIsLnaOn;
private boolean[] mIsLayerErrors;
private Integer mMer;
private Integer mFreqOffset;
private Integer mHierarchy;
private Boolean mIsRfLocked;
private Atsc3PlpTuningInfo[] mPlpInfo;
// Constructed and fields set by JNI code.
private FrontendStatus() {
}
/**
* Lock status for Demod.
*/
public boolean isDemodLocked() {
if (mIsDemodLocked == null) {
throw new IllegalStateException();
}
return mIsDemodLocked;
}
/**
* Gets Signal to Noise Ratio in thousandths of a deciBel (0.001dB).
*/
public int getSnr() {
if (mSnr == null) {
throw new IllegalStateException();
}
return mSnr;
}
/**
* Gets Bit Error Ratio.
*
* <p>The number of error bit per 1 billion bits.
*/
public int getBer() {
if (mBer == null) {
throw new IllegalStateException();
}
return mBer;
}
/**
* Gets Packages Error Ratio.
*
* <p>The number of error package per 1 billion packages.
*/
public int getPer() {
if (mPer == null) {
throw new IllegalStateException();
}
return mPer;
}
/**
* Gets Bit Error Ratio before Forward Error Correction (FEC).
*
* <p>The number of error bit per 1 billion bits before FEC.
*/
public int getPerBer() {
if (mPerBer == null) {
throw new IllegalStateException();
}
return mPerBer;
}
/**
* Gets Signal Quality in percent.
*/
public int getSignalQuality() {
if (mSignalQuality == null) {
throw new IllegalStateException();
}
return mSignalQuality;
}
/**
* Gets Signal Strength in thousandths of a dBm (0.001dBm).
*/
public int getSignalStrength() {
if (mSignalStrength == null) {
throw new IllegalStateException();
}
return mSignalStrength;
}
/**
* Gets symbol rate in symbols per second.
*/
public int getSymbolRate() {
if (mSymbolRate == null) {
throw new IllegalStateException();
}
return mSymbolRate;
}
/**
* Gets Inner Forward Error Correction type as specified in ETSI EN 300 468 V1.15.1
* and ETSI EN 302 307-2 V1.1.1.
*/
@FrontendSettings.InnerFec
public long getInnerFec() {
if (mInnerFec == null) {
throw new IllegalStateException();
}
return mInnerFec;
}
/**
* Gets modulation.
*/
@FrontendModulation
public int getModulation() {
if (mModulation == null) {
throw new IllegalStateException();
}
return mModulation;
}
/**
* Gets Spectral Inversion for DVBC.
*/
@DvbcFrontendSettings.SpectralInversion
public int getSpectralInversion() {
if (mInversion == null) {
throw new IllegalStateException();
}
return mInversion;
}
/**
* Gets Power Voltage Type for LNB.
*/
@Lnb.Voltage
public int getLnbVoltage() {
if (mLnbVoltage == null) {
throw new IllegalStateException();
}
return mLnbVoltage;
}
/**
* Gets Physical Layer Pipe ID.
*/
public int getPlpId() {
if (mPlpId == null) {
throw new IllegalStateException();
}
return mPlpId;
}
/**
* Checks whether it's Emergency Warning Broadcasting System
*/
public boolean isEwbs() {
if (mIsEwbs == null) {
throw new IllegalStateException();
}
return mIsEwbs;
}
/**
* Gets Automatic Gain Control value which is normalized from 0 to 255.
*/
public int getAgc() {
if (mAgc == null) {
throw new IllegalStateException();
}
return mAgc;
}
/**
* Checks LNA (Low Noise Amplifier) is on or not.
*/
public boolean isLnaOn() {
if (mIsLnaOn == null) {
throw new IllegalStateException();
}
return mIsLnaOn;
}
/**
* Gets Error status by layer.
*/
@NonNull
public boolean[] getLayerErrors() {
if (mIsLayerErrors == null) {
throw new IllegalStateException();
}
return mIsLayerErrors;
}
/**
* Gets Modulation Error Ratio in thousandths of a deciBel (0.001dB).
*/
public int getMer() {
if (mMer == null) {
throw new IllegalStateException();
}
return mMer;
}
/**
* Gets frequency difference in Hz.
*
* <p>Difference between tuning frequency and actual locked frequency.
*/
public int getFreqOffset() {
if (mFreqOffset == null) {
throw new IllegalStateException();
}
return mFreqOffset;
}
/**
* Gets hierarchy Type for DVBT.
*/
@DvbtFrontendSettings.Hierarchy
public int getHierarchy() {
if (mHierarchy == null) {
throw new IllegalStateException();
}
return mHierarchy;
}
/**
* Gets lock status for RF.
*/
public boolean isRfLocked() {
if (mIsRfLocked == null) {
throw new IllegalStateException();
}
return mIsRfLocked;
}
/**
* Gets an array of PLP status for tuned PLPs for ATSC3 frontend.
*/
@NonNull
public Atsc3PlpTuningInfo[] getAtsc3PlpTuningInfo() {
if (mPlpInfo == null) {
throw new IllegalStateException();
}
return mPlpInfo;
}
/**
* Status for each tuning Physical Layer Pipes.
*/
public static class Atsc3PlpTuningInfo {
private final int mPlpId;
private final boolean mIsLocked;
private final int mUec;
private Atsc3PlpTuningInfo(int plpId, boolean isLocked, int uec) {
mPlpId = plpId;
mIsLocked = isLocked;
mUec = uec;
}
/**
* Gets Physical Layer Pipe ID.
*/
public int getPlpId() {
return mPlpId;
}
/**
* Gets Demod Lock/Unlock status of this particular PLP.
*/
public boolean isLocked() {
return mIsLocked;
}
/**
* Gets Uncorrectable Error Counts (UEC) of this particular PLP since last tune operation.
*/
public int getUec() {
return mUec;
}
}
}
| UTF-8 | Java | 14,747 | java | FrontendStatus.java | Java | [] | null | [] | /*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv.tuner.frontend;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.hardware.tv.tuner.V1_0.Constants;
import android.media.tv.tuner.Lnb;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Frontend status.
*
* @hide
*/
@SystemApi
public class FrontendStatus {
/** @hide */
@IntDef({FRONTEND_STATUS_TYPE_DEMOD_LOCK, FRONTEND_STATUS_TYPE_SNR, FRONTEND_STATUS_TYPE_BER,
FRONTEND_STATUS_TYPE_PER, FRONTEND_STATUS_TYPE_PRE_BER,
FRONTEND_STATUS_TYPE_SIGNAL_QUALITY, FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH,
FRONTEND_STATUS_TYPE_SYMBOL_RATE, FRONTEND_STATUS_TYPE_FEC,
FRONTEND_STATUS_TYPE_MODULATION, FRONTEND_STATUS_TYPE_SPECTRAL,
FRONTEND_STATUS_TYPE_LNB_VOLTAGE, FRONTEND_STATUS_TYPE_PLP_ID,
FRONTEND_STATUS_TYPE_EWBS, FRONTEND_STATUS_TYPE_AGC, FRONTEND_STATUS_TYPE_LNA,
FRONTEND_STATUS_TYPE_LAYER_ERROR, FRONTEND_STATUS_TYPE_MER,
FRONTEND_STATUS_TYPE_FREQ_OFFSET, FRONTEND_STATUS_TYPE_HIERARCHY,
FRONTEND_STATUS_TYPE_RF_LOCK, FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO})
@Retention(RetentionPolicy.SOURCE)
public @interface FrontendStatusType {}
/**
* Lock status for Demod.
*/
public static final int FRONTEND_STATUS_TYPE_DEMOD_LOCK =
Constants.FrontendStatusType.DEMOD_LOCK;
/**
* Signal to Noise Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_SNR = Constants.FrontendStatusType.SNR;
/**
* Bit Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_BER = Constants.FrontendStatusType.BER;
/**
* Packages Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_PER = Constants.FrontendStatusType.PER;
/**
* Bit Error Ratio before FEC.
*/
public static final int FRONTEND_STATUS_TYPE_PRE_BER = Constants.FrontendStatusType.PRE_BER;
/**
* Signal Quality (0..100). Good data over total data in percent can be
* used as a way to present Signal Quality.
*/
public static final int FRONTEND_STATUS_TYPE_SIGNAL_QUALITY =
Constants.FrontendStatusType.SIGNAL_QUALITY;
/**
* Signal Strength.
*/
public static final int FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH =
Constants.FrontendStatusType.SIGNAL_STRENGTH;
/**
* Symbol Rate in symbols per second.
*/
public static final int FRONTEND_STATUS_TYPE_SYMBOL_RATE =
Constants.FrontendStatusType.SYMBOL_RATE;
/**
* Forward Error Correction Type.
*/
public static final int FRONTEND_STATUS_TYPE_FEC = Constants.FrontendStatusType.FEC;
/**
* Modulation Type.
*/
public static final int FRONTEND_STATUS_TYPE_MODULATION =
Constants.FrontendStatusType.MODULATION;
/**
* Spectral Inversion Type.
*/
public static final int FRONTEND_STATUS_TYPE_SPECTRAL = Constants.FrontendStatusType.SPECTRAL;
/**
* LNB Voltage.
*/
public static final int FRONTEND_STATUS_TYPE_LNB_VOLTAGE =
Constants.FrontendStatusType.LNB_VOLTAGE;
/**
* Physical Layer Pipe ID.
*/
public static final int FRONTEND_STATUS_TYPE_PLP_ID = Constants.FrontendStatusType.PLP_ID;
/**
* Status for Emergency Warning Broadcasting System.
*/
public static final int FRONTEND_STATUS_TYPE_EWBS = Constants.FrontendStatusType.EWBS;
/**
* Automatic Gain Control.
*/
public static final int FRONTEND_STATUS_TYPE_AGC = Constants.FrontendStatusType.AGC;
/**
* Low Noise Amplifier.
*/
public static final int FRONTEND_STATUS_TYPE_LNA = Constants.FrontendStatusType.LNA;
/**
* Error status by layer.
*/
public static final int FRONTEND_STATUS_TYPE_LAYER_ERROR =
Constants.FrontendStatusType.LAYER_ERROR;
/**
* Modulation Error Ratio.
*/
public static final int FRONTEND_STATUS_TYPE_MER = Constants.FrontendStatusType.MER;
/**
* Difference between tuning frequency and actual locked frequency.
*/
public static final int FRONTEND_STATUS_TYPE_FREQ_OFFSET =
Constants.FrontendStatusType.FREQ_OFFSET;
/**
* Hierarchy for DVBT.
*/
public static final int FRONTEND_STATUS_TYPE_HIERARCHY = Constants.FrontendStatusType.HIERARCHY;
/**
* Lock status for RF.
*/
public static final int FRONTEND_STATUS_TYPE_RF_LOCK = Constants.FrontendStatusType.RF_LOCK;
/**
* PLP information in a frequency band for ATSC-3.0 frontend.
*/
public static final int FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO =
Constants.FrontendStatusType.ATSC3_PLP_INFO;
/** @hide */
@IntDef(value = {
DvbcFrontendSettings.MODULATION_UNDEFINED,
DvbcFrontendSettings.MODULATION_AUTO,
DvbcFrontendSettings.MODULATION_MOD_16QAM,
DvbcFrontendSettings.MODULATION_MOD_32QAM,
DvbcFrontendSettings.MODULATION_MOD_64QAM,
DvbcFrontendSettings.MODULATION_MOD_128QAM,
DvbcFrontendSettings.MODULATION_MOD_256QAM,
DvbsFrontendSettings.MODULATION_UNDEFINED,
DvbsFrontendSettings.MODULATION_AUTO,
DvbsFrontendSettings.MODULATION_MOD_QPSK,
DvbsFrontendSettings.MODULATION_MOD_8PSK,
DvbsFrontendSettings.MODULATION_MOD_16QAM,
DvbsFrontendSettings.MODULATION_MOD_16PSK,
DvbsFrontendSettings.MODULATION_MOD_32PSK,
DvbsFrontendSettings.MODULATION_MOD_ACM,
DvbsFrontendSettings.MODULATION_MOD_8APSK,
DvbsFrontendSettings.MODULATION_MOD_16APSK,
DvbsFrontendSettings.MODULATION_MOD_32APSK,
DvbsFrontendSettings.MODULATION_MOD_64APSK,
DvbsFrontendSettings.MODULATION_MOD_128APSK,
DvbsFrontendSettings.MODULATION_MOD_256APSK,
DvbsFrontendSettings.MODULATION_MOD_RESERVED,
IsdbsFrontendSettings.MODULATION_UNDEFINED,
IsdbsFrontendSettings.MODULATION_AUTO,
IsdbsFrontendSettings.MODULATION_MOD_BPSK,
IsdbsFrontendSettings.MODULATION_MOD_QPSK,
IsdbsFrontendSettings.MODULATION_MOD_TC8PSK,
Isdbs3FrontendSettings.MODULATION_UNDEFINED,
Isdbs3FrontendSettings.MODULATION_AUTO,
Isdbs3FrontendSettings.MODULATION_MOD_BPSK,
Isdbs3FrontendSettings.MODULATION_MOD_QPSK,
Isdbs3FrontendSettings.MODULATION_MOD_8PSK,
Isdbs3FrontendSettings.MODULATION_MOD_16APSK,
Isdbs3FrontendSettings.MODULATION_MOD_32APSK,
IsdbtFrontendSettings.MODULATION_UNDEFINED,
IsdbtFrontendSettings.MODULATION_AUTO,
IsdbtFrontendSettings.MODULATION_MOD_DQPSK,
IsdbtFrontendSettings.MODULATION_MOD_QPSK,
IsdbtFrontendSettings.MODULATION_MOD_16QAM,
IsdbtFrontendSettings.MODULATION_MOD_64QAM})
@Retention(RetentionPolicy.SOURCE)
public @interface FrontendModulation {}
private Boolean mIsDemodLocked;
private Integer mSnr;
private Integer mBer;
private Integer mPer;
private Integer mPerBer;
private Integer mSignalQuality;
private Integer mSignalStrength;
private Integer mSymbolRate;
private Long mInnerFec;
private Integer mModulation;
private Integer mInversion;
private Integer mLnbVoltage;
private Integer mPlpId;
private Boolean mIsEwbs;
private Integer mAgc;
private Boolean mIsLnaOn;
private boolean[] mIsLayerErrors;
private Integer mMer;
private Integer mFreqOffset;
private Integer mHierarchy;
private Boolean mIsRfLocked;
private Atsc3PlpTuningInfo[] mPlpInfo;
// Constructed and fields set by JNI code.
private FrontendStatus() {
}
/**
* Lock status for Demod.
*/
public boolean isDemodLocked() {
if (mIsDemodLocked == null) {
throw new IllegalStateException();
}
return mIsDemodLocked;
}
/**
* Gets Signal to Noise Ratio in thousandths of a deciBel (0.001dB).
*/
public int getSnr() {
if (mSnr == null) {
throw new IllegalStateException();
}
return mSnr;
}
/**
* Gets Bit Error Ratio.
*
* <p>The number of error bit per 1 billion bits.
*/
public int getBer() {
if (mBer == null) {
throw new IllegalStateException();
}
return mBer;
}
/**
* Gets Packages Error Ratio.
*
* <p>The number of error package per 1 billion packages.
*/
public int getPer() {
if (mPer == null) {
throw new IllegalStateException();
}
return mPer;
}
/**
* Gets Bit Error Ratio before Forward Error Correction (FEC).
*
* <p>The number of error bit per 1 billion bits before FEC.
*/
public int getPerBer() {
if (mPerBer == null) {
throw new IllegalStateException();
}
return mPerBer;
}
/**
* Gets Signal Quality in percent.
*/
public int getSignalQuality() {
if (mSignalQuality == null) {
throw new IllegalStateException();
}
return mSignalQuality;
}
/**
* Gets Signal Strength in thousandths of a dBm (0.001dBm).
*/
public int getSignalStrength() {
if (mSignalStrength == null) {
throw new IllegalStateException();
}
return mSignalStrength;
}
/**
* Gets symbol rate in symbols per second.
*/
public int getSymbolRate() {
if (mSymbolRate == null) {
throw new IllegalStateException();
}
return mSymbolRate;
}
/**
* Gets Inner Forward Error Correction type as specified in ETSI EN 300 468 V1.15.1
* and ETSI EN 302 307-2 V1.1.1.
*/
@FrontendSettings.InnerFec
public long getInnerFec() {
if (mInnerFec == null) {
throw new IllegalStateException();
}
return mInnerFec;
}
/**
* Gets modulation.
*/
@FrontendModulation
public int getModulation() {
if (mModulation == null) {
throw new IllegalStateException();
}
return mModulation;
}
/**
* Gets Spectral Inversion for DVBC.
*/
@DvbcFrontendSettings.SpectralInversion
public int getSpectralInversion() {
if (mInversion == null) {
throw new IllegalStateException();
}
return mInversion;
}
/**
* Gets Power Voltage Type for LNB.
*/
@Lnb.Voltage
public int getLnbVoltage() {
if (mLnbVoltage == null) {
throw new IllegalStateException();
}
return mLnbVoltage;
}
/**
* Gets Physical Layer Pipe ID.
*/
public int getPlpId() {
if (mPlpId == null) {
throw new IllegalStateException();
}
return mPlpId;
}
/**
* Checks whether it's Emergency Warning Broadcasting System
*/
public boolean isEwbs() {
if (mIsEwbs == null) {
throw new IllegalStateException();
}
return mIsEwbs;
}
/**
* Gets Automatic Gain Control value which is normalized from 0 to 255.
*/
public int getAgc() {
if (mAgc == null) {
throw new IllegalStateException();
}
return mAgc;
}
/**
* Checks LNA (Low Noise Amplifier) is on or not.
*/
public boolean isLnaOn() {
if (mIsLnaOn == null) {
throw new IllegalStateException();
}
return mIsLnaOn;
}
/**
* Gets Error status by layer.
*/
@NonNull
public boolean[] getLayerErrors() {
if (mIsLayerErrors == null) {
throw new IllegalStateException();
}
return mIsLayerErrors;
}
/**
* Gets Modulation Error Ratio in thousandths of a deciBel (0.001dB).
*/
public int getMer() {
if (mMer == null) {
throw new IllegalStateException();
}
return mMer;
}
/**
* Gets frequency difference in Hz.
*
* <p>Difference between tuning frequency and actual locked frequency.
*/
public int getFreqOffset() {
if (mFreqOffset == null) {
throw new IllegalStateException();
}
return mFreqOffset;
}
/**
* Gets hierarchy Type for DVBT.
*/
@DvbtFrontendSettings.Hierarchy
public int getHierarchy() {
if (mHierarchy == null) {
throw new IllegalStateException();
}
return mHierarchy;
}
/**
* Gets lock status for RF.
*/
public boolean isRfLocked() {
if (mIsRfLocked == null) {
throw new IllegalStateException();
}
return mIsRfLocked;
}
/**
* Gets an array of PLP status for tuned PLPs for ATSC3 frontend.
*/
@NonNull
public Atsc3PlpTuningInfo[] getAtsc3PlpTuningInfo() {
if (mPlpInfo == null) {
throw new IllegalStateException();
}
return mPlpInfo;
}
/**
* Status for each tuning Physical Layer Pipes.
*/
public static class Atsc3PlpTuningInfo {
private final int mPlpId;
private final boolean mIsLocked;
private final int mUec;
private Atsc3PlpTuningInfo(int plpId, boolean isLocked, int uec) {
mPlpId = plpId;
mIsLocked = isLocked;
mUec = uec;
}
/**
* Gets Physical Layer Pipe ID.
*/
public int getPlpId() {
return mPlpId;
}
/**
* Gets Demod Lock/Unlock status of this particular PLP.
*/
public boolean isLocked() {
return mIsLocked;
}
/**
* Gets Uncorrectable Error Counts (UEC) of this particular PLP since last tune operation.
*/
public int getUec() {
return mUec;
}
}
}
| 14,747 | 0.623449 | 0.615786 | 472 | 30.243645 | 23.919754 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.364407 | false | false | 13 |
0a2f422e529f0b126b42d09f618658d6a4302fa3 | 31,086,973,293,165 | 9c63247b4dc005dd68cf4b9a2e6914264bf591e5 | /src/com/alan/remidiKuis1/RemidiTest.java | f91044266ab6a3f086510d218b25acb7735127c4 | [] | no_license | alanrizky/remidial-quiz1 | https://github.com/alanrizky/remidial-quiz1 | 52ae164bdc84aa1d05abff987530f15605d4316f | 478d9ce719c51d6b6dcb23ba77c0991299679670 | refs/heads/master | 2020-04-04T15:13:51.318000 | 2018-11-03T23:28:37 | 2018-11-03T23:28:37 | 156,029,642 | 0 | 0 | null | true | 2018-11-03T22:35:52 | 2018-11-03T22:35:52 | 2018-11-03T12:38:16 | 2018-11-03T19:05:41 | 13 | 0 | 0 | 0 | null | false | null | package com.alan.remidiKuis1;
public class RemidiTest {
public static void main(String[] args) {
KijangInnova ki = new KijangInnova();
ki.setWarna("Silver");
ki.setMaxSpeed(200);
ki.carInfo();
ki.innovaDemo();
}
}
| UTF-8 | Java | 274 | java | RemidiTest.java | Java | [] | null | [] | package com.alan.remidiKuis1;
public class RemidiTest {
public static void main(String[] args) {
KijangInnova ki = new KijangInnova();
ki.setWarna("Silver");
ki.setMaxSpeed(200);
ki.carInfo();
ki.innovaDemo();
}
}
| 274 | 0.576642 | 0.562044 | 11 | 22.90909 | 14.712113 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 13 |
6646224f99aa841bf92597942c5eb24b2d7bfdd7 | 13,804,024,914,788 | 997a73c7abe10cd732155f431c861ebfec0455fd | /src/tinyweb/App.java | 35c0fd1d66a480055095ac125a50e5d581cf540f | [] | no_license | VS-Studio/Tinyweb | https://github.com/VS-Studio/Tinyweb | 13caa30d7121cd3411f8db17c66c5d0750ca5a20 | 0df48f540c4ecf840eab50f7b338e2b1fad470be | refs/heads/master | 2021-01-23T18:00:01.972000 | 2014-06-04T10:42:36 | 2014-06-04T10:42:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 tinyweb;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import tinyweb.core.Controler;
import tinyweb.core.utils.StrUtils;
/**
*
* @author Administrator
*/
public class App implements Runnable{
Socket socket = null;
public App(Socket _socket) {
this.socket = _socket;
}
@Override
public void run() {
Controler controler = new Controler(parseRequest());
try{
OutputStream out = socket.getOutputStream();
String outStr = StrUtils.httpResponse((String)controler.output());
//StrUtils.pl(outStr);
out.write(outStr.getBytes());
}catch(Exception e){
e.printStackTrace();
}
}
public String parseRequest()
{
String ret = "";
try{
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String req = br.readLine();
ret = req.split(" ")[1];
}catch(Exception e){}
return ret;
}
public static void main(String[] args)
{
App.startWeb();
}
public static void startWeb()
{
try{
ServerSocket ss = new ServerSocket(8800);
Socket s;
while((s = ss.accept()) != null)
{
new Thread(new App(s)).start();
}
}catch(Exception e){}
}
}
| UTF-8 | Java | 1,502 | java | App.java | Java | [
{
"context": "rt tinyweb.core.utils.StrUtils;\n\n/**\n *\n * @author Administrator\n */\npublic class App implements Runnable{\n Soc",
"end": 451,
"score": 0.7022098898887634,
"start": 438,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | /*
* 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 tinyweb;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import tinyweb.core.Controler;
import tinyweb.core.utils.StrUtils;
/**
*
* @author Administrator
*/
public class App implements Runnable{
Socket socket = null;
public App(Socket _socket) {
this.socket = _socket;
}
@Override
public void run() {
Controler controler = new Controler(parseRequest());
try{
OutputStream out = socket.getOutputStream();
String outStr = StrUtils.httpResponse((String)controler.output());
//StrUtils.pl(outStr);
out.write(outStr.getBytes());
}catch(Exception e){
e.printStackTrace();
}
}
public String parseRequest()
{
String ret = "";
try{
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String req = br.readLine();
ret = req.split(" ")[1];
}catch(Exception e){}
return ret;
}
public static void main(String[] args)
{
App.startWeb();
}
public static void startWeb()
{
try{
ServerSocket ss = new ServerSocket(8800);
Socket s;
while((s = ss.accept()) != null)
{
new Thread(new App(s)).start();
}
}catch(Exception e){}
}
}
| 1,502 | 0.655127 | 0.651798 | 67 | 21.41791 | 19.734165 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.820895 | false | false | 9 |
06e67e2f8897dea8e8a0397346f26ed628b34ff2 | 30,597,347,045,143 | e5997280200779b97ecba669737b9c022b209a5e | /flower-common/src/main/java/flower/leader/LeaderAdapter.java | 0e5082880d68bc5b8e34e9628edab410c528f09c | [] | no_license | thomaslee/flower | https://github.com/thomaslee/flower | fab0737eff4287d7df4dbe1160b1cc061023a084 | fa8ab15548d8f666c3cbad0936e4d128a95b6aab | refs/heads/master | 2016-04-01T19:21:48.112000 | 2014-08-31T23:57:38 | 2014-08-31T23:57:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package flower.leader;
import flower.common.BlockInfo;
import flower.common.Callback;
import flower.common.FileInfo;
public class LeaderAdapter implements Leader {
@Override
public void ping() throws Exception {
}
@Override
public FileInfo info(String path) throws Exception {
return null;
}
@Override
public void range(String path, int firstBlock, int numBlocks, boolean create, Callback<BlockInfo> callable) throws Exception {
}
}
| UTF-8 | Java | 481 | java | LeaderAdapter.java | Java | [] | null | [] | package flower.leader;
import flower.common.BlockInfo;
import flower.common.Callback;
import flower.common.FileInfo;
public class LeaderAdapter implements Leader {
@Override
public void ping() throws Exception {
}
@Override
public FileInfo info(String path) throws Exception {
return null;
}
@Override
public void range(String path, int firstBlock, int numBlocks, boolean create, Callback<BlockInfo> callable) throws Exception {
}
}
| 481 | 0.721414 | 0.721414 | 20 | 23.049999 | 29.52537 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false | 9 |
a4fbdca6279336470c1610c3339d0c3ff4a035ff | 2,997,887,208,969 | 20518e86c7102fb122403006670097eb1f1ddb5b | /src/main/java/com/nix/cinema/infrastructure/CommonUtils.java | 7d43d5b292461f38eea86287cac602782a70c5ff | [] | no_license | kazinarka/final_project | https://github.com/kazinarka/final_project | 8036c9c346bf8cd85e1121eaf5405c1111af6e38 | 2ed9f240c4faba685fa212446d6484c7b3f09ece | refs/heads/main | 2023-08-04T11:42:42.670000 | 2021-09-17T08:52:57 | 2021-09-17T08:52:57 | 406,837,363 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nix.cinema.infrastructure;
import lombok.experimental.UtilityClass;
import java.util.Optional;
import java.util.function.Supplier;
@UtilityClass
public class CommonUtils {
public <T> T safeGet(T object, Supplier<? extends RuntimeException> exceptionSupplier) {
return Optional.ofNullable(object).orElseThrow(exceptionSupplier);
}
}
| UTF-8 | Java | 378 | java | CommonUtils.java | Java | [] | null | [] | package com.nix.cinema.infrastructure;
import lombok.experimental.UtilityClass;
import java.util.Optional;
import java.util.function.Supplier;
@UtilityClass
public class CommonUtils {
public <T> T safeGet(T object, Supplier<? extends RuntimeException> exceptionSupplier) {
return Optional.ofNullable(object).orElseThrow(exceptionSupplier);
}
}
| 378 | 0.748677 | 0.748677 | 14 | 25 | 28.038239 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
91bf4218fdd37d72cfbfb54d0cd43754fb8f132a | 2,997,887,208,611 | 266eeb425d828c728a539106ddcf20588fdf9cdc | /unit-testing/src/main/java/com/example/unittesting/business/SomeBusinessImpl.java | 1fe75523eab1e4fed1f5594227406be2ad818018 | [] | no_license | Megha-Niharika/Unit_Testing | https://github.com/Megha-Niharika/Unit_Testing | 974c6b0220050d29081dbd0e886f4108708e300b | 9908564adf31f7fb74e83b17c3ddbcf1495f3686 | refs/heads/master | 2020-08-01T17:48:38.060000 | 2019-09-26T10:50:52 | 2019-09-26T10:50:52 | 211,066,348 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.unittesting.business;
public class SomeBusinessImpl {
public int calculateSum(int [] data)
{
int sum=0;
for(int value:data)
{
sum+=value;
}
return sum;
}
}
| UTF-8 | Java | 211 | java | SomeBusinessImpl.java | Java | [] | null | [] | package com.example.unittesting.business;
public class SomeBusinessImpl {
public int calculateSum(int [] data)
{
int sum=0;
for(int value:data)
{
sum+=value;
}
return sum;
}
}
| 211 | 0.616114 | 0.611374 | 15 | 12.066667 | 13.674632 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 9 |
a1742b7a40838ed33c388aa05d06db87b9844757 | 8,735,963,511,173 | e4ae207f7d59bdad0620baca0e0d025f0d7c9241 | /src/main/java/com/cbhb/cbhbdetect/QuartzConfiguration.java | 0f1fa26f0b010826fd01db89975b029a73e93f9b | [] | no_license | xiaosos/cbhbdetect_alone | https://github.com/xiaosos/cbhbdetect_alone | 1ca9508026671036e50bb203a31a558fa032e2fd | 89c753a35fa048c14c1baeeeb0da29327db33395 | refs/heads/master | 2021-06-27T14:50:03.388000 | 2020-01-20T06:16:46 | 2020-01-20T06:16:46 | 232,707,188 | 0 | 0 | null | false | 2021-06-04T02:24:46 | 2020-01-09T02:45:23 | 2020-01-20T07:56:28 | 2021-06-04T02:24:45 | 83 | 0 | 0 | 2 | Java | false | false | package com.cbhb.cbhbdetect;
import com.cbhb.job.CronJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
@Configuration
public class QuartzConfiguration {
// @Bean
// public JobDetail pdfJobDetail(){
// return JobBuilder.newJob(InvokePDFJob.class).withIdentity("pdfjob").storeDurably().build();
// }
// @Bean
// public Trigger pdfTrigger(){
// SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever();
// return TriggerBuilder.newTrigger().forJob(pdfJobDetail()).withIdentity("pdfjob").withSchedule(scheduleBuilder).build();
// }
@Bean
public JobDetail cronJobDetail(){
return JobBuilder.newJob(CronJob.class).withIdentity("cronJob").storeDurably().build();
}
@Bean
public Trigger cronTrigger(){
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0 30 23 * * ? *").withMisfireHandlingInstructionDoNothing();
return TriggerBuilder.newTrigger().forJob(cronJobDetail()).withIdentity("crontrigger").withSchedule(scheduleBuilder).build();
}
}
| UTF-8 | Java | 1,404 | java | QuartzConfiguration.java | Java | [] | null | [] | package com.cbhb.cbhbdetect;
import com.cbhb.job.CronJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
@Configuration
public class QuartzConfiguration {
// @Bean
// public JobDetail pdfJobDetail(){
// return JobBuilder.newJob(InvokePDFJob.class).withIdentity("pdfjob").storeDurably().build();
// }
// @Bean
// public Trigger pdfTrigger(){
// SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever();
// return TriggerBuilder.newTrigger().forJob(pdfJobDetail()).withIdentity("pdfjob").withSchedule(scheduleBuilder).build();
// }
@Bean
public JobDetail cronJobDetail(){
return JobBuilder.newJob(CronJob.class).withIdentity("cronJob").storeDurably().build();
}
@Bean
public Trigger cronTrigger(){
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0 30 23 * * ? *").withMisfireHandlingInstructionDoNothing();
return TriggerBuilder.newTrigger().forJob(cronJobDetail()).withIdentity("crontrigger").withSchedule(scheduleBuilder).build();
}
}
| 1,404 | 0.747863 | 0.742877 | 42 | 32.42857 | 40.146248 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404762 | false | false | 9 |
2f281e445bed6bf6cea559c43516d65810882fec | 22,385,369,576,066 | 28da7038838ff7bc3263cf10684fdfbcb19cd673 | /src/java/main/com/lankr/tv_cloud/web/api/webchat/WebChatInterceptor.java | 6b59bf726d49796527f1fbbe0aa62bbb6a0b84d1 | [] | no_license | hefugu136234/weike_learn | https://github.com/hefugu136234/weike_learn | e2b820b8c550f8a81f7c88968ee43b56c2c32cdb | 5cfa678e8ab124999870a368aae4f5a75d1d5f5c | refs/heads/master | 2021-01-13T16:17:59.246000 | 2017-02-08T09:45:43 | 2017-02-08T09:45:43 | 81,301,335 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lankr.tv_cloud.web.api.webchat;
import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.lankr.tv_cloud.facade.WebchatFacade;
import com.lankr.tv_cloud.model.User;
import com.lankr.tv_cloud.model.WebchatUser;
import com.lankr.tv_cloud.utils.Tools;
import com.lankr.tv_cloud.web.AbsHandlerIntercepor;
import com.lankr.tv_cloud.web.BaseController.Platform;
import com.lankr.tv_cloud.web.api.webchat.util.WebChatMenu;
import com.lankr.tv_cloud.web.api.webchat.util.WxBusinessCommon;
import com.lankr.tv_cloud.web.api.webchat.util.WxShare;
import com.lankr.tv_cloud.web.api.webchat.util.WxUtil;
import com.lankr.tv_cloud.web.api.webchat.vo.WxSignature;
import com.lankr.tv_cloud.web.auth.RequestAuthority;
public class WebChatInterceptor extends AbsHandlerIntercepor {
@Autowired
protected WebchatFacade webchatFacade;
public final static String HANDLE_VISITOR = "handle_visitor";
public final static String NOT_HANDLE_VISITOR = "not_handle_visitor";
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
// TODO Auto-generated method stub
logCurrentTime(request);
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
RequestAuthority requestAuthority = handlerMethod
.getMethodAnnotation(RequestAuthority.class);
/**
* 2016-12-16 添加微信浏览用户的记录
*/
if (requestAuthority != null && controllerMethodView(handlerMethod)
&& !isUser(request)) {
// 除去公共跳转,不是页面,当前未登录
/**
* 1.没有opendid,需要主动授权(获取信息,最后跳转当前页面)
* 获取到opendid,如有user,放入session,若无,检查微信信息是否存放(有存放标志),入伍获取信息
*/
String red_url=preHandleVisitor(request);
if(!Tools.isBlank(red_url)){
response.sendRedirect(red_url);
return false;
}
}
if (requestAuthority != null && requestAuthority.requiredProject()) {
if (!isUser(request)) {
// 无user
boolean viewPage = controllerMethodPage(handlerMethod);
if (viewPage) {
// 页面
onAuthWaiting(request);
response.sendRedirect(dealUrl(request, false));
} else {
// 操作
response.sendRedirect(dealUrl(request, true));
}
return false;
}
}
}
return super.preHandle(request, response, handler);
}
// 检测游客数据
/**
* @he 2016-12-19 1.没有opendid(session),需要主动授权(获取信息,最后跳转当前页面),
* 获取opendid,当有user信息时,直接处于登录状态;
* 若无user,查看到wechatuser,有信息时,存放opneid,标志获取过信息; 若无信息,获取信息后,标志
*
*/
public String preHandleVisitor(HttpServletRequest request) {
//由于前次微信code跳转2次,拿不到
String not_handle_visitor=getValueBySessionKey(NOT_HANDLE_VISITOR, request);
if(!Tools.isBlank(not_handle_visitor)&¬_handle_visitor.equals(NOT_HANDLE_VISITOR)){
//此次没有拿到openid,暂不做处理,等待下次
return null;
}
String currentUrl = getBaseUrl(request);
String openId = getValueBySessionKey(BaseWechatController.OPENID_KEY,
request);
if (Tools.isBlank(openId)) {
// 返回授权页面
return WebChatMenu.authCommonVisitor(currentUrl);
}
// 有opneid
String visitorMark = getValueBySessionKey(HANDLE_VISITOR, request);
if (Tools.isBlank(visitorMark) || !visitorMark.equals(HANDLE_VISITOR)) {
// 没有获取信息标记
/**
* 1.获取webuser信息
*/
WebchatUser webchatUser = webchatFacade
.searchWebChatUserByOpenid(openId);
if (webchatUser == null) {
return WebChatMenu.authCommonVisitor(currentUrl);
}
User user = webchatUser.getUser();
if (user == null) {
// 需要获取用户微信信息,user不存在
if (WxBusinessCommon.judyVisitor(webchatUser)) {
return WebChatMenu.authCommonVisitor(currentUrl);
}
// 不获取用户信息,标志信息获取
setValueBySessionKey(HANDLE_VISITOR, HANDLE_VISITOR, request);
}
}
return null;
}
public boolean controllerMethodPage(HandlerMethod handlerMethod) {
ResponseBody responseBody = handlerMethod
.getMethodAnnotation(ResponseBody.class);
if (responseBody == null) {
return true;
}
return false;
}
public boolean controllerMethodView(HandlerMethod handlerMethod) {
Method method = handlerMethod.getMethod();
if (method == null) {
return false;
}
Class<?> reTypeClass = method.getReturnType();
if (reTypeClass == null) {
return false;
}
String pageView = reTypeClass.getSimpleName();
if (Tools.isBlank(pageView)) {
return false;
}
if ("ModelAndView".equals(pageView)) {
return true;
}
return false;
}
// 此处添加微信jssdk签名
@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// TODO Auto-generated method stub
super.postHandle(request, response, handler, modelAndView);
if (modelAndView == null) {
return;
}
String viewName = modelAndView.getViewName();
// System.out.println("modelAndView:"+viewName);
// 如果为跳转页面,则不加分享签名(只在跳转页面里面加)
if (viewName.startsWith("redirect:")) {
return;
}
if (!(handler instanceof HandlerMethod)) {
return;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
RequestAuthority requestAuthority = handlerMethod
.getMethodAnnotation(RequestAuthority.class);
if (requestAuthority == null) {
return;
}
int shareType = requestAuthority.wxShareType();
if (shareType == WxSignature.WX_NO_SHARE) {
// 不分享
return;
}
// System.out.println("modelAndView:"+modelAndView.getViewName());
String localHref = getBaseUrl(request);
WxSignature wxSignature = WxUtil.getWxSignature(localHref);
User user = getCurrentUser(request);
WxShare.buildWxSignatureDetail(request, viewName, shareType, localHref,
user, wxSignature);
request.setAttribute("wx_signature", wxSignature);
}
@Override
public Platform platform() {
return Platform.WECHAT;
}
@Override
public User getCurrentUser(HttpServletRequest request) {
Integer userId = (Integer) request.getSession().getAttribute(
BaseWechatController.USER_SESSION_KEY);
if (userId == null)
return null;
return getCacheUser(userId);
}
// 判断用户详情的入口
public boolean isUser(HttpServletRequest request) {
User user = getCurrentUser(request);
if (user == null) {
return false;
}
return true;
}
protected void setCurrentSessionUser(User user, HttpServletRequest request) {
if (user != null) {
userCache().put(user.getId(), user);
request.getSession().setAttribute(
BaseWechatController.USER_SESSION_KEY, user.getId());
}
}
protected void onAuthWaiting(HttpServletRequest request) {
try {
HttpSession session = request.getSession();
if (session != null) {
// session.setAttribute(BaseWechatController.WX_FOUND_PRIOR_URL,
// request.getRequestURL().toString());
session.setAttribute(BaseWechatController.WX_FOUND_PRIOR_URL,
getBaseUrl(request));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
protected String getValueBySessionKey(String key, HttpServletRequest request) {
HttpSession session = request.getSession();
if (session == null)
return null;
return session.getAttribute(key) == null ? null : request.getSession()
.getAttribute(key).toString();
}
protected void setValueBySessionKey(String key, String value,
HttpServletRequest request) {
HttpSession session = request.getSession();
if (session == null)
return;
session.setAttribute(key, value);
}
// 当session失效时,Interceptor处理的跳转链接
public String dealUrl(HttpServletRequest request, boolean body) {
String url = "";
if (body) {
url = BaseWechatController.WX_INDEX;
} else {
url = getBaseUrl(request);
}
// 此处无user
String openId = getValueBySessionKey(BaseWechatController.OPENID_KEY,
request);
System.out.println("过滤器的openid: " + openId);
if (openId != null && !openId.isEmpty()) {
// 当openid存在时,不必走授权
WebchatUser webchatUser = webchatFacade
.searchWebChatUserByOpenid(openId);
if (webchatUser == null) {
// 登录
url = BaseWechatController.WX_LOGIN;
} else {
User user = webchatUser.getUser();
if (user == null) {
url = BaseWechatController.WX_LOGIN;
} else {
if (!BaseWechatController.loginIsAbel(user)) {
// 无登录权限
url = BaseWechatController.WX_ABLE_LOGIN;
} else {
// 可以登录url 不变
setCurrentSessionUser(user, request);
}
}
}
} else {
// 授权链接
url = WebChatMenu.authCommonUrl(url);
}
System.out.println("过滤器的url:" + url);
return url;
}
}
| UTF-8 | Java | 9,441 | java | WebChatInterceptor.java | Java | [] | null | [] | package com.lankr.tv_cloud.web.api.webchat;
import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.lankr.tv_cloud.facade.WebchatFacade;
import com.lankr.tv_cloud.model.User;
import com.lankr.tv_cloud.model.WebchatUser;
import com.lankr.tv_cloud.utils.Tools;
import com.lankr.tv_cloud.web.AbsHandlerIntercepor;
import com.lankr.tv_cloud.web.BaseController.Platform;
import com.lankr.tv_cloud.web.api.webchat.util.WebChatMenu;
import com.lankr.tv_cloud.web.api.webchat.util.WxBusinessCommon;
import com.lankr.tv_cloud.web.api.webchat.util.WxShare;
import com.lankr.tv_cloud.web.api.webchat.util.WxUtil;
import com.lankr.tv_cloud.web.api.webchat.vo.WxSignature;
import com.lankr.tv_cloud.web.auth.RequestAuthority;
public class WebChatInterceptor extends AbsHandlerIntercepor {
@Autowired
protected WebchatFacade webchatFacade;
public final static String HANDLE_VISITOR = "handle_visitor";
public final static String NOT_HANDLE_VISITOR = "not_handle_visitor";
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
// TODO Auto-generated method stub
logCurrentTime(request);
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
RequestAuthority requestAuthority = handlerMethod
.getMethodAnnotation(RequestAuthority.class);
/**
* 2016-12-16 添加微信浏览用户的记录
*/
if (requestAuthority != null && controllerMethodView(handlerMethod)
&& !isUser(request)) {
// 除去公共跳转,不是页面,当前未登录
/**
* 1.没有opendid,需要主动授权(获取信息,最后跳转当前页面)
* 获取到opendid,如有user,放入session,若无,检查微信信息是否存放(有存放标志),入伍获取信息
*/
String red_url=preHandleVisitor(request);
if(!Tools.isBlank(red_url)){
response.sendRedirect(red_url);
return false;
}
}
if (requestAuthority != null && requestAuthority.requiredProject()) {
if (!isUser(request)) {
// 无user
boolean viewPage = controllerMethodPage(handlerMethod);
if (viewPage) {
// 页面
onAuthWaiting(request);
response.sendRedirect(dealUrl(request, false));
} else {
// 操作
response.sendRedirect(dealUrl(request, true));
}
return false;
}
}
}
return super.preHandle(request, response, handler);
}
// 检测游客数据
/**
* @he 2016-12-19 1.没有opendid(session),需要主动授权(获取信息,最后跳转当前页面),
* 获取opendid,当有user信息时,直接处于登录状态;
* 若无user,查看到wechatuser,有信息时,存放opneid,标志获取过信息; 若无信息,获取信息后,标志
*
*/
public String preHandleVisitor(HttpServletRequest request) {
//由于前次微信code跳转2次,拿不到
String not_handle_visitor=getValueBySessionKey(NOT_HANDLE_VISITOR, request);
if(!Tools.isBlank(not_handle_visitor)&¬_handle_visitor.equals(NOT_HANDLE_VISITOR)){
//此次没有拿到openid,暂不做处理,等待下次
return null;
}
String currentUrl = getBaseUrl(request);
String openId = getValueBySessionKey(BaseWechatController.OPENID_KEY,
request);
if (Tools.isBlank(openId)) {
// 返回授权页面
return WebChatMenu.authCommonVisitor(currentUrl);
}
// 有opneid
String visitorMark = getValueBySessionKey(HANDLE_VISITOR, request);
if (Tools.isBlank(visitorMark) || !visitorMark.equals(HANDLE_VISITOR)) {
// 没有获取信息标记
/**
* 1.获取webuser信息
*/
WebchatUser webchatUser = webchatFacade
.searchWebChatUserByOpenid(openId);
if (webchatUser == null) {
return WebChatMenu.authCommonVisitor(currentUrl);
}
User user = webchatUser.getUser();
if (user == null) {
// 需要获取用户微信信息,user不存在
if (WxBusinessCommon.judyVisitor(webchatUser)) {
return WebChatMenu.authCommonVisitor(currentUrl);
}
// 不获取用户信息,标志信息获取
setValueBySessionKey(HANDLE_VISITOR, HANDLE_VISITOR, request);
}
}
return null;
}
public boolean controllerMethodPage(HandlerMethod handlerMethod) {
ResponseBody responseBody = handlerMethod
.getMethodAnnotation(ResponseBody.class);
if (responseBody == null) {
return true;
}
return false;
}
public boolean controllerMethodView(HandlerMethod handlerMethod) {
Method method = handlerMethod.getMethod();
if (method == null) {
return false;
}
Class<?> reTypeClass = method.getReturnType();
if (reTypeClass == null) {
return false;
}
String pageView = reTypeClass.getSimpleName();
if (Tools.isBlank(pageView)) {
return false;
}
if ("ModelAndView".equals(pageView)) {
return true;
}
return false;
}
// 此处添加微信jssdk签名
@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// TODO Auto-generated method stub
super.postHandle(request, response, handler, modelAndView);
if (modelAndView == null) {
return;
}
String viewName = modelAndView.getViewName();
// System.out.println("modelAndView:"+viewName);
// 如果为跳转页面,则不加分享签名(只在跳转页面里面加)
if (viewName.startsWith("redirect:")) {
return;
}
if (!(handler instanceof HandlerMethod)) {
return;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
RequestAuthority requestAuthority = handlerMethod
.getMethodAnnotation(RequestAuthority.class);
if (requestAuthority == null) {
return;
}
int shareType = requestAuthority.wxShareType();
if (shareType == WxSignature.WX_NO_SHARE) {
// 不分享
return;
}
// System.out.println("modelAndView:"+modelAndView.getViewName());
String localHref = getBaseUrl(request);
WxSignature wxSignature = WxUtil.getWxSignature(localHref);
User user = getCurrentUser(request);
WxShare.buildWxSignatureDetail(request, viewName, shareType, localHref,
user, wxSignature);
request.setAttribute("wx_signature", wxSignature);
}
@Override
public Platform platform() {
return Platform.WECHAT;
}
@Override
public User getCurrentUser(HttpServletRequest request) {
Integer userId = (Integer) request.getSession().getAttribute(
BaseWechatController.USER_SESSION_KEY);
if (userId == null)
return null;
return getCacheUser(userId);
}
// 判断用户详情的入口
public boolean isUser(HttpServletRequest request) {
User user = getCurrentUser(request);
if (user == null) {
return false;
}
return true;
}
protected void setCurrentSessionUser(User user, HttpServletRequest request) {
if (user != null) {
userCache().put(user.getId(), user);
request.getSession().setAttribute(
BaseWechatController.USER_SESSION_KEY, user.getId());
}
}
protected void onAuthWaiting(HttpServletRequest request) {
try {
HttpSession session = request.getSession();
if (session != null) {
// session.setAttribute(BaseWechatController.WX_FOUND_PRIOR_URL,
// request.getRequestURL().toString());
session.setAttribute(BaseWechatController.WX_FOUND_PRIOR_URL,
getBaseUrl(request));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
protected String getValueBySessionKey(String key, HttpServletRequest request) {
HttpSession session = request.getSession();
if (session == null)
return null;
return session.getAttribute(key) == null ? null : request.getSession()
.getAttribute(key).toString();
}
protected void setValueBySessionKey(String key, String value,
HttpServletRequest request) {
HttpSession session = request.getSession();
if (session == null)
return;
session.setAttribute(key, value);
}
// 当session失效时,Interceptor处理的跳转链接
public String dealUrl(HttpServletRequest request, boolean body) {
String url = "";
if (body) {
url = BaseWechatController.WX_INDEX;
} else {
url = getBaseUrl(request);
}
// 此处无user
String openId = getValueBySessionKey(BaseWechatController.OPENID_KEY,
request);
System.out.println("过滤器的openid: " + openId);
if (openId != null && !openId.isEmpty()) {
// 当openid存在时,不必走授权
WebchatUser webchatUser = webchatFacade
.searchWebChatUserByOpenid(openId);
if (webchatUser == null) {
// 登录
url = BaseWechatController.WX_LOGIN;
} else {
User user = webchatUser.getUser();
if (user == null) {
url = BaseWechatController.WX_LOGIN;
} else {
if (!BaseWechatController.loginIsAbel(user)) {
// 无登录权限
url = BaseWechatController.WX_ABLE_LOGIN;
} else {
// 可以登录url 不变
setCurrentSessionUser(user, request);
}
}
}
} else {
// 授权链接
url = WebChatMenu.authCommonUrl(url);
}
System.out.println("过滤器的url:" + url);
return url;
}
}
| 9,441 | 0.717279 | 0.714989 | 298 | 28.305368 | 22.66011 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.758389 | false | false | 9 |
67b127a9d6c56a346623c1434bc5caf62768d6bf | 15,530,601,777,435 | 316f9472ce5332f02e9047bb77d58bf7e50713dd | /src/main/java/per/lai/forum/pojo/dto/ReceivedUser.java | 014e1176717d60d288c5fe267a020e776efb0062 | [] | no_license | JMTBB/forum-backend | https://github.com/JMTBB/forum-backend | 94dd0e1cf1bce5015ba8ca8c4aa46360fc4efafc | 7a95dc11e08c46fb3e8e033ef197577a65a5a5f0 | refs/heads/master | 2023-03-14T18:31:32.114000 | 2021-03-21T07:25:28 | 2021-03-21T07:25:28 | 349,927,439 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package per.lai.forum.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ReceivedUser {
private int id;
private String name;
private String job;
private String phone;
private String address;
private int exp;
boolean checkIntegrity() {
return id != 0 && StringUtils.hasText(name);
}
}
| UTF-8 | Java | 476 | java | ReceivedUser.java | Java | [] | null | [] | package per.lai.forum.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ReceivedUser {
private int id;
private String name;
private String job;
private String phone;
private String address;
private int exp;
boolean checkIntegrity() {
return id != 0 && StringUtils.hasText(name);
}
}
| 476 | 0.733193 | 0.731092 | 22 | 20.636364 | 13.966016 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 9 |
dbcce59c5ef50aa8658f5d978801b4c2dc530da0 | 5,360,119,222,289 | 9918379689de9ff2be37b76573184c6cc8b7bf36 | /src/balls/BallsSimulator.java | 4e63cffd829a07a2748368e4c67f04eefc84259e | [] | no_license | GastonF5/Systemes-multiagents | https://github.com/GastonF5/Systemes-multiagents | 0a8d7f93de35be398593cb69813e7d7cc7ad0ff3 | edc3088bd81014dfee0a9b29c9fd2b493313c82e | refs/heads/main | 2022-12-29T16:02:53.785000 | 2020-10-19T11:14:20 | 2020-10-19T11:14:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package balls;
import gui.Simulable;
import gui.GUISimulator;
import events.EventManager;
import events.BallsEvent;
/**
* BallsSimulator is a class implementing the Simulable interface.
* This class also uses an EventManager.
*
* @see Simulable
* @see EventManager
*/
public class BallsSimulator implements Simulable {
/**
* Event manager of the simulator.
*/
private EventManager manager;
private Balls balls;
private GUISimulator gui;
/**
* Constructor of BallsSimulator.
* Initializes the event manager.
*
* @param balls
* Balls object.
* @see Balls
* @param gui
* GUISimulator object.
* @see GUISimulator
*/
public BallsSimulator(Balls balls, GUISimulator gui) {
this.balls = balls;
this.gui = gui;
manager = new EventManager();
manager.addEvent(new BallsEvent(0, balls, gui, manager));
}
/**
* @see EventManager#next
*/
public void next() {
manager.next();
}
/**
* Restarts the simulator.
* Adds the first event of the simulation.
*
* @see EventManager#restart
* @see EventManager#addEvent
*/
public void restart() {
manager.restart();
manager.addEvent(new BallsEvent(0, balls, gui, manager));
}
} | UTF-8 | Java | 1,191 | java | BallsSimulator.java | Java | [] | null | [] | package balls;
import gui.Simulable;
import gui.GUISimulator;
import events.EventManager;
import events.BallsEvent;
/**
* BallsSimulator is a class implementing the Simulable interface.
* This class also uses an EventManager.
*
* @see Simulable
* @see EventManager
*/
public class BallsSimulator implements Simulable {
/**
* Event manager of the simulator.
*/
private EventManager manager;
private Balls balls;
private GUISimulator gui;
/**
* Constructor of BallsSimulator.
* Initializes the event manager.
*
* @param balls
* Balls object.
* @see Balls
* @param gui
* GUISimulator object.
* @see GUISimulator
*/
public BallsSimulator(Balls balls, GUISimulator gui) {
this.balls = balls;
this.gui = gui;
manager = new EventManager();
manager.addEvent(new BallsEvent(0, balls, gui, manager));
}
/**
* @see EventManager#next
*/
public void next() {
manager.next();
}
/**
* Restarts the simulator.
* Adds the first event of the simulation.
*
* @see EventManager#restart
* @see EventManager#addEvent
*/
public void restart() {
manager.restart();
manager.addEvent(new BallsEvent(0, balls, gui, manager));
}
} | 1,191 | 0.687657 | 0.685978 | 59 | 19.20339 | 16.652765 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.305085 | false | false | 9 |
3b90c3303f3e5810191904d4b2ac80703610147e | 5,360,119,219,355 | 30669bf645dd63e4113efab50763678ef9dac057 | /RMIChatCliente/src/rmichat/Evento.java | 3c12e78504980feb352d0262e4d57169e5568eb1 | [] | no_license | Lifka/Chat-Java-RMI | https://github.com/Lifka/Chat-Java-RMI | 58b88d3545284e59b2c7fe01ea2a1bf4fd6a5a89 | 89f073b8e30105d572b6693d3fff9a2f9b7c828f | refs/heads/master | 2021-01-13T06:23:58.316000 | 2016-05-24T14:35:20 | 2016-05-24T14:35:20 | 59,546,088 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /****************************************
* Izquierdo Vera, Javier
* javierizquierdovera@gmail.com
***************************************/
package rmichat;
public enum Evento {
/************ Eventos sala de chat ******************/
CONECTADO, DESCONECTADO, MENSAJE, FIN_CONEXION,
/************ Eventos para privado: P2P **************/
NUEVO_CONTACTO, ELIMINAR_CONTACTO, MENSAJE_PRIVADO,
DESCONECTADO_PRIVADO, INICIAR_PRIVADO,
CONEXION_CERRADA_PRIVADO, ACTUALIZAR_PRIVADO
}
| UTF-8 | Java | 538 | java | Evento.java | Java | [
{
"context": "/****************************************\n * Izquierdo Vera, Javier\n * javierizquierdovera@gmail.com\n ***",
"end": 64,
"score": 0.9327516555786133,
"start": 50,
"tag": "NAME",
"value": "Izquierdo Vera"
},
{
"context": "**************************\n * Iz... | null | [] | /****************************************
* <NAME>, Javier
* <EMAIL>
***************************************/
package rmichat;
public enum Evento {
/************ Eventos sala de chat ******************/
CONECTADO, DESCONECTADO, MENSAJE, FIN_CONEXION,
/************ Eventos para privado: P2P **************/
NUEVO_CONTACTO, ELIMINAR_CONTACTO, MENSAJE_PRIVADO,
DESCONECTADO_PRIVADO, INICIAR_PRIVADO,
CONEXION_CERRADA_PRIVADO, ACTUALIZAR_PRIVADO
}
| 508 | 0.498141 | 0.496283 | 16 | 32.625 | 21.862854 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
5b3f6be7f2953df64b44a8ee9fd72f9702185800 | 33,663,953,696,229 | 5a3d2e24875b23f82350f398041e2a0c2981d444 | /src/tag/bst/Searcha2DMatrixII_240.java | ee13c3ae6d048388bbeb7e299363ae12ea3b3389 | [
"MIT"
] | permissive | HaomingChen/LeetCodeNotes | https://github.com/HaomingChen/LeetCodeNotes | 009b2eabd057ff99f5c214b899e9495bea2a25c5 | 498da18a92a4fc5a2d5b6059f634142e6801fb08 | refs/heads/master | 2021-08-26T05:41:56.691000 | 2021-08-25T18:28:38 | 2021-08-25T18:28:38 | 124,029,045 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tag.bst;
/**
* Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
*
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
*
* @author 58212
* @date 2019-11-14 0:14
*/
public class Searcha2DMatrixII_240 {
public boolean searchMatrix(int[][] matrix, int target) {
if(matrix.length == 0 || matrix[0].length == 0){
return false;
}
int col = matrix[0].length - 1;
int row = 0;
while(col > -1 || row < matrix.length){
if(matrix[row][col] == target){
return true;
}
if(col == 0 && matrix[row][0] > target){
return false;
}
if(row == matrix.length - 1 && matrix[matrix.length - 1][col] < target){
return false;
}
if(matrix[row][col] > target){
col--;
}else{
row++;
}
}
return false;
}
}
| UTF-8 | Java | 1,111 | java | Searcha2DMatrixII_240.java | Java | [
{
"context": "ed in ascending from top to bottom.\n *\n * @author 58212\n * @date 2019-11-14 0:14\n */\npublic class Searcha",
"end": 303,
"score": 0.9986462593078613,
"start": 298,
"tag": "USERNAME",
"value": "58212"
}
] | null | [] | package tag.bst;
/**
* Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
*
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
*
* @author 58212
* @date 2019-11-14 0:14
*/
public class Searcha2DMatrixII_240 {
public boolean searchMatrix(int[][] matrix, int target) {
if(matrix.length == 0 || matrix[0].length == 0){
return false;
}
int col = matrix[0].length - 1;
int row = 0;
while(col > -1 || row < matrix.length){
if(matrix[row][col] == target){
return true;
}
if(col == 0 && matrix[row][0] > target){
return false;
}
if(row == matrix.length - 1 && matrix[matrix.length - 1][col] < target){
return false;
}
if(matrix[row][col] > target){
col--;
}else{
row++;
}
}
return false;
}
}
| 1,111 | 0.509451 | 0.481548 | 39 | 27.487179 | 26.087498 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 9 |
20e677f24031bc8c87ce83ca0c0c8dcff17228ac | 3,925,600,167,719 | 95e41a9583a3f90851db6d6a3af3212d41d8838c | /src/main/java/com/java/practise/optimisation/TestClass.java | 2164c1706679e7abf473d91044f4a5004b9da028 | [] | no_license | Dharmu-I/java-practise | https://github.com/Dharmu-I/java-practise | 606ab4dd9ffd4920f73aa6485fa2e56716376670 | be51671074af454e73fb55fd9cd1a9b2eae28e21 | refs/heads/master | 2023-06-22T07:09:28.316000 | 2022-03-11T06:09:27 | 2022-03-11T06:09:27 | 230,863,387 | 0 | 0 | null | false | 2023-06-14T22:33:05 | 2019-12-30T06:47:14 | 2022-03-11T06:09:03 | 2023-06-14T22:33:04 | 976 | 0 | 0 | 4 | Java | false | false | package com.java.practise.optimisation;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
public class TestClass {
@Test
public void testClassMethod() {
Map<Person,Integer> map = new HashMap<>();
for (int i=0; i< 100; i++){
map.put(new Person("Jon"),1);
}
Assert.assertEquals(map.size(),1);
}
}
| UTF-8 | Java | 401 | java | TestClass.java | Java | [
{
"context": "=0; i< 100; i++){\n map.put(new Person(\"Jon\"),1);\n }\n Assert.assertEquals(map.s",
"end": 333,
"score": 0.9985368847846985,
"start": 330,
"tag": "NAME",
"value": "Jon"
}
] | null | [] | package com.java.practise.optimisation;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
public class TestClass {
@Test
public void testClassMethod() {
Map<Person,Integer> map = new HashMap<>();
for (int i=0; i< 100; i++){
map.put(new Person("Jon"),1);
}
Assert.assertEquals(map.size(),1);
}
}
| 401 | 0.613466 | 0.598504 | 19 | 20.105263 | 16.424932 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 9 |
b3f98849292ba4e61b493e4281e64124ea5127e1 | 22,256,520,567,252 | 726b9c9fa3ff704c62a3a6b288371b27d21321b9 | /src/main/java/by/vchernukha/demo/dto/account/ClientAccountDTO.java | 88e81c211587a185598ae2f43bc4e0df0ff3f8dc | [] | no_license | vitalikchernukha/demo | https://github.com/vitalikchernukha/demo | d89c7b813af7ae297f6e5cee6c91a9d55552f6b9 | d9dc5c8a28711a5713551116e1ca226bde4ec52c | refs/heads/master | 2022-10-02T17:29:08.248000 | 2020-06-01T10:23:23 | 2020-06-01T10:23:23 | 268,475,562 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.vchernukha.demo.dto.account;
import by.vchernukha.demo.dto.client.ClientDTO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ClientAccountDTO {
private Long id;
private ClientDTO client;
private BigDecimal balance;
}
| UTF-8 | Java | 405 | java | ClientAccountDTO.java | Java | [] | null | [] | package by.vchernukha.demo.dto.account;
import by.vchernukha.demo.dto.client.ClientDTO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ClientAccountDTO {
private Long id;
private ClientDTO client;
private BigDecimal balance;
}
| 405 | 0.802469 | 0.802469 | 21 | 18.285715 | 14.531223 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 9 |
422c103dba7f6c49eaf89228683cfc6bf4f0c603 | 22,256,520,565,140 | 2cd64269df4137e0a39e8e67063ff3bd44d72f1b | /commercetools/commercetools-sdk-java-api/src/main/java-predicates-generated/com/commercetools/api/predicates/query/business_unit/BusinessUnitChangeAssociateActionQueryBuilderDsl.java | daab8ed9fdfe50096d0ece5ac93fb7add5a804ca | [
"Apache-2.0",
"GPL-2.0-only",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"BSD-3-Clause",
"Classpath-exception-2.0"
] | permissive | commercetools/commercetools-sdk-java-v2 | https://github.com/commercetools/commercetools-sdk-java-v2 | a8703f5f8c5dde6cc3ebe4619c892cccfcf71cb8 | 76d5065566ff37d365c28829b8137cbc48f14df1 | refs/heads/main | 2023-08-14T16:16:38.709000 | 2023-08-14T11:58:19 | 2023-08-14T11:58:19 | 206,558,937 | 29 | 13 | Apache-2.0 | false | 2023-09-14T12:30:00 | 2019-09-05T12:30:27 | 2023-08-25T13:41:43 | 2023-09-14T12:29:59 | 549,563 | 27 | 13 | 16 | Java | false | false |
package com.commercetools.api.predicates.query.business_unit;
import java.util.function.Function;
import com.commercetools.api.predicates.query.*;
public class BusinessUnitChangeAssociateActionQueryBuilderDsl {
public BusinessUnitChangeAssociateActionQueryBuilderDsl() {
}
public static BusinessUnitChangeAssociateActionQueryBuilderDsl of() {
return new BusinessUnitChangeAssociateActionQueryBuilderDsl();
}
public StringComparisonPredicateBuilder<BusinessUnitChangeAssociateActionQueryBuilderDsl> action() {
return new StringComparisonPredicateBuilder<>(
BinaryQueryPredicate.of().left(new ConstantQueryPredicate("action")),
p -> new CombinationQueryPredicate<>(p, BusinessUnitChangeAssociateActionQueryBuilderDsl::of));
}
public CombinationQueryPredicate<BusinessUnitChangeAssociateActionQueryBuilderDsl> associate(
Function<com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl, CombinationQueryPredicate<com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl>> fn) {
return new CombinationQueryPredicate<>(
ContainerQueryPredicate.of()
.parent(ConstantQueryPredicate.of().constant("associate"))
.inner(fn.apply(
com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl.of())),
BusinessUnitChangeAssociateActionQueryBuilderDsl::of);
}
}
| UTF-8 | Java | 1,511 | java | BusinessUnitChangeAssociateActionQueryBuilderDsl.java | Java | [] | null | [] |
package com.commercetools.api.predicates.query.business_unit;
import java.util.function.Function;
import com.commercetools.api.predicates.query.*;
public class BusinessUnitChangeAssociateActionQueryBuilderDsl {
public BusinessUnitChangeAssociateActionQueryBuilderDsl() {
}
public static BusinessUnitChangeAssociateActionQueryBuilderDsl of() {
return new BusinessUnitChangeAssociateActionQueryBuilderDsl();
}
public StringComparisonPredicateBuilder<BusinessUnitChangeAssociateActionQueryBuilderDsl> action() {
return new StringComparisonPredicateBuilder<>(
BinaryQueryPredicate.of().left(new ConstantQueryPredicate("action")),
p -> new CombinationQueryPredicate<>(p, BusinessUnitChangeAssociateActionQueryBuilderDsl::of));
}
public CombinationQueryPredicate<BusinessUnitChangeAssociateActionQueryBuilderDsl> associate(
Function<com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl, CombinationQueryPredicate<com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl>> fn) {
return new CombinationQueryPredicate<>(
ContainerQueryPredicate.of()
.parent(ConstantQueryPredicate.of().constant("associate"))
.inner(fn.apply(
com.commercetools.api.predicates.query.business_unit.AssociateDraftQueryBuilderDsl.of())),
BusinessUnitChangeAssociateActionQueryBuilderDsl::of);
}
}
| 1,511 | 0.756453 | 0.756453 | 31 | 47.709679 | 48.688736 | 221 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.322581 | false | false | 9 |
80feafb916684c85b4b36873ffc26c86056e239f | 32,117,765,482,685 | 0c8c1772b44c0a064b800e44c7088b08b4df3a2e | /app/src/main/java/eugenzh/ru/pravradiopodcast/Models/Repository/Repository.java | d1317104b4bd04cfa7f4feb637893788494fdc7d | [] | no_license | mrpurgen/PravRadioApp | https://github.com/mrpurgen/PravRadioApp | 79721b2ee7f69e9876a5a5b9733d7f2008d7382b | 4acd918a893d0c57f7b1bdc0e53f413d19019ede | refs/heads/master | 2020-05-04T23:22:38.491000 | 2019-08-18T13:40:22 | 2019-08-18T13:40:22 | 179,541,862 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eugenzh.ru.pravradiopodcast.Models.Repository;
public interface Repository {
void requestCategories(HandlerRequestItems handler);
void requestPodcasts(long categoryId, HandlerRequestItems handler);
}
| UTF-8 | Java | 217 | java | Repository.java | Java | [] | null | [] | package eugenzh.ru.pravradiopodcast.Models.Repository;
public interface Repository {
void requestCategories(HandlerRequestItems handler);
void requestPodcasts(long categoryId, HandlerRequestItems handler);
}
| 217 | 0.824885 | 0.824885 | 6 | 35.166668 | 27.431227 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 9 |
84357d7d42a55b74773d9151c725518a820b5daf | 6,021,544,159,089 | 204a6b89a4fb3593515ee650ef87b3743cbf3a13 | /app/src/main/java/org/birdback/histudents/entity/ResponseEntity.java | 0d93320ef17c2b490a85a1ffb3246c9cfc80afb3 | [] | no_license | psuugdufnm/HiStudents | https://github.com/psuugdufnm/HiStudents | 105fba99fb5ad87b092a1e1fd8caf0b90cad5cd5 | 94c7cbd1193e765f947a96d56375873c850f6fe0 | refs/heads/master | 2020-03-08T15:38:14.504000 | 2018-06-12T03:04:17 | 2018-06-12T03:04:17 | 128,217,104 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.birdback.histudents.entity;
import org.birdback.histudents.net.HttpServer;
import java.io.Serializable;
public class ResponseEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
private T data;
private int ok;
private String msg;
public int getOk() {
return ok;
}
public void setOk(int ok) {
this.ok = ok;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getMessage() {
return msg;
}
public void setMessage(String msg) {
this.msg = msg;
}
public boolean isSuccess() {
return ok == HttpServer.SUCCESS;
}
@Override
public String toString() {
return "ResponseEntity{" +
"data=" + data +
", ok=" + ok +
", msg='" + msg + '\'' +
'}';
}
}
| UTF-8 | Java | 958 | java | ResponseEntity.java | Java | [] | null | [] | package org.birdback.histudents.entity;
import org.birdback.histudents.net.HttpServer;
import java.io.Serializable;
public class ResponseEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
private T data;
private int ok;
private String msg;
public int getOk() {
return ok;
}
public void setOk(int ok) {
this.ok = ok;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getMessage() {
return msg;
}
public void setMessage(String msg) {
this.msg = msg;
}
public boolean isSuccess() {
return ok == HttpServer.SUCCESS;
}
@Override
public String toString() {
return "ResponseEntity{" +
"data=" + data +
", ok=" + ok +
", msg='" + msg + '\'' +
'}';
}
}
| 958 | 0.539666 | 0.538622 | 54 | 16.74074 | 16.019878 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.314815 | false | false | 9 |
eb3e7393e4cef9e73b545969921e9b706bdb0f81 | 21,680,994,957,026 | 1e713abe05707d31e35935f926e97a03c66939a7 | /clara-webapp/src/main/java/edu/uams/clara/webapp/report/service/customreport/impl/BudgetApprovalReportImpl.java | 6395cfef1d38443841729dddb47113eec0cc99dc | [] | no_license | bianjiang/clara | https://github.com/bianjiang/clara | b622c475a0aaaf21b150cfa8e2e4e898b510bfe1 | 1d39bb7af2b6fbcd7a8a2655036dd0ef6ffc4fba | refs/heads/master | 2020-05-18T04:15:27.034000 | 2015-06-30T15:43:47 | 2015-06-30T15:43:47 | 15,677,823 | 2 | 0 | null | false | 2014-02-05T14:49:36 | 2014-01-06T15:44:57 | 2014-02-05T14:49:36 | 2014-02-05T14:49:36 | 19,836 | 1 | 0 | 0 | JavaScript | null | null | package edu.uams.clara.webapp.report.service.customreport.impl;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Maps;
import edu.uams.clara.webapp.common.util.DateFormatUtil;
import edu.uams.clara.webapp.report.domain.ReportTemplate;
import edu.uams.clara.webapp.report.service.customreport.CustomReportService;
public class BudgetApprovalReportImpl extends CustomReportService {
private final static Logger logger = LoggerFactory.getLogger(BudgetApprovalReportImpl.class);
private EntityManager em;
@Override
public String generateReportResult(ReportTemplate reportTemplate) {
String finalResultXml = "<report-results>";
Map<String, String> queryCriteriasValueMap = Maps.newHashMap();
queryCriteriasValueMap.put("Budget Approval Date", "6/1/2014 to "+DateFormatUtil.formateDateToMDY(new Date()));
finalResultXml = finalResultXml+generateSummaryCriteriaTable(reportTemplate,
queryCriteriasValueMap);
finalResultXml += "<report-result id=\""+ reportTemplate.getTypeDescription() +"\" created=\""+ DateFormatUtil.formateDateToMDY(new Date()) +"\">";
finalResultXml += "<title>"+ reportTemplate.getDescription() +"</title>";
finalResultXml += "<fields>";
finalResultXml += "<field id=\"protocolid\" desc=\"IRB #\" hidden=\"false\" />";
finalResultXml += "<field id=\"title\" desc=\"Title\" hidden=\"false\" />";
finalResultXml += "<field id=\"budgetapprovaldate\" desc=\"Budget Approval Date\" hidden=\"false\" />";
finalResultXml += "<field id=\"involvecancer\" desc=\"Involve Cancer Drug Treatment \" hidden=\"false\" />";
finalResultXml += "</fields>";
finalResultXml += "<report-items>";
List<Object[]> results = generateQueryResult();
for(Object[] result : results){
try{
BigInteger pid = (BigInteger)result[0];
String title = (String)result[1];
String budgetApprovalDate = (String)result[2];
String involveCancer = (String)result[3];
if(involveCancer.equals("n")){
involveCancer = "No";
}else if(involveCancer.equals("y")){
involveCancer = "Yes";
}
finalResultXml += "<report-item>";
finalResultXml += "<field id=\"" + "protocolid" + "\">";
finalResultXml +="<![CDATA[<a target=\"_blank\" href=\""+this.getAppHost()+"/clara-webapp/protocols/"+pid+"/dashboard\">"+pid+"</a>]]>";
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "title" + "\">";
finalResultXml += title;
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "budgetapprovaldate" + "\">";
finalResultXml += budgetApprovalDate;
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "involvecancer" + "\">";
finalResultXml += involveCancer;
finalResultXml += "</field>";
finalResultXml += "</report-item>";
}catch(Exception e){
logger.debug((BigInteger)result[0]+"");
e.printStackTrace();
}
}
finalResultXml += "</report-items>";
finalResultXml += "</report-result>";
finalResultXml += "</report-results>";
finalResultXml = finalResultXml.replaceAll("&", "&");
finalResultXml =finalResultXml.replace("<![CDATA[null]]>", "");
finalResultXml =finalResultXml.replace(">null", ">");
finalResultXml =finalResultXml.replace("null<br>", "");
logger.debug(finalResultXml);
return finalResultXml;
}
private List<Object[]> generateQueryResult(){
String queryStatement = "select id, meta_data_xml.value('(/protocol/title/text())[1]','varchar(max)') as title, meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)') as involvecancertreat, meta_data_xml.value('(/protocol/epic/involve-chemotherapy/text())[1]','varchar(100)') as budgetapprovaldate from protocol where retired = 0 and meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)') is not null and Datediff(Day, meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)'), '2014-06-01')<0";
Query query = em.createNativeQuery(queryStatement);
List<Object[]> results = (List<Object[]>) query.getResultList();
return results;
}
public EntityManager getEm() {
return em;
}
@PersistenceContext(unitName = "defaultPersistenceUnit")
public void setEm(EntityManager em) {
this.em = em;
}
}
| UTF-8 | Java | 4,617 | java | BudgetApprovalReportImpl.java | Java | [] | null | [] | package edu.uams.clara.webapp.report.service.customreport.impl;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Maps;
import edu.uams.clara.webapp.common.util.DateFormatUtil;
import edu.uams.clara.webapp.report.domain.ReportTemplate;
import edu.uams.clara.webapp.report.service.customreport.CustomReportService;
public class BudgetApprovalReportImpl extends CustomReportService {
private final static Logger logger = LoggerFactory.getLogger(BudgetApprovalReportImpl.class);
private EntityManager em;
@Override
public String generateReportResult(ReportTemplate reportTemplate) {
String finalResultXml = "<report-results>";
Map<String, String> queryCriteriasValueMap = Maps.newHashMap();
queryCriteriasValueMap.put("Budget Approval Date", "6/1/2014 to "+DateFormatUtil.formateDateToMDY(new Date()));
finalResultXml = finalResultXml+generateSummaryCriteriaTable(reportTemplate,
queryCriteriasValueMap);
finalResultXml += "<report-result id=\""+ reportTemplate.getTypeDescription() +"\" created=\""+ DateFormatUtil.formateDateToMDY(new Date()) +"\">";
finalResultXml += "<title>"+ reportTemplate.getDescription() +"</title>";
finalResultXml += "<fields>";
finalResultXml += "<field id=\"protocolid\" desc=\"IRB #\" hidden=\"false\" />";
finalResultXml += "<field id=\"title\" desc=\"Title\" hidden=\"false\" />";
finalResultXml += "<field id=\"budgetapprovaldate\" desc=\"Budget Approval Date\" hidden=\"false\" />";
finalResultXml += "<field id=\"involvecancer\" desc=\"Involve Cancer Drug Treatment \" hidden=\"false\" />";
finalResultXml += "</fields>";
finalResultXml += "<report-items>";
List<Object[]> results = generateQueryResult();
for(Object[] result : results){
try{
BigInteger pid = (BigInteger)result[0];
String title = (String)result[1];
String budgetApprovalDate = (String)result[2];
String involveCancer = (String)result[3];
if(involveCancer.equals("n")){
involveCancer = "No";
}else if(involveCancer.equals("y")){
involveCancer = "Yes";
}
finalResultXml += "<report-item>";
finalResultXml += "<field id=\"" + "protocolid" + "\">";
finalResultXml +="<![CDATA[<a target=\"_blank\" href=\""+this.getAppHost()+"/clara-webapp/protocols/"+pid+"/dashboard\">"+pid+"</a>]]>";
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "title" + "\">";
finalResultXml += title;
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "budgetapprovaldate" + "\">";
finalResultXml += budgetApprovalDate;
finalResultXml += "</field>";
finalResultXml += "<field id=\"" + "involvecancer" + "\">";
finalResultXml += involveCancer;
finalResultXml += "</field>";
finalResultXml += "</report-item>";
}catch(Exception e){
logger.debug((BigInteger)result[0]+"");
e.printStackTrace();
}
}
finalResultXml += "</report-items>";
finalResultXml += "</report-result>";
finalResultXml += "</report-results>";
finalResultXml = finalResultXml.replaceAll("&", "&");
finalResultXml =finalResultXml.replace("<![CDATA[null]]>", "");
finalResultXml =finalResultXml.replace(">null", ">");
finalResultXml =finalResultXml.replace("null<br>", "");
logger.debug(finalResultXml);
return finalResultXml;
}
private List<Object[]> generateQueryResult(){
String queryStatement = "select id, meta_data_xml.value('(/protocol/title/text())[1]','varchar(max)') as title, meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)') as involvecancertreat, meta_data_xml.value('(/protocol/epic/involve-chemotherapy/text())[1]','varchar(100)') as budgetapprovaldate from protocol where retired = 0 and meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)') is not null and Datediff(Day, meta_data_xml.value('(/protocol/summary/budget-determination/approval-date/text())[1]','varchar(100)'), '2014-06-01')<0";
Query query = em.createNativeQuery(queryStatement);
List<Object[]> results = (List<Object[]>) query.getResultList();
return results;
}
public EntityManager getEm() {
return em;
}
@PersistenceContext(unitName = "defaultPersistenceUnit")
public void setEm(EntityManager em) {
this.em = em;
}
}
| 4,617 | 0.692874 | 0.684211 | 119 | 37.798321 | 63.6175 | 642 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.773109 | false | false | 9 |
3bf1a69eea1bac7f34a4e0f0dc25f896550c57f5 | 3,178,275,866,160 | 9e62f35851f6910697d1e99e4bf9b1d0c5308b8b | /app/src/main/java/com/bajzat/ubbnews/adapter/FeedListAdapter.java | c3aa81e7c9977cf1014ac1c965df36ef9b88bf42 | [] | no_license | alexbajzat/UBBNews | https://github.com/alexbajzat/UBBNews | e20340434b59cf8be31daa9751874ff9e9c1ae21 | 3483a23b88695e3393cce48ef6c07982a019f7e5 | refs/heads/master | 2021-01-23T03:08:01.182000 | 2017-04-01T13:33:52 | 2017-04-01T13:33:52 | 86,050,969 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bajzat.ubbnews.adapter;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bajzat.ubbnews.R;
import com.bajzat.ubbnews.model.FeedItem;
import com.bajzat.ubbnews.service.FeedService;
import com.bajzat.ubbnews.util.Observable;
import com.bajzat.ubbnews.util.Observer;
import java.util.ArrayList;
/**
* Created by bjz on 3/25/2017.
*/
public class FeedListAdapter extends RecyclerView.Adapter<FeedListAdapter.ViewHolder> implements Observer {
private ArrayList<FeedItem> dataSet;
public FeedListAdapter(ArrayList<FeedItem> dataSet) {
this.dataSet = dataSet;
}
//create new views invoked by layout manager
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
CardView cardView = (CardView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.feed_item_list, parent, false);
ViewHolder viewHolder = new ViewHolder(cardView);
return viewHolder;
}
//Replace the contents of a view (invoked by layout manager)
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
FeedItem feedItem = dataSet.get(position);
holder.feedDescription.setText(feedItem.getDescription());
holder.feedAuthor.setText(feedItem.getAuthor());
holder.feedDate.setText(feedItem.getPubDate());
holder.feedCategory.setText(feedItem.getCategory());
holder.feedTitle.setText(feedItem.getTitle());
holder.feedContent.setText(feedItem.getContent());
}
@Override
public int getItemCount() {
return dataSet.size();
}
@Override
public void update(Observable observable) {
FeedService service = (FeedService) observable;
dataSet = (ArrayList<FeedItem>) service.getList();
notifyDataSetChanged();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private CardView feed;
protected TextView feedTitle;
protected TextView feedDate;
protected TextView feedAuthor;
protected TextView feedDescription;
protected TextView feedCategory;
protected TextView feedContent;
public ViewHolder(View itemView) {
super(itemView);
feed = (CardView) itemView;
feedTitle = (TextView) itemView.findViewById(R.id.feed_title);
feedDate = (TextView) itemView.findViewById(R.id.feed_date);
feedAuthor = (TextView) itemView.findViewById(R.id.feed_author);
feedDescription = (TextView) itemView.findViewById(R.id.feed_description);
feedCategory = (TextView) itemView.findViewById(R.id.feed_category);
feedContent = (TextView) itemView.findViewById(R.id.feed_content);
feedContent.setVisibility(View.GONE);
}
}
}
| UTF-8 | Java | 3,032 | java | FeedListAdapter.java | Java | [
{
"context": "r;\n\nimport java.util.ArrayList;\n\n/**\n * Created by bjz on 3/25/2017.\n */\n\npublic class FeedListAdapter e",
"end": 532,
"score": 0.9996397495269775,
"start": 529,
"tag": "USERNAME",
"value": "bjz"
}
] | null | [] | package com.bajzat.ubbnews.adapter;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bajzat.ubbnews.R;
import com.bajzat.ubbnews.model.FeedItem;
import com.bajzat.ubbnews.service.FeedService;
import com.bajzat.ubbnews.util.Observable;
import com.bajzat.ubbnews.util.Observer;
import java.util.ArrayList;
/**
* Created by bjz on 3/25/2017.
*/
public class FeedListAdapter extends RecyclerView.Adapter<FeedListAdapter.ViewHolder> implements Observer {
private ArrayList<FeedItem> dataSet;
public FeedListAdapter(ArrayList<FeedItem> dataSet) {
this.dataSet = dataSet;
}
//create new views invoked by layout manager
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
CardView cardView = (CardView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.feed_item_list, parent, false);
ViewHolder viewHolder = new ViewHolder(cardView);
return viewHolder;
}
//Replace the contents of a view (invoked by layout manager)
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
FeedItem feedItem = dataSet.get(position);
holder.feedDescription.setText(feedItem.getDescription());
holder.feedAuthor.setText(feedItem.getAuthor());
holder.feedDate.setText(feedItem.getPubDate());
holder.feedCategory.setText(feedItem.getCategory());
holder.feedTitle.setText(feedItem.getTitle());
holder.feedContent.setText(feedItem.getContent());
}
@Override
public int getItemCount() {
return dataSet.size();
}
@Override
public void update(Observable observable) {
FeedService service = (FeedService) observable;
dataSet = (ArrayList<FeedItem>) service.getList();
notifyDataSetChanged();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private CardView feed;
protected TextView feedTitle;
protected TextView feedDate;
protected TextView feedAuthor;
protected TextView feedDescription;
protected TextView feedCategory;
protected TextView feedContent;
public ViewHolder(View itemView) {
super(itemView);
feed = (CardView) itemView;
feedTitle = (TextView) itemView.findViewById(R.id.feed_title);
feedDate = (TextView) itemView.findViewById(R.id.feed_date);
feedAuthor = (TextView) itemView.findViewById(R.id.feed_author);
feedDescription = (TextView) itemView.findViewById(R.id.feed_description);
feedCategory = (TextView) itemView.findViewById(R.id.feed_category);
feedContent = (TextView) itemView.findViewById(R.id.feed_content);
feedContent.setVisibility(View.GONE);
}
}
}
| 3,032 | 0.699868 | 0.6969 | 88 | 33.454544 | 26.396845 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568182 | false | false | 9 |
462b7a1b6d2cb0bd4c28530a7ee8493662357ee3 | 19,516,331,450,905 | 93f9cc21e6182af51b61c0f19e80e159514e596c | /app/src/main/java/com/monolite/contacts/model/Contact.java | b71d9010df54b5c1ae0de5bc4419f9da2c64dce8 | [] | no_license | Monolite/Contacts | https://github.com/Monolite/Contacts | c8e17f6b8438c7e05ae89e4ecca0c91f623cb824 | bd56590069e5ba8aae5479783052290790540a78 | refs/heads/master | 2021-01-20T17:02:34.029000 | 2016-07-23T21:35:05 | 2016-07-23T21:35:05 | 64,037,000 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.monolite.contacts.model;
import java.io.Serializable;
/**
* Created by JoséAugusto on 23/07/2016.
*/
public class Contact implements Serializable {
public Contact(int id, String name, String twitter, String mail) {
Id = id;
Name = name;
Twitter = twitter;
Mail = mail;
}
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getTwitter() {
return Twitter;
}
public void setTwitter(String twitter) {
Twitter = twitter;
}
public String getMail() {
return Mail;
}
public void setMail(String mail) {
Mail = mail;
}
private int Id;
private String Name;
private String Twitter;
private String Mail;
@Override
public String toString() {
return Name;
}
}
| UTF-8 | Java | 1,005 | java | Contact.java | Java | [
{
"context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by JoséAugusto on 23/07/2016.\n */\n\npublic class Contact implemen",
"end": 97,
"score": 0.9996124505996704,
"start": 86,
"tag": "NAME",
"value": "JoséAugusto"
}
] | null | [] | package com.monolite.contacts.model;
import java.io.Serializable;
/**
* Created by JoséAugusto on 23/07/2016.
*/
public class Contact implements Serializable {
public Contact(int id, String name, String twitter, String mail) {
Id = id;
Name = name;
Twitter = twitter;
Mail = mail;
}
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getTwitter() {
return Twitter;
}
public void setTwitter(String twitter) {
Twitter = twitter;
}
public String getMail() {
return Mail;
}
public void setMail(String mail) {
Mail = mail;
}
private int Id;
private String Name;
private String Twitter;
private String Mail;
@Override
public String toString() {
return Name;
}
}
| 1,005 | 0.567729 | 0.559761 | 60 | 15.733334 | 15.27947 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.366667 | false | false | 9 |
553f1c638f8fddbff70bfc1da5b56569b04fc9c9 | 31,336,081,440,199 | 300a6928734ce0b4e0c1b476f3ba72564abcd9ac | /src/test/java/com/se/dao/users/UserDAOTest.java | ecf534d7052a57b7439e6489a753b640a5956776 | [] | no_license | paladin952/SE_Faculty_Project | https://github.com/paladin952/SE_Faculty_Project | 9221741412782b038475ca5ca7cebdb1d579c137 | 712a99c6bfad3a5b39584fc06f1bfa4db82d7bf3 | refs/heads/master | 2021-01-21T13:34:15.639000 | 2016-05-30T08:53:17 | 2016-05-30T08:53:17 | 52,661,015 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package com.se.dao.users;
//
//import com.se.database.dao.daoImplementation.UserDAOImpl;
//import com.se.database.dao.model.users.UserVO;
//import org.hibernate.Session;
//import org.hibernate.SessionFactory;
//import org.hibernate.cfg.AnnotationConfiguration;
//import org.hibernate.cfg.Configuration;
//import org.junit.After;
//import org.junit.Before;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//import org.springframework.test.context.transaction.TransactionConfiguration;
//import org.springframework.transaction.annotation.Transactional;
//
//import static org.junit.Assert.*;
//
////@RunWith(SpringJUnit4ClassRunner.class)
////@ContextConfiguration(locations={"classpath:applicationContext.xml"})
//public class UserDAOTest {
//// @Qualifier("sessionFactory")
//// @Autowired
// private SessionFactory sessionFactory;
//// private Session session = null;
//
// private UserDAOImpl userDAO;
//
// private static final String USERNAME = "user1";
// private static final String USERNAME_NEW = "user1";
// private static final String PASSWORD = "password1";
// private static final String PASSWORD_NEW = "password1";
// private UserVO userVO;
//
// @Before
// public void setUp() throws Exception {
//// Configuration configuration = new Configuration();
// AnnotationConfiguration configuration = new AnnotationConfiguration();
// configuration.addAnnotatedClass(UserVO.class);
// configuration.setProperty("hibernate.dialect","org.hibernate.dialect.MySQLDialect");
// configuration.setProperty("hibernate.connection.driver_class","com.mysql.jdbc.Driver");
// configuration.setProperty("hibernate.connection.url","jdbc:mysql://localhost:3306/ubbdb");
// configuration.setProperty("hibernate.connection.username","root");
// configuration.setProperty("hibernate.connection.password","admin");
//
//// sessionFactory = configuration.configure().buildSessionFactory();
// sessionFactory = configuration.buildSessionFactory();
//
//
// userVO = new UserVO(USERNAME, PASSWORD);
// userDAO = new UserDAOImpl(sessionFactory);
// }
//
// @After
// public void tearDown() throws Exception {
// sessionFactory = null;
// userDAO = null;
// userVO = null;
// }
//
// @Test
// public void updateUser_add() throws Exception {
// assertEquals(0, userVO.getId());
// userVO = userDAO.updateUser(userVO);
// assertNotEquals(0, userVO.getId());
// System.out.println(userVO.getId());
// userDAO.deleteById(userVO.getId());
// }
//
// @Test
// public void deleteById() throws Exception {
// userDAO.deleteById(11);
// assertNull(userDAO.getById(11));
// }
//}
| UTF-8 | Java | 3,055 | java | UserDAOTest.java | Java | [
{
"context": "\n//\n// private static final String USERNAME = \"user1\";\n// private static final String USERNAME_NEW ",
"end": 1255,
"score": 0.9978063702583313,
"start": 1250,
"tag": "USERNAME",
"value": "user1"
},
{
"context": "// private static final String USERNAME_NEW ... | null | [] | //package com.se.dao.users;
//
//import com.se.database.dao.daoImplementation.UserDAOImpl;
//import com.se.database.dao.model.users.UserVO;
//import org.hibernate.Session;
//import org.hibernate.SessionFactory;
//import org.hibernate.cfg.AnnotationConfiguration;
//import org.hibernate.cfg.Configuration;
//import org.junit.After;
//import org.junit.Before;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//import org.springframework.test.context.transaction.TransactionConfiguration;
//import org.springframework.transaction.annotation.Transactional;
//
//import static org.junit.Assert.*;
//
////@RunWith(SpringJUnit4ClassRunner.class)
////@ContextConfiguration(locations={"classpath:applicationContext.xml"})
//public class UserDAOTest {
//// @Qualifier("sessionFactory")
//// @Autowired
// private SessionFactory sessionFactory;
//// private Session session = null;
//
// private UserDAOImpl userDAO;
//
// private static final String USERNAME = "user1";
// private static final String USERNAME_NEW = "user1";
// private static final String PASSWORD = "<PASSWORD>";
// private static final String PASSWORD_NEW = "<PASSWORD>";
// private UserVO userVO;
//
// @Before
// public void setUp() throws Exception {
//// Configuration configuration = new Configuration();
// AnnotationConfiguration configuration = new AnnotationConfiguration();
// configuration.addAnnotatedClass(UserVO.class);
// configuration.setProperty("hibernate.dialect","org.hibernate.dialect.MySQLDialect");
// configuration.setProperty("hibernate.connection.driver_class","com.mysql.jdbc.Driver");
// configuration.setProperty("hibernate.connection.url","jdbc:mysql://localhost:3306/ubbdb");
// configuration.setProperty("hibernate.connection.username","root");
// configuration.setProperty("hibernate.connection.password","<PASSWORD>");
//
//// sessionFactory = configuration.configure().buildSessionFactory();
// sessionFactory = configuration.buildSessionFactory();
//
//
// userVO = new UserVO(USERNAME, PASSWORD);
// userDAO = new UserDAOImpl(sessionFactory);
// }
//
// @After
// public void tearDown() throws Exception {
// sessionFactory = null;
// userDAO = null;
// userVO = null;
// }
//
// @Test
// public void updateUser_add() throws Exception {
// assertEquals(0, userVO.getId());
// userVO = userDAO.updateUser(userVO);
// assertNotEquals(0, userVO.getId());
// System.out.println(userVO.getId());
// userDAO.deleteById(userVO.getId());
// }
//
// @Test
// public void deleteById() throws Exception {
// userDAO.deleteById(11);
// assertNull(userDAO.getById(11));
// }
//}
| 3,062 | 0.699509 | 0.693944 | 78 | 38.166668 | 26.204041 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.717949 | false | false | 9 |
dac21e236a1f0022c9ed910175b6659c99dc7274 | 21,303,037,848,585 | 6ba47b27255c68ad86053674f5f4f63f1f226a40 | /biz/src/main/java/com/cwb/news/biz/model/Video.java | 1b2efaa59c05a81df433224569a30766a633de13 | [] | no_license | whcwb/news | https://github.com/whcwb/news | ebff8af6225fb1a4e48c87c07fcabdee8c858b8a | 4838f601e9a9b47a9305cf81eeb0ca5156081a41 | refs/heads/master | 2022-07-07T06:38:36.432000 | 2019-11-06T01:52:13 | 2019-11-06T01:52:13 | 202,466,372 | 0 | 1 | null | false | 2022-06-29T17:34:47 | 2019-08-15T03:18:49 | 2019-11-06T01:52:44 | 2022-06-29T17:34:45 | 137,584 | 0 | 1 | 9 | Vue | false | false | package com.cwb.news.biz.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Table(name = "biz_video")
@Getter
@Setter
public class Video implements Serializable {
@Id
@Column(name = "ID")
private String id;
/**
* 视频路径
*/
@Column(name = "VI_PATH")
private String viPath;
/**
* 视频封面图
*/
@Column(name = "VI_IMG")
private String viImg;
/**
* 视频语言类型
*/
@Column(name = "VI_LANG")
private String viLang;
/**
* 视频内容类型 宣传片 景区
*/
@Column(name = "VI_TYPE")
private String viType;
@Column(name = "CJSJ")
private String cjsj;
@Column(name = "CJR")
private String cjr;
private static final long serialVersionUID = 1L;
public enum InnerColumn {
id("ID"),
viPath("VI_PATH"),
viImg("VI_IMG"),
viLang("VI_LANG"),
viType("VI_TYPE"),
cjsj("CJSJ"),
cjr("CJR");
private final String column;
public String value() {
return this.column;
}
public String getValue() {
return this.column;
}
InnerColumn(String column) {
this.column = column;
}
public String desc() {
return this.column + " DESC";
}
public String asc() {
return this.column + " ASC";
}
}
} | UTF-8 | Java | 1,557 | java | Video.java | Java | [] | null | [] | package com.cwb.news.biz.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Table(name = "biz_video")
@Getter
@Setter
public class Video implements Serializable {
@Id
@Column(name = "ID")
private String id;
/**
* 视频路径
*/
@Column(name = "VI_PATH")
private String viPath;
/**
* 视频封面图
*/
@Column(name = "VI_IMG")
private String viImg;
/**
* 视频语言类型
*/
@Column(name = "VI_LANG")
private String viLang;
/**
* 视频内容类型 宣传片 景区
*/
@Column(name = "VI_TYPE")
private String viType;
@Column(name = "CJSJ")
private String cjsj;
@Column(name = "CJR")
private String cjr;
private static final long serialVersionUID = 1L;
public enum InnerColumn {
id("ID"),
viPath("VI_PATH"),
viImg("VI_IMG"),
viLang("VI_LANG"),
viType("VI_TYPE"),
cjsj("CJSJ"),
cjr("CJR");
private final String column;
public String value() {
return this.column;
}
public String getValue() {
return this.column;
}
InnerColumn(String column) {
this.column = column;
}
public String desc() {
return this.column + " DESC";
}
public String asc() {
return this.column + " ASC";
}
}
} | 1,557 | 0.53887 | 0.538206 | 84 | 16.928572 | 13.465817 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
1a1facba57fa2b631ae4c020025c5fd28e51d10a | 21,303,037,845,050 | b7974697cde0431c70a05d35969a35a051ca3a68 | /nucleus-core/src/main/java/io/github/nucleuspowered/nucleus/services/impl/chatmessageformatter/ChatMessageFormatterService.java | 4ed8974d35f85373c250540070f2a64e0d19c1cd | [
"MIT"
] | permissive | NickImpact/Nucleus | https://github.com/NickImpact/Nucleus | 254e02bdfc01074b270b85b76912e10fb788bbcf | c94f39877a3671501c99992c21d73d34fc1a13f4 | refs/heads/v2/S7 | 2022-11-10T05:45:11.607000 | 2021-02-25T16:58:23 | 2021-02-25T16:58:34 | 284,608,226 | 0 | 0 | MIT | true | 2020-08-03T05:06:22 | 2020-08-03T05:06:21 | 2020-08-02T15:48:43 | 2020-08-02T15:48:41 | 11,590 | 0 | 0 | 0 | null | false | false | /*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.services.impl.chatmessageformatter;
import com.google.common.base.Preconditions;
import io.github.nucleuspowered.nucleus.api.util.NoExceptionAutoClosable;
import io.github.nucleuspowered.nucleus.services.interfaces.IChatMessageFormatterService;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.source.ConsoleSource;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.User;
import org.spongepowered.api.text.channel.MessageChannel;
import org.spongepowered.api.text.channel.MessageReceiver;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.WeakHashMap;
import javax.inject.Singleton;
@Singleton
public class ChatMessageFormatterService implements IChatMessageFormatterService {
private final Map<UUID, Channel> chatChannels = new HashMap<>();
private final Map<CommandSource, Channel> sourceChannelMap = new WeakHashMap<>();
@Override
public Optional<Channel> getNucleusChannel(CommandSource source) {
if (source instanceof User) {
return this.getNucleusChannel(((User) source).getUniqueId());
}
return Optional.ofNullable(this.sourceChannelMap.get(source));
}
@Override
public Optional<Channel> getNucleusChannel(UUID uuid) {
return Optional.ofNullable(this.chatChannels.get(uuid));
}
@Override
public void setPlayerNucleusChannel(UUID uuid, @Nullable Channel channel) {
if (channel == null) {
this.chatChannels.remove(uuid);
} else {
this.chatChannels.put(uuid, channel);
}
}
@Override
public NoExceptionAutoClosable setCommandSourceNucleusChannelTemporarily(final CommandSource source, final Channel channel) {
if (source instanceof User) {
return this.setPlayerNucleusChannelTemporarily(((User) source).getUniqueId(), channel);
}
Preconditions.checkNotNull(channel);
this.sourceChannelMap.put(source, channel);
final MessageChannel originalChannel = source.getMessageChannel();
if (channel instanceof Channel.External<?>) {
final MessageChannel newChannel = ((Channel.External<?>) channel).createChannel(originalChannel);
source.setMessageChannel(newChannel);
}
return () -> {
this.sourceChannelMap.remove(source);
Sponge.getServer().getConsole().setMessageChannel(originalChannel);
};
}
@Override
public NoExceptionAutoClosable setPlayerNucleusChannelTemporarily(UUID uuid, Channel channel) {
Preconditions.checkNotNull(channel);
final Channel original = this.chatChannels.get(uuid);
final Optional<Player> player = Sponge.getServer().getPlayer(uuid);
final MessageChannel originalChannel = player.map(MessageReceiver::getMessageChannel).orElse(null);
this.chatChannels.put(uuid, channel);
if (channel instanceof Channel.External<?>) {
final MessageChannel newChannel = ((Channel.External<?>) channel).createChannel(originalChannel);
player.ifPresent(x -> x.setMessageChannel(newChannel));
}
return () -> {
this.setPlayerNucleusChannel(uuid, original);
if (originalChannel != null) {
player.ifPresent(x -> x.setMessageChannel(originalChannel));
} else {
player.ifPresent(x -> x.setMessageChannel(MessageChannel.TO_ALL));
}
};
}
}
| UTF-8 | Java | 3,866 | java | ChatMessageFormatterService.java | Java | [
{
"context": "s project for more details.\n */\npackage io.github.nucleuspowered.nucleus.services.impl.chatmessageformatter;\n\nimpo",
"end": 184,
"score": 0.9764382243156433,
"start": 170,
"tag": "USERNAME",
"value": "nucleuspowered"
},
{
"context": "oogle.common.base.Preconditions;... | null | [] | /*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.services.impl.chatmessageformatter;
import com.google.common.base.Preconditions;
import io.github.nucleuspowered.nucleus.api.util.NoExceptionAutoClosable;
import io.github.nucleuspowered.nucleus.services.interfaces.IChatMessageFormatterService;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.source.ConsoleSource;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.User;
import org.spongepowered.api.text.channel.MessageChannel;
import org.spongepowered.api.text.channel.MessageReceiver;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.WeakHashMap;
import javax.inject.Singleton;
@Singleton
public class ChatMessageFormatterService implements IChatMessageFormatterService {
private final Map<UUID, Channel> chatChannels = new HashMap<>();
private final Map<CommandSource, Channel> sourceChannelMap = new WeakHashMap<>();
@Override
public Optional<Channel> getNucleusChannel(CommandSource source) {
if (source instanceof User) {
return this.getNucleusChannel(((User) source).getUniqueId());
}
return Optional.ofNullable(this.sourceChannelMap.get(source));
}
@Override
public Optional<Channel> getNucleusChannel(UUID uuid) {
return Optional.ofNullable(this.chatChannels.get(uuid));
}
@Override
public void setPlayerNucleusChannel(UUID uuid, @Nullable Channel channel) {
if (channel == null) {
this.chatChannels.remove(uuid);
} else {
this.chatChannels.put(uuid, channel);
}
}
@Override
public NoExceptionAutoClosable setCommandSourceNucleusChannelTemporarily(final CommandSource source, final Channel channel) {
if (source instanceof User) {
return this.setPlayerNucleusChannelTemporarily(((User) source).getUniqueId(), channel);
}
Preconditions.checkNotNull(channel);
this.sourceChannelMap.put(source, channel);
final MessageChannel originalChannel = source.getMessageChannel();
if (channel instanceof Channel.External<?>) {
final MessageChannel newChannel = ((Channel.External<?>) channel).createChannel(originalChannel);
source.setMessageChannel(newChannel);
}
return () -> {
this.sourceChannelMap.remove(source);
Sponge.getServer().getConsole().setMessageChannel(originalChannel);
};
}
@Override
public NoExceptionAutoClosable setPlayerNucleusChannelTemporarily(UUID uuid, Channel channel) {
Preconditions.checkNotNull(channel);
final Channel original = this.chatChannels.get(uuid);
final Optional<Player> player = Sponge.getServer().getPlayer(uuid);
final MessageChannel originalChannel = player.map(MessageReceiver::getMessageChannel).orElse(null);
this.chatChannels.put(uuid, channel);
if (channel instanceof Channel.External<?>) {
final MessageChannel newChannel = ((Channel.External<?>) channel).createChannel(originalChannel);
player.ifPresent(x -> x.setMessageChannel(newChannel));
}
return () -> {
this.setPlayerNucleusChannel(uuid, original);
if (originalChannel != null) {
player.ifPresent(x -> x.setMessageChannel(originalChannel));
} else {
player.ifPresent(x -> x.setMessageChannel(MessageChannel.TO_ALL));
}
};
}
}
| 3,866 | 0.70926 | 0.70926 | 94 | 40.127659 | 32.755131 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.595745 | false | false | 9 |
2859370af205306477c23e8378d1c5220d2f9c80 | 9,216,999,817,521 | d2c7305e1d5c49ab08c52e23709724f209a67f44 | /src/main/java/com/javaguru/student_ivan_shulga/lesson_13/level_1_intern/Task_6.java | de4bdb75ef220df2d459293a57a730cfbadb3689 | [] | no_license | javagururt/jg-java-1-august-2020 | https://github.com/javagururt/jg-java-1-august-2020 | 407fa03734cff6b2d0c52927de483241069271af | ad67f04d0982a2cc671fb92c1fc9a90163a5a98c | refs/heads/master | 2023-04-18T17:04:52.401000 | 2021-05-04T19:27:41 | 2021-05-04T19:27:41 | 288,084,604 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.javaguru.student_ivan_shulga.lesson_13.level_1_intern;
import com.javaguru.teacher.codereview.CodeReview;
@CodeReview(approved = true)
class Task_6 {
/*
RuntimeException
* ArithmeticException
* ArrayStoreException
* ClassCastException
* ConcurrentModificationException
* EnumConstantNotPresentException
* IllegalArgumentException
- IllegalThreadStateException
- NumberFormatException
* IllegalMonitorStateException
* IllegalStateException
* IndexOutOfBoundsException
- ArrayIndexOutOfBoundsException
- StringIndexOutOfBoundsException
* NegativeArraySizeException
* NullPointerException
* SecurityException
* TypeNotPresentException
* UnsupportedOperationException
*/
}
/*
Воспользуйтесь документацией Java (javadoc)
и найдите информацию о иерархии наследования класса java.lang.RuntimeException.
*/ | UTF-8 | Java | 1,040 | java | Task_6.java | Java | [] | null | [] | package com.javaguru.student_ivan_shulga.lesson_13.level_1_intern;
import com.javaguru.teacher.codereview.CodeReview;
@CodeReview(approved = true)
class Task_6 {
/*
RuntimeException
* ArithmeticException
* ArrayStoreException
* ClassCastException
* ConcurrentModificationException
* EnumConstantNotPresentException
* IllegalArgumentException
- IllegalThreadStateException
- NumberFormatException
* IllegalMonitorStateException
* IllegalStateException
* IndexOutOfBoundsException
- ArrayIndexOutOfBoundsException
- StringIndexOutOfBoundsException
* NegativeArraySizeException
* NullPointerException
* SecurityException
* TypeNotPresentException
* UnsupportedOperationException
*/
}
/*
Воспользуйтесь документацией Java (javadoc)
и найдите информацию о иерархии наследования класса java.lang.RuntimeException.
*/ | 1,040 | 0.716942 | 0.71281 | 32 | 29.28125 | 18.328997 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | false | false | 9 |
266817d71c7218b830b507e7a1fd798a9f8a1d0a | 13,735,305,414,440 | 7cd5e34de43b34e4e83537699b334434fb4f8ae3 | /src/planBidudHotel/utils/Utils.java | d785228f733d0128eb03af4f16bbe17490af1aba | [] | no_license | muhammad89a/PlanBidudHotelSystem | https://github.com/muhammad89a/PlanBidudHotelSystem | 76c8514386cd09520d9a7e9ab27b682b1c7e431c | 9d5883cf1d3a9c364a9c1eac07c87b68e595bfd2 | refs/heads/master | 2023-06-15T21:50:36.186000 | 2021-07-18T09:59:11 | 2021-07-18T09:59:11 | 385,284,436 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package planBidudHotel.utils;
import org.apache.commons.validator.routines.EmailValidator;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
public static boolean isFutureDate(Date date) {
return new Date().before(date);
}
public static boolean isValidEmailAddress(String email) {
return EmailValidator.getInstance().isValid(email);
}
public static boolean isTextIsNumbers(String text) {
return (text.matches("[0-9]+") && text.length() > 0);
}
public static boolean isPhoneNumber(String number) {
Pattern pattern = Pattern.compile("\\d{3}-\\d{7}");
Matcher matcher = pattern.matcher(number);
return matcher.matches();
}
}
| UTF-8 | Java | 768 | java | Utils.java | Java | [] | null | [] | package planBidudHotel.utils;
import org.apache.commons.validator.routines.EmailValidator;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
public static boolean isFutureDate(Date date) {
return new Date().before(date);
}
public static boolean isValidEmailAddress(String email) {
return EmailValidator.getInstance().isValid(email);
}
public static boolean isTextIsNumbers(String text) {
return (text.matches("[0-9]+") && text.length() > 0);
}
public static boolean isPhoneNumber(String number) {
Pattern pattern = Pattern.compile("\\d{3}-\\d{7}");
Matcher matcher = pattern.matcher(number);
return matcher.matches();
}
}
| 768 | 0.68099 | 0.674479 | 28 | 26.428572 | 24.128271 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392857 | false | false | 9 |
7888b3d3628783a2ca50cb18d9f17e41a6b38d55 | 27,092,653,705,395 | d20b5d9be3a5ffd0e3d94c8d80c6ba1301a4ba36 | /mydesign/src/main/java/com/fewwind/mydesign/fragment/FragmentFactory.java | 174fcae2c66d3a3e7d3913a84078c307ea52094d | [
"Apache-2.0"
] | permissive | fewwind/MyFirst | https://github.com/fewwind/MyFirst | f2fab75d4e6248d634a69d02c5c380b7cdc8ede1 | 128fc19e39a3ec6376596189e116915622a9254a | refs/heads/master | 2021-01-09T20:14:38.647000 | 2016-07-12T03:09:33 | 2016-07-12T03:09:33 | 63,120,692 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fewwind.mydesign.fragment;
import android.app.Fragment;
import java.util.HashMap;
import java.util.Map;
/**
* Created by fewwind on 2015/10/15.
*/
public class FragmentFactory {
private static Map<Integer, Fragment> mFragments = new HashMap<>();
public static Fragment getFragment(int position) {
Fragment fm = null;
fm = mFragments.get(position);
if (fm == null) {
if (position == 1) {
fm = new FragmentMain();
} else if (position == 2) {
fm = new FragmentSysChan();
} else if (position == 3) {
fm = new FragmentCustom();
} else if (position == 4) {
}
}
if (fm != null) {
mFragments.put(position, fm);
}
return fm;
}
}
| UTF-8 | Java | 833 | java | FragmentFactory.java | Java | [
{
"context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by fewwind on 2015/10/15.\n */\npublic class FragmentFactory {",
"end": 145,
"score": 0.9993591904640198,
"start": 138,
"tag": "USERNAME",
"value": "fewwind"
}
] | null | [] | package com.fewwind.mydesign.fragment;
import android.app.Fragment;
import java.util.HashMap;
import java.util.Map;
/**
* Created by fewwind on 2015/10/15.
*/
public class FragmentFactory {
private static Map<Integer, Fragment> mFragments = new HashMap<>();
public static Fragment getFragment(int position) {
Fragment fm = null;
fm = mFragments.get(position);
if (fm == null) {
if (position == 1) {
fm = new FragmentMain();
} else if (position == 2) {
fm = new FragmentSysChan();
} else if (position == 3) {
fm = new FragmentCustom();
} else if (position == 4) {
}
}
if (fm != null) {
mFragments.put(position, fm);
}
return fm;
}
}
| 833 | 0.523409 | 0.509004 | 39 | 20.358974 | 18.868624 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.358974 | false | false | 9 |
1cacda111e6fe25690d9805a41d87303c2a93884 | 26,603,027,479,064 | 2c4c5f35ca5305f23f874c52afefd088b17fc752 | /Gehoelz mit Abstrakter Klasse/src/Gehoelz.java | 4cda7bf75b6563e034085c2b5b1919b2144b4460 | [] | no_license | Codrink/Projekt-Aufgabe-Gehoelz | https://github.com/Codrink/Projekt-Aufgabe-Gehoelz | 3ac82567a6bcc256343a8a9de15bd3ef3f03cc55 | 193c9460f51cfd4c7ef440d9e0d962fc50c3cff3 | refs/heads/master | 2016-08-13T01:57:53.411000 | 2016-02-11T21:55:35 | 2016-02-11T21:55:35 | 50,720,986 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public abstract class Gehoelz {
private String art;
private int pflanzenJahr;
private float preis;
public Gehoelz(String art, int pflanzenJahr, float preis) {
super();
this.art = art;
this.pflanzenJahr = pflanzenJahr;
this.preis = preis;
}
public String getArt() {
return art;
}
public void setArt(String art) {
this.art = art;
}
public int getpflanzenJahr() {
return pflanzenJahr;
}
public void setpflanzenJahr(int pflanzenJahr) {
this.pflanzenJahr = pflanzenJahr;
}
public float getPreis() {
return preis;
}
public void setPreis(float preis) {
this.preis = preis;
}
public String getInfo(){
return art + ", PflanzJahr: " + pflanzenJahr + ", Preis: " + preis + " Euro ";
}
}
| UTF-8 | Java | 725 | java | Gehoelz.java | Java | [] | null | [] |
public abstract class Gehoelz {
private String art;
private int pflanzenJahr;
private float preis;
public Gehoelz(String art, int pflanzenJahr, float preis) {
super();
this.art = art;
this.pflanzenJahr = pflanzenJahr;
this.preis = preis;
}
public String getArt() {
return art;
}
public void setArt(String art) {
this.art = art;
}
public int getpflanzenJahr() {
return pflanzenJahr;
}
public void setpflanzenJahr(int pflanzenJahr) {
this.pflanzenJahr = pflanzenJahr;
}
public float getPreis() {
return preis;
}
public void setPreis(float preis) {
this.preis = preis;
}
public String getInfo(){
return art + ", PflanzJahr: " + pflanzenJahr + ", Preis: " + preis + " Euro ";
}
}
| 725 | 0.68 | 0.68 | 36 | 19.111111 | 18.127293 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.722222 | false | false | 9 |
acce59d084f69e7e6def40db03ac856cdc1ac6a7 | 16,621,523,504,909 | 5eb17d44b5f583caa7d6c7e68b62f9024c722763 | /src/test/com/tajahmed/geektrust/p1s4/models/ScoreBoardTest.java | fc83b3d28d8686345d364bb6e74fea040743e5fd | [] | no_license | go4taj/GeetTrust-Problems | https://github.com/go4taj/GeetTrust-Problems | 1fc2b2f0da4dd7974ce9ed4b619832ad0119c9f8 | a07a70a70d50732941ab666471f84438a0d6f0a6 | refs/heads/master | 2016-09-26T20:18:45.950000 | 2016-06-09T09:26:51 | 2016-06-09T09:26:51 | 60,174,768 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tajahmed.geektrust.p1s4.models;
import com.tajahmed.geektrust.p1s4.models.commentary.Commentator;
import com.tajahmed.geektrust.p1s4.models.commentary.INEnglishCommentator;
import com.tajahmed.geektrust.p1s4.models.player.Shot;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.*;
public class ScoreBoardTest {
ScoreBoard scoreBoard;
ArrayList<String> teamOnePlayers = new ArrayList<>();
ArrayList<String> teamTwoPlayers = new ArrayList<>();
int numberOfOvers = 2;
@Before
public void setUp() throws Exception {
teamOnePlayers.clear();
teamOnePlayers.add("Kohli");
teamOnePlayers.add("Dhoni");
teamOnePlayers.add("Rohit");
teamTwoPlayers.clear();
teamTwoPlayers.add("AB devilliers");
teamTwoPlayers.add("Shane watson");
scoreBoard = new ScoreBoard();
scoreBoard.setupMatch("Royal challengers bangalore","Chennai Super Kings",numberOfOvers, 0);
scoreBoard.startInnings("Kohli","Dhoni",Innings.First);
}
@Test
public void scoreBoardHasDetailsAboutMatch() {
assertEquals(0,scoreBoard.getTotalScore());
assertEquals("Kohli",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
assertTrue(scoreBoard.getOversLeft() == 2);
assertEquals(Innings.First,scoreBoard.getInnings());
}
@Test
public void scoreBoardUpdatedScoreForEachShotPlayed() {
scoreBoard.updateScoreBoard(Shot.Boundry);
assertEquals(4,scoreBoard.getTotalScore());
scoreBoard.updateScoreBoard(Shot.SixRun);
assertEquals(10,scoreBoard.getTotalScore());
assertEquals("Kohli",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
assertTrue(scoreBoard.getOversLeft() == 1.4);
}
@Test
public void scoreBoardUpdatedOverCompletedAfterEachOverCompletion() {
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
int oversLeft = (int) scoreBoard.getOversLeft();
assertEquals("Overs left should be 1",1,oversLeft);
}
@Test
public void scoreBoardUpdatedStrikePlayerOnSingleTripleAndFiveRuns() {
assertEquals("Kohli", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals("Dhoni", scoreBoard.getOnStrikePlayer());
assertEquals("Kohli", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals("Kohli", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals("Dhoni", scoreBoard.getOnStrikePlayer());
assertEquals("Kohli", scoreBoard.getNonStrikePlayer());
}
@Test
public void scoreBoardUpdatePlayerOnWicket() {
scoreBoard.updateScoreBoardWicket("H Amla");
assertEquals("H Amla", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
assertEquals(1,scoreBoard.getWickets());
}
@Test
public void scoreBoardNowHasCommentators() {
Commentator englishCommentator = mock(INEnglishCommentator.class);
doNothing().when(englishCommentator).comment(any(Shot.class),anyString(),anyDouble());
scoreBoard.addCommentator(englishCommentator);
scoreBoard.commentMatchOpening();
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.FiveRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DotBall);
scoreBoard.updateScoreBoard(Shot.TripleRun);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Wicket);
scoreBoard.updateScoreBoardWicket("A Player");
scoreBoard.commentInningsScore();
verify(englishCommentator).commentMatchOpening("Royal challengers bangalore");
verify(englishCommentator,times(8)).comment(any(Shot.class),anyString(),anyDouble());
verify(englishCommentator).overEnds(anyInt(),eq(0),eq(1.0),eq(1.0),anyInt(),eq(0),any(Innings.class));
verify(englishCommentator).commentWicket(anyString(),anyDouble());
verify(englishCommentator).commentInningsScore(eq(Innings.First),anyInt(),anyInt(),anyInt(),anyInt(),anyDouble(),eq(""),any(HashMap.class));
}
@Test
public void scoreBoardUpdatesWicketsBeforeCommentaryOnLastBallOfOver() {
Commentator englishCommentator = mock(INEnglishCommentator.class);
doNothing().when(englishCommentator).comment(any(Shot.class),anyString(),anyDouble());
doNothing().when(englishCommentator).commentWicket(anyString(),eq(1.0));
scoreBoard.addCommentator(englishCommentator);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.FiveRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DotBall);
scoreBoard.updateScoreBoardWicket("Next Player");
verify(englishCommentator,times(5)).comment(any(Shot.class),anyString(),anyDouble());
assertEquals(1.0,scoreBoard.getOversCompleted(),0.04);
verify(englishCommentator).commentWicket(anyString(),anyDouble());
}
@Test
public void scoreBoardTellAboutNoOfOversCompleted() {
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals(0.1,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.Boundry);
assertEquals(0.2,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals(0.3,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
assertEquals(0.4,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.DotBall);
assertEquals(0.5,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals(1.0,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.SixRun);
assertEquals(1.1,scoreBoard.getOversCompleted(),0.04);
}
@Test
public void scoreBoardHasScoreDetailsAboutEachPlayer() {
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoardWicket("A Player");
HashMap<String, PlayerScoreCard> hostTeamPlayerScores = scoreBoard.getHostTeamPlayerScores();
PlayerScoreCard kohliScoreCard = hostTeamPlayerScores.get("Kohli");
assertEquals(16,kohliScoreCard.getTotalRuns());
assertEquals(1,kohliScoreCard.getDoubles());
assertEquals(2,kohliScoreCard.getBoundries());
assertEquals(1,kohliScoreCard.getSixes());
}
@Test
public void scoreBoardHasScoreDetailsAboutEachPlayerFromSeconInningsToo() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoardWicket("Bumrah");
HashMap<String, PlayerScoreCard> hostTeamPlayerScores = scoreBoard.getGuestTeamPlayerScores();
PlayerScoreCard kohliScoreCard = hostTeamPlayerScores.get("Malinga");
assertEquals(16,kohliScoreCard.getTotalRuns());
assertEquals(1,kohliScoreCard.getDoubles());
assertEquals(2,kohliScoreCard.getBoundries());
assertEquals(1,kohliScoreCard.getSixes());
}
@Test
public void playerChangesStrikeAfterEveryOver() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
assertEquals("Nehra",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfSingleRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfFiveRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfTripleRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void nonStrikePlayerComesOnStrikeIfWicketFallsOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoardWicket("Dhoni");
assertEquals("Nehra",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
}
@Test
public void matchResultIsTieIfBothTeamsScoreEqualRuns() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
when(scoreBoard.getTotalScore()).thenReturn(20);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("Tie",scoreBoard.getMatchResult());
}
@Test
public void hostTeamWinsIfGuestTeamFailsToChase() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
scoreBoard.setupMatch("RCB","CSK",numberOfOvers, 0);
when(scoreBoard.getTotalScore()).thenReturn(15);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("RCB",scoreBoard.getMatchResult());
}
@Test
public void hostTeamWinsIfGuestTeamChasesSuccessFully() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
scoreBoard.setupMatch("RCB","CSK",numberOfOvers, 0);
when(scoreBoard.getTotalScore()).thenReturn(21);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("CSK",scoreBoard.getMatchResult());
when(scoreBoard.getTotalScore()).thenReturn(23);
assertEquals("CSK",scoreBoard.getMatchResult());
}
} | UTF-8 | Java | 12,262 | java | ScoreBoardTest.java | Java | [
{
"context": "amOnePlayers.clear();\n teamOnePlayers.add(\"Kohli\");\n teamOnePlayers.add(\"Dhoni\");\n t",
"end": 874,
"score": 0.998720645904541,
"start": 869,
"tag": "NAME",
"value": "Kohli"
},
{
"context": "Players.add(\"Kohli\");\n teamOnePlayers.add(... | null | [] | package com.tajahmed.geektrust.p1s4.models;
import com.tajahmed.geektrust.p1s4.models.commentary.Commentator;
import com.tajahmed.geektrust.p1s4.models.commentary.INEnglishCommentator;
import com.tajahmed.geektrust.p1s4.models.player.Shot;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.*;
public class ScoreBoardTest {
ScoreBoard scoreBoard;
ArrayList<String> teamOnePlayers = new ArrayList<>();
ArrayList<String> teamTwoPlayers = new ArrayList<>();
int numberOfOvers = 2;
@Before
public void setUp() throws Exception {
teamOnePlayers.clear();
teamOnePlayers.add("Kohli");
teamOnePlayers.add("Dhoni");
teamOnePlayers.add("Rohit");
teamTwoPlayers.clear();
teamTwoPlayers.add("<NAME>");
teamTwoPlayers.add("<NAME>");
scoreBoard = new ScoreBoard();
scoreBoard.setupMatch("Royal challengers bangalore","Chennai Super Kings",numberOfOvers, 0);
scoreBoard.startInnings("Kohli","Dhoni",Innings.First);
}
@Test
public void scoreBoardHasDetailsAboutMatch() {
assertEquals(0,scoreBoard.getTotalScore());
assertEquals("Kohli",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
assertTrue(scoreBoard.getOversLeft() == 2);
assertEquals(Innings.First,scoreBoard.getInnings());
}
@Test
public void scoreBoardUpdatedScoreForEachShotPlayed() {
scoreBoard.updateScoreBoard(Shot.Boundry);
assertEquals(4,scoreBoard.getTotalScore());
scoreBoard.updateScoreBoard(Shot.SixRun);
assertEquals(10,scoreBoard.getTotalScore());
assertEquals("Kohli",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
assertTrue(scoreBoard.getOversLeft() == 1.4);
}
@Test
public void scoreBoardUpdatedOverCompletedAfterEachOverCompletion() {
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
int oversLeft = (int) scoreBoard.getOversLeft();
assertEquals("Overs left should be 1",1,oversLeft);
}
@Test
public void scoreBoardUpdatedStrikePlayerOnSingleTripleAndFiveRuns() {
assertEquals("Kohli", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals("Dhoni", scoreBoard.getOnStrikePlayer());
assertEquals("Kohli", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals("Kohli", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals("Dhoni", scoreBoard.getOnStrikePlayer());
assertEquals("Kohli", scoreBoard.getNonStrikePlayer());
}
@Test
public void scoreBoardUpdatePlayerOnWicket() {
scoreBoard.updateScoreBoardWicket("H Amla");
assertEquals("H Amla", scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni", scoreBoard.getNonStrikePlayer());
assertEquals(1,scoreBoard.getWickets());
}
@Test
public void scoreBoardNowHasCommentators() {
Commentator englishCommentator = mock(INEnglishCommentator.class);
doNothing().when(englishCommentator).comment(any(Shot.class),anyString(),anyDouble());
scoreBoard.addCommentator(englishCommentator);
scoreBoard.commentMatchOpening();
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.FiveRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DotBall);
scoreBoard.updateScoreBoard(Shot.TripleRun);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Wicket);
scoreBoard.updateScoreBoardWicket("A Player");
scoreBoard.commentInningsScore();
verify(englishCommentator).commentMatchOpening("Royal challengers bangalore");
verify(englishCommentator,times(8)).comment(any(Shot.class),anyString(),anyDouble());
verify(englishCommentator).overEnds(anyInt(),eq(0),eq(1.0),eq(1.0),anyInt(),eq(0),any(Innings.class));
verify(englishCommentator).commentWicket(anyString(),anyDouble());
verify(englishCommentator).commentInningsScore(eq(Innings.First),anyInt(),anyInt(),anyInt(),anyInt(),anyDouble(),eq(""),any(HashMap.class));
}
@Test
public void scoreBoardUpdatesWicketsBeforeCommentaryOnLastBallOfOver() {
Commentator englishCommentator = mock(INEnglishCommentator.class);
doNothing().when(englishCommentator).comment(any(Shot.class),anyString(),anyDouble());
doNothing().when(englishCommentator).commentWicket(anyString(),eq(1.0));
scoreBoard.addCommentator(englishCommentator);
scoreBoard.updateScoreBoard(Shot.SingleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.FiveRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DotBall);
scoreBoard.updateScoreBoardWicket("Next Player");
verify(englishCommentator,times(5)).comment(any(Shot.class),anyString(),anyDouble());
assertEquals(1.0,scoreBoard.getOversCompleted(),0.04);
verify(englishCommentator).commentWicket(anyString(),anyDouble());
}
@Test
public void scoreBoardTellAboutNoOfOversCompleted() {
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals(0.1,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.Boundry);
assertEquals(0.2,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals(0.3,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
assertEquals(0.4,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.DotBall);
assertEquals(0.5,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals(1.0,scoreBoard.getOversCompleted(),0.04);
scoreBoard.updateScoreBoard(Shot.SixRun);
assertEquals(1.1,scoreBoard.getOversCompleted(),0.04);
}
@Test
public void scoreBoardHasScoreDetailsAboutEachPlayer() {
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoardWicket("A Player");
HashMap<String, PlayerScoreCard> hostTeamPlayerScores = scoreBoard.getHostTeamPlayerScores();
PlayerScoreCard kohliScoreCard = hostTeamPlayerScores.get("Kohli");
assertEquals(16,kohliScoreCard.getTotalRuns());
assertEquals(1,kohliScoreCard.getDoubles());
assertEquals(2,kohliScoreCard.getBoundries());
assertEquals(1,kohliScoreCard.getSixes());
}
@Test
public void scoreBoardHasScoreDetailsAboutEachPlayerFromSeconInningsToo() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoardWicket("Bumrah");
HashMap<String, PlayerScoreCard> hostTeamPlayerScores = scoreBoard.getGuestTeamPlayerScores();
PlayerScoreCard kohliScoreCard = hostTeamPlayerScores.get("Malinga");
assertEquals(16,kohliScoreCard.getTotalRuns());
assertEquals(1,kohliScoreCard.getDoubles());
assertEquals(2,kohliScoreCard.getBoundries());
assertEquals(1,kohliScoreCard.getSixes());
}
@Test
public void playerChangesStrikeAfterEveryOver() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
assertEquals("Nehra",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfSingleRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.SingleRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfFiveRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.FiveRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void samePlayerIsOnStrikeIfTripleRunIsTakenOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.TripleRun);
assertEquals("Malinga",scoreBoard.getOnStrikePlayer());
}
@Test
public void nonStrikePlayerComesOnStrikeIfWicketFallsOnLastBall() {
scoreBoard.startInnings("Malinga","Nehra",Innings.Second);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.SixRun);
scoreBoard.updateScoreBoard(Shot.Boundry);
scoreBoard.updateScoreBoard(Shot.DoubleRun);
scoreBoard.updateScoreBoardWicket("Dhoni");
assertEquals("Nehra",scoreBoard.getOnStrikePlayer());
assertEquals("Dhoni",scoreBoard.getNonStrikePlayer());
}
@Test
public void matchResultIsTieIfBothTeamsScoreEqualRuns() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
when(scoreBoard.getTotalScore()).thenReturn(20);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("Tie",scoreBoard.getMatchResult());
}
@Test
public void hostTeamWinsIfGuestTeamFailsToChase() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
scoreBoard.setupMatch("RCB","CSK",numberOfOvers, 0);
when(scoreBoard.getTotalScore()).thenReturn(15);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("RCB",scoreBoard.getMatchResult());
}
@Test
public void hostTeamWinsIfGuestTeamChasesSuccessFully() {
ScoreBoard scoreBoard = spy(ScoreBoard.class);
scoreBoard.setupMatch("RCB","CSK",numberOfOvers, 0);
when(scoreBoard.getTotalScore()).thenReturn(21);
when(scoreBoard.getRequiredScore()).thenReturn(21);
assertEquals("CSK",scoreBoard.getMatchResult());
when(scoreBoard.getTotalScore()).thenReturn(23);
assertEquals("CSK",scoreBoard.getMatchResult());
}
} | 12,249 | 0.71587 | 0.708041 | 276 | 43.43116 | 26.015999 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.065217 | false | false | 9 |
bc8ebc40fc73a8a8a82529d2ac86a5379c78d05d | 26,749,056,384,884 | 41ff23b249050efe7fc780181aead20634fa26e3 | /java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/util/VtGateParams.java | 3a591ab5c98f41b93ab24375bbf1628fbad89b66 | [
"BSD-3-Clause"
] | permissive | denji/vitess | https://github.com/denji/vitess | e8c198327f82e35c45b443f022ca2e80aee52b67 | a9edc106b9c6991bae1fc531114d137ed1aa6ea6 | refs/heads/master | 2019-12-01T06:13:09.232000 | 2014-09-25T23:16:24 | 2014-09-25T23:16:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.youtube.vitess.vtgate.integration.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.common.primitives.UnsignedLong;
import com.youtube.vitess.vtgate.KeyspaceId;
/**
* Helper class to hold the configurations for VtGate setup used in integration
* tests
*/
public class VtGateParams {
public String keyspace_name;
public int port;
public Map<String, List<String>> shard_kid_map;
public List<KeyspaceId> kids;
/**
* Return all keyspaceIds in the Keyspace
*/
public List<KeyspaceId> getAllKeyspaceIds() {
if (kids != null) {
return kids;
}
kids = new ArrayList<>();
for (List<String> ids : shard_kid_map.values()) {
for (String id : ids) {
kids.add(KeyspaceId.valueOf(UnsignedLong.valueOf(id)));
}
}
return kids;
}
/**
* Return all keyspaceIds in a specific shard
*/
public List<KeyspaceId> getKeyspaceIds(String shardName) {
List<String> kidsStr = shard_kid_map.get(shardName);
if (kidsStr != null) {
List<KeyspaceId> kids = new ArrayList<>();
for (String kid : kidsStr) {
kids.add(KeyspaceId.valueOf(UnsignedLong.valueOf(kid)));
}
return kids;
}
return null;
}
} | UTF-8 | Java | 1,195 | java | VtGateParams.java | Java | [] | null | [] | package com.youtube.vitess.vtgate.integration.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.common.primitives.UnsignedLong;
import com.youtube.vitess.vtgate.KeyspaceId;
/**
* Helper class to hold the configurations for VtGate setup used in integration
* tests
*/
public class VtGateParams {
public String keyspace_name;
public int port;
public Map<String, List<String>> shard_kid_map;
public List<KeyspaceId> kids;
/**
* Return all keyspaceIds in the Keyspace
*/
public List<KeyspaceId> getAllKeyspaceIds() {
if (kids != null) {
return kids;
}
kids = new ArrayList<>();
for (List<String> ids : shard_kid_map.values()) {
for (String id : ids) {
kids.add(KeyspaceId.valueOf(UnsignedLong.valueOf(id)));
}
}
return kids;
}
/**
* Return all keyspaceIds in a specific shard
*/
public List<KeyspaceId> getKeyspaceIds(String shardName) {
List<String> kidsStr = shard_kid_map.get(shardName);
if (kidsStr != null) {
List<KeyspaceId> kids = new ArrayList<>();
for (String kid : kidsStr) {
kids.add(KeyspaceId.valueOf(UnsignedLong.valueOf(kid)));
}
return kids;
}
return null;
}
} | 1,195 | 0.697908 | 0.697908 | 51 | 22.450981 | 21.110645 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.627451 | false | false | 9 |
ff0116cb3df14f7915451f063d64fe4d9c4f9bc2 | 7,000,796,753,607 | ac0824a961eea28a9084ca19f00a72eec6f0c7e7 | /src/main/java/com/example/BookShoop/Spring/controllers/GlobalExceptionHandler.java | a93e21ac231553e63fe6f508dbeac382e19865a8 | [] | no_license | Ciemiorek/BookShopWithSpring | https://github.com/Ciemiorek/BookShopWithSpring | ef87cdd08830170609756730978b4c9c219a0f75 | 4cba6448abab52ef24e071b7718f0e9d26c5fced | refs/heads/master | 2022-09-18T10:10:50.700000 | 2019-10-06T13:59:54 | 2019-10-06T13:59:54 | 213,125,718 | 0 | 0 | null | false | 2022-09-08T01:02:53 | 2019-10-06T07:27:18 | 2019-10-06T14:00:01 | 2022-09-08T01:02:52 | 60 | 0 | 0 | 2 | Java | false | false | package com.example.BookShoop.Spring.controllers;
import org.postgresql.util.PSQLException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.sql.SQLException;
@ControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = {IllegalArgumentException.class})
@ResponseBody
protected ResponseEntity<Object> hendlerIllegalArgumentException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex, ex.getMessage(),new HttpHeaders(), HttpStatus.NOT_FOUND, request);
}
@ExceptionHandler(value = {SQLException.class})
@ResponseBody
protected ResponseEntity<Object> hendlerSQLException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex, ex.getMessage(),new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
@ExceptionHandler(value = {PSQLException.class})
@ResponseBody
protected ResponseEntity<Object> handleException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex,ex.getMessage(),new HttpHeaders(),HttpStatus.INTERNAL_SERVER_ERROR, request);
}
}
| UTF-8 | Java | 1,604 | java | GlobalExceptionHandler.java | Java | [] | null | [] | package com.example.BookShoop.Spring.controllers;
import org.postgresql.util.PSQLException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.sql.SQLException;
@ControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = {IllegalArgumentException.class})
@ResponseBody
protected ResponseEntity<Object> hendlerIllegalArgumentException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex, ex.getMessage(),new HttpHeaders(), HttpStatus.NOT_FOUND, request);
}
@ExceptionHandler(value = {SQLException.class})
@ResponseBody
protected ResponseEntity<Object> hendlerSQLException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex, ex.getMessage(),new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
@ExceptionHandler(value = {PSQLException.class})
@ResponseBody
protected ResponseEntity<Object> handleException(RuntimeException ex, WebRequest request){
return handleExceptionInternal(ex,ex.getMessage(),new HttpHeaders(),HttpStatus.INTERNAL_SERVER_ERROR, request);
}
}
| 1,604 | 0.809227 | 0.809227 | 36 | 43.555557 | 38.638958 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.805556 | false | false | 9 |
21bf302e222aa56b724fab34812b26762946d3e9 | 28,484,223,169,172 | e84e6fe4521f9ba19e42fe9b1b7255f35ac36c64 | /src/main/java/br/gov/cultura/DitelAdm/controller/UsuarioMenuDispositivosController.java | 44abad42a2f8b23a6e8dc2aefa8a6c5106151df6 | [] | no_license | lappis-unb/SisTel | https://github.com/lappis-unb/SisTel | 0265a6e002038f0b66866418607845f2e58af6ca | 99669b12e0d364dfffb8ae7818bcccb66572d09b | refs/heads/master | 2021-09-03T16:24:09.279000 | 2018-01-10T11:40:12 | 2018-01-10T09:41:05 | 108,408,357 | 0 | 1 | null | true | 2018-01-10T11:33:19 | 2017-10-26T12:26:49 | 2017-10-26T12:26:53 | 2018-01-10T11:33:18 | 13,113 | 0 | 1 | 0 | HTML | false | null | package br.gov.cultura.DitelAdm.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import br.gov.cultura.DitelAdm.model.Chip;
import br.gov.cultura.DitelAdm.model.Dispositivo;
import br.gov.cultura.DitelAdm.model.Linha;
import br.gov.cultura.DitelAdm.model.Usuario;
import br.gov.cultura.DitelAdm.repository.filtro.FiltroPesquisa;
import br.gov.cultura.DitelAdm.service.CadastroChipService;
import br.gov.cultura.DitelAdm.service.CadastroDispositivoService;
import br.gov.cultura.DitelAdm.service.CadastroLinhaService;
import br.gov.cultura.DitelAdm.service.CadastroUsuarioService;
@Controller
@RequestMapping("/menu-usuario")
public class UsuarioMenuDispositivosController {
@Autowired
private CadastroDispositivoService cadastroDispositivoService;
@Autowired
private CadastroUsuarioService cadastroUsuarioService;
@Autowired
private CadastroChipService cadastroChipService;
@Autowired
private CadastroLinhaService cadastroLinhaService;
@RequestMapping("/dispositivo")
public ModelAndView dispositivo(@ModelAttribute("filtro")FiltroPesquisa filtro){
List<Dispositivo> todosDispositivos = cadastroDispositivoService.getIdDispositivo();
ModelAndView mv = new ModelAndView("UsuarioMenuDispositivo");
mv.addObject("dispositivos", todosDispositivos);
List<Usuario> todosUsuarios = cadastroUsuarioService.getIdUsuario();
mv.addObject("usuarios", todosUsuarios);
List<Chip> todosChips = cadastroChipService.getIdChip();
mv.addObject("chips", todosChips);
List<Linha> todasLinhas = cadastroLinhaService.getIdLinha();
mv.addObject("linhas", todasLinhas);
return mv;
}
@RequestMapping("/agenda")
public ModelAndView agenda(@ModelAttribute("filtro")FiltroPesquisa filtro){
List<Dispositivo> todosDispositivos = cadastroDispositivoService.getIdDispositivo();
ModelAndView mv = new ModelAndView("UsuarioMenuAgenda");
mv.addObject("dispositivos", todosDispositivos);
List<Usuario> todosUsuarios = cadastroUsuarioService.getIdUsuario();
mv.addObject("usuarios", todosUsuarios);
List<Chip> todosChips = cadastroChipService.getIdChip();
mv.addObject("chips", todosChips);
List<Linha> todasLinhas = cadastroLinhaService.getIdLinha();
mv.addObject("linhas", todasLinhas);
return mv;
}
} | UTF-8 | Java | 2,619 | java | UsuarioMenuDispositivosController.java | Java | [] | null | [] | package br.gov.cultura.DitelAdm.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import br.gov.cultura.DitelAdm.model.Chip;
import br.gov.cultura.DitelAdm.model.Dispositivo;
import br.gov.cultura.DitelAdm.model.Linha;
import br.gov.cultura.DitelAdm.model.Usuario;
import br.gov.cultura.DitelAdm.repository.filtro.FiltroPesquisa;
import br.gov.cultura.DitelAdm.service.CadastroChipService;
import br.gov.cultura.DitelAdm.service.CadastroDispositivoService;
import br.gov.cultura.DitelAdm.service.CadastroLinhaService;
import br.gov.cultura.DitelAdm.service.CadastroUsuarioService;
@Controller
@RequestMapping("/menu-usuario")
public class UsuarioMenuDispositivosController {
@Autowired
private CadastroDispositivoService cadastroDispositivoService;
@Autowired
private CadastroUsuarioService cadastroUsuarioService;
@Autowired
private CadastroChipService cadastroChipService;
@Autowired
private CadastroLinhaService cadastroLinhaService;
@RequestMapping("/dispositivo")
public ModelAndView dispositivo(@ModelAttribute("filtro")FiltroPesquisa filtro){
List<Dispositivo> todosDispositivos = cadastroDispositivoService.getIdDispositivo();
ModelAndView mv = new ModelAndView("UsuarioMenuDispositivo");
mv.addObject("dispositivos", todosDispositivos);
List<Usuario> todosUsuarios = cadastroUsuarioService.getIdUsuario();
mv.addObject("usuarios", todosUsuarios);
List<Chip> todosChips = cadastroChipService.getIdChip();
mv.addObject("chips", todosChips);
List<Linha> todasLinhas = cadastroLinhaService.getIdLinha();
mv.addObject("linhas", todasLinhas);
return mv;
}
@RequestMapping("/agenda")
public ModelAndView agenda(@ModelAttribute("filtro")FiltroPesquisa filtro){
List<Dispositivo> todosDispositivos = cadastroDispositivoService.getIdDispositivo();
ModelAndView mv = new ModelAndView("UsuarioMenuAgenda");
mv.addObject("dispositivos", todosDispositivos);
List<Usuario> todosUsuarios = cadastroUsuarioService.getIdUsuario();
mv.addObject("usuarios", todosUsuarios);
List<Chip> todosChips = cadastroChipService.getIdChip();
mv.addObject("chips", todosChips);
List<Linha> todasLinhas = cadastroLinhaService.getIdLinha();
mv.addObject("linhas", todasLinhas);
return mv;
}
} | 2,619 | 0.783505 | 0.783505 | 99 | 25.464647 | 27.15995 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.777778 | false | false | 9 |
7d33e4b4b0aa2b65215073512b5e653bb2c38863 | 22,892,175,746,356 | 0176862d17cd299a55a33d78e466cc2c0be6995b | /Learning/src/leetcode/HouseRobberDP.java | 09fcb67a915243924f0b0ef4ccef4b82b97ab20f | [] | no_license | shubham1210/interview-Alogo-DS | https://github.com/shubham1210/interview-Alogo-DS | eb4781caa17d045168ff1ccb478e8a2beb22b9c0 | d341e33de7210dfc15989503406feb2ffd952e1f | refs/heads/master | 2022-12-28T11:57:44.688000 | 2020-09-12T14:48:05 | 2020-09-12T14:48:05 | 55,890,286 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode;
/**
* https://leetcode.com/problems/house-robber/
*/
public class HouseRobberDP {
public int rob(int[] nums) {
int n = nums.length;
if(n==0)return 0;
if(n==1) return nums[0];
int max[] = new int[n];
max[0] = nums[0];
max[1] = Math.max(nums[0],nums[1]);
int i=2;
for(i=2;i<n;i++)
{
// so we are checking at i we can onlt look back i-2 due to question constrained and see if current postion + last i-2 processed
// positon is greater than last processed postion. i-1
max[i] = Math.max(nums[i]+max[i-2] , max[i-1]);
}
return max[n-1];
}
public static void main(String[] args) {
int a[] = {2,1,1,2};
HouseRobberDP dp = new HouseRobberDP();
System.out.println(dp.rob(a));
}
}
| UTF-8 | Java | 895 | java | HouseRobberDP.java | Java | [] | null | [] | package leetcode;
/**
* https://leetcode.com/problems/house-robber/
*/
public class HouseRobberDP {
public int rob(int[] nums) {
int n = nums.length;
if(n==0)return 0;
if(n==1) return nums[0];
int max[] = new int[n];
max[0] = nums[0];
max[1] = Math.max(nums[0],nums[1]);
int i=2;
for(i=2;i<n;i++)
{
// so we are checking at i we can onlt look back i-2 due to question constrained and see if current postion + last i-2 processed
// positon is greater than last processed postion. i-1
max[i] = Math.max(nums[i]+max[i-2] , max[i-1]);
}
return max[n-1];
}
public static void main(String[] args) {
int a[] = {2,1,1,2};
HouseRobberDP dp = new HouseRobberDP();
System.out.println(dp.rob(a));
}
}
| 895 | 0.510615 | 0.487151 | 33 | 25.121212 | 27.392498 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606061 | false | false | 9 |
a555a567803e212e1820b0ebe2460f543d8cd747 | 9,577,777,129,392 | 2b6d87789b04c9c694474f2fa5efca1040da2706 | /src/com/biz/controller/ScoreExec_02.java | 30b7731fd4635438d2c8685378567a1153f9b115 | [] | no_license | wkdghdrl1/Grade_02 | https://github.com/wkdghdrl1/Grade_02 | a3a62fd93d4776b11ca1e20291a0e7363805f70e | 512087436443f5579d230c870f7d04d865551d75 | refs/heads/master | 2020-06-04T06:08:06.336000 | 2019-06-14T07:45:49 | 2019-06-14T07:45:49 | 191,899,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.biz.controller;
import java.io.FileNotFoundException;
import com.biz.grade.service.ScoreService;
import com.biz.grade.service.ScoreServiceImp_04;
public class ScoreExec_02 {
public static void main(String[] args) {
String scoreFile = "src/com/biz/data/Score.txt";
/*
* try 문으로 묶어야되는 명령문이 있을 경우 try 문 안에서 객체나, 변수를 생성하면 try 문 안에 모든 코드를 집중시켜야한다.
*
* 그래서 선언문과 생성문을 별도로 분리하는 것이 좋다.
*/
ScoreService sService = null; // 선언문
try {
// 생성문
sService = new ScoreServiceImp_04(10, scoreFile);
} catch (FileNotFoundException e) {
// TODO: handle exception
}
sService.inputScore(0);
sService.viewList();
}
}
| UTF-8 | Java | 799 | java | ScoreExec_02.java | Java | [] | null | [] | package com.biz.controller;
import java.io.FileNotFoundException;
import com.biz.grade.service.ScoreService;
import com.biz.grade.service.ScoreServiceImp_04;
public class ScoreExec_02 {
public static void main(String[] args) {
String scoreFile = "src/com/biz/data/Score.txt";
/*
* try 문으로 묶어야되는 명령문이 있을 경우 try 문 안에서 객체나, 변수를 생성하면 try 문 안에 모든 코드를 집중시켜야한다.
*
* 그래서 선언문과 생성문을 별도로 분리하는 것이 좋다.
*/
ScoreService sService = null; // 선언문
try {
// 생성문
sService = new ScoreServiceImp_04(10, scoreFile);
} catch (FileNotFoundException e) {
// TODO: handle exception
}
sService.inputScore(0);
sService.viewList();
}
}
| 799 | 0.689127 | 0.675345 | 31 | 20.064516 | 20.834116 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.483871 | false | false | 9 |
6ef957935e5ba1702c800f386a84705f31d3b426 | 29,824,252,973,494 | 6f105b353377cf2544cffc7b54ca8e0ddc9a7aeb | /NewBostonNetbeans/src/ToString/ToString_Caller.java | 4e5268502dd2eb793e1c282b8b4cfd30d3b41027 | [
"MIT"
] | permissive | avoajaugochukwu/java.tut | https://github.com/avoajaugochukwu/java.tut | df91c6443eaad4cf7af964f0b6d164725cf2e391 | 6255b06ffe47f4d7915532e3a92da1b21f614dff | refs/heads/master | 2020-03-04T04:37:32.092000 | 2015-05-08T14:55:50 | 2015-05-08T14:55:50 | 33,926,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ToString;
/**
*
* @author TOOCHUWKUO AVOAJA
*/
public class ToString_Caller {
public static void main(String[] args) {
ToString toStringObject = new ToString(4, 5, 6);
ToStringComposition toStringCompositionObject = new ToStringComposition("Greg", toStringObject);
System.out.println(toStringCompositionObject);
}
}
| UTF-8 | Java | 457 | java | ToString_Caller.java | Java | [
{
"context": "or.\r\n */\r\npackage ToString;\r\n\r\n/**\r\n *\r\n * @author TOOCHUWKUO AVOAJA\r\n */\r\npublic class ToString_Caller {\r\n\tpublic sta",
"end": 162,
"score": 0.999692440032959,
"start": 145,
"tag": "NAME",
"value": "TOOCHUWKUO AVOAJA"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ToString;
/**
*
* @author <NAME>
*/
public class ToString_Caller {
public static void main(String[] args) {
ToString toStringObject = new ToString(4, 5, 6);
ToStringComposition toStringCompositionObject = new ToStringComposition("Greg", toStringObject);
System.out.println(toStringCompositionObject);
}
}
| 446 | 0.704595 | 0.698031 | 19 | 22.052631 | 26.244747 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.894737 | false | false | 9 |
be20e16c4c04f3846673576fb3b9a16d284267a5 | 24,446,953,903,042 | dc846791331f4177c1889cbea060479c6a1c6f6f | /src/java/com/model/Empleado.java | 6d43afcaae225119579884752b31cb48c5b266d2 | [] | no_license | Alejandro7740/SpringConexionBaseDatos1 | https://github.com/Alejandro7740/SpringConexionBaseDatos1 | f2f0206eddf362e2408e429f364a9468bed743fd | 6879fe65fa4a2920d3a5805cd4f5b3a0b4707825 | refs/heads/master | 2020-08-21T21:10:22.569000 | 2019-10-19T17:40:48 | 2019-10-19T17:40:48 | 216,245,948 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.model;
/**
*
* @author Administrador
*/
public class Empleado {
private int codigoEmpleado;
private String nombre;
private String genero;
private int edad;
private String cargo;
public Empleado() {
}
public Empleado(int codigoEmpleado, String nombre, String genero, int edad, String cargo) {
this.codigoEmpleado = codigoEmpleado;
this.nombre = nombre;
this.genero = genero;
this.edad = edad;
this.cargo = cargo;
}
public int getCodigoEmpleado() {
return codigoEmpleado;
}
public void setCodigoEmpleado(int codigoEmpleado) {
this.codigoEmpleado = codigoEmpleado;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
public String getCargo() {
return cargo;
}
public void setCargo(String cargo) {
this.cargo = cargo;
}
}
| UTF-8 | Java | 1,254 | java | Empleado.java | Java | [
{
"context": "package com.model;\n\n/**\n *\n * @author Administrador\n */\npublic class Empleado {\n\n private int codi",
"end": 51,
"score": 0.8345997333526611,
"start": 38,
"tag": "NAME",
"value": "Administrador"
}
] | null | [] | package com.model;
/**
*
* @author Administrador
*/
public class Empleado {
private int codigoEmpleado;
private String nombre;
private String genero;
private int edad;
private String cargo;
public Empleado() {
}
public Empleado(int codigoEmpleado, String nombre, String genero, int edad, String cargo) {
this.codigoEmpleado = codigoEmpleado;
this.nombre = nombre;
this.genero = genero;
this.edad = edad;
this.cargo = cargo;
}
public int getCodigoEmpleado() {
return codigoEmpleado;
}
public void setCodigoEmpleado(int codigoEmpleado) {
this.codigoEmpleado = codigoEmpleado;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
public String getCargo() {
return cargo;
}
public void setCargo(String cargo) {
this.cargo = cargo;
}
}
| 1,254 | 0.591707 | 0.591707 | 68 | 17.441177 | 17.594603 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.367647 | false | false | 9 |
d55d3e3fd1d7a465e130c44b4404f73e802b75f7 | 24,446,953,903,451 | d9c39bdd08d7650edfe2da61ffa71ff917912e3f | /GCM_android_files/src/com/sepeiupdates/gcm/RegisterActivity.java | 91a4a033ab3fd5a2378d84c12d9950d491e127ec | [] | no_license | Shakeebbk/PEIUpdates | https://github.com/Shakeebbk/PEIUpdates | c8b69c97efc38787668c48f595bbf6acf95dbddb | 549cf3a5491f8849bac762e1911cf08a5b8cc1d2 | refs/heads/master | 2016-08-12T12:51:13.632000 | 2015-05-26T06:22:24 | 2015-05-26T06:22:24 | 36,276,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sepeiupdates.gcm;
import com.sepeiupdates.gcm.R;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class RegisterActivity extends Activity {
// UI elements
EditText txtName;
TextView txtEmail;
// Register button
Button btnRegister;
private int count = 0;
private long startMillis=0;
//Prefs
public static final String MYPREFS= "MyLogin";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
getActionBar().setDisplayShowTitleEnabled(false);
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_logo));
if((activeNetworkInfo != null && activeNetworkInfo.isConnected()) == false) {
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_logo_no_connection));
}
//Get Global Controller Class object (see application tag in AndroidManifest.xml)
final Controller aController = (Controller) getApplicationContext();
// Check if Internet Connection present
if (!aController.isConnectingToInternet()) {
// Internet Connection is not present
//aController.showAlertDialog(RegisterActivity.this,
// "Internet Connection Error",
// "Please connect to working Internet connection", false);
// stop executing code by return
//return;
}
// Check if GCM configuration is set
if (Config.YOUR_SERVER_URL == null || Config.GOOGLE_SENDER_ID == null || Config.YOUR_SERVER_URL.length() == 0
|| Config.GOOGLE_SENDER_ID.length() == 0) {
// GCM sernder id / server url is missing
aController.showAlertDialog(RegisterActivity.this, "Configuration Error!",
"Please set your Server URL and GCM Sender ID", false);
// stop executing code by return
return;
}
//Get the Prefs
final SharedPreferences settings = getSharedPreferences(MYPREFS, 0);
// Getting intent
Intent regIntent = getIntent();
final Boolean isIntent = regIntent.getBooleanExtra("isIntent", false);
if(settings.contains("userName") && (!isIntent)) {
// Launch Main Activity
final String name = settings.getString("userName", "");
final String email = settings.getString("email", "");
Intent i = new Intent(getApplicationContext(), MainActivity.class);
// Registering user on our server
// Sending registraiton details to MainActivity
i.putExtra("name", name);
i.putExtra("email", email);
startActivity(i);
finish();
}
else {
txtName = (EditText) findViewById(R.id.txtName);
txtEmail = (TextView) findViewById(R.id.txtEmail);
String emailID = null;
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
for (Account account : accounts) {
// this is where the email should be in:
emailID = account.name;
}
txtEmail.setText(emailID);
txtEmail.setKeyListener(null);
Log.i("#MyAppDebug", "emailID = "+emailID);
btnRegister = (Button) findViewById(R.id.btnRegister);
if(isIntent) {
txtName.setText(settings.getString("userName", ""));
txtEmail.setText(settings.getString("email", ""));
Log.d("#MyAppDebug", "RegisterActivity(isIntent)"+isIntent);
}
// Click event on Register button
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// Get data from EditText
String name = txtName.getText().toString();
String email = txtEmail.getText().toString();
// Check if user filled the form
if(name.trim().length() > 0 && email.trim().length() > 0){
SharedPreferences.Editor editor = settings.edit();
editor.putString("userName", name);
editor.putString("email", email);
editor.putBoolean("isReadFilter", false);
editor.commit();
// Launch Main Activity
Intent i = new Intent(getApplicationContext(), MainActivity.class);
// Registering user on our server
// Sending registraiton details to MainActivity
i.putExtra("name", name);
i.putExtra("email", email);
startActivity(i);
finish();
}else{
// user doen't filled that data
final AlertDialog ad = new AlertDialog(RegisterActivity.this, R.style.Theme_MyCustomProgressDialog) {};
ad.setTitle("Registration Error!");
ad.setMessage("Please check account details");
ad.show();
}
}
});
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
if (eventaction == MotionEvent.ACTION_UP) {
//get system current milliseconds
long time= System.currentTimeMillis();
//if it is the first time, or if it has been more than 3 seconds since the first tap ( so it is like a new try), we reset everything
if (startMillis==0 || (time-startMillis> 3000) ) {
startMillis=time;
count=1;
}
//it is not the first, and it has been less than 3 seconds since the first
else{ // time-startMillis< 3000
count++;
}
if (count==7) {
//do whatever you need
Log.d("#MyAppDebug EasterEgg", "SHAKEEB!");
Intent i = new Intent(getApplicationContext(), EasterEggActivity.class);
startActivity(i);
//finish();
}
return true;
}
return false;
}
}
| UTF-8 | Java | 6,106 | java | RegisterActivity.java | Java | [
{
"context": "ra(\"isIntent\", false);\n\t\t\n\t\tif(settings.contains(\"userName\") && (!isIntent)) {\n\t\t\t// Launch Main Activity\n\t\t",
"end": 2747,
"score": 0.9454008936882019,
"start": 2739,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "tivity\n\t\t\tfinal String na... | null | [] | package com.sepeiupdates.gcm;
import com.sepeiupdates.gcm.R;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class RegisterActivity extends Activity {
// UI elements
EditText txtName;
TextView txtEmail;
// Register button
Button btnRegister;
private int count = 0;
private long startMillis=0;
//Prefs
public static final String MYPREFS= "MyLogin";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
getActionBar().setDisplayShowTitleEnabled(false);
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_logo));
if((activeNetworkInfo != null && activeNetworkInfo.isConnected()) == false) {
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_logo_no_connection));
}
//Get Global Controller Class object (see application tag in AndroidManifest.xml)
final Controller aController = (Controller) getApplicationContext();
// Check if Internet Connection present
if (!aController.isConnectingToInternet()) {
// Internet Connection is not present
//aController.showAlertDialog(RegisterActivity.this,
// "Internet Connection Error",
// "Please connect to working Internet connection", false);
// stop executing code by return
//return;
}
// Check if GCM configuration is set
if (Config.YOUR_SERVER_URL == null || Config.GOOGLE_SENDER_ID == null || Config.YOUR_SERVER_URL.length() == 0
|| Config.GOOGLE_SENDER_ID.length() == 0) {
// GCM sernder id / server url is missing
aController.showAlertDialog(RegisterActivity.this, "Configuration Error!",
"Please set your Server URL and GCM Sender ID", false);
// stop executing code by return
return;
}
//Get the Prefs
final SharedPreferences settings = getSharedPreferences(MYPREFS, 0);
// Getting intent
Intent regIntent = getIntent();
final Boolean isIntent = regIntent.getBooleanExtra("isIntent", false);
if(settings.contains("userName") && (!isIntent)) {
// Launch Main Activity
final String name = settings.getString("userName", "");
final String email = settings.getString("email", "");
Intent i = new Intent(getApplicationContext(), MainActivity.class);
// Registering user on our server
// Sending registraiton details to MainActivity
i.putExtra("name", name);
i.putExtra("email", email);
startActivity(i);
finish();
}
else {
txtName = (EditText) findViewById(R.id.txtName);
txtEmail = (TextView) findViewById(R.id.txtEmail);
String emailID = null;
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
for (Account account : accounts) {
// this is where the email should be in:
emailID = account.name;
}
txtEmail.setText(emailID);
txtEmail.setKeyListener(null);
Log.i("#MyAppDebug", "emailID = "+emailID);
btnRegister = (Button) findViewById(R.id.btnRegister);
if(isIntent) {
txtName.setText(settings.getString("userName", ""));
txtEmail.setText(settings.getString("email", ""));
Log.d("#MyAppDebug", "RegisterActivity(isIntent)"+isIntent);
}
// Click event on Register button
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// Get data from EditText
String name = txtName.getText().toString();
String email = txtEmail.getText().toString();
// Check if user filled the form
if(name.trim().length() > 0 && email.trim().length() > 0){
SharedPreferences.Editor editor = settings.edit();
editor.putString("userName", name);
editor.putString("email", email);
editor.putBoolean("isReadFilter", false);
editor.commit();
// Launch Main Activity
Intent i = new Intent(getApplicationContext(), MainActivity.class);
// Registering user on our server
// Sending registraiton details to MainActivity
i.putExtra("name", name);
i.putExtra("email", email);
startActivity(i);
finish();
}else{
// user doen't filled that data
final AlertDialog ad = new AlertDialog(RegisterActivity.this, R.style.Theme_MyCustomProgressDialog) {};
ad.setTitle("Registration Error!");
ad.setMessage("Please check account details");
ad.show();
}
}
});
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
if (eventaction == MotionEvent.ACTION_UP) {
//get system current milliseconds
long time= System.currentTimeMillis();
//if it is the first time, or if it has been more than 3 seconds since the first tap ( so it is like a new try), we reset everything
if (startMillis==0 || (time-startMillis> 3000) ) {
startMillis=time;
count=1;
}
//it is not the first, and it has been less than 3 seconds since the first
else{ // time-startMillis< 3000
count++;
}
if (count==7) {
//do whatever you need
Log.d("#MyAppDebug EasterEgg", "SHAKEEB!");
Intent i = new Intent(getApplicationContext(), EasterEggActivity.class);
startActivity(i);
//finish();
}
return true;
}
return false;
}
}
| 6,106 | 0.682607 | 0.679168 | 192 | 30.802084 | 26.140892 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.833333 | false | false | 9 |
30cc5e86be644f997278f268b7e7306c0a459fe1 | 6,657,199,320,044 | e6c2296302d557f7749b287e49964afbc537cc29 | /src/main/java/edu/tamu/app/model/repo/ProductRepo.java | 0cae7166ecf886bc8b78037fa7a8848eb86e4dc7 | [
"MIT"
] | permissive | TAMULib/ProjectManagementService | https://github.com/TAMULib/ProjectManagementService | 3e65b65113e67d4be903b73efa6737fa6bf0c6b9 | 264f77b2001a23bd69df644abe9c8f6c6d65eac1 | refs/heads/main | 2023-01-05T19:32:54.408000 | 2022-11-04T19:40:42 | 2022-11-04T19:40:42 | 124,890,811 | 0 | 0 | MIT | false | 2022-11-04T19:40:43 | 2018-03-12T13:09:07 | 2022-08-05T15:48:28 | 2022-11-04T19:40:42 | 1,146 | 0 | 0 | 11 | Java | false | false | package edu.tamu.app.model.repo;
import java.util.Optional;
import edu.tamu.app.model.Product;
import edu.tamu.app.model.repo.custom.ProductRepoCustom;
import edu.tamu.weaver.data.model.repo.WeaverRepo;
public interface ProductRepo extends WeaverRepo<Product>, ProductRepoCustom {
public Long countByRemoteProjectInfoRemoteProjectManagerId(Long remoteProjectInfoRemoteProjectManagerId);
public Optional<Product> findByName(String name);
}
| UTF-8 | Java | 453 | java | ProductRepo.java | Java | [] | null | [] | package edu.tamu.app.model.repo;
import java.util.Optional;
import edu.tamu.app.model.Product;
import edu.tamu.app.model.repo.custom.ProductRepoCustom;
import edu.tamu.weaver.data.model.repo.WeaverRepo;
public interface ProductRepo extends WeaverRepo<Product>, ProductRepoCustom {
public Long countByRemoteProjectInfoRemoteProjectManagerId(Long remoteProjectInfoRemoteProjectManagerId);
public Optional<Product> findByName(String name);
}
| 453 | 0.8234 | 0.8234 | 15 | 29.200001 | 32.98727 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 9 |
e96cf632ae546a050de3ef4a049c2d5f5ce01251 | 14,181,982,015,613 | d9b190f43dab12e3f87bc47cb10692b8f6e47fb7 | /src/main/java/com/halle/java/base/proxy/jdk/XInterface.java | f6e4f45ebcc2c4455d11d16548c452c90041d286 | [] | no_license | jinhao11/halleStudy | https://github.com/jinhao11/halleStudy | 101555046507d9642c3ab81e3210b23ab3cf86a4 | 8a3ac54c7d33c37173cc7e34dfdea5483cb9d0e6 | refs/heads/master | 2021-06-12T14:21:01.716000 | 2021-03-09T12:36:40 | 2021-03-09T12:36:40 | 139,165,334 | 0 | 0 | null | false | 2020-10-13T04:47:02 | 2018-06-29T15:23:38 | 2020-09-01T05:43:46 | 2020-10-13T04:47:00 | 1,470 | 0 | 0 | 1 | Java | false | false | package com.halle.java.base.proxy.jdk;
public interface XInterface {
void doX(int num);
}
| UTF-8 | Java | 95 | java | XInterface.java | Java | [] | null | [] | package com.halle.java.base.proxy.jdk;
public interface XInterface {
void doX(int num);
}
| 95 | 0.726316 | 0.726316 | 5 | 18 | 15.165751 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 9 |
6337d677b7308ea1a361c1d664e342c6bfbf22e3 | 23,210,003,325,692 | 233b654a09622ce391ab6cc62eb0347a02fd9ef7 | /pr/lab7/czytelnia_java/src/czytelnia_java/Writer.java | 02cf65aae35afd939f4856dac8f7f736a9235a3a | [] | no_license | niemcu/agh-stuff | https://github.com/niemcu/agh-stuff | d1db58fbfb8225455ccca787217e5d1c5202d5d5 | 02986ac1ef04baf8f57d0dc9379d04c8d49ed8e6 | refs/heads/master | 2020-04-16T00:50:51.949000 | 2016-07-23T05:43:41 | 2016-07-23T05:43:41 | 35,327,145 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package czytelnia_java;
import java.util.Random;
public class Writer implements Runnable {
private ReadingRoom room;
public Writer(ReadingRoom room) {
this.room = room;
}
@Override
public void run() {
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": chcę pisać");
room.startWriting();
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": piszę");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {}
room.stopWriting();
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": skończyłem pisać");
}
} | UTF-8 | Java | 627 | java | Writer.java | Java | [] | null | [] | package czytelnia_java;
import java.util.Random;
public class Writer implements Runnable {
private ReadingRoom room;
public Writer(ReadingRoom room) {
this.room = room;
}
@Override
public void run() {
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": chcę pisać");
room.startWriting();
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": piszę");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {}
room.stopWriting();
System.out.println("nrwatku: " + Thread.currentThread().getId() + ": skończyłem pisać");
}
} | 627 | 0.647343 | 0.640902 | 24 | 24.791666 | 27.210567 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.083333 | false | false | 9 |
e255e938d22f17cf95db4f3e6a20200c8ea075d0 | 30,434,138,264,200 | 8beff2947aff3acb27f40ea98956c414578641e0 | /src/main/java/com/powerboot/system/service/FinancialProductService.java | fbde8630af9dc67ffcf99d80f9822a56e31c8bc7 | [] | no_license | tufeng1992/online-earning-boss | https://github.com/tufeng1992/online-earning-boss | 06f6ad41cee1d7f27674bc84af570740bf5e9099 | 4db5af387262cef9465978fbbfd2bdafaaac38a6 | refs/heads/main | 2023-07-13T12:58:48.584000 | 2021-08-27T15:10:32 | 2021-08-27T15:10:32 | 357,754,347 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.powerboot.system.service;
import com.powerboot.system.domain.FinancialProductDO;
import java.util.List;
import java.util.Map;
/**
* 理财产品表
*
*/
public interface FinancialProductService {
FinancialProductDO get(Integer id);
List<FinancialProductDO> list(Map<String, Object> map);
int count(Map<String, Object> map);
int save(FinancialProductDO financialProduct);
int update(FinancialProductDO financialProduct);
int remove(Integer id);
int batchRemove(Integer[] ids);
}
| UTF-8 | Java | 518 | java | FinancialProductService.java | Java | [] | null | [] | package com.powerboot.system.service;
import com.powerboot.system.domain.FinancialProductDO;
import java.util.List;
import java.util.Map;
/**
* 理财产品表
*
*/
public interface FinancialProductService {
FinancialProductDO get(Integer id);
List<FinancialProductDO> list(Map<String, Object> map);
int count(Map<String, Object> map);
int save(FinancialProductDO financialProduct);
int update(FinancialProductDO financialProduct);
int remove(Integer id);
int batchRemove(Integer[] ids);
}
| 518 | 0.755906 | 0.755906 | 27 | 17.814816 | 19.665794 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
377f9cba2e7fb8266c8863b34a3f35c6b1190aae | 29,497,835,446,731 | 5ed5d3d1b6f02909c38da3fb9f82a34b3c8c31d2 | /src/main/java/com/wms/dto/productDTO.java | a2078a87ece2bb06a95e548fd61a86ab884edfde | [] | no_license | fjh1998/wms | https://github.com/fjh1998/wms | 73d60591b86a828b4ed9342726aa846b5ce736be | f6cd739dcf07c7e401f6d2188a1ba3e09e33a6c8 | refs/heads/master | 2022-06-22T10:29:10.964000 | 2019-10-26T02:55:39 | 2019-10-26T02:55:39 | 211,017,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wms.dto;
import lombok.Data;
@Data
public class productDTO {
private Integer id;
private String name;
private Double price;
private Integer min;
private Integer max;
private String unit;
private String warehouse;
private String category;
private String standards;
private Integer storage;
}
| UTF-8 | Java | 345 | java | productDTO.java | Java | [] | null | [] | package com.wms.dto;
import lombok.Data;
@Data
public class productDTO {
private Integer id;
private String name;
private Double price;
private Integer min;
private Integer max;
private String unit;
private String warehouse;
private String category;
private String standards;
private Integer storage;
}
| 345 | 0.710145 | 0.710145 | 17 | 19.294117 | 10.265675 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.705882 | false | false | 9 |
21aa4aee0e0d35c0b1c2abc59993677423468986 | 31,645,319,041,261 | 3b4bf1c3bb3278e4a54715fe39e566e36f8d64b5 | /app/src/main/java/com/autionsy/seller/activity/ManagementGoodsActivity.java | 91f12a1371674191f4b474eb0b56897f8ef24b28 | [] | no_license | dawei1980/AutoinsySeller-Android | https://github.com/dawei1980/AutoinsySeller-Android | 153599f94aedcf95c52c2fc45d69cc4f3abe02ba | 37c24b3d1b10f5f31c251a0342b30cf804c0bac6 | refs/heads/master | 2022-06-09T03:19:02.473000 | 2020-05-05T12:30:12 | 2020-05-05T12:30:12 | 261,461,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.autionsy.seller.activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.autionsy.seller.R;
import com.autionsy.seller.adapter.ManagementGoodsAdapter;
import com.autionsy.seller.constant.Constants;
import com.autionsy.seller.entity.Goods;
import com.autionsy.seller.utils.OkHttp3Utils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class ManagementGoodsActivity extends BaseActivity {
@BindView(R.id.title_tv)
TextView title_tv;
@BindView(R.id.goods_management_lv)
ListView goods_management_lv;
private ManagementGoodsAdapter mAdapter;
private List<Goods> mList = new ArrayList<>();
private Goods goods;
@Override
public void onDestroy(){
super.onDestroy();
if(title_tv != null){
title_tv = null;
}
if(goods_management_lv != null){
goods_management_lv = null;
}
if(mList.size() != 0){
mList.clear();
}
if(goods != null){
goods = null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_management_goods);
ButterKnife.bind(this);
initView();
postAsynHttpGoods();
}
private void initView(){
title_tv.setVisibility(View.VISIBLE);
title_tv.setText(R.string.goods_management);
}
@OnClick({R.id.back_btn})
public void onClick(View view){
switch (view.getId()){
case R.id.back_btn:
finish();
break;
}
}
/**商品*/
private void postAsynHttpGoods(){
SharedPreferences prefs = getSharedPreferences("seller_login_data", MODE_PRIVATE); //获取对象,读取data文件
String username = prefs.getString("USERNAME", ""); //获取文件中的数据
String url = Constants.HTTP_URL + "getAllGoods";
Map<String,String> map = new HashMap<>();
map.put("username",username);
OkHttp3Utils.doPost(url, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responeString = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject jsonObject = new JSONObject(responeString);
String resultCode = jsonObject.optString("code");
String data = jsonObject.optString("data");
String message = jsonObject.optString("message");
if("200".equals(resultCode)){
goods = new Goods();
JSONArray jsonArray = jsonObject.getJSONArray(data);
for (int i=0; i<jsonArray.length(); i++){
JSONObject jsonObjectGoods = jsonArray.getJSONObject(i);
goods.setGoodsId(jsonObjectGoods.getString("goodsId"));
goods.setBrand(jsonObjectGoods.getString("brand"));
goods.setGoodsName(jsonObjectGoods.getString("goodsName"));
goods.setGoodsPic(jsonObjectGoods.getString("goodsPic"));
goods.setPrice(jsonObjectGoods.getString("price"));
goods.setQuantity(jsonObjectGoods.getString("quantity"));
goods.setDescribe(jsonObjectGoods.getString("describe"));
goods.setMotorcycleFrameNumber(jsonObjectGoods.getString("motorcycleFrameNumber"));
goods.setProductPlace(jsonObjectGoods.getString("productPlace"));
goods.setPublishTime(jsonObjectGoods.getString("publishTime"));
mList.add(goods);
}
/**需要根据状态来发送请求*/
mAdapter = new ManagementGoodsAdapter(ManagementGoodsActivity.this,mList);
goods_management_lv.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
}else if("403".equals(resultCode)){
Toast.makeText(getApplicationContext(),R.string.param_error,Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(getApplicationContext(),R.string.login_fail,Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
});
}
}
| UTF-8 | Java | 5,609 | java | ManagementGoodsActivity.java | Java | [
{
"context": "data文件\n String username = prefs.getString(\"USERNAME\", \"\"); //获取文件中的数据\n\n String url = Constants",
"end": 2300,
"score": 0.9771547913551331,
"start": 2292,
"tag": "USERNAME",
"value": "USERNAME"
}
] | null | [] | package com.autionsy.seller.activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.autionsy.seller.R;
import com.autionsy.seller.adapter.ManagementGoodsAdapter;
import com.autionsy.seller.constant.Constants;
import com.autionsy.seller.entity.Goods;
import com.autionsy.seller.utils.OkHttp3Utils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class ManagementGoodsActivity extends BaseActivity {
@BindView(R.id.title_tv)
TextView title_tv;
@BindView(R.id.goods_management_lv)
ListView goods_management_lv;
private ManagementGoodsAdapter mAdapter;
private List<Goods> mList = new ArrayList<>();
private Goods goods;
@Override
public void onDestroy(){
super.onDestroy();
if(title_tv != null){
title_tv = null;
}
if(goods_management_lv != null){
goods_management_lv = null;
}
if(mList.size() != 0){
mList.clear();
}
if(goods != null){
goods = null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_management_goods);
ButterKnife.bind(this);
initView();
postAsynHttpGoods();
}
private void initView(){
title_tv.setVisibility(View.VISIBLE);
title_tv.setText(R.string.goods_management);
}
@OnClick({R.id.back_btn})
public void onClick(View view){
switch (view.getId()){
case R.id.back_btn:
finish();
break;
}
}
/**商品*/
private void postAsynHttpGoods(){
SharedPreferences prefs = getSharedPreferences("seller_login_data", MODE_PRIVATE); //获取对象,读取data文件
String username = prefs.getString("USERNAME", ""); //获取文件中的数据
String url = Constants.HTTP_URL + "getAllGoods";
Map<String,String> map = new HashMap<>();
map.put("username",username);
OkHttp3Utils.doPost(url, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responeString = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject jsonObject = new JSONObject(responeString);
String resultCode = jsonObject.optString("code");
String data = jsonObject.optString("data");
String message = jsonObject.optString("message");
if("200".equals(resultCode)){
goods = new Goods();
JSONArray jsonArray = jsonObject.getJSONArray(data);
for (int i=0; i<jsonArray.length(); i++){
JSONObject jsonObjectGoods = jsonArray.getJSONObject(i);
goods.setGoodsId(jsonObjectGoods.getString("goodsId"));
goods.setBrand(jsonObjectGoods.getString("brand"));
goods.setGoodsName(jsonObjectGoods.getString("goodsName"));
goods.setGoodsPic(jsonObjectGoods.getString("goodsPic"));
goods.setPrice(jsonObjectGoods.getString("price"));
goods.setQuantity(jsonObjectGoods.getString("quantity"));
goods.setDescribe(jsonObjectGoods.getString("describe"));
goods.setMotorcycleFrameNumber(jsonObjectGoods.getString("motorcycleFrameNumber"));
goods.setProductPlace(jsonObjectGoods.getString("productPlace"));
goods.setPublishTime(jsonObjectGoods.getString("publishTime"));
mList.add(goods);
}
/**需要根据状态来发送请求*/
mAdapter = new ManagementGoodsAdapter(ManagementGoodsActivity.this,mList);
goods_management_lv.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
}else if("403".equals(resultCode)){
Toast.makeText(getApplicationContext(),R.string.param_error,Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(getApplicationContext(),R.string.login_fail,Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
});
}
}
| 5,609 | 0.549829 | 0.547486 | 150 | 35.993332 | 29.968315 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.613333 | false | false | 9 |
5945b23a564f93fd1f1fbae62319a6fc5c16e673 | 15,728,170,244,542 | c16c0aaa6cdddc5460b7360a8f3fde9f4a5835fc | /src/main/java/com/idaoben/jpaexample/web/controller/EmpController.java | 7071800d2e5f34cc71a419ef8817e4cd05cc1b74 | [] | no_license | yumiaoxia/jpaexample | https://github.com/yumiaoxia/jpaexample | a888a7aad5db97f81d70f73bc2a08045a32fa3cf | 45c1d8da92b8a250eb21633779c4ebfa87764f7b | refs/heads/master | 2018-12-04T08:18:20.848000 | 2018-09-07T23:04:47 | 2018-09-07T23:04:47 | 147,618,133 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.idaoben.jpaexample.web.controller;
import com.idaoben.jpaexample.web.command.EmpListCommand;
import com.idaoben.jpaexample.web.command.IdCommand;
import com.idaoben.jpaexample.web.command.UpdateCommand;
import com.idaoben.jpaexample.web.entity.Employee;
import com.idaoben.jpaexample.web.service.EmpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
/**
* @author Sherman
* created in 2018/9/6
*/
@Api(tags = "雇员接口")
@Controller
@RequestMapping("/employee")
public class EmpController {
@Autowired
private EmpService empService;
@ApiOperation("保存雇员信息")
@PostMapping("/save")
public ModelAndView save(@ApiIgnore ModelAndView mv) {
Employee employee = new Employee();
employee.setName("yumiaoxia");
employee.setAge(24);
employee.setSalary(BigDecimal.valueOf(4000L));
employee = empService.save(employee);
mv.addObject("employee", employee);
mv.setViewName("/result");
return mv;
}
@ApiOperation("查询雇员列表")
@ResponseBody
@PostMapping("/list")
public ResponseEntity<Page<Employee>> list(@RequestBody EmpListCommand command){
Pageable pageable = new PageRequest(command.getPageNo(),command.getPageSize());
return ResponseEntity.ok(empService.findPage(pageable));
}
@ApiOperation("查看雇员信息")
@PostMapping("/view")
@ResponseBody
public ResponseEntity<Employee> view(@RequestBody IdCommand idCommand){
return ResponseEntity.ok(empService.findOne(idCommand.getId()));
}
@ApiOperation("更新雇员信息")
@PostMapping("/update")
@ResponseBody
public ResponseEntity update(@RequestBody UpdateCommand command){
Employee employee = empService.findOne(command.getId());
employee.setAge(command.getAge());
employee.setSalary(command.getSalary());
employee.setName(command.getName());
empService.save(employee);
return ResponseEntity.ok("OK");
}
}
| UTF-8 | Java | 2,593 | java | EmpController.java | Java | [
{
"context": "ore;\n\nimport java.math.BigDecimal;\n\n/**\n * @author Sherman\n * created in 2018/9/6\n */\n@Api(tags = \"雇员接口\")\n@C",
"end": 966,
"score": 0.9983658194541931,
"start": 959,
"tag": "NAME",
"value": "Sherman"
},
{
"context": "loyee = new Employee();\n employee.... | null | [] | package com.idaoben.jpaexample.web.controller;
import com.idaoben.jpaexample.web.command.EmpListCommand;
import com.idaoben.jpaexample.web.command.IdCommand;
import com.idaoben.jpaexample.web.command.UpdateCommand;
import com.idaoben.jpaexample.web.entity.Employee;
import com.idaoben.jpaexample.web.service.EmpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
/**
* @author Sherman
* created in 2018/9/6
*/
@Api(tags = "雇员接口")
@Controller
@RequestMapping("/employee")
public class EmpController {
@Autowired
private EmpService empService;
@ApiOperation("保存雇员信息")
@PostMapping("/save")
public ModelAndView save(@ApiIgnore ModelAndView mv) {
Employee employee = new Employee();
employee.setName("yumiaoxia");
employee.setAge(24);
employee.setSalary(BigDecimal.valueOf(4000L));
employee = empService.save(employee);
mv.addObject("employee", employee);
mv.setViewName("/result");
return mv;
}
@ApiOperation("查询雇员列表")
@ResponseBody
@PostMapping("/list")
public ResponseEntity<Page<Employee>> list(@RequestBody EmpListCommand command){
Pageable pageable = new PageRequest(command.getPageNo(),command.getPageSize());
return ResponseEntity.ok(empService.findPage(pageable));
}
@ApiOperation("查看雇员信息")
@PostMapping("/view")
@ResponseBody
public ResponseEntity<Employee> view(@RequestBody IdCommand idCommand){
return ResponseEntity.ok(empService.findOne(idCommand.getId()));
}
@ApiOperation("更新雇员信息")
@PostMapping("/update")
@ResponseBody
public ResponseEntity update(@RequestBody UpdateCommand command){
Employee employee = empService.findOne(command.getId());
employee.setAge(command.getAge());
employee.setSalary(command.getSalary());
employee.setName(command.getName());
empService.save(employee);
return ResponseEntity.ok("OK");
}
}
| 2,593 | 0.738668 | 0.733938 | 75 | 32.826668 | 22.605234 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false | 9 |
668d97fda2cdf850403cf4b36b464084d051955f | 25,555,055,475,139 | 3b40c60c4d1dd51dd99621c24f78b4ddab226607 | /src/main/java/DesignPatterns/Mediator/ChatMessengerExample.java | 3ef06d3993ca97f91d6e9af54062aa3e8789438e | [] | no_license | AshkIza/AlgorithmsAndSystemDesign | https://github.com/AshkIza/AlgorithmsAndSystemDesign | 902618c102af055b0cf54ed85308f4d2b9773b7e | 7da3bfb32b5bd60e84e35608d07c12944f315cc5 | refs/heads/main | 2023-02-24T03:39:58.849000 | 2021-02-01T22:07:49 | 2021-02-01T22:07:49 | 323,681,739 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package DesignPatterns.Mediator;
import java.util.ArrayList;
import java.util.List;
/* https://www.journaldev.com/1730/mediator-design-pattern-java
*
* mediators ACTS AS A ROUTER between colleagues
colleagues talk to each other through mediator, colleague01 --> mediator --> colleague02
mediators knows and is in charge of all the communication between colleague
* */
public class ChatMessengerExample {
public enum UserTypeEnum {
INTERNAL, SUPPORT
}
// Colleague
public static abstract class User {
ChatInterface mediator;
String userName;
UserTypeEnum type;
User (String userName, ChatInterface mediator){
this.userName = userName;
this.mediator = mediator;
mediator.addUser(this);
}
public void send(String chatMsg) {
System.out.println(userName + " sends the message : " + chatMsg);
mediator.send(this, chatMsg);
}
public void receive(String chatMsg) {
System.out.println(userName + " received the message : " + chatMsg);
}
}
public static class InternalUser extends User{
InternalUser(String userName, ChatInterface mediator) {
super(userName, mediator);
this.type = UserTypeEnum.INTERNAL;
}
public void sendToInternals(String chatMsg) {
System.out.println(userName + " sends internal message : " + chatMsg);
mediator.sendToInternals(this, chatMsg);
}
}
public static class SupportUser extends User {
SupportUser(String userName, ChatInterface mediator) {
super(userName, mediator);
this.type = UserTypeEnum.SUPPORT;
}
}
// Mediator
public static interface ChatInterface {
public void send(User user, String chatMessage);
public void sendToInternals(User user, String chatMessage);
public void addUser(User user);
}
// concrete Mediator
public static class ChatMessenger implements ChatInterface{
List<User> users;
ChatMessenger(){
users = new ArrayList<>();
}
@Override
public void addUser(User user) {
users.add(user);
}
@Override
public void send(User user, String chatMessage) {
for(User itemUser : users) {
if(itemUser != user) {
itemUser.receive(chatMessage);
}
}
}
@Override
public void sendToInternals(User user, String chatMessage) {
for(User itemUser : users) {
if(itemUser != user && itemUser.type == UserTypeEnum.INTERNAL) {
itemUser.receive(chatMessage + " (internal message)");
}
}
}
}
public static void main(String[] args) {
System.out.println( " mediators ACTS AS A ROUTER between colleagues" );
System.out.println( " colleagues talk to each other through mediator, colleague01 --> mediator --> colleague02 " );
System.out.println( " mediators knows and is in charge of all the communication between colleague \n" );
ChatInterface chatMessenger = new ChatMessenger();
InternalUser internal01 = new InternalUser("internal01", chatMessenger);
InternalUser internal02 = new InternalUser("internal02", chatMessenger);
InternalUser internal03 = new InternalUser("internal03", chatMessenger);
SupportUser support01 = new SupportUser("support01", chatMessenger);
SupportUser support02 = new SupportUser("support02", chatMessenger);
SupportUser support03 = new SupportUser("support03", chatMessenger);
SupportUser support04 = new SupportUser("support04", chatMessenger);
internal02.sendToInternals("who can work on Sunday?");
support04.send(" I have an issue with my product ");
}
}
| UTF-8 | Java | 3,447 | java | ChatMessengerExample.java | Java | [
{
"context": "rName, ChatInterface mediator){\n\t\t\tthis.userName = userName;\n\t\t\tthis.mediator = mediator;\n\t\t\tmediator.addUser",
"end": 669,
"score": 0.9969183206558228,
"start": 661,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package DesignPatterns.Mediator;
import java.util.ArrayList;
import java.util.List;
/* https://www.journaldev.com/1730/mediator-design-pattern-java
*
* mediators ACTS AS A ROUTER between colleagues
colleagues talk to each other through mediator, colleague01 --> mediator --> colleague02
mediators knows and is in charge of all the communication between colleague
* */
public class ChatMessengerExample {
public enum UserTypeEnum {
INTERNAL, SUPPORT
}
// Colleague
public static abstract class User {
ChatInterface mediator;
String userName;
UserTypeEnum type;
User (String userName, ChatInterface mediator){
this.userName = userName;
this.mediator = mediator;
mediator.addUser(this);
}
public void send(String chatMsg) {
System.out.println(userName + " sends the message : " + chatMsg);
mediator.send(this, chatMsg);
}
public void receive(String chatMsg) {
System.out.println(userName + " received the message : " + chatMsg);
}
}
public static class InternalUser extends User{
InternalUser(String userName, ChatInterface mediator) {
super(userName, mediator);
this.type = UserTypeEnum.INTERNAL;
}
public void sendToInternals(String chatMsg) {
System.out.println(userName + " sends internal message : " + chatMsg);
mediator.sendToInternals(this, chatMsg);
}
}
public static class SupportUser extends User {
SupportUser(String userName, ChatInterface mediator) {
super(userName, mediator);
this.type = UserTypeEnum.SUPPORT;
}
}
// Mediator
public static interface ChatInterface {
public void send(User user, String chatMessage);
public void sendToInternals(User user, String chatMessage);
public void addUser(User user);
}
// concrete Mediator
public static class ChatMessenger implements ChatInterface{
List<User> users;
ChatMessenger(){
users = new ArrayList<>();
}
@Override
public void addUser(User user) {
users.add(user);
}
@Override
public void send(User user, String chatMessage) {
for(User itemUser : users) {
if(itemUser != user) {
itemUser.receive(chatMessage);
}
}
}
@Override
public void sendToInternals(User user, String chatMessage) {
for(User itemUser : users) {
if(itemUser != user && itemUser.type == UserTypeEnum.INTERNAL) {
itemUser.receive(chatMessage + " (internal message)");
}
}
}
}
public static void main(String[] args) {
System.out.println( " mediators ACTS AS A ROUTER between colleagues" );
System.out.println( " colleagues talk to each other through mediator, colleague01 --> mediator --> colleague02 " );
System.out.println( " mediators knows and is in charge of all the communication between colleague \n" );
ChatInterface chatMessenger = new ChatMessenger();
InternalUser internal01 = new InternalUser("internal01", chatMessenger);
InternalUser internal02 = new InternalUser("internal02", chatMessenger);
InternalUser internal03 = new InternalUser("internal03", chatMessenger);
SupportUser support01 = new SupportUser("support01", chatMessenger);
SupportUser support02 = new SupportUser("support02", chatMessenger);
SupportUser support03 = new SupportUser("support03", chatMessenger);
SupportUser support04 = new SupportUser("support04", chatMessenger);
internal02.sendToInternals("who can work on Sunday?");
support04.send(" I have an issue with my product ");
}
}
| 3,447 | 0.719176 | 0.706411 | 121 | 27.487604 | 27.476246 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.247934 | false | false | 9 |
03f3a05b6fcb285a7b5fa0f1b1bf1ded0a91226d | 6,751,688,651,215 | c539cd4fd45d2c72b3fd30ed0e91b91a8a7c8091 | /app/src/main/java/com/acme/a3csci3130/CreateContactAcitivity.java | be93fd46b466f8cd4c11398c665d361b318a5991 | [] | no_license | jc408991/A3csci3130 | https://github.com/jc408991/A3csci3130 | 33643c68048a9c9f343b2807b5ceab1c99c3b965 | 335929a935fe0ab211e2b980bce86574ee9a917e | refs/heads/master | 2021-04-06T20:52:39.224000 | 2018-03-16T20:55:13 | 2018-03-16T20:55:13 | 125,406,377 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.acme.a3csci3130;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class CreateContactAcitivity extends Activity {
private Button submitButton;
private EditText nameField,numberField, businessField, addressField, provinceField;
private MyApplicationData appState;
/**
* Method that creates a new Create Contact activity and connects the Button and EditText
* variables to objects made in the corresponding XML file
*
* @param savedInstanceState is the most recent app data so app is updated correctly
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_contact_acitivity);
//Get the app wide shared variables
appState = ((MyApplicationData) getApplicationContext());
submitButton = (Button) findViewById(R.id.submitButton);
nameField = (EditText) findViewById(R.id.name);
numberField = (EditText) findViewById(R.id.number);
businessField = (EditText) findViewById(R.id.business);
addressField = (EditText) findViewById(R.id.address);
provinceField = (EditText) findViewById(R.id.province);
}
/**
* Method that creates a new business and adds the inputted data to the firebase database
* when the Create Business button is clicked
*
* @param v is the view variable passed in by the button
*/
public void submitInfoButton(View v) {
//each entry needs a unique ID
String businessID = appState.firebaseReference.push().getKey();
String name = nameField.getText().toString();
int number = Integer.parseInt(numberField.getText().toString());
String business = businessField.getText().toString();
String address = addressField.getText().toString();
String province = provinceField.getText().toString();
Contact newBusiness = new Contact(businessID, name, number, business, address, province);
appState.firebaseReference.child(businessID).setValue(newBusiness);
finish();
}
}
| UTF-8 | Java | 2,232 | java | CreateContactAcitivity.java | Java | [] | null | [] | package com.acme.a3csci3130;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class CreateContactAcitivity extends Activity {
private Button submitButton;
private EditText nameField,numberField, businessField, addressField, provinceField;
private MyApplicationData appState;
/**
* Method that creates a new Create Contact activity and connects the Button and EditText
* variables to objects made in the corresponding XML file
*
* @param savedInstanceState is the most recent app data so app is updated correctly
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_contact_acitivity);
//Get the app wide shared variables
appState = ((MyApplicationData) getApplicationContext());
submitButton = (Button) findViewById(R.id.submitButton);
nameField = (EditText) findViewById(R.id.name);
numberField = (EditText) findViewById(R.id.number);
businessField = (EditText) findViewById(R.id.business);
addressField = (EditText) findViewById(R.id.address);
provinceField = (EditText) findViewById(R.id.province);
}
/**
* Method that creates a new business and adds the inputted data to the firebase database
* when the Create Business button is clicked
*
* @param v is the view variable passed in by the button
*/
public void submitInfoButton(View v) {
//each entry needs a unique ID
String businessID = appState.firebaseReference.push().getKey();
String name = nameField.getText().toString();
int number = Integer.parseInt(numberField.getText().toString());
String business = businessField.getText().toString();
String address = addressField.getText().toString();
String province = provinceField.getText().toString();
Contact newBusiness = new Contact(businessID, name, number, business, address, province);
appState.firebaseReference.child(businessID).setValue(newBusiness);
finish();
}
}
| 2,232 | 0.702061 | 0.699821 | 58 | 37.482758 | 29.977142 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62069 | false | false | 9 |
edbb07ce146a41f52589d31d6b5b242e36c3e95e | 7,610,682,066,659 | b42f17cbfb8a13d7960b44a83a70f4509b77ab13 | /api-bolao/src/main/java/br/com/deveficiente/bolaoapi/services/poll/PollRepository.java | 25a0f0d0ea7e04f590f052554b67355e45ae9f1b | [
"MIT"
] | permissive | kevenLeandro/jornada-dev-eficiente | https://github.com/kevenLeandro/jornada-dev-eficiente | 3ead5a16e5efbdab33bca9277eda89b28a48bfca | 6c4f78088f3caa89fe71f7d118f26e0e82182139 | refs/heads/master | 2023-03-27T05:58:20.826000 | 2021-03-27T21:22:26 | 2021-03-27T21:22:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.deveficiente.bolaoapi.services.poll;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PollRepository extends JpaRepository<Poll, Long> {
}
| UTF-8 | Java | 186 | java | PollRepository.java | Java | [] | null | [] | package br.com.deveficiente.bolaoapi.services.poll;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PollRepository extends JpaRepository<Poll, Long> {
}
| 186 | 0.833333 | 0.833333 | 6 | 30 | 30.033316 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
d9c9b5b4891aae16319f4bccffeb3e5a63214c26 | 19,851,338,842,651 | bf4ca9436342df7ae3283aa9195cd98432336b3b | /src/main/java/kr/lineus/aipalm/entity/HomeClientImgEntity.java | 865a2f389c65f97662dbd8b6138ff3d888821397 | [] | no_license | vanhieu39/checkconflict | https://github.com/vanhieu39/checkconflict | 40da19d82a157e2cd21d2f30616e23652e5bc081 | a4f8248063830e88dab241ad2bde95734d67ae1a | refs/heads/main | 2023-01-09T11:15:37.466000 | 2020-10-29T04:27:01 | 2020-10-29T04:27:01 | 308,215,899 | 0 | 0 | null | false | 2020-10-29T06:02:56 | 2020-10-29T04:21:09 | 2020-10-29T04:27:36 | 2020-10-29T04:32:31 | 185,431 | 0 | 0 | 1 | Java | false | false | package kr.lineus.aipalm.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import kr.lineus.aipalm.entity.ImageEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "home_clients_image")
public class HomeClientImgEntity {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private String id;
@EqualsAndHashCode.Exclude
@OneToOne
@JoinColumn(name="image", nullable=false)
private ImageEntity image;
}
| UTF-8 | Java | 847 | java | HomeClientImgEntity.java | Java | [] | null | [] | package kr.lineus.aipalm.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import kr.lineus.aipalm.entity.ImageEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "home_clients_image")
public class HomeClientImgEntity {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private String id;
@EqualsAndHashCode.Exclude
@OneToOne
@JoinColumn(name="image", nullable=false)
private ImageEntity image;
}
| 847 | 0.805195 | 0.802834 | 35 | 23.200001 | 18.353357 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.771429 | false | false | 9 |
074e8cac8eec1e64948de1491fb6aefdfebec59f | 25,357,486,937,567 | 96292cec4a103e6483cb8fec5f85e396e26a6d5d | /src/main/java/nl/clockwork/ebms/admin/web/configuration/ProxyPropertiesFormPanel.java | 9dc86a80346a4cdd03d1a0d48eae9ffd40c5d896 | [
"Apache-2.0"
] | permissive | java-ebms-adapter/ebms-admin-console | https://github.com/java-ebms-adapter/ebms-admin-console | 4efcbfdcf8eab413ee7770f1387d446e458f9cb7 | 10ba4f0fb5e47f05195d7aae4d41f07f5bf74677 | refs/heads/master | 2022-12-21T14:34:30.195000 | 2022-12-11T14:43:03 | 2022-12-11T14:43:03 | 200,047,490 | 0 | 0 | Apache-2.0 | false | 2022-12-11T14:43:04 | 2019-08-01T12:35:16 | 2022-02-10T11:56:28 | 2022-12-11T14:43:03 | 1,284 | 0 | 0 | 2 | Java | false | false | /**
* Copyright 2013 Clockwork
*
* 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 nl.clockwork.ebms.admin.web.configuration;
import nl.clockwork.ebms.admin.web.BootstrapFormComponentFeedbackBorder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.util.io.IClusterable;
public class ProxyPropertiesFormPanel extends Panel
{
private static final long serialVersionUID = 1L;
protected transient Log logger = LogFactory.getLog(this.getClass());
public ProxyPropertiesFormPanel(String id, final IModel<ProxyPropertiesFormModel> model)
{
super(id,model);
add(new ProxyPropertiesForm("form",model));
}
public class ProxyPropertiesForm extends Form<ProxyPropertiesFormModel>
{
private static final long serialVersionUID = 1L;
public ProxyPropertiesForm(String id, final IModel<ProxyPropertiesFormModel> model)
{
super(id,new CompoundPropertyModel<ProxyPropertiesFormModel>(model));
add(new BootstrapFormComponentFeedbackBorder("hostFeedback",new TextField<String>("host").setLabel(new ResourceModel("lbl.host")).setRequired(true)));
add(new BootstrapFormComponentFeedbackBorder("portFeedback",new TextField<Integer>("port").setLabel(new ResourceModel("lbl.port"))));
add(new TextField<String>("nonProxyHosts").setLabel(new ResourceModel("lbl.nonProxyHosts")));
add(new TextField<String>("username").setLabel(new ResourceModel("lbl.username")));
add(new PasswordTextField("password").setResetPassword(false).setLabel(new ResourceModel("lbl.password")).setRequired(false));
}
}
public static class ProxyPropertiesFormModel implements IClusterable
{
private static final long serialVersionUID = 1L;
private String host;
private Integer port;
private String nonProxyHosts;
private String username;
private String password;
public String getHost()
{
return host;
}
public void setHost(String host)
{
this.host = host;
}
public Integer getPort()
{
return port;
}
public void setPort(Integer port)
{
this.port = port;
}
public String getNonProxyHosts()
{
return nonProxyHosts;
}
public void setNonProxyHosts(String nonProxyHosts)
{
this.nonProxyHosts = nonProxyHosts;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public static long getSerialversionuid()
{
return serialVersionUID;
}
}
}
| UTF-8 | Java | 3,570 | java | ProxyPropertiesFormPanel.java | Java | [
{
"context": "nonProxyHosts\")));\r\n\t\t\tadd(new TextField<String>(\"username\").setLabel(new ResourceModel(\"lbl.username\")));\r\n",
"end": 2307,
"score": 0.606049656867981,
"start": 2299,
"tag": "USERNAME",
"value": "username"
},
{
"context": "\t\t}\r\n\t\tpublic String getUsern... | null | [] | /**
* Copyright 2013 Clockwork
*
* 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 nl.clockwork.ebms.admin.web.configuration;
import nl.clockwork.ebms.admin.web.BootstrapFormComponentFeedbackBorder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.util.io.IClusterable;
public class ProxyPropertiesFormPanel extends Panel
{
private static final long serialVersionUID = 1L;
protected transient Log logger = LogFactory.getLog(this.getClass());
public ProxyPropertiesFormPanel(String id, final IModel<ProxyPropertiesFormModel> model)
{
super(id,model);
add(new ProxyPropertiesForm("form",model));
}
public class ProxyPropertiesForm extends Form<ProxyPropertiesFormModel>
{
private static final long serialVersionUID = 1L;
public ProxyPropertiesForm(String id, final IModel<ProxyPropertiesFormModel> model)
{
super(id,new CompoundPropertyModel<ProxyPropertiesFormModel>(model));
add(new BootstrapFormComponentFeedbackBorder("hostFeedback",new TextField<String>("host").setLabel(new ResourceModel("lbl.host")).setRequired(true)));
add(new BootstrapFormComponentFeedbackBorder("portFeedback",new TextField<Integer>("port").setLabel(new ResourceModel("lbl.port"))));
add(new TextField<String>("nonProxyHosts").setLabel(new ResourceModel("lbl.nonProxyHosts")));
add(new TextField<String>("username").setLabel(new ResourceModel("lbl.username")));
add(new PasswordTextField("password").setResetPassword(false).setLabel(new ResourceModel("lbl.password")).setRequired(false));
}
}
public static class ProxyPropertiesFormModel implements IClusterable
{
private static final long serialVersionUID = 1L;
private String host;
private Integer port;
private String nonProxyHosts;
private String username;
private String password;
public String getHost()
{
return host;
}
public void setHost(String host)
{
this.host = host;
}
public Integer getPort()
{
return port;
}
public void setPort(Integer port)
{
this.port = port;
}
public String getNonProxyHosts()
{
return nonProxyHosts;
}
public void setNonProxyHosts(String nonProxyHosts)
{
this.nonProxyHosts = nonProxyHosts;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return <PASSWORD>;
}
public void setPassword(String password)
{
this.password = <PASSWORD>;
}
public static long getSerialversionuid()
{
return serialVersionUID;
}
}
}
| 3,574 | 0.737255 | 0.734174 | 111 | 30.162163 | 31.638596 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.837838 | false | false | 9 |
2b1a7012cd4b9ad6512e28e95351c002f3155132 | 16,338,055,642,360 | dc4abe5cbc40f830725f9a723169e2cc80b0a9d6 | /src/main/java/com/sgai/property/budget/service/RecordTemplateServiceImpl.java | 9ce0dab3d337589c05509e1f8f1920d1192c1880 | [] | no_license | ppliuzf/sgai-training-property | https://github.com/ppliuzf/sgai-training-property | 0d49cd4f3556da07277fe45972027ad4b0b85cb9 | 0ce7bdf33ff9c66f254faec70ea7eef9917ecc67 | refs/heads/master | 2020-05-27T16:25:57.961000 | 2019-06-03T01:12:51 | 2019-06-03T01:12:51 | 188,697,303 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sgai.property.budget.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sgai.property.budget.dao.IRecordTemplateDao;
import com.sgai.property.budget.entity.RecordTemplate;
@Service
public class RecordTemplateServiceImpl extends MoreDataSourceCrudServiceImpl<IRecordTemplateDao,RecordTemplate>{
@Autowired
private IRecordTemplateDao recordTemplateDao;
} | UTF-8 | Java | 447 | java | RecordTemplateServiceImpl.java | Java | [] | null | [] | package com.sgai.property.budget.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sgai.property.budget.dao.IRecordTemplateDao;
import com.sgai.property.budget.entity.RecordTemplate;
@Service
public class RecordTemplateServiceImpl extends MoreDataSourceCrudServiceImpl<IRecordTemplateDao,RecordTemplate>{
@Autowired
private IRecordTemplateDao recordTemplateDao;
} | 447 | 0.868009 | 0.868009 | 12 | 36.333332 | 32.386555 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
37c6b3d6c1ddbd1f78ea743be41fe6e97e05c1f2 | 16,338,055,642,591 | 4f9280416d3cc0ed68a0f422f377e9210af19692 | /APCompSciA/src/dunno/MoneyTest.java | 1ff3e9e5d95f95ca048d346de42938cdfd63b5cd | [] | no_license | rovert1001/AP-CSA | https://github.com/rovert1001/AP-CSA | 6329afb11fb9123559d94ef0dd15d799e21cd257 | 5f592637f162dc778422ad6e025eee642110aa9e | refs/heads/master | 2021-07-02T08:18:27.203000 | 2019-05-02T14:50:53 | 2019-05-02T14:50:53 | 147,531,435 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dunno;
/**
* MoneyTest.java
*
* Code Description:
*
* @author Trevor Slabicki
* @version
* @contact 1002089@palisadessd.net
*/
public class MoneyTest
{
//private static CashMoney[] cash = new CashMoney();
/**
* main method -
*
* @param args
*/
public static void main(String[] args)
{
}
}
| UTF-8 | Java | 381 | java | MoneyTest.java | Java | [
{
"context": "st.java\r\n *\r\n * Code Description:\r\n * \r\n * @author Trevor Slabicki\r\n * @version\r\n * @contact 1002089@palisadessd.net",
"end": 97,
"score": 0.9998688101768494,
"start": 82,
"tag": "NAME",
"value": "Trevor Slabicki"
},
{
"context": "@author Trevor Slabicki\r\n... | null | [] | package dunno;
/**
* MoneyTest.java
*
* Code Description:
*
* @author <NAME>
* @version
* @contact <EMAIL>
*/
public class MoneyTest
{
//private static CashMoney[] cash = new CashMoney();
/**
* main method -
*
* @param args
*/
public static void main(String[] args)
{
}
}
| 356 | 0.530184 | 0.511811 | 30 | 10.7 | 13.203914 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | false | false | 9 |
525f4fc037fdc9f47be50574f2f8ee1e2f3fcf1a | 2,628,520,048,659 | 6c0243bea8df540cbc0976060ec6574b804d429b | /src/main/java/br/iesb/sie/entidade/BaseEntity.java | d34a4e8e87db5fd9e584cfff7975f216bdd25fb5 | [] | no_license | anaclarajacques/sie | https://github.com/anaclarajacques/sie | 231a79d37db32be734a5ea46dda76f2f28b40365 | 42dcea8ba7c4f67e35fe61993d4d3c6c283e2456 | refs/heads/master | 2021-01-16T21:36:21.985000 | 2015-08-27T11:28:18 | 2015-08-27T11:28:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.iesb.sie.entidade;
import java.io.Serializable;
public abstract class BaseEntity implements Serializable {
public abstract Serializable getId();
}
| UTF-8 | Java | 177 | java | BaseEntity.java | Java | [] | null | [] | package br.iesb.sie.entidade;
import java.io.Serializable;
public abstract class BaseEntity implements Serializable {
public abstract Serializable getId();
}
| 177 | 0.734463 | 0.734463 | 10 | 15.7 | 20.50878 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 9 |
9e6b250767661d722a0f9758a36f5bb5d4db15cb | 11,579,231,837,394 | 099285433a033e38285f9c405510254c9061f333 | /app/src/main/java/com/example/touchdemo/MainActivity.java | 6d0063042130cf1f8d9b8e83dc97c3b34cd0c94b | [] | no_license | EddyChao/Android-Demo01 | https://github.com/EddyChao/Android-Demo01 | c20b4ab48cfdfeff987f73bb52d7c7f5761f0160 | ce591791f57e1d582200c77ba89e9bbb9c58820d | refs/heads/main | 2023-01-10T12:21:26.941000 | 2020-11-12T09:44:51 | 2020-11-12T09:44:51 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.touchdemo;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.DisplayCutout;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends Activity implements View.OnTouchListener {
private TextView tvTouchShowStart;
private TextView tvTouchShow;
private LinearLayout llTouch;
private DisplayMetrics dm;
//画图
private Paint mPaint;
private Paint mPointPaint = new Paint();
private Canvas mCanvas;//画布
private Bitmap bitmap;//位图
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dm = new DisplayMetrics();
init();
}
private void init() {
// tvTouchShowStart = (TextView) findViewById(R.id.touch_show_start);
// tvTouchShow = (TextView) findViewById(R.id.touch_show);
// llTouch = (LinearLayout) findViewById(R.id.ll_touch);
getWindowManager().getDefaultDisplay().getMetrics(dm);
llTouch.setOnTouchListener(this);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
/**
* 点击的开始位置
*/
case MotionEvent.ACTION_DOWN:
int width = dm.widthPixels;
int height = dm.heightPixels;
Rect notch = Notch();
int daohang = getDaoHangHeight(this);
if (notch != null){
tvTouchShowStart.setText("当前屏幕的高是:" + (height + notch.bottom + daohang) + "\n"
+ "当前屏幕的宽是:" + width + "\n"
+ "状态栏高度:" + notch.bottom + "\n"
+ "挖孔屏左侧距左侧屏幕边缘:" + notch.left +"\n"
+ "刘海右侧距左侧屏幕边缘:" + notch.right +"\n"
+ "挖孔区域大小:" + (notch.right - notch.left) + "\n"
);
int x = (int) event.getX();
int y = (int) event.getY();
}
break;
/**
* 触屏实时位置
*/
case MotionEvent.ACTION_MOVE:
tvTouchShow.setText("实时位置:(" + event.getX() + "," + event.getY() + ")");
break;
/**
* 离开屏幕的位置
*/
case MotionEvent.ACTION_UP:
tvTouchShow.setText("结束位置:(" + event.getX() + "," + event.getY() + ")");
break;
default:
break;
}
/**
* 注意返回值
* true:view继续响应Touch操作;
* false:view不再响应Touch操作,故此处若为false,只能显示起始位置,不能显示实时位置和结束位置
*/
return true;
}
@TargetApi(28)
public Rect Notch(){
final View decorView = getWindow().getDecorView();
WindowInsets rootWindowInsets = decorView.getRootWindowInsets();
if (rootWindowInsets == null) {
Log.e("TAG", "rootWindowInsets为空了");
return null;
}
DisplayCutout displayCutout = rootWindowInsets.getDisplayCutout();
Log.e("TAG", "安全区域距离屏幕左边的距离 SafeInsetLeft:" + displayCutout.getSafeInsetLeft());
Log.e("TAG", "安全区域距离屏幕右部的距离 SafeInsetRight:" + displayCutout.getSafeInsetRight());
Log.e("TAG", "安全区域距离屏幕顶部的距离 SafeInsetTop:" + displayCutout.getSafeInsetTop());
Log.e("TAG", "安全区域距离屏幕底部的距离 SafeInsetBottom:" + displayCutout.getSafeInsetBottom());
List<Rect> rects = displayCutout.getBoundingRects();
if (rects == null || rects.size() == 0) {
Log.e("TAG", "不是刘海屏");
} else {
Log.e("TAG", "刘海屏数量:" + rects.size());
for (Rect rect : rects) {
Log.e("TAG", "刘海屏区域:" + rect);
}
}
return rects.get(0);
}
/**
* 获取导航栏高度
* @param context
* @return
*/
public static int getDaoHangHeight(Context context) {
int resourceId = 0;
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
if (rid != 0) {
resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
return context.getResources().getDimensionPixelSize(resourceId);
} else
return 0;
}
} | UTF-8 | Java | 5,480 | java | MainActivity.java | Java | [] | null | [] | package com.example.touchdemo;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.DisplayCutout;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends Activity implements View.OnTouchListener {
private TextView tvTouchShowStart;
private TextView tvTouchShow;
private LinearLayout llTouch;
private DisplayMetrics dm;
//画图
private Paint mPaint;
private Paint mPointPaint = new Paint();
private Canvas mCanvas;//画布
private Bitmap bitmap;//位图
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dm = new DisplayMetrics();
init();
}
private void init() {
// tvTouchShowStart = (TextView) findViewById(R.id.touch_show_start);
// tvTouchShow = (TextView) findViewById(R.id.touch_show);
// llTouch = (LinearLayout) findViewById(R.id.ll_touch);
getWindowManager().getDefaultDisplay().getMetrics(dm);
llTouch.setOnTouchListener(this);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
/**
* 点击的开始位置
*/
case MotionEvent.ACTION_DOWN:
int width = dm.widthPixels;
int height = dm.heightPixels;
Rect notch = Notch();
int daohang = getDaoHangHeight(this);
if (notch != null){
tvTouchShowStart.setText("当前屏幕的高是:" + (height + notch.bottom + daohang) + "\n"
+ "当前屏幕的宽是:" + width + "\n"
+ "状态栏高度:" + notch.bottom + "\n"
+ "挖孔屏左侧距左侧屏幕边缘:" + notch.left +"\n"
+ "刘海右侧距左侧屏幕边缘:" + notch.right +"\n"
+ "挖孔区域大小:" + (notch.right - notch.left) + "\n"
);
int x = (int) event.getX();
int y = (int) event.getY();
}
break;
/**
* 触屏实时位置
*/
case MotionEvent.ACTION_MOVE:
tvTouchShow.setText("实时位置:(" + event.getX() + "," + event.getY() + ")");
break;
/**
* 离开屏幕的位置
*/
case MotionEvent.ACTION_UP:
tvTouchShow.setText("结束位置:(" + event.getX() + "," + event.getY() + ")");
break;
default:
break;
}
/**
* 注意返回值
* true:view继续响应Touch操作;
* false:view不再响应Touch操作,故此处若为false,只能显示起始位置,不能显示实时位置和结束位置
*/
return true;
}
@TargetApi(28)
public Rect Notch(){
final View decorView = getWindow().getDecorView();
WindowInsets rootWindowInsets = decorView.getRootWindowInsets();
if (rootWindowInsets == null) {
Log.e("TAG", "rootWindowInsets为空了");
return null;
}
DisplayCutout displayCutout = rootWindowInsets.getDisplayCutout();
Log.e("TAG", "安全区域距离屏幕左边的距离 SafeInsetLeft:" + displayCutout.getSafeInsetLeft());
Log.e("TAG", "安全区域距离屏幕右部的距离 SafeInsetRight:" + displayCutout.getSafeInsetRight());
Log.e("TAG", "安全区域距离屏幕顶部的距离 SafeInsetTop:" + displayCutout.getSafeInsetTop());
Log.e("TAG", "安全区域距离屏幕底部的距离 SafeInsetBottom:" + displayCutout.getSafeInsetBottom());
List<Rect> rects = displayCutout.getBoundingRects();
if (rects == null || rects.size() == 0) {
Log.e("TAG", "不是刘海屏");
} else {
Log.e("TAG", "刘海屏数量:" + rects.size());
for (Rect rect : rects) {
Log.e("TAG", "刘海屏区域:" + rect);
}
}
return rects.get(0);
}
/**
* 获取导航栏高度
* @param context
* @return
*/
public static int getDaoHangHeight(Context context) {
int resourceId = 0;
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
if (rid != 0) {
resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
return context.getResources().getDimensionPixelSize(resourceId);
} else
return 0;
}
} | 5,480 | 0.557669 | 0.556282 | 143 | 33.300701 | 24.664188 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.629371 | false | false | 9 |
cf852e474f45e960c4bccd75548640ddd3319322 | 9,405,978,396,745 | 6702649e1aad0ea7ead96af1483665273c0d50ba | /src/dao/CarroDao.java | e35275d42317ea0c739a6c1309b87694707cbf63 | [] | no_license | rrmartins/SCC | https://github.com/rrmartins/SCC | 0afd07cb66a42abe47c00bbc9add89697465a67f | bfb11d43b9177ae5ea4324c3df4e7fed4c3b8e5f | refs/heads/master | 2016-09-05T12:04:32.485000 | 2010-11-30T22:56:36 | 2010-11-30T22:56:36 | 1,039,953 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dao;
import domain.Carro;
import domain.GrupoCarro;
import domain.Locacao;
import java.sql.SQLException;
import java.util.Vector;
import util.Conexao;
import util.ConexaoException;
import util.MinhaException;
public interface CarroDao {
public Carro selecionarCarro(int codGrupoCar) throws MinhaException, SQLException, ConexaoException;
public int obterCodCarro(int codLocacao) throws MinhaException, SQLException, ConexaoException;
public void inserirCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public Carro selecionarCarro(Locacao loca) throws MinhaException, SQLException, ConexaoException;
public void removerCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public void alterarCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public Vector<Carro> selecionarTodosCarros () throws MinhaException, SQLException, ConexaoException;
public void alterarKMDisponibilidade(Vector linha) throws SQLException, ConexaoException;
public Vector<Carro> selecionarCarrosPorGrupo(GrupoCarro grupoCarro) throws MinhaException, SQLException, ConexaoException;
public void mudarDisponibilidade(Conexao connection, Carro carro) throws SQLException;
}
| UTF-8 | Java | 1,286 | java | CarroDao.java | Java | [] | null | [] | package dao;
import domain.Carro;
import domain.GrupoCarro;
import domain.Locacao;
import java.sql.SQLException;
import java.util.Vector;
import util.Conexao;
import util.ConexaoException;
import util.MinhaException;
public interface CarroDao {
public Carro selecionarCarro(int codGrupoCar) throws MinhaException, SQLException, ConexaoException;
public int obterCodCarro(int codLocacao) throws MinhaException, SQLException, ConexaoException;
public void inserirCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public Carro selecionarCarro(Locacao loca) throws MinhaException, SQLException, ConexaoException;
public void removerCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public void alterarCarro (Carro carro) throws MinhaException, SQLException, ConexaoException;
public Vector<Carro> selecionarTodosCarros () throws MinhaException, SQLException, ConexaoException;
public void alterarKMDisponibilidade(Vector linha) throws SQLException, ConexaoException;
public Vector<Carro> selecionarCarrosPorGrupo(GrupoCarro grupoCarro) throws MinhaException, SQLException, ConexaoException;
public void mudarDisponibilidade(Conexao connection, Carro carro) throws SQLException;
}
| 1,286 | 0.81493 | 0.81493 | 35 | 35.57143 | 42.83609 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.057143 | false | false | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.