blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8044aecaad1599aafea06bf638c3a07bad63097d | a79b2681476a805f5360e501f33d2bfa9141c8fb | /Chat-Messenger-Java-master/TCPclient/tcpclient/ChatClientThread.java | 0292423fc47da31a1a3482c03c54659d7ea29920 | [] | no_license | NabidAlam/Chat-Messenger-Java | 46003183d88e9d57767845b9bef47b473c30d7c8 | 784780d9458ee7774a6d756644ab66ce7c7f3ce0 | refs/heads/master | 2021-01-21T17:14:18.809644 | 2017-05-21T08:56:24 | 2017-05-21T08:56:24 | 91,944,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java |
package tcpclient;
import java.net.*;
import java.io.*;
public class ChatClientThread extends Thread {
private Socket socket = null;
private TCPclient client = null;
private DataInputStream streamIn = null;
public ChatClientThread(TCPclient _client, Socket _socket) {
client = _client;
socket = _socket;
open();
start();
}
public void open() {
try {
streamIn = new DataInputStream(socket.getInputStream());
} catch (IOException ioe) {
System.out.println("Error getting input stream: " + ioe);
client.stop();
}
}
public void close() {
try {
if (streamIn != null)
streamIn.close();
} catch (IOException ioe) {
System.out.println("Error closing input stream: " + ioe);
}
}
public void run() {
while (true) {
try {
client.handle(streamIn.readUTF());
} catch (IOException ioe) {
System.out.println("Listening error: " + ioe.getMessage());
client.stop();
}
}
}
} | [
"msa.nabid007@gmail.com"
] | msa.nabid007@gmail.com |
9ced756f16fad62d3b21bfdd92f71734b3f35fcf | fd81823087beec2964c53207c3ba1b295303af07 | /app/src/main/java/com/xiaozhu/dome/activity/MainActivity.java | cd463e97447e90d0dbb094bf34a2c9d41782a60d | [] | no_license | liuyi192/XiaoZhu | 7e9fd2caaf6c7070f7d4807fbdaee0366c1b5743 | f01fe618ab57593edf14e8a5b8c1e3c4338d110d | refs/heads/master | 2020-03-18T08:47:18.217481 | 2018-05-23T07:09:14 | 2018-05-23T07:09:25 | 114,745,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,939 | java | package com.xiaozhu.dome.activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Toast;
import com.xiaozhu.common.base.activitys.BaseActivity;
import com.xiaozhu.common.download.DownloadUtils;
import com.xiaozhu.common.download.callback.SimpleDownloadCallback;
import com.xiaozhu.common.download.manger.FileUtils;
import com.xiaozhu.common.eventBus.EventBusUtils;
import com.xiaozhu.common.permissions.PermissionCallback;
import com.xiaozhu.common.permissions.PermissionEnum;
import com.xiaozhu.common.permissions.PermissionManager;
import com.xiaozhu.common.utils.FileManagerUtils;
import com.xiaozhu.common.utils.LogUtils;
import com.xiaozhu.common.widget.dialog.CommonDialog;
import com.xiaozhu.common.widget.dialog.DialogViewHolder;
import com.xiaozhu.common.widget.toast.ToastUtils;
import com.xiaozhu.dome.R;
import com.xiaozhu.dome.activity.banner.BannerActivity;
import com.xiaozhu.dome.activity.expandable.ExpandableActivity;
import com.xiaozhu.dome.activity.fillet.FilletActivity;
import com.xiaozhu.dome.activity.http.HttpActivity;
import com.xiaozhu.dome.activity.indicator.IndicatorActivity;
import com.xiaozhu.dome.activity.list.ListDataActivity;
import com.xiaozhu.dome.activity.loading.LoadingActivity;
import com.xiaozhu.dome.activity.log.LogActivity;
import com.xiaozhu.dome.activity.progress.ProgressActivity;
import com.xiaozhu.dome.activity.refresh.RefreshActivity;
import com.xiaozhu.dome.activity.refresh.RefreshListActivity;
import com.xiaozhu.dome.activity.title.TitleBarActivity;
import com.xiaozhu.dome.activity.web.WebViewActivity;
import java.io.File;
import java.util.ArrayList;
public class MainActivity extends BaseActivity implements View.OnClickListener {
private CommonDialog commonDialog;
@Override
public Class getDelegateClass() {
return MainDelegate.class;
}
@Override
public void bindEvenListener() {
viewDelegate.setOnClickListener(this,
R.id.tvTitle,
R.id.btnBanner,
R.id.btnFillet,
R.id.btnProgress,
R.id.btnLoading,
R.id.btnIndicator,
R.id.btnHttp,
R.id.btnLog,
R.id.btnWeb,
R.id.btnTitle,
R.id.btnRefresh,
R.id.btnExpand,
R.id.btnRefreshList,
R.id.btnDownload
);
}
@Override
public void business() {
checkPermissions();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tvTitle:
startActivity(new Intent(this, ListDataActivity.class));
break;
case R.id.btnBanner:
startActivity(new Intent(this, BannerActivity.class));
break;
case R.id.btnFillet:
startActivity(new Intent(this, FilletActivity.class));
break;
case R.id.btnProgress:
startActivity(new Intent(this, ProgressActivity.class));
break;
case R.id.btnLoading:
startActivity(new Intent(this, LoadingActivity.class));
break;
case R.id.btnIndicator:
startActivity(new Intent(this, IndicatorActivity.class));
break;
case R.id.btnHttp:
startActivity(new Intent(this, HttpActivity.class));
break;
case R.id.btnLog:
startActivity(new Intent(this, LogActivity.class));
break;
case R.id.btnWeb:
startActivity(new Intent(this, WebViewActivity.class));
break;
case R.id.btnTitle:
startActivity(new Intent(this, TitleBarActivity.class));
break;
case R.id.btnExpand:
startActivity(new Intent(this, ExpandableActivity.class));
break;
case R.id.btnRefresh:
startActivity(new Intent(this, RefreshActivity.class));
break;
case R.id.btnRefreshList:
startActivity(new Intent(this, RefreshListActivity.class));
break;
case R.id.btnDownload:
//downloadFile("http://1.199.93.153/imtt.dd.qq.com/16891/5FE88135737E977CCCE1A4DAC9FAFFCB.apk");
showShare();
break;
}
}
public void showShare() {
commonDialog = new CommonDialog(this, R.layout.common_share_dialog) {
@Override
public void convert(DialogViewHolder holder) {
holder.setOnClick(R.id.share_wechat, new View.OnClickListener() {
@Override
public void onClick(View v) {
commonDialog.dismiss();
}
});
holder.setOnClick(R.id.share_circle_friends, new View.OnClickListener() {
@Override
public void onClick(View v) {
commonDialog.dismiss();
}
});
holder.setOnClick(R.id.cancel, new View.OnClickListener() {
@Override
public void onClick(View v) {
commonDialog.dismiss();
}
});
}
}.fromBottom().showDialog().setCanceledOnTouchOutside(false);
}
public void downloadFile(String url) {
DownloadUtils.init(this)
.path(FileManagerUtils.getInstance().getDownloadFolder())
.name(FileUtils.getSuffixName(url))
.url(url)
.childTaskCount(3)
.build()
.start(new SimpleDownloadCallback() {
@Override
public void onStart(long currentSize, long totalSize, float progress) {
LogUtils.i("开始下载 currentSize:" + currentSize + " totalSize:" + totalSize + " progress:" + progress);
}
@Override
public void onProgress(long currentSize, long totalSize, float progress) {
LogUtils.i("下载中 currentSize:" + currentSize + " totalSize:" + totalSize + " progress:" + progress);
}
@Override
public void onFinish(File file) {
LogUtils.i("下载完成");
}
@Override
public void onWait() {
}
});
}
@Override
protected void onDestroy() {
EventBusUtils.getInstance().sendEventBus(1002);
super.onDestroy();
}
public void checkPermissions() {
PermissionManager.with(this).tag(1000)
.permission(PermissionEnum.READ_EXTERNAL_STORAGE, PermissionEnum.WRITE_EXTERNAL_STORAGE)
.callback(new PermissionCallback() {
@Override
public void onGranted(ArrayList<PermissionEnum> grantedList) {
ToastUtils.show("权限被允许", 3000, ToastUtils.ICON_TYPE_SUCCESS);
}
@Override
public void onDenied(ArrayList<PermissionEnum> deniedList) {
ToastUtils.show("权限被拒绝", 3000, ToastUtils.ICON_TYPE_FAIL);
}
}).checkAsk();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
PermissionManager.with(this).handleResult(requestCode, permissions, grantResults);
}
}
| [
"2743569843@qq.com"
] | 2743569843@qq.com |
6afd93cb02c2face8b50e6a5db6777d70bec50a5 | 39a6023428ef4a99ba65089e316134eb16629dbf | /app/src/main/java/com/strish/android/test_vrg_soft/fragments/TabFragment.java | 64b4451162ffd232ca8f25a8998086309c0bb193 | [] | no_license | Strishwork/RoomProject | 8c555c2c35bf86eb449214d04da200345161196d | c9ff5eef5f3f5036fdd3021abcd3e57ebc79fcbe | refs/heads/master | 2022-12-25T15:50:52.549231 | 2020-09-17T15:56:10 | 2020-09-17T15:56:10 | 296,374,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,634 | java | package com.strish.android.test_vrg_soft.fragments;
import android.arch.lifecycle.Observer;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.strish.android.test_vrg_soft.Article;
import com.strish.android.test_vrg_soft.ArticleViewModel;
import com.strish.android.test_vrg_soft.R;
import com.strish.android.test_vrg_soft.activities.MainActivity;
import com.strish.android.test_vrg_soft.adapters.TabsAdapter;
import java.util.ArrayList;
import java.util.List;
public class TabFragment extends Fragment implements TabsAdapter.OnItemClickedListener {
public static final String ARGS_TAB_NUM = "args_tab_num";
private RecyclerView mRecyclerView;
private TabsAdapter mAdapter;
private ArticleViewModel mArticleViewModel;
private int tabNum;
public static TabFragment newInstance(int i) {
Bundle args = new Bundle();
TabFragment fragment = new TabFragment();
args.putInt(ARGS_TAB_NUM, i);
fragment.setArguments(args);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.tab_fragment_layout, container, false);
tabNum = getArguments().getInt(ARGS_TAB_NUM, 0);
mRecyclerView = view.findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mAdapter = new TabsAdapter(new ArrayList<Article>());
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickedListener(this);
mArticleViewModel = ((MainActivity) getActivity()).getArticleViewModel();
mArticleViewModel.getArticlesById(tabNum).observe(this, new Observer<List<Article>>() {
@Override
public void onChanged(@Nullable List<Article> articles) {
mAdapter.setArticles(articles);
}
});
return view;
}
@Override
public void onItemClicked(Article article) {
mArticleViewModel.articleClicked(article);
}
@Override
public void onFavoriteButtonClicked(Article article, Drawable drawable) {
mArticleViewModel.favoriteButtonClicked(article, tabNum, drawable);
}
}
| [
"strishwork@gmail.com"
] | strishwork@gmail.com |
12be85d68658861cf0e35f51ea4510559274e312 | 51f6fb95122f5d6ac1e65653bb875223f4fc8228 | /library/src/com/lidroid/xutils/db/converter/ByteArrayColumnConverter.java | 54b175e824be9cd8b1322d0fc0b7fb1df076643f | [] | no_license | webwlsong/xUtils | 46920981a43c829ee1708762ebfd6d58b9c27568 | 69b66b4375a6afb90569d6d8ac4cd20b3bbae58f | refs/heads/master | 2021-01-18T13:30:24.756374 | 2013-11-23T06:55:33 | 2013-11-23T06:55:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.lidroid.xutils.db.converter;
import android.database.Cursor;
/**
* Author: wyouflf
* Date: 13-11-4
* Time: 下午10:51
*/
public class ByteArrayColumnConverter implements ColumnConverter<byte[]> {
@Override
public byte[] getFiledValue(final Cursor cursor, int index) {
return cursor.getBlob(index);
}
@Override
public byte[] getFiledValue(String fieldStringValue) {
return null;
}
@Override
public Object fieldValue2ColumnValue(byte[] fieldValue) {
return fieldValue;
}
@Override
public String getColumnDbType() {
return "BLOB";
}
}
| [
"wyouflf@gmail.com"
] | wyouflf@gmail.com |
327254620209464e31da7ff74cd79f05625e5530 | 3a2ef0c4226bb504dd1c9271bd43cc7404d1c022 | /src/main/java/com/hospital/almenara/controller/ServicioDelegadoController.java | 13b52b5df92fd2d61bf1e607f933f3a6c84448ce | [] | no_license | develope915/almenara-dev | f19a4a2ddeaa5d3d168add32651f5437e79e0e82 | 22fa9287060051afbf67350ecd55c992a1c5da24 | refs/heads/master | 2023-03-12T16:40:47.072609 | 2021-02-14T00:36:57 | 2021-02-14T00:36:57 | 338,523,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package com.hospital.almenara.controller;
import com.hospital.almenara.entity.ServicioDelegado;
import com.hospital.almenara.repository.ServicioDelegadoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@CrossOrigin(origins = {"http://localhost:3000", "https://frosty-bohr-e33186.netlify.app", "https://hopeful-euclid-8ea55a.netlify.app"})
@RestController
@RequestMapping("/servicio-delegado")
public class ServicioDelegadoController {
@Autowired
ServicioDelegadoRepository repository;
@GetMapping
public List<ServicioDelegado> find(){
return repository.findAll();
}
@PutMapping
@PreAuthorize("hasRole('ADMIN')")
public ServicioDelegado update(@RequestBody ServicioDelegado servicioDelegado)
{
return repository.save(servicioDelegado);
}
}
| [
"jose_antonio_alvino21@outlook.es"
] | jose_antonio_alvino21@outlook.es |
03d407207cf06ebda176dfbafc0f517e9c1d1051 | bccb412254b3e6f35a5c4dd227f440ecbbb60db9 | /hl7/model/V2_6/group/ORDER_OMN_O07.java | a9d30d02b3d681a88de3490bf73c54aec3569827 | [] | no_license | nlp-lap/Version_Compatible_HL7_Parser | 8bdb307aa75a5317265f730c5b2ac92ae430962b | 9977e1fcd1400916efc4aa161588beae81900cfd | refs/heads/master | 2021-03-03T15:05:36.071491 | 2020-03-09T07:54:42 | 2020-03-09T07:54:42 | 245,967,680 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 10,547 | java | package hl7.model.V2_6.group;
import hl7.bean.Structure;
import hl7.bean.group.Group;
import hl7.bean.message.MessageStructure;
import hl7.bean.segment.Segment;
public class ORDER_OMN_O07 extends hl7.model.V2_51.group.ORDER_OMN_O07{
public static final String VERSION = "2.6";
public static int SIZE = 7;
public Structure[][] components = new Structure[SIZE][];
public static Structure[] standard = new Structure[SIZE];
public static boolean[] optional = new boolean[SIZE];
public static boolean[] repeatable = new boolean[SIZE];
static{
standard[0]=hl7.pseudo.segment.ORC.CLASS;
standard[2]=hl7.pseudo.segment.RQD.CLASS;
standard[3]=hl7.pseudo.segment.RQ1.CLASS;
standard[4]=hl7.pseudo.segment.NTE.CLASS;
standard[6]=hl7.pseudo.segment.BLG.CLASS;
standard[1]=hl7.pseudo.group.TIMING_OMN_O07.CLASS;
standard[5]=hl7.pseudo.group.OBSERVATION_OMN_O07.CLASS;
optional[0]=false;
optional[2]=false;
optional[3]=false;
optional[4]=false;
optional[6]=false;
optional[1]=true;
optional[5]=true;
repeatable [0]=false;
repeatable [2]=false;
repeatable [3]=false;
repeatable [4]=false;
repeatable [6]=false;
repeatable [1]=true;
repeatable [5]=true;
}
@Override
public Group cloneClass(String originalVersion, String setVersion) {
hl7.pseudo.group.ORDER_OMN_O07 group = new hl7.pseudo.group.ORDER_OMN_O07();
group.originalVersion = originalVersion;
group.setVersion = setVersion;
return group;
}
public void setVersion(String setVersion) {
super.setVersion(setVersion);
this.setVersion = setVersion;
for(int i=0; i<components.length; i++){
Structure[] structures = components[i];
for(int c=0; structures!=null&&c<structures.length; c++){
Structure structure = components[i][c];
structure.setVersion(setVersion);
}
}
}
public void originalVersion(String originalVersion) {
super.originalVersion(originalVersion);
this.originalVersion = originalVersion;
for(int i=0; i<components.length; i++){
Structure[] structures = components[i];
for(int c=0; structures!=null&&c<structures.length; c++){
Structure structure = components[i][c];
structure.originalVersion(originalVersion);
}
}
}
public Structure[][] getComponents(){
if(setVersion.equals(VERSION)){
return components;
}else{
return super.getComponents();
}
}
public boolean needsNewGroup(String segmentType, Structure[] comps){
if(comps==null) return true;
//앱력 Segment의 위치 알아내기
int stdIndex = indexStandard(segmentType);
//현재 components의 마지막 객체 저장 위치 알아내기
int compIndex = -1;
for(int i=0; i<comps.length; i++){
if(comps[i]!=null) compIndex = i;
}
//입력 Segment의 위치가 components 마지막 객체 위치보다 같거나(중복저장) 뒤(추가) 인가?
return stdIndex>=compIndex;
}
public int indexStandard(String segmentType){
int stdIndex = -1;
for(int i=0; i<standard.length; i++){
Structure structure = standard[i];
if(structure instanceof Segment){
if(segmentType.equals(structure.getType())){
stdIndex = i;
break;
}
}else if(structure instanceof Group){
Group group = (Group)structure;
stdIndex = group.indexStandard(segmentType);
if(stdIndex>=0) break;
}
}
return stdIndex;
}
private boolean compiled = false; //최초 컴파일 여부 확인
public void decode(String message) throws Exception {
if(MessageStructure.getVersionCode(originalVersion)<MessageStructure.getVersionCode(VERSION)){
super.decode(message);
}else{
compiled = true; //최초 컴파일 여부 확인
char separator = MessageStructure.SEGMENT_TERMINATOR;
String[] comps = divide(message, separator);
if(comps==null) return;
int[] index = new int[2];
while(index[0]<comps.length && index[1]<SIZE){
decode(originalVersion, setVersion, VERSION, index, index[1], comps);
}
}
}
public void decode(String originalVersion, String setVersion, String VERSION, int[] index, int prevLength, String[] comps) throws Exception{
int[] newIndex = new int[]{index[0], 0};
while(newIndex[1]<standard.length){
Structure structure = standard[newIndex[1]];
if(comps.length<=newIndex[0]){
index[0]=newIndex[0];
return;
}
String comp = comps[newIndex[0]];
String segmentType = comp.substring(0, 3);
if(structure instanceof Segment){ //Segment일 때
String standardType = structure.getType();
if(segmentType.equals(standardType)){ //표준과 Type이 동일한가?
Segment segment = ((Segment)structure).cloneClass(originalVersion, setVersion);
segment.originalVersion(originalVersion);
segment.decode(comp);
addStructure(components, segment, newIndex[1]);
newIndex[0]++; //다음 comp 처리
}else{
newIndex[1]++; //다음 Segment와 비교
}
}else if(structure instanceof Group){
Group group = (Group)structure;
int stdIndex = group.indexStandard(segmentType);
if(stdIndex<0){
newIndex[1]++;
}else{
boolean needsNewGroup = group.needsNewGroup(segmentType, components[newIndex[1]]);
if(needsNewGroup){
Group newGroup = group.cloneClass(originalVersion, setVersion);
newGroup.originalVersion(originalVersion);
newGroup.decode(originalVersion, setVersion, VERSION, newIndex, prevLength, comps);
addStructure(components, newGroup, newIndex[1]);
newIndex[0]++;
}else{
group.decode(originalVersion, setVersion, VERSION, newIndex, prevLength, comps);
}
}
}
}
index[0]=newIndex[0];
}
public static void addStructure(Structure[][] components, Structure structure, int index){
if(components.length<=index) return;
Structure[] comps = components[index];
Structure[] newComps;
newComps = (comps==null)?new Structure[1]:new Structure[comps.length+1];
for(int i=0; i<newComps.length-1; i++) newComps[i]=comps[i];
newComps[newComps.length-1] = structure;
components[index] = newComps;
}
/* -----------------------------------------------------------------
* 이전 버전으로 매핑 components:구버전, subComponents:신버전
* 신버전 메시지-->구버전 파서(상위호환)
* -----------------------------------------------------------------
*/
public static void backward(Structure[][] components, Structure[][] subComponents, String originalVersion, String setVersion) throws Exception{
components[0] = subComponents[0];
components[1] = subComponents[1];
components[2] = subComponents[2];
components[3] = subComponents[3];
components[4] = subComponents[4];
components[5] = subComponents[5];
components[6] = subComponents[6];
}
/* -----------------------------------------------------------------
* 이후 버전으로 매핑 components:구버전, subComponents:신버전
* 구버전 메시지-->신버전 파서(하위호환)
* -----------------------------------------------------------------
*/
public static void forward(Structure[][] components, Structure[][] subComponents, String originalVersion, String setVersion) throws Exception{
subComponents[0] = components[0];
subComponents[1] = components[1];
subComponents[2] = components[2];
subComponents[3] = components[3];
subComponents[4] = components[4];
subComponents[5] = components[5];
subComponents[6] = components[6];
}
public String encode() throws Exception{
seekOriginalVersion = true; //가장 마지막 메소드에서 위치찾기 옵션 설정
return encode(null);
}
public String encode(Structure[][] subComponents) throws Exception{
if(seekOriginalVersion&&MessageStructure.getVersionCode(originalVersion)<MessageStructure.getVersionCode(VERSION)){ //실제 버전의 위치 찾기
//실제 버전이 현재 위치가 아닐 때
//실제 버전 위치 찾아가기
return super.encode(null);
}else{//실제 버전의 위치 찾기
seekOriginalVersion = false;
//실제 버전이 현재 위치일 때
if(setVersion.equals(VERSION)){ //설정 버전의 위치 찾기
//설정 버전이 현재 위치일 때
String message = this.makeMessage(components, VERSION);
return message;
}else{ //설정 버전의 위치 찾기
//설정 버전이 현재 위치가 아닐 때
if(MessageStructure.getVersionCode(setVersion)<MessageStructure.getVersionCode(VERSION)){ //버전으로 이동 방향 찾기
//설정 버전이 현재 버전보다 낮을 때 (backward)
hl7.model.V2_51.group.ORDER_OMN_O07 type = (hl7.model.V2_51.group.ORDER_OMN_O07)this;
type.backward(type.components, components, originalVersion, setVersion);
//}
return super.encode(components);
}else{ //버전으로 이동 방향 찾기
/*-------------------------------------------------------------
*설정 버전이 현재 버전보다 높을 때(forward)
*이후 버전으로 Casting 후 forward 호출
*마지막 버전은 생략
*-----------------------------------------------------------------
*/
encodeVersion = VERSION;
return this.encodeForward(encodeVersion, setVersion);
}
}
}
}
public String encodeForward(String encodeVersion, String setVersion) throws Exception{
//하위 버전으로 인코딩 시 해당 위치를 찾아 가도록 (메소드 오버라이딩 때문에 처음부터 다시 찾아가야 함)
if(encodeVersion.equals(VERSION)){
hl7.model.V2_7.group.ORDER_OMN_O07 type = (hl7.model.V2_7.group.ORDER_OMN_O07)this;
type.forward(this.components, type.components, originalVersion, setVersion);
encodeVersion = type.VERSION;
if(encodeVersion.equals(setVersion)) return type.makeMessage(type.components, encodeVersion);
else return encodeForward(encodeVersion, setVersion);
}else{
return super.encodeForward(encodeVersion, setVersion);
}
}
public String makeMessage(Structure[][] components, String version) throws Exception{
if(VERSION.equals(version)){
setCharacter(components, version);
String message = "";
char separator = MessageStructure.SEGMENT_TERMINATOR;
for(int i=0; i<SIZE; i++){
if(components[i]==null) continue;
for(int j=0; j<components[i].length; j++){
if(!repeatable[i]&&j>0) continue;
String segment = components[i][j].encode();
if(segment!=null){
if(message.length()>0) message += separator;
message += segment;
}
}
}
return (message.length()==0)?null:message;
}else{
return super.makeMessage(components, version);
}
}
}
| [
"terminator800@hanmail.net"
] | terminator800@hanmail.net |
87acd806242739263520de340e0481e08a3ffb8b | 927a2f0983c7e181ce5ce8f2d2f7cbe79d8e5b0c | /src/pkgFormularios/frmRecuperarContraseña.java | 64aed71b028e5fb014964d5db1749dcfcec5be61 | [] | no_license | icarloscornejo/2014_Expotecnica_ITR | 13bfe2040f2cda3e1754adff53aa3aaf6a16bb26 | 4c45fd3e0168ed11404787f4fe7fab930eed5ec0 | refs/heads/master | 2020-06-17T03:29:08.561295 | 2016-11-29T05:00:33 | 2016-11-29T05:00:33 | 75,044,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,721 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pkgFormularios;
import pkgClases.Helper;
/**
*
* @author VAIO1
*/
public class frmRecuperarContraseña extends javax.swing.JDialog {
/**
* Creates new form FrmRecuperarContraseña
*/
public frmRecuperarContraseña(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTextArea1 = new javax.swing.JTextArea();
lblRecuperarContraseña = new javax.swing.JLabel();
btnCancelar = new javax.swing.JButton();
btnEnviar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
txtCorreo = new javax.swing.JTextField();
txtUsuario = new javax.swing.JTextField();
lblFondo = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Ubuntu Light", 0, 18)); // NOI18N
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
jTextArea1.setText("Para recuperar su contraseña por favor ingrese su\nusuario y su correo, asi nuestro sistema le enviara \nun correo electronico donde podra restablecer su \ncontraseña y acceder al sistema.");
jTextArea1.setWrapStyleWord(true);
jTextArea1.setFocusable(false);
jTextArea1.setRequestFocusEnabled(false);
getContentPane().add(jTextArea1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 80, 430, -1));
lblRecuperarContraseña.setFont(new java.awt.Font("Ubuntu", 0, 36)); // NOI18N
lblRecuperarContraseña.setForeground(new java.awt.Color(255, 255, 255));
lblRecuperarContraseña.setText("Recuperar Contraseña");
getContentPane().add(lblRecuperarContraseña, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 10, -1, -1));
btnCancelar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnCancelar.setText("Cancelar");
btnCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelarActionPerformed(evt);
}
});
getContentPane().add(btnCancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 351, 130, 50));
btnEnviar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnEnviar.setText("Enviar");
btnEnviar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEnviarActionPerformed(evt);
}
});
getContentPane().add(btnEnviar, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 350, 130, 50));
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(620, 210, -1, -1));
txtCorreo.setFont(new java.awt.Font("Segoe UI Semilight", 0, 18)); // NOI18N
txtCorreo.setForeground(new java.awt.Color(153, 153, 153));
txtCorreo.setText("Correo electronico");
txtCorreo.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtCorreoFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtCorreoFocusLost(evt);
}
});
txtCorreo.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtCorreoKeyTyped(evt);
}
});
getContentPane().add(txtCorreo, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 260, 280, 30));
txtUsuario.setFont(new java.awt.Font("Segoe UI Semilight", 0, 18)); // NOI18N
txtUsuario.setForeground(new java.awt.Color(153, 153, 153));
txtUsuario.setText("Usuario");
txtUsuario.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtUsuarioFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtUsuarioFocusLost(evt);
}
});
txtUsuario.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtUsuarioKeyTyped(evt);
}
});
getContentPane().add(txtUsuario, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 210, 280, 30));
lblFondo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pkgImagenes/Fondo Menu.png"))); // NOI18N
getContentPane().add(lblFondo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 530, 440));
pack();
}// </editor-fold>//GEN-END:initComponents
Helper H = new Helper();
private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
this.dispose();
}//GEN-LAST:event_btnCancelarActionPerformed
private void btnEnviarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEnviarActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btnEnviarActionPerformed
private void txtCorreoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCorreoFocusGained
H.focusOn(txtCorreo);
}//GEN-LAST:event_txtCorreoFocusGained
private void txtCorreoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCorreoFocusLost
H.focusOff(txtCorreo, "Correo electronico");
}//GEN-LAST:event_txtCorreoFocusLost
private void txtCorreoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCorreoKeyTyped
}//GEN-LAST:event_txtCorreoKeyTyped
private void txtUsuarioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsuarioFocusGained
H.focusOn(txtUsuario);
}//GEN-LAST:event_txtUsuarioFocusGained
private void txtUsuarioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsuarioFocusLost
H.focusOff(txtUsuario, "Usuario");
}//GEN-LAST:event_txtUsuarioFocusLost
private void txtUsuarioKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUsuarioKeyTyped
}//GEN-LAST:event_txtUsuarioKeyTyped
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmRecuperarContraseña.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmRecuperarContraseña.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmRecuperarContraseña.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmRecuperarContraseña.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmRecuperarContraseña dialog = new frmRecuperarContraseña(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancelar;
private javax.swing.JButton btnEnviar;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JLabel lblFondo;
private javax.swing.JLabel lblRecuperarContraseña;
private javax.swing.JTextField txtCorreo;
private javax.swing.JTextField txtUsuario;
// End of variables declaration//GEN-END:variables
}
| [
"icarloscornejo@outlook.com"
] | icarloscornejo@outlook.com |
75d59f04d3b4ffba33910bbc9f9fb006c272f632 | 5fcbd4fdaf8251a0842ae86546ec4577f17729f7 | /src/main/java/de/wusel/partyplayer/gui/PlaylistTableModel.java | 274f424b682938ee46740b89fcc276d0c194f155 | [] | no_license | wusel/partyplayer | 887b946d56958bda65d0ce7fdb4b526b439f6ec4 | 5ced6d395d874f6402d06f2574bd56379e231670 | refs/heads/master | 2020-08-25T06:47:17.179636 | 2011-01-10T13:04:08 | 2011-01-10T13:04:08 | 1,207,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,830 | java | /*
* Copyright (C) 2010 wusel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.wusel.partyplayer.gui;
import de.wusel.partyplayer.model.PlayerModel;
import de.wusel.partyplayer.model.PlaylistListener;
import de.wusel.partyplayer.model.SongWrapper;
import javax.swing.table.AbstractTableModel;
import org.jdesktop.application.Application;
/**
*
* @author wusel
*/
class PlaylistTableModel extends AbstractTableModel {
private final PlayerModel playerModel;
private final PlaylistListener listener = new PlaylistListener() {
@Override
public void songAdded(SongWrapper song) {
fireTableDataChanged();
}
@Override
public void songOrderChanged() {
fireTableDataChanged();
}
@Override
public void songRemoved(SongWrapper song) {
fireTableDataChanged();
}
};
private final Application application;
public PlaylistTableModel(PlayerModel playerModel, Application application) {
this.playerModel = playerModel;
this.playerModel.addPlaylistListener(listener);
this.application = application;
}
@Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return application.getContext().getResourceMap().getString("table.playlist.column.title.label");
case 1:
return application.getContext().getResourceMap().getString("table.playlist.column.votes.label");
default:
throw new RuntimeException("unknown columnIndex");
}
}
@Override
public int getRowCount() {
return playerModel.getPlaylistSongCount();
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
SongWrapper song = playerModel.getPlaylistSongs().get(rowIndex);
switch (columnIndex) {
case 0:
return song.getTitle();
case 1:
return song.getCurrentRequestCount();
default:
throw new RuntimeException("unknown columnIndex");
}
}
}
| [
"der.wusel@gmail.com"
] | der.wusel@gmail.com |
7241db9735038ead06419471067523b671b47a8c | eb4eb4e0628827b1815e9fd888a14aed8e754b52 | /permispiste/src/main/java/com/permispiste/service/ServiceMission.java | c1e48b9251ea4fb7dc40d87406840463cce9c941 | [] | no_license | SamuelJeune/FREP | e396141cfd56397efc6a49c3f0eefeccceac1c16 | 17e62e7c1df6cc0983113c6756de8f74d1251add | refs/heads/master | 2021-01-20T16:24:45.398161 | 2017-06-19T11:28:07 | 2017-06-19T11:28:07 | 90,838,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package com.permispiste.service;
import com.permispiste.metier.MissionEntity;
import java.util.List;
public class ServiceMission extends Services{
public List<MissionEntity> getAll() {
List<MissionEntity> missions;
String request = "SELECT mission FROM MissionEntity mission";
missions = this.execute(request, MissionEntity.class);
return missions;
}
public List<MissionEntity> getByJeu(int id) {
List<MissionEntity> missionsForJeu;
String request = "SELECT mission FROM MissionEntity mission WHERE mission.numjeu = " + id;
missionsForJeu = this.execute(request, MissionEntity.class);
return missionsForJeu;
}
public MissionEntity getById(int id) {
MissionEntity mission;
String request = "SELECT mission FROM MissionEntity mission WHERE mission.nummission = " + id;
mission = this.execute(request, MissionEntity.class).get(0);
return mission;
}
public void remove(MissionEntity mission) {
super.remove(mission);
}
public void remove(int id) {
this.remove(this.getById(id));
}
public void saveOrUpdate(MissionEntity mission) {
super.saveOrUpdate(mission);
}
}
| [
"magnybor@gmail.com"
] | magnybor@gmail.com |
2934f659eb266f0d2a804458be83f57b1b859604 | 4a6bda3fe9e06490ca30b2f9a40b0455f78cd035 | /eShopProject/src/main/java/fr/adaming/service/SendMail.java | 184dba002ff562425045d005f6b3ef08a2b1e2b5 | [] | no_license | FJankowiak/eShopProject | 91604572049bce9631dd878df6ee675a5d1bf216 | 890dd54f1bbe20196b4771ca4fe0cd7867b0413a | refs/heads/master | 2020-03-09T11:15:22.899815 | 2018-04-13T20:07:59 | 2018-04-13T20:07:59 | 128,757,329 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,934 | java | package fr.adaming.service;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class SendMail {
public static void sendMessage(String mail2) {
final String username = "phanuellesainteloi@gmail.com";
final String password = "ARYA052230";
//Création de la session
Properties properties = new Properties();
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.starttls.enable", "true");
properties.put("mail.smtp.host", "smtp.gmail.com");
properties.put("mail.smtp.port", "587");
// Get Session object.
Session session = Session.getInstance(properties, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress("phanuellesainteloi@gmail.com"));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO, new InternetAddress(mail2));
// Set Subject: header field
message.setSubject("Enregistrement produit");
// Create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
messageBodyPart.setText("Les modification apportées à la liste de produits ont été enregistrées");
// Create a multipart message
Multipart multipart = new MimeMultipart();
// Set text message part
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
String filename = "C:\\Users\\inti0426\\Desktop\\Produit.pdf";
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
// Send the complete message parts
message.setContent(multipart );
// Send message
Transport.send(message);
System.out.println("Sent message successfully....");
} catch (MessagingException mex) {
mex.printStackTrace();
}
}
}
| [
"inti0426@DESKTOP-5QL27UL.home"
] | inti0426@DESKTOP-5QL27UL.home |
8e067bb3919d16515364414c4a07cfa8b3b822b2 | 5e4a9ea758b161575637e77ecc2f8887adeea1d0 | /三角形/src/g596565656/G596565656.java | 8dac4f5961297b61189b1d46a91e9795f46750b9 | [] | no_license | AirKuma/Java-Exercise | 1301a5b2d6d02c1e18c6ed904ef526f08eec49d2 | c5af65f754b3925f0100fc541711b0033e0c5df6 | refs/heads/master | 2020-09-22T07:12:52.058964 | 2019-12-01T03:20:59 | 2019-12-01T03:20:59 | 225,100,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package g596565656;
import java.util.Scanner;
public class G596565656 {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
for(int i = 1; i <= 8; i++)
{
for(int j = i; j <= 8; j++)
{
System.out.print(" ");
}
for(int k = 1; k <= i; k++)
{
System.out.print((int)(Math.pow(2, k))/2 +" ");
}
for(int q = i -1; q > 0; q--)
{
System.out.print((int)(Math.pow(2,q))/2 +" ");
}
System.out.println();
}
}
}
| [
"401violet@gmail.com"
] | 401violet@gmail.com |
f083712fd97683ffa82933ad2f019e4b78df218e | e10175ac43f95cdd21940a5d06526c648e17a5b5 | /src/main/java/org/tool/test/TestResultRepository.java | 84472045889ba50568d70d130da572ae8d902e05 | [] | no_license | pavanpwm/AssessmentTool | b391eb8446144caf62aae1daeac8d790be141db7 | 030d74eec8bbfb971747e9e2e4e54ad9fe6da228 | refs/heads/master | 2022-12-29T09:56:49.949800 | 2020-10-18T12:27:00 | 2020-10-18T12:27:00 | 298,513,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package org.tool.test;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface TestResultRepository extends CrudRepository<TestResultsEntity, Integer>{
List<TestResultsEntity> findByTestCode(String testCode);
}
| [
"pavanpwm@gmail.com"
] | pavanpwm@gmail.com |
08676fda02e43500dff03456059aee18a652d49b | 4ef431684e518b07288e8b8bdebbcfbe35f364e4 | /elastic-tracestore/test-core/src/main/java/com/ca/apm/tests/testbed/MultipleStandAloneTestBed.java | 73e69fff39f240990673dac2d6252d8e2173b844 | [] | no_license | Sarojkswain/APMAutomation | a37c59aade283b079284cb0a8d3cbbf79f3480e3 | 15659ce9a0030c2e9e5b992040e05311fff713be | refs/heads/master | 2020-03-30T00:43:23.925740 | 2018-09-27T23:42:04 | 2018-09-27T23:42:04 | 150,540,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,166 | java | /*
* Copyright (c) 2014 CA. All rights reserved.
*
* This software and all information contained therein is confidential and
* proprietary and shall not be duplicated, used, disclosed or disseminated in
* any way except as authorized by the applicable license agreement, without
* the express written permission of CA. All authorized reproductions must be
* marked with this language.
*
* EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO THE EXTENT
* PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS SOFTWARE WITHOUT WARRANTY OF
* ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL CA BE
* LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR
* INDIRECT, FROM THE USE OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, LOST
* PROFITS, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS
* EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE.
*/
package com.ca.apm.tests.testbed;
import java.util.Arrays;
import java.util.Collection;
import com.ca.apm.automation.action.flow.utility.FileCreatorFlow;
import com.ca.apm.automation.action.flow.utility.FileCreatorFlowContext;
import com.ca.apm.systemtest.fld.artifact.FLDHvrAgentLoadExtractArtifact;
import com.ca.apm.systemtest.fld.role.CLWWorkStationLoadRole;
import com.ca.apm.systemtest.fld.role.loads.HVRAgentLoadRole;
import com.ca.apm.systemtest.fld.role.loads.WurlitzerBaseRole;
import com.ca.apm.systemtest.fld.role.loads.WurlitzerLoadRole;
import com.ca.apm.tests.role.ClientDeployRole;
import com.ca.tas.artifact.ITasArtifact;
import com.ca.tas.resolver.ITasResolver;
import com.ca.tas.role.EmRole;
import com.ca.tas.role.utility.UtilityRole;
import com.ca.tas.testbed.Bitness;
import com.ca.tas.testbed.ITestbed;
import com.ca.tas.testbed.ITestbedFactory;
import com.ca.tas.testbed.ITestbedMachine;
import com.ca.tas.testbed.Testbed;
import com.ca.tas.testbed.TestbedMachine;
import com.ca.tas.tests.annotations.TestBedDefinition;
@TestBedDefinition
public class MultipleStandAloneTestBed implements ITestbedFactory {
public static final int NUM_OF_SA = 5;
private static final String SYSTEM_XML = "xml/appmap-stress/load-test/system.xml";
public static final String ADMIN_AUX_TOKEN = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
private static final Collection<String> LAXNL_JAVA_OPTION = Arrays.asList(
"-Djava.awt.headless=true", "-Dmail.mime.charset=UTF-8",
"-Dorg.owasp.esapi.resources=./config/esapi", "-XX:+UseConcMarkSweepGC",
"-XX:+UseParNewGC", "-Xss512k", "-Dcom.wily.assert=false", "-showversion",
"-XX:CMSInitiatingOccupancyFraction=50", "-XX:+HeapDumpOnOutOfMemoryError", "-Xms4096m",
"-Xmx4096m", "-verbose:gc", "-Dappmap.user=admin", "-Dappmap.token=" + ADMIN_AUX_TOKEN);
@Override
public ITestbed create(ITasResolver tasResolver) {
ITestbed bed = new Testbed("Mutiple SA Environment");
// String yml = "/jarvis_data/docker-compose.yml";
// UtilityRole<?> fileCreationRole =
// UtilityRole.flow("jarvisDockerComposeCopyRole", FileCreatorFlow.class,
// new FileCreatorFlowContext.Builder().fromResource("/docker/docker-compose.yml")
// .destinationPath(yml).build());
// UtilityRole<?> executionRole =
// UtilityRole.commandFlow("startJarvisDockerRole", new RunCommandFlowContext.Builder(
// "docker-compose").args(Arrays.asList("-f", yml, "up", "-d")).build());
// fileCreationRole.before(executionRole);
// ITestbedMachine jarvisMachine =
// new TestbedMachine.LinuxBuilder("jarvisMachine").templateId("co7_500g")
// .bitness(Bitness.b64).build();
// jarvisMachine.addRole(executionRole, fileCreationRole);
// bed.addMachine(jarvisMachine);
for (int i = 0; i < NUM_OF_SA; i++) {
EmRole emRole =
new EmRole.LinuxBuilder("emRole" + i, tasResolver)
.silentInstallChosenFeatures(
Arrays.asList("Enterprise Manager", "Database", "WebView"))
.configProperty("com.ca.apm.ttstore", "es")
.configProperty("ca.apm.ttstore.elastic.url","http://130.200.67.237:9200")
// .configProperty("ca.apm.ttstore.jarvis.ingestion.url",
// "http://sc97a:8081/ingestion")
// .configProperty("ca.apm.ttstore.jarvis.es.url", "http://sc97a:9200")
// .configProperty("ca.apm.ttstore.jarvis.onboarding.url",
// "http://sc97a:8080/onboarding")
// .configProperty("introscope.tenantId", "load-tenant-" + i)
.configProperty("introscope.apmserver.teamcenter.saas", "true")
.configProperty("introscope.enterprisemanager.tess.enabled", "false")
.emLaxNlClearJavaOption(LAXNL_JAVA_OPTION).build();
ITestbedMachine emMachine =
new TestbedMachine.LinuxBuilder("emMachine" + i).templateId("co66")
.bitness(Bitness.b64).build();
emMachine.addRole(emRole);
ITestbedMachine loadMachine =
new TestbedMachine.LinuxBuilder("loadMachine" + i).templateId("w64")
.bitness(Bitness.b64).build();
// HVR Load
FLDHvrAgentLoadExtractArtifact artifactFactory =
new FLDHvrAgentLoadExtractArtifact(tasResolver);
ITasArtifact artifact = artifactFactory.createArtifact("10.3");
HVRAgentLoadRole hvrLoadRole =
new HVRAgentLoadRole.Builder("hvrRole" + i, tasResolver)
.emHost(tasResolver.getHostnameById("emRole" + i)).emPort("5001")
.cloneagents(10).cloneconnections(25).agentHost("HVRAgent").secondspertrace(1)
.addMetricsArtifact(artifact.getArtifact()).build();
loadMachine.addRole(hvrLoadRole);
// Wurlitzer Load
WurlitzerBaseRole wurlitzerBaseRole =
new WurlitzerBaseRole.Builder("wurlitzerBaseRole" + i, tasResolver).deployDir(
"wurlitzerBase").build();
loadMachine.addRole(wurlitzerBaseRole);
String xml = "3Complex-200agents-2apps-25frontends-100EJBsession";
WurlitzerLoadRole wurlitzerLoadrole =
new WurlitzerLoadRole.Builder("wurlitzerRole" + i, tasResolver).emRole(emRole)
.buildFileLocation(SYSTEM_XML).target(xml).logFile(xml + ".log")
.wurlitzerBaseRole(wurlitzerBaseRole).build();
loadMachine.addRole(wurlitzerLoadrole);
// CLW Load
CLWWorkStationLoadRole clwRole =
new CLWWorkStationLoadRole.Builder("clwRole" + i, tasResolver)
.emHost(tasResolver.getHostnameById("emRole" + i)).agentName("HVRAgent.*")
.agentName(".*ErrorStallAgent.*").build();
loadMachine.addRole(clwRole);
// client deploy role
ClientDeployRole clientDeployRole =
new ClientDeployRole.Builder("clientDeployRole" + i, tasResolver).emHost(
tasResolver.getHostnameById("emRole" + i)).build();
loadMachine.addRole(clientDeployRole);
// deploy jmeter load script role
try {
UtilityRole<?> copyRestTraceLoadRole =
UtilityRole
.flow(
"copyRestTraceLoadJmx" + i,
FileCreatorFlow.class,
new FileCreatorFlowContext.Builder()
.fromResource("/jmeter/TT_Viewer.JMX")
.destinationPath("C:/automation/deployed/jmeter/TT_Viewer.JMX")
.build());
clientDeployRole.before(copyRestTraceLoadRole);
loadMachine.addRole(copyRestTraceLoadRole);
} catch (Exception e) {}
bed.addMachine(emMachine, loadMachine);
}
return bed;
}
}
| [
"sarojkswain@gmail.com"
] | sarojkswain@gmail.com |
d66398bb87dd411ca5dbed8944166e37b2f9bc0b | a95ec0054ccbda380d34174092f3291b49231171 | /app/src/main/java/com/durov/maks/winestore_02/network/RequestProductListInterface.java | 4f47bf21439a41c84de89113b50f2c3fc0726759 | [] | no_license | maks45/WineStore_02 | aba378c69a1fdd1251a5675d2568953f969bf1b1 | 6294c78a39ae6df1e07241e653738802de4e156c | refs/heads/master | 2020-03-21T01:17:26.580064 | 2018-07-02T09:41:04 | 2018-07-02T09:41:04 | 137,934,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.durov.maks.winestore_02.network;
import com.durov.maks.winestore_02.model.StoreList;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface RequestProductListInterface {
@GET("lcboapi.com/products?store_id={@store}&page ={@page}")
Observable<StoreList> register(@Query(value = "page", encoded = true) String page, @Query(value = "store", encoded = true) String store);
}
| [
"maksim.durov45@gmail.com"
] | maksim.durov45@gmail.com |
e9d7dcecf05e06525f3b1b30cfbf0919403da2b7 | 0d768acdc41a9bb571a2f8a6357f50aca69b7274 | /src/main/java/de/tuclausthal/submissioninterface/authfilter/authentication/verify/impl/ShibbolethVerify.java | c535124beaeaec563bd0c3b2a86c6aefde6b4806 | [] | no_license | csware/si | a176d3c77f811a10c4c2e6150df6e198eeb54a5e | d8f2bf1a3d4cd6b3640f72323851dffa387e6197 | refs/heads/master | 2023-08-18T13:04:14.349267 | 2023-08-02T18:35:21 | 2023-08-02T18:35:21 | 1,578,315 | 5 | 3 | null | 2020-12-11T10:51:30 | 2011-04-06T17:41:16 | Java | UTF-8 | Java | false | false | 3,516 | java | /*
* Copyright 2020-2021 Sven Strickroth <email@cs-ware.de>
*
* This file is part of the GATE.
*
* GATE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* GATE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GATE. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tuclausthal.submissioninterface.authfilter.authentication.verify.impl;
import java.lang.invoke.MethodHandles;
import javax.servlet.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.tuclausthal.submissioninterface.authfilter.authentication.login.LoginData;
import de.tuclausthal.submissioninterface.authfilter.authentication.login.impl.Shibboleth;
import de.tuclausthal.submissioninterface.authfilter.authentication.verify.VerifyIf;
import de.tuclausthal.submissioninterface.authfilter.authentication.verify.VerifyResult;
import de.tuclausthal.submissioninterface.persistence.dao.DAOFactory;
import de.tuclausthal.submissioninterface.persistence.datamodel.User;
import de.tuclausthal.submissioninterface.util.Util;
/**
* Shibboleth credential verifyer
* @author Sven Strickroth
*/
public class ShibbolethVerify implements VerifyIf {
final static private Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private String userAttribute;
private String matrikelNumberAttribute;
public ShibbolethVerify(FilterConfig filterConfig) {
this.userAttribute = filterConfig.getInitParameter("userAttribute");
this.matrikelNumberAttribute = filterConfig.getInitParameter("matrikelNumberAttribute");
}
@Override
public VerifyResult checkCredentials(Session session, LoginData logindata, HttpServletRequest request) {
if (request.getAttribute("Shib-Identity-Provider") == null) {
LOG.error("No Shib-Identity-Provider request attribute found.");
return null;
}
if (!logindata.getUsername().equals(Shibboleth.getAttribute(request, userAttribute))) {
LOG.error("Got mismatching username from Shibboleth and LoginIf.");
return null;
}
User user = DAOFactory.UserDAOIf(session).getUserByUsername(logindata.getUsername());
String lastName = Shibboleth.getAttribute(request, "sn");
String firstName = Shibboleth.getAttribute(request, "givenName");
String mail = Shibboleth.getAttribute(request, "mail");
VerifyResult result = null;
if (user != null) {
result = new VerifyResult(user);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setEmail(mail);
} else {
result = new VerifyResult();
result.username = logindata.getUsername();
result.lastName = lastName;
result.firstName = firstName;
result.mail = mail;
if (matrikelNumberAttribute != null) {
String matrikelnumber = Shibboleth.getAttribute(request, matrikelNumberAttribute);
if (matrikelnumber != null && Util.isInteger(matrikelnumber)) {
result.matrikelNumber = Integer.parseInt(matrikelnumber);
}
}
}
if (!result.wasLoginSuccessful()) {
LOG.warn("Shibboleth login worked, but not detected as logged in, missing data?!");
}
return result;
}
}
| [
"email@cs-ware.de"
] | email@cs-ware.de |
108feebbec6f3e0047621984f29abf2996584082 | 5a7676c23289e3f4e67e930b2fc16085c4776f35 | /src/test/java/watsapp/TimeResourceTest.java | b9004e8a2f0dd00f995a6a9a66c33ef4417e482f | [] | no_license | aniltegeti03/watsapp | 13eb6f12b9de0751a458e459f6e9d7b5a314fb33 | 9d60222e2cc7f6005b957dd04dc2b27dabdfec2f | refs/heads/master | 2023-07-26T00:53:52.678492 | 2021-09-05T17:25:07 | 2021-09-05T17:25:07 | 403,370,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | /*
* Copyright 2013 ${company}.
*/
package watsapp;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import javax.inject.Inject;
import static org.assertj.core.api.Assertions.assertThat;
import org.atteo.moonshine.Moonshine;
import org.atteo.moonshine.tests.MoonshineConfiguration;
import org.atteo.moonshine.tests.MoonshineTest;
import org.atteo.moonshine.webserver.WebServerAddress;
import org.junit.Test;
import com.google.common.io.Resources;
@MoonshineConfiguration(autoConfiguration = true)
public class TimeResourceTest extends MoonshineTest {
@Inject
private WebServerAddress address;
@Test
public void shouldReturnTime() throws IOException, MalformedURLException {
System.out.println(Resources.toString(new URL("http://localhost:" + address.getPort() + "/time"), StandardCharsets.UTF_8));
}
}
| [
"aniltegeti@gmail.com"
] | aniltegeti@gmail.com |
9d86b84a96fd89ce7ce1bff94206eaff49b89051 | bf391142ee36ee4ac9086d5c896c150cad6ea3fa | /src/main/java/com/vi/custom/aspect/annotation/MethodExecutionCalculationAspect.java | 8acf4f4d86ad662825f895e7f0f408cd87596c9a | [] | no_license | vixir/Custom-Aspect-Annotation | 24ccf139fe7452ac2daa4c3682b4a1bdcddbcacd | 0a84914b3e7369f321273e2d106bd8a345b1636c | refs/heads/master | 2020-05-21T18:53:05.225117 | 2019-05-11T14:29:41 | 2019-05-11T14:29:41 | 186,141,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.vi.custom.aspect.annotation;
import com.vi.custom.aspect.annotation.performance.*;
import lombok.extern.slf4j.*;
import org.aspectj.lang.*;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.*;
import org.springframework.core.annotation.*;
import org.springframework.stereotype.*;
import java.util.*;
@Component
@Aspect
@Slf4j
public class MethodExecutionCalculationAspect {
@Around("@annotation(com.vi.custom.aspect.annotation.performance.TrackTime)")
public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
Object proceed;
long startTime = System.currentTimeMillis();
MethodSignature methodSignature = (MethodSignature) proceedingJoinPoint.getSignature();
TrackTime trackTime = AnnotationUtils.findAnnotation(methodSignature.getMethod(), TrackTime.class);
Map<String, Object> map = AnnotationUtils.getAnnotationAttributes(trackTime);
String headName = (String) map.get("headName");
String subHeadName = (String) map.get("subHeadName");
try {
proceed = proceedingJoinPoint.proceed();
} finally {
long endTime = System.currentTimeMillis();
log.info("Time Taken by head {}, subHead {} and joinPoint {} returned with value {}",
headName,
subHeadName,
proceedingJoinPoint,
endTime - startTime);
}
return proceed;
}
}
| [
"vivk274@gmail.com"
] | vivk274@gmail.com |
64648156704571df7a68dc1bacf9c8d2288e41c7 | 57587859b314416bbf7e9e45a9fb073a2b9dc825 | /SmartChildren/src/com/ydhl/utils/MyHttpUtils.java | c8d7a25004587cc0dce4d1217e11c2a899d92dcb | [] | no_license | L-value/SmartChildren | 058939bb3e614fcf48b38d2249940cbcbd45a52c | c56bdd76a2e059497ff7da64cd8af2298556772b | refs/heads/master | 2021-01-01T03:55:16.958925 | 2016-05-08T06:51:29 | 2016-05-08T06:54:48 | 58,030,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,432 | java | package com.ydhl.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import android.os.AsyncTask;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ydhl.bean.LoginInfo;
import com.ydhl.bean.PlayTime;
import com.ydhl.bean.UserInfo;
import com.ydhl.listener.MyHttpListener;
public class MyHttpUtils
{
private String method;
private UserInfo data;
private PlayTime playTime;
private String path;
private MyHttpListener myHttpListener;
private Map<String, String> dataMap;
private JsonObject jsonObject = new JsonObject();
private Gson gson = new Gson();
private LoginInfo loginInfo;
private String facade;
public MyHttpUtils(String method, UserInfo data, String path,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.data = data;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("code","300");
dataMap.put("UserName",data.getUserName());
dataMap.put("Password",data.getPassWord());
dataMap.put("sex",data.getSex());
dataMap.put("age",Integer.toString(data.getAge()));
dataMap.put("tel", data.getTel());
dataMap.put("parent", data.getLead());
}
public MyHttpUtils(String method,String facade, String path,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.facade = facade;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("", facade);
}
public MyHttpUtils(String method,String username,String tel,String email, String path,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("Username", username);
dataMap.put("tel", tel);
dataMap.put("email", email);
}
public MyHttpUtils(String method, LoginInfo loginInfo, String path,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.loginInfo = loginInfo;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("code","302");
dataMap.put("UserName",loginInfo.getUserName());
dataMap.put("Password",loginInfo.getPassWord());
}
public MyHttpUtils(String method, PlayTime playTime, String path,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.playTime = playTime;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("code","100");
dataMap.put("Game_1_time", playTime.getGame_1_Time());
dataMap.put("Game_2_time", playTime.getGame_2_Time());
dataMap.put("Game_3_time", playTime.getGame_3_Time());
dataMap.put("Game_1_grade", playTime.getGame_1_Grade());
dataMap.put("Game_2_grade", playTime.getGame_2_Grade());
dataMap.put("Game_3_grade", playTime.getGame_3_Grade());
}
public MyHttpUtils(String method,String path,String key,int a,MyHttpListener myHttpListener)
{
super();
this.method = method;
this.path = path;
this.myHttpListener = myHttpListener;
dataMap = new HashMap<>();
dataMap.put("key", key);
}
public void DoRequestByHttpUrlConnection(){
MyHttpTask myHttpTask = new MyHttpTask();
myHttpTask.execute();
}
private String doGetByHttpClient(){
HttpGet httpGet = new HttpGet(path);
String content = null;
HttpClient httpClient = MyHttpClient.getInstatnce();
try
{
HttpResponse response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200)
{
content = EntityUtils.toString(response.getEntity(),"utf-8");
myHttpListener.onSuccess(content);
}
} catch (Exception e)
{
myHttpListener.onFailed(content);
e.printStackTrace();
}
return content;
}
private String doPostByHttpClient(){
String content = null;
HttpPost httpPost = new HttpPost(path);
HttpClient httpClient = MyHttpClient.getInstatnce();
List<NameValuePair> parameters = new ArrayList<>();
for (Entry<String, String> entry : dataMap.entrySet())
{
NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), entry.getValue());
parameters.add(nameValuePair);
}
try
{
UrlEncodedFormEntity encodedFormEntity = new UrlEncodedFormEntity(parameters);
httpPost.setEntity(encodedFormEntity);
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() == 200)
{
content = EntityUtils.toString(response.getEntity(),"utf-8");
myHttpListener.onSuccess(content);
}
} catch (Exception e1)
{
myHttpListener.onFailed(content);
e1.printStackTrace();
}
return content;
}
private class MyHttpTask extends AsyncTask<String, Void, String>{
@Override
protected String doInBackground(String... params)
{
if (method.equals("GET"))
{
return doGetByHttpClient();
}else if(method.equals("POST")){
return doPostByHttpClient();
}
return null;
}
@Override
protected void onPostExecute(String result)
{
super.onPostExecute(result);
}
}
}
| [
"188724563@qq.com"
] | 188724563@qq.com |
6702a05e008457296807810ff46802a9dd3877a3 | 219cbfd2b09c8989afbdcdd4198b77dd93799b1e | /develop/server/toolProject/gameTool/src/main/java/com/home/gameTool/app/GameAllToolsApp.java | 041ded7f211be1841300fd004b59e36e0d811e34 | [
"Apache-2.0"
] | permissive | shineTeam7/tank | 2c9d6e1f01ebe6803731b520ce84eea52c593d2b | 1d37e93474bc00ca3923be08d0742849c73f1049 | refs/heads/master | 2022-12-02T01:35:12.116350 | 2020-08-17T12:09:01 | 2020-08-17T12:09:01 | 288,139,019 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.home.gameTool.app;
import com.home.commonTool.app.AllToolsApp;
public class GameAllToolsApp
{
public static void main(String[] args)
{
AllToolsApp.main(args);
}
}
| [
"359944951@qq.com"
] | 359944951@qq.com |
900835d0ae5e02942b5173434a034550af074581 | 4a1474e64fff6dbe844e7d9c6f5a7143a16691c2 | /src/main/java/com/adventure/uaa/service/InvalidPasswordException.java | 718f28c5158e4523eff62c4cfe5909bee2cad237 | [] | no_license | Adventure-RPG/adventure-uaa | db5c33028e5e44cb3fe74b429d4e677fde4d2bb1 | cd4f7328085a0c1bb134e6ffcb7a82b0e15045d4 | refs/heads/master | 2022-12-11T16:32:09.262435 | 2020-01-10T09:58:57 | 2020-01-10T09:58:57 | 160,107,323 | 1 | 0 | null | 2022-12-08T09:35:22 | 2018-12-02T23:38:37 | Java | UTF-8 | Java | false | false | 188 | java | package com.adventure.uaa.service;
public class InvalidPasswordException extends RuntimeException {
public InvalidPasswordException() {
super("Incorrect password");
}
}
| [
"jenkins@jenkins.jenkins.iamborsch.ru"
] | jenkins@jenkins.jenkins.iamborsch.ru |
e224f22f5b5b3aac6840206d7bbe659d7f2682cd | 0c1867ee79dccc6239b081b69f1ecd5c4eb1899d | /src/main/java/com/crudWithMysql/crudWithMysql/reposatory/inf/UserReposatoryInf.java | 7206bf2f9fa03406e4da2017d0590e9a17363a97 | [] | no_license | weblearnex/crudWithMysql | 5f934e22755617a82a30cbd47fc3033fb654c13a | 7072bd89b2476da7481bd218296cef2e0bb01644 | refs/heads/master | 2022-05-24T09:11:45.890549 | 2020-04-29T16:56:54 | 2020-04-29T16:56:54 | 259,986,656 | 0 | 0 | null | 2022-05-20T21:37:12 | 2020-04-29T16:54:52 | Java | UTF-8 | Java | false | false | 405 | java | package com.crudWithMysql.crudWithMysql.reposatory.inf;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.crudWithMysql.crudWithMysql.model.entity.User;
@Repository
public interface UserReposatoryInf extends CrudRepository<User, Long> {
List<User> findByNameAndPassword(String name,String password);
}
| [
"virendrams2014@gmail.com"
] | virendrams2014@gmail.com |
0f4c5c522925161b0f0756a337860e98833d89dd | 706afb1e7ed08ad00c6b43c3e2d0c52f25d8d5c7 | /TrafficInfo/src/test/java/au/com/sportsbet/traffic/user/inactive/HourCounterTest.java | bd88340f8b87eba2e2fa0d212caa2971adebfe20 | [] | no_license | LiuJiang682/sportsbet | f71df47e84b456950211b8e8df15907233ffd6af | 5b13f2832f7f2ab577d102649ad416dce088b8bb | refs/heads/master | 2021-01-10T16:56:05.270533 | 2015-06-04T18:45:25 | 2015-06-04T18:45:25 | 36,775,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | package au.com.sportsbet.traffic.user.inactive;
import static org.mockito.Mockito.when;
import java.util.Iterator;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import au.com.sportsbet.common.WeekDay;
import au.com.sportsbet.common.constants.Constants.Numeral;
import au.com.sportsbet.common.constants.Constants.Strings;
import au.com.sportsbet.traffic.dto.TrafficRecord;
@RunWith(PowerMockRunner.class)
@PrepareForTest({TrafficRecord.class})
public class HourCounterTest {
@Mock
private List<TrafficRecord> mockList;
@Mock
private Iterator<TrafficRecord> mockIterator;
@Mock
private TrafficRecord mockRecord1;
@Mock
private TrafficRecord mockRecord2;
@Mock
private TrafficRecord mockRecord3;
@Mock
private TrafficRecord mockRecord4;
@Mock
private TrafficRecord mockRecord5;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
public void testCountAndDisplay() {
when(mockList.iterator()).thenReturn(mockIterator);
when(mockIterator.hasNext()).thenReturn(true, true, true, true, true, false);
when(mockIterator.next()).thenReturn(mockRecord1, mockRecord2, mockRecord3, mockRecord4, mockRecord5);
when(mockRecord1.getDay()).thenReturn(WeekDay.Monday);
when(mockRecord1.getHour()).thenReturn(Numeral.ZERO);
when(mockRecord2.getDay()).thenReturn(WeekDay.Tuesday);
when(mockRecord2.getHour()).thenReturn(Numeral.ONE);
when(mockRecord3.getDay()).thenReturn(WeekDay.Wednesday);
when(mockRecord3.getHour()).thenReturn(Numeral.THREE);
when(mockRecord4.getDay()).thenReturn(WeekDay.Thursday);
when(mockRecord4.getHour()).thenReturn(Numeral.SIX);
when(mockRecord5.getDay()).thenReturn(WeekDay.Friday);
when(mockRecord5.getHour()).thenReturn(Numeral.TWELVE);
HourCounter h = new HourCounter(this.mockList, Strings.DIRECTION_A);
h.countAndDisplay();
}
}
| [
"liujiang682@gmail.com"
] | liujiang682@gmail.com |
cd9e826b65708ef659c6b2d129f0c1e78c1d4b87 | 991d186bc28682251afe21110d33f85087fc7725 | /src/com/thebenchwarmers/View/Controller/NotifContoller.java | 74f66e17b0c89e895d6293b222317ea6e63d1c4c | [] | no_license | mgafsi/pidev | 8d39add33266c6141cb6b2b67fba3fd8b6d8b6b3 | 611ad548cba66d1b51917f1ff0d360aa2bc8d7a3 | refs/heads/master | 2020-05-24T05:36:20.164078 | 2019-05-17T00:42:13 | 2019-05-17T00:42:13 | 187,120,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,326 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.thebenchwarmers.View.Controller;
import com.jfoenix.controls.JFXListView;
import com.thebenchwarmers.utility.CurrentUser;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import com.thebenchwarmers.utility.User;
import com.thebenchwarmers.utility.evenement;
import com.thebenchwarmers.utility.notif;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import com.thebenchwarmers.utility.MyServiceEvenement;
//import util.Authentification;
/**
*
*
*/
public class NotifContoller implements Initializable{
// private final User currentUser=Authentification.user;
MyServiceEvenement service_pr=new MyServiceEvenement();
int currentUser = CurrentUser.id;
notif p = new notif();
@FXML
private JFXListView<Pane> ListView_Produits ;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// ListView_Produits.setMouseTransparent( true );
ListView_Produits.setFocusTraversable( false );
getShowPane();
}
public void getShowPane()
{
List <notif> AllProducts = new ArrayList();
for (notif p: service_pr.MesNotif())
{
AllProducts.add(p);
}
System.out.println(AllProducts);
int i=0;
int j=0;
ObservableList<Pane> Panes = FXCollections.observableArrayList();
List <notif> ThreeProducts= new ArrayList();
for (notif p:AllProducts )
{
Panes.add(AddPane(ThreeProducts));
ThreeProducts.clear();
ThreeProducts.add(p);
i++;
j++;
Panes.add(AddPane(ThreeProducts));
ThreeProducts.clear();
}
ListView_Produits.setItems(Panes);
}
public Pane AddPane( List<notif> ThreeProduct)
{
Pane pane = new Pane();
int k =1;
for (notif p3:ThreeProduct )
{
Pane pane2=new Pane();
pane2.setLayoutX(25);
pane2.setMaxWidth(215);
//pane2.setStyle("-fx-background-radius: 50;");
pane2.setStyle(" -fx-border-radius: 10 10 0 0;-fx-border-color: #383d3b ;-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 8, 0, 0, 0); ");
Text t=new Text("quick view");
Text t1=new Text("acheter");
t1.setStyle("-fx-font-weight: bold;");
t.setStyle("-fx-font-weight: bold;");
String A = p3.getImagee();
A = "C:\\xampp\\htdocs\\datatable_21\\web\\"+A;
File F1 = new File(A);
Image image2 = new Image(F1.toURI().toString());
ImageView image=new ImageView();
image.setFitWidth(50);
image.setFitHeight(50);
image.setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 8, 0, 0, 0);");
image.setImage(image2);
image.setLayoutX(0);
image.setLayoutY(0);
pane2.getChildren().add(image);
pane.setOnMouseClicked((MouseEvent event) -> {
System.out.println("aaaaaaa");
});
Text nomt=new Text("Nom évenement: ");
Label nom = new Label(p3.getNome());
Text prixt=new Text("Nom Inviteur : ");
Label prix = new Label(String.valueOf(p3.getNominviteur()));
nomt.setLayoutX(110);
nomt.setLayoutY(20);
nom.setLayoutX(110);
nom.setLayoutY(20);
prixt.setLayoutX(110);
prixt.setLayoutY(50);
prix.setLayoutX(110);
prix.setLayoutY(50);
nomt.setStyle("-fx-font-weight: bold;-fx-fill : red");
prixt.setStyle("-fx-font-weight: bold;-fx-fill : red");
t1.setOnMouseClicked((MouseEvent event) -> {
getShowPane();
});
pane.getChildren().addAll(pane2,nomt,prixt,nom,prix);
}
return pane;
}
}
| [
"mayssa.gafsi@esprit.tn"
] | mayssa.gafsi@esprit.tn |
73ad71a9d27c8c5725419aab18c711b4c8ecc530 | 89afcfd9822ecfef1f696fd62c27218e0f874744 | /app/src/main/java/com/whatmedia/ttia/page/main/communication/CommunicationRecyclerViewAdapter.java | c2795f97f768f18bb8de5368951dae670193003f | [] | no_license | ilikekobe0502/Airport | d99647a98abfda4ef42ed10613cdc07b380b943e | a346d59e411377045503d4bd8e48f12aa1461b64 | refs/heads/master | 2021-01-15T14:28:36.573681 | 2017-09-29T12:34:44 | 2017-09-29T12:34:44 | 99,692,168 | 0 | 1 | null | 2018-02-12T05:17:56 | 2017-08-08T12:49:42 | Java | UTF-8 | Java | false | false | 2,686 | java | package com.whatmedia.ttia.page.main.communication;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.whatmedia.ttia.R;
import com.whatmedia.ttia.enums.CommunicationService;
import com.whatmedia.ttia.enums.StoreOffers;
import com.whatmedia.ttia.interfaces.IOnItemClickListener;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by neo_mac on 2017/8/4.
*/
public class CommunicationRecyclerViewAdapter extends RecyclerView.Adapter<CommunicationRecyclerViewAdapter.ViewHolder> {
private final static String TAG = CommunicationRecyclerViewAdapter.class.getSimpleName();
private List<CommunicationService> mItems = CommunicationService.getPage();
private Context mContext;
private IOnItemClickListener mListener;
public CommunicationRecyclerViewAdapter(Context context) {
mContext = context;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_feature, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (mItems == null) {
Log.e(TAG, "mItem is null");
return;
}
CommunicationService item = CommunicationService.getItemByTag(mItems.get(position));
if (item == null) {
Log.e(TAG, "item is null");
return;
}
holder.mTextViewTitle.setText(mContext.getText(item.getTitle()));
holder.mImageViewIcon.setBackground(ContextCompat.getDrawable(mContext, item.getIcon()));
holder.mImageViewIcon.setTag(item);
}
@Override
public int getItemCount() {
return mItems != null ? mItems.size() : 0;
}
public void setClickListener(IOnItemClickListener listener) {
mListener = listener;
}
public class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.imageView_icon)
ImageView mImageViewIcon;
@BindView(R.id.textView_title)
TextView mTextViewTitle;
ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
@OnClick(R.id.imageView_icon)
public void onViewClicked(View view) {
mListener.onClick(view);
}
}
}
| [
"hu.yu.huei@gmail.com"
] | hu.yu.huei@gmail.com |
21931c16083828c09d58081456d7cf47eef1c3bb | 38171d5439f85c5e6852dfde08ffc1baab3b3d45 | /src/main/java/com/example/springsocial/security/TokenProvider.java | 9b8672ef1e6cf277449d8806f2bd1917eaf07f96 | [] | no_license | pandeyrenu12/POC | 9be240717f601c8093f15cb70c6254110e4b9e81 | 4a035fe1dde76e2737f99a769d1277d8fc562793 | refs/heads/master | 2020-06-01T16:46:03.746658 | 2019-06-08T06:53:17 | 2019-06-08T06:53:17 | 190,854,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,649 | java | package com.example.springsocial.security;
import com.example.springsocial.config.AppProperties;
import io.jsonwebtoken.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
import java.security.Key;
import java.util.Date;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
@Service
public class TokenProvider {
private static final Logger logger = LoggerFactory.getLogger(TokenProvider.class);
private AppProperties appProperties;
public TokenProvider(AppProperties appProperties) {
this.appProperties = appProperties;
}
public String createToken(Authentication authentication) {
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
Date now = new Date();
Date expiryDate = new Date(now.getTime() + appProperties.getAuth().getTokenExpirationMsec());
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(appProperties.getAuth().getTokenSecret());
Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
return Jwts.builder()
.setSubject(Long.toString(userPrincipal.getId()))
.claim("name", userPrincipal.getUsername())
.claim("provider", "facebook")
.setIssuedAt(new Date())
.setExpiration(expiryDate)
.signWith(signatureAlgorithm, signingKey)
.compact();
}
public Long getUserIdFromToken(String token) {
Claims claims = Jwts.parser()
.setSigningKey(appProperties.getAuth().getTokenSecret())
.parseClaimsJws(token)
.getBody();
return Long.parseLong(claims.getSubject());
}
public boolean validateToken(String authToken) {
try {
Jwts.parser().setSigningKey(appProperties.getAuth().getTokenSecret()).parseClaimsJws(authToken);
return true;
} catch (SignatureException ex) {
logger.error("Invalid JWT signature");
} catch (MalformedJwtException ex) {
logger.error("Invalid JWT token");
} catch (ExpiredJwtException ex) {
logger.error("Expired JWT token");
} catch (UnsupportedJwtException ex) {
logger.error("Unsupported JWT token");
} catch (IllegalArgumentException ex) {
logger.error("JWT claims string is empty.");
}
return false;
}
}
| [
"38316571+RenuPandeyPJI@users.noreply.github.com"
] | 38316571+RenuPandeyPJI@users.noreply.github.com |
ae43751c23534330e64ac82643493f7047eeb3cb | cb47a69eb202feae227358af2493efe9c35d0cf6 | /spring-cloud/springboot-seata/seata-samples-master/seata-spring-boot-starter-samples/samples-account-service/src/main/java/io/seata/samples/integration/account/controller/TAccountController.java | aa4aa71cd34fa4a58e35091c892bf8e373c66d08 | [
"Apache-2.0"
] | permissive | WCry/demo | e4f6ee469e39e9a96e9deec2724eb89d642830b5 | 5801b12371a1beb610328a8b83a056276427817d | refs/heads/master | 2023-05-28T14:42:29.175634 | 2021-06-14T14:06:43 | 2021-06-14T14:06:43 | 266,535,701 | 2 | 1 | Apache-2.0 | 2020-10-21T01:03:55 | 2020-05-24T12:24:51 | Java | UTF-8 | Java | false | false | 1,131 | java | package io.seata.samples.integration.account.controller;
import io.seata.samples.integration.account.service.ITAccountService;
import io.seata.samples.integration.common.dto.AccountDTO;
import io.seata.samples.integration.common.response.ObjectResponse;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 账户扣钱
* </p>
*
* * @author lidong
* @since 2019-09-04
*/
@RestController
@RequestMapping("/account")
@Slf4j
public class TAccountController {
@Autowired
private ITAccountService accountService;
@PostMapping("/dec_account")
ObjectResponse decreaseAccount(@RequestBody AccountDTO accountDTO) {
log.info("请求账户微服务:{}", accountDTO.toString());
return accountService.decreaseAccount(accountDTO);
}
}
| [
"627292959@qq.com"
] | 627292959@qq.com |
66f2b01c37f1e5f3e313d6fd6e9b75f34fa64f27 | aa3d7f0d2ba7f0c997f01352a016340c1f647232 | /src/br/com/caelum/financas/dao/MovimentacaoDao.java | 1cdbce53a3aa0f5b670a114db8fd1986c9f28247 | [] | no_license | alexandregvida/JavaJpaAlura | d97aa3e89ed6695ec905cc99da686a645368bfef | e62fcca7b51808b08162fed0429ba0884af0bf9c | refs/heads/master | 2020-06-13T06:41:24.594873 | 2019-07-22T04:32:33 | 2019-07-22T04:32:33 | 194,574,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package br.com.caelum.financas.dao;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import com.sun.xml.internal.stream.Entity;
import br.com.caelum.financas.modelo.TipoMovimentacao;
import br.com.caelum.financas.modelo.Conta.Conta;
public class MovimentacaoDao {
private EntityManager em;
public MovimentacaoDao(EntityManager em) {
super();
this.em = em;
}
public List<Double> getMediasPorDiaETipo(TipoMovimentacao saida, Conta conta) {
// String jpql = "select m from Movimentacao m where m.conta = :pConta" + " and
// m.tipo = :pTipo " + " order by m.valor desc";
// Soma
// String jpql = "select sum(m.valor) from Movimentacao m where m.conta =
// :pConta" + " and m.tipo = :pTipo";
// Media
// String jpql = "select avg(m.valor) from Movimentacao m where m.conta =
// :pConta" + " and m.tipo = :pTipo";
// Maior Valor
String jpql = "select distinct avg(m.valor) from Movimentacao m where m.conta = :pConta" + " and m.tipo = :pTipo" + " group by m.data";
TypedQuery<Double> query = em.createQuery(jpql, Double.class);
query.setParameter("pConta", conta);
query.setParameter("pTipo", TipoMovimentacao.SAIDA);
return query.getResultList();
}
}
| [
"alexandre.vida@valecard.com.br"
] | alexandre.vida@valecard.com.br |
b52d050a163d53248219611fdd7c5efa435076eb | f57953264a6ee6a08e5f5d16838bb3338e10c3ab | /api/src/test/java/org/searchisko/api/rest/SearchRestServiceTest.java | a57e4e75e5d85304e5779cc98febff911971d499 | [
"Apache-2.0"
] | permissive | bleathem/searchisko | 9aa8ef68bed37764875fd75c0c06ab66751baee6 | a647df732959ea084379050935ed552c4ae4d23c | refs/heads/master | 2020-04-05T23:09:53.726008 | 2014-04-04T12:02:26 | 2014-04-04T12:02:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,000 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
*/
package org.searchisko.api.rest;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.Logger;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.xcontent.ToXContent.Params;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.indices.IndexMissingException;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.searchisko.api.model.QuerySettings;
import org.searchisko.api.rest.exception.BadFieldException;
import org.searchisko.api.rest.exception.RequiredFieldException;
import org.searchisko.api.service.SearchService;
import org.searchisko.api.service.StatsRecordType;
import org.searchisko.api.testtools.TestUtils;
import org.searchisko.api.util.QuerySettingsParser;
/**
* Unit test for {@link SearchRestService}
*
* @author Vlastimil Elias (velias at redhat dot com)
*/
public class SearchRestServiceTest {
@Test
public void search_permissions() {
TestUtils.assertPermissionGuest(SearchRestService.class, "search", UriInfo.class);
}
@Test(expected = BadFieldException.class)
public void search_inputParam_1() throws IOException {
SearchRestService tested = getTested();
tested.search(null);
}
@Test(expected = BadFieldException.class)
public void search_invalidParam_2() throws IOException {
SearchRestService tested = getTested();
// case - error handling for invalid request value
Mockito.reset(tested.querySettingsParser, tested.searchService);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenThrow(
new IllegalArgumentException("test exception"));
Object response = tested.search(uriInfo);
TestUtils.assertResponseStatus(response, Status.BAD_REQUEST);
Mockito.verifyNoMoreInteractions(tested.searchService);
}
@Test
public void search() throws IOException {
SearchRestService tested = getTested();
// case - correct processing sequence
{
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
QuerySettings qs = new QuerySettings();
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenReturn(qs);
SearchResponse sr = Mockito.mock(SearchResponse.class);
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
XContentBuilder b = (XContentBuilder) invocation.getArguments()[0];
b.field("testfield", "testvalue");
return null;
}
}).when(sr).toXContent(Mockito.any(XContentBuilder.class), Mockito.any(Params.class));
Mockito.when(
tested.searchService.performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.SEARCH))).thenReturn(sr);
Mockito.when(tested.searchService.getSearchResponseAdditionalFields(Mockito.eq(qs))).thenReturn(
new HashMap<String, String>());
Object response = tested.search(uriInfo);
Mockito.verify(uriInfo).getQueryParameters();
Mockito.verify(tested.querySettingsParser).parseUriParams(qp);
Mockito.verify(tested.searchService).performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.SEARCH));
Mockito.verify(tested.searchService).getSearchResponseAdditionalFields(Mockito.eq(qs));
Mockito.verifyNoMoreInteractions(tested.searchService);
TestUtils.assetStreamingOutputContentRegexp("\\{\"uuid\":\".+\",\"testfield\":\"testvalue\"\\}", response);
}
// case - error handling for index not found exception
{
Mockito.reset(tested.querySettingsParser, tested.searchService);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
QuerySettings qs = new QuerySettings();
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenReturn(qs);
Mockito.when(
tested.searchService.performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.SEARCH))).thenThrow(new IndexMissingException(null));
Object response = tested.search(uriInfo);
TestUtils.assertResponseStatus(response, Status.NOT_FOUND);
}
}
// case - error handling for other exceptions
@Test(expected = RuntimeException.class)
public void search_exceptionFromService() {
SearchRestService tested = getTested();
Mockito.reset(tested.querySettingsParser, tested.searchService);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
QuerySettings qs = new QuerySettings();
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenReturn(qs);
Mockito.when(
tested.searchService.performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.SEARCH))).thenThrow(new RuntimeException());
tested.search(uriInfo);
}
@Test(expected = RequiredFieldException.class)
public void writeSearchHitUsedStatisticsRecord_invalidParam_1() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord(null, "aa", null);
}
public void writeSearchHitUsedStatisticsRecord_invalidParam_2() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord("", "aa", null);
}
public void writeSearchHitUsedStatisticsRecord_invalidParam_3() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord(" ", "aa", null);
}
public void writeSearchHitUsedStatisticsRecord_invalidParam_4() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord("sss", null, null);
}
public void writeSearchHitUsedStatisticsRecord_invalidParam_5() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord("sss", "", null);
}
public void writeSearchHitUsedStatisticsRecord_invalidParam_6() {
SearchRestService tested = getTested();
tested.writeSearchHitUsedStatisticsRecord("sss", " ", null);
}
@Test
public void writeSearchHitUsedStatisticsRecord() {
SearchRestService tested = getTested();
// case - input params trimmed
{
Mockito.reset(tested.searchService);
Mockito.when(tested.searchService.writeSearchHitUsedStatisticsRecord("aaa", "bb", null)).thenReturn(true);
TestUtils.assertResponseStatus(tested.writeSearchHitUsedStatisticsRecord(" aaa ", " bb ", " "), Status.OK);
Mockito.verify(tested.searchService).writeSearchHitUsedStatisticsRecord("aaa", "bb", null);
Mockito.verifyNoMoreInteractions(tested.searchService);
}
// case - record accepted
{
Mockito.reset(tested.searchService);
Mockito.when(tested.searchService.writeSearchHitUsedStatisticsRecord("aaa", "bb", null)).thenReturn(true);
TestUtils.assertResponseStatus(tested.writeSearchHitUsedStatisticsRecord("aaa", "bb", null), Status.OK,
"statistics record accepted");
Mockito.verify(tested.searchService).writeSearchHitUsedStatisticsRecord("aaa", "bb", null);
Mockito.verifyNoMoreInteractions(tested.searchService);
}
// case - record denied
{
Mockito.reset(tested.searchService);
Mockito.when(tested.searchService.writeSearchHitUsedStatisticsRecord("aaa", "bb", "jj")).thenReturn(false);
TestUtils.assertResponseStatus(tested.writeSearchHitUsedStatisticsRecord("aaa", "bb", "jj"), Status.OK,
"statistics record ignored");
Mockito.verify(tested.searchService).writeSearchHitUsedStatisticsRecord("aaa", "bb", "jj");
Mockito.verifyNoMoreInteractions(tested.searchService);
}
}
@Test(expected = RuntimeException.class)
public void writeSearchHitUsedStatisticsRecord_exceptionFromService() {
SearchRestService tested = getTested();
Mockito.reset(tested.searchService);
Mockito.when(tested.searchService.writeSearchHitUsedStatisticsRecord("aaa", "bb", null)).thenThrow(
new RuntimeException("exception"));
tested.writeSearchHitUsedStatisticsRecord("aaa", "bb", null);
}
private SearchRestService getTested() {
SearchRestService tested = new SearchRestService();
tested.querySettingsParser = Mockito.mock(QuerySettingsParser.class);
tested.searchService = Mockito.mock(SearchService.class);
tested.log = Logger.getLogger("test logger");
return tested;
}
}
| [
"vlastimil.elias@worldonline.cz"
] | vlastimil.elias@worldonline.cz |
bf9a6ba32e838eb56aeaae0fd441f43f446f6005 | 4c5bc80e39bfec777409440d6c2cb52b2e953c91 | /Lab4-1173710107-master/src/debug/TopVotedCandidate.java | 86332503b294530569e8d388e459880b80d50594 | [] | no_license | 1173710107/SoftwareStructure | 0cac2a79d7b5968772e1d05b34b7030f52bd1378 | 2d5157564655e87de3a2147ba53a5409be080a49 | refs/heads/master | 2022-09-30T10:34:44.669660 | 2020-06-04T13:22:18 | 2020-06-04T13:22:18 | 269,363,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,585 | java | /**
* In an election, the i-th vote was cast for persons[i] at time times[i].
*
* Now, we would like to implement the following query function:
* TopVotedCandidate.q(int t) will return the number of the person that was
* leading the election at time t.
*
* Votes cast at time t will count towards our query. In the case of a tie, the
* most recent vote (among tied candidates) wins.
*
*
*
* Example 1:
*
* Input: ["TopVotedCandidate","q","q","q","q","q","q"],
* [[[0,1,1,0,0,1,0],[0,5,10,15,20,25,30]],[3],[12],[25],[15],[24],[8]]
* Output:
* [null,0,1,1,0,0,1]
*
* Explanation:
* At time 3, the votes are [0], and 0 is leading.
* At time 12, the votes are [0,1,1], and 1 is leading.
* At time 25, the votes are [0,1,1,0,0,1], and 1 is leading (as ties go to the most recent
* vote.)
* This continues for 3 more queries at time 15, 24, and 8.
*
*
* Note:
*
* 1 <= persons.length = times.length <= 5000
* 0 <= persons[i] <= persons.length
* times is a strictly increasing array with all elements in [0, 10^9].
* TopVotedCandidate.q is called at most 10000 times per test case.
* TopVotedCandidate.q(int t) is always called with t >= times[0].
*
*/
package debug;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class TopVotedCandidate {
List<List<Vote>> A;
public TopVotedCandidate(int[] persons, int[] times) {
A = new ArrayList<List<Vote>>();
Map<Integer, Integer> count = new HashMap<Integer, Integer>();
for (int i = 0; i < persons.length; ++i) {
int p = persons[i], t = times[i];
int c = count.getOrDefault(p, 0);
c++;
count.put(p, c);
while (A.size() <= c)
A.add(new ArrayList<Vote>());
A.get(c).add(new Vote(p, t));
}
}
public int q(int t) {
int lo = 1, hi = A.size() - 1;
while (lo < hi) {
int mi = lo + (hi - lo) / 2;
if(A.get(hi).get(0).time <= t) {
lo = hi;
break;
}
if(mi == lo) {
if(A.get(hi).get(0).time == t) {
lo = hi;
}
break;
}
if (A.get(mi).get(0).time < t)
lo = mi;
else
hi = mi;
}
int i = lo;
lo = 0;
hi = A.get(i).size() - 1;
while (lo < hi) {
int mi = lo + (hi - lo) / 2;
if(A.get(i).get(hi).time <= t) {
lo = hi;
break;
}
if(mi == lo) {
if(A.get(i).get(hi).time == t) {
lo = hi;
}
break;
}
if (A.get(i).get(mi).time < t)
lo = mi;
else
hi = mi;
}
int j = Math.max(lo, 0);
return A.get(i).get(j).person;
}
}
class Vote {
int person, time;
Vote(int p, int t) {
person = p;
time = t;
}
}
| [
"805402160@qq.com"
] | 805402160@qq.com |
4ba0198854c16b57da183c3c56033e027dbbb1a2 | 949efa84533f9820c5086b599672808aeb91db57 | /src/main/java/osp/security/oauth2/UserEmailAlreadyRegisteredException.java | 6e54ff0a22cd62f270ebdac7a85f70fde5cd0d8a | [] | no_license | kingz-slayer/Oauth2-security | 691d75bae1e7249201f47cbc11e13197cdee53d5 | 59fa1b8a70eca65843e57a1f06144f55f010b587 | refs/heads/master | 2021-01-02T09:44:54.229704 | 2017-10-28T21:05:55 | 2017-10-28T21:05:55 | 99,286,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package osp.security.oauth2;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@SuppressWarnings("serial")
@ResponseStatus(HttpStatus.FORBIDDEN)
public class UserEmailAlreadyRegisteredException extends RuntimeException {
public UserEmailAlreadyRegisteredException(String userEmailAddress){
super("User with " + userEmailAddress + " email address is already registered");
}
}
| [
"franky_venki@yahoo.com"
] | franky_venki@yahoo.com |
919e1eac9a9314a46d3c63c8c80fc5ff1af8eeb2 | 8bf68aead0baea9c9e71005efbebf3a02814675d | /src/main/java/com/demoboot/service/Impl/UserServiceImpl.java | 6ed4a2ebd714c8f74875cbaaecf1c2b0c6504d90 | [] | no_license | wangkegit/demoboot | c6bd38af537d97bc6796bee96fba07796515d5c7 | 6def40b5297c1714ba7ddbdf6019fedf778ba17b | refs/heads/master | 2021-07-07T02:39:48.738737 | 2020-11-06T07:33:21 | 2020-11-06T07:33:21 | 205,075,878 | 0 | 0 | null | 2020-10-13T18:24:13 | 2019-08-29T03:50:43 | Java | UTF-8 | Java | false | false | 635 | java | package com.demoboot.service.Impl;
import com.demoboot.entity.User;
import com.demoboot.repository.UserRepository;
import com.demoboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
@Autowired
UserRepository repository;
@Override
public User getUser(Integer id) {
//return repository.findById(id);
return repository.getUser(id);
}
@Override
public List<User> getAllUser() {
return repository.findAll();
}
}
| [
"saibeizouzu@gmail.com"
] | saibeizouzu@gmail.com |
4f91c330068f011fc3e80e1e66a6ee449deda57b | 25d8e20f75e342661d626a40053aedbcd3ae089f | /test/src/main/java/com/example/test/algorithm/leeCode/string/_回文子串.java | e98912b839d46397111e07f2f1d8d800a5588193 | [] | no_license | xiang-leiel/testDemo | 60e577075e35d953b78753a13a0a3d5022b03a07 | 21274c3c00c9ebc2aab9694a3104bcd577e94567 | refs/heads/master | 2022-08-09T19:36:22.963209 | 2021-05-08T00:54:36 | 2021-05-08T00:54:36 | 230,921,168 | 0 | 1 | null | 2022-07-01T21:25:48 | 2019-12-30T13:30:14 | Java | UTF-8 | Java | false | false | 570 | java | package com.example.test.algorithm.leeCode.string;
/**
* https://leetcode-cn.com/problems/palindromic-substrings/
* @Description
* @author leiel
* @Date 2020/8/19 10:59 AM
*/
public class _回文子串 {
public int countSubstrings(String s) {
int n = s.length(), ans = 0;
for (int i = 0; i < 2 * n - 1; ++i) {
int l = i / 2, r = i / 2 + i % 2;
while (l >= 0 && r < n && s.charAt(l) == s.charAt(r)) {
--l;
++r;
++ans;
}
}
return ans;
}
}
| [
"xianglei_family@sina.com"
] | xianglei_family@sina.com |
43ec4f6f173b8e2a8dcaab46b38f213c9f6ed216 | 1fbb4256dd2994bb44c94af5641883165f8609cd | /app/src/main/java/com/maiajam/mymemory/HelperMethodes.java | 7c33e4c8cbd52885ccb9a7e13432b66793e863d3 | [] | no_license | maiajam/myMemory | 25a74e3b1e0c24033bd9d62c6db1611848d65b70 | e04aba5025bffacb646fbe46bee3c8f712fce45e | refs/heads/master | 2020-07-18T17:52:13.795352 | 2019-12-12T10:01:16 | 2019-12-12T10:01:16 | 206,287,538 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.maiajam.mymemory;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
public class HelperMethodes {
public static void beginTransaction(FragmentTransaction fragmentTransaction, Fragment fragment, int frameId) {
fragmentTransaction.replace(frameId, fragment);
fragmentTransaction.commit();
}
public static boolean checkValidate(String email, String pass) {
if(email.isEmpty())
{
return false;
}
if(pass.isEmpty())
{
return false;
}
return true;
}
}
| [
"maiajam88@hotmail.com"
] | maiajam88@hotmail.com |
85a7a63bda726fa709b1ae21f52c1abe4d54945c | 77a0d65a230c7ad5a7dd74d90417e05bbade9168 | /Square.java | bf332568ddfcf5a71c82d50caa7983bbfc451805 | [] | no_license | VanLien1503/TH_TrienKhai_Comparator | 24d68f2aff83f8c17951a8c3315d07cb493ce2d5 | 1c624fc1d45d960e25b292dfcc48db0afd02da15 | refs/heads/master | 2022-06-26T08:20:10.516969 | 2020-05-07T14:30:07 | 2020-05-07T14:30:07 | 262,073,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package TH_TrienKhai_Comparator;
public class Square extends Rectangle {
public Square() {
}
public Square(double side){
super(side, side);
}
public Square(String color, boolean filled, double side){
super(color, filled, side, side);
}
public double getSide(){
return getHeight();
}
public void setSide(double side){
setHeight(side);
setWidth(side);
}
@Override
public void setWidth(double width) {
setSide(width);
}
@Override
public void setHeight(double height) {
setSide(height);
}
@Override
public String toString(){
return "A square with side = "+getSide()+", which is a subclass of "+super.toString();
}
}
| [
"hoanglien89nd@gmail.com"
] | hoanglien89nd@gmail.com |
94dea0a79903c816b000dab983e35b6e96369d2d | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-13/u-13-f9374.java | c2690fb0593fb42df4d32975343a8e5cc7eab6a6 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
3111123589519 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
cf915efb66735b0cec16fb81d0ce135e0d21b581 | 147cec9d3d3a7842d7d747a79af5ff0e606a526a | /net/minecraft/command/CommandEnchant.java | 67ff6ec032a6f58ca7398b50249093fa44218603 | [] | no_license | LXisCool1337/Async-Src | 3f365c69a12ef61d1192d5a276473106c4c4b067 | 77ac70ec28e8d2933ea5a554c026c59023ec630d | refs/heads/main | 2023-09-02T20:59:38.814117 | 2021-11-16T19:19:08 | 2021-11-16T19:19:08 | 428,784,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,414 | java | package net.minecraft.command;
import java.util.List;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
public class CommandEnchant extends CommandBase
{
public String getCommandName()
{
return "enchant";
}
public int getRequiredPermissionLevel()
{
return 2;
}
public String getCommandUsage(ICommandSender sender)
{
return "commands.enchant.usage";
}
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
if (args.length < 2)
{
throw new WrongUsageException("commands.enchant.usage", new Object[0]);
}
else
{
EntityPlayer entityplayer = getPlayer(sender, args[0]);
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 0);
int i;
try
{
i = parseInt(args[1], 0);
}
catch (NumberInvalidException numberinvalidexception)
{
Enchantment enchantment = Enchantment.getEnchantmentByLocation(args[1]);
if (enchantment == null)
{
throw numberinvalidexception;
}
i = enchantment.effectId;
}
int j = 1;
ItemStack itemstack = entityplayer.getCurrentEquippedItem();
if (itemstack == null)
{
throw new CommandException("commands.enchant.noItem", new Object[0]);
}
else
{
Enchantment enchantment1 = Enchantment.getEnchantmentById(i);
if (enchantment1 == null)
{
throw new NumberInvalidException("commands.enchant.notFound", new Object[] {Integer.valueOf(i)});
}
else if (!enchantment1.canApply(itemstack))
{
throw new CommandException("commands.enchant.cantEnchant", new Object[0]);
}
else
{
if (args.length >= 3)
{
j = parseInt(args[2], enchantment1.getMinLevel(), enchantment1.getMaxLevel());
}
if (itemstack.hasTagCompound())
{
NBTTagList nbttaglist = itemstack.getEnchantmentTagList();
if (nbttaglist != null)
{
for (int k = 0; k < nbttaglist.tagCount(); ++k)
{
int l = nbttaglist.getCompoundTagAt(k).getShort("id");
if (Enchantment.getEnchantmentById(l) != null)
{
Enchantment enchantment2 = Enchantment.getEnchantmentById(l);
if (!enchantment2.canApplyTogether(enchantment1))
{
throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))});
}
}
}
}
}
itemstack.addEnchantment(enchantment1, j);
notifyOperators(sender, this, "commands.enchant.success", new Object[0]);
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 1);
}
}
}
}
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
return args.length == 1 ? getListOfStringsMatchingLastWord(args, this.getListOfPlayers()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, Enchantment.func_181077_c()) : null);
}
protected String[] getListOfPlayers()
{
return MinecraftServer.getServer().getAllUsernames();
}
public boolean isUsernameIndex(String[] args, int index)
{
return index == 0;
}
}
| [
"77858604+LXisCool1337@users.noreply.github.com"
] | 77858604+LXisCool1337@users.noreply.github.com |
f5ce6ad3df8fa9bf4764bf53abfa9d9c38b933bf | c5aa86caa1cb6bc922ec81b95ed6f4559fe53d0c | /app/src/main/java/com/example/android/inventoryappstage2/UnknownItemsFragment.java | 396d39bc5921a16b3451953e09b199ca38696eda | [] | no_license | abhishekrnc/Inventory_app_stage_2_new_updated | 7e1f04c9cd05c5d4bacb187e650fa0447cade1e1 | 1fe0f1abab7b427d28fdd0afb2aa0b204b3c5c6b | refs/heads/master | 2020-03-30T18:00:40.238639 | 2018-10-06T21:09:56 | 2018-10-06T21:09:56 | 151,479,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,822 | java | package com.example.android.inventoryappstage2;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.support.v4.content.CursorLoader;
import com.example.android.inventoryappstage2.data.StockContract.ItemEntry;
public class UnknownItemsFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
private static final int ITEM_LOADER = 0;
ItemCursorAdapter mCursorAdapter;
public UnknownItemsFragment() {
// Required empty public constructor
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
getLoaderManager().initLoader(ITEM_LOADER, null, this);
super.onActivityCreated(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.items_list, container, false);
// Find the ListView which will be populated with the item data
ListView itemListView = (ListView) rootView.findViewById(R.id.list);
// Find and set empty view on the ListView, so that it only shows when the list has 0 items.
View emptyView = rootView.findViewById(R.id.empty_view);
itemListView.setEmptyView(emptyView);
// Setup an Adapter to create a list item for each row of item data in the Cursor.
// There is no item data yet (until the loader finishes) so pass in null for the Cursor.
mCursorAdapter = new ItemCursorAdapter(getActivity(), null);
itemListView.setAdapter(mCursorAdapter);
// Setup the item click listener
itemListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
// Create new intent to go to {@link EditorActivity}
Intent intent = new Intent(getActivity(), InfoActivity.class);
// Form the content URI that represents the specific item that was clicked on,
// by appending the "id" (passed as input to this method) onto the
// {@link ItemEntry#CONTENT_URI}.
// For example, the URI would be
// "content://com.example.android.inventoryappstage1/items/2"
// if the item with ID 2 was clicked on.
Uri currentItemUri = ContentUris.withAppendedId(ItemEntry.CONTENT_URI, id);
// Set the URI on the data field of the intent
intent.setData(currentItemUri);
// Launch the {@link EditorActivity} to display the data for the current item.
startActivity(intent);
}
});
// Kick off the loader
getLoaderManager().initLoader(ITEM_LOADER, null, this);
return rootView;
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// Define a projection that specifies the columns from the table we care about.
String[] projection = {
ItemEntry._ID,
ItemEntry.COLUMN_ITEM_NAME,
ItemEntry.COLUMN_ITEM_QUANTITY,
ItemEntry.COLUMN_ITEM_PRICE};
String selection = ItemEntry.COLUMN_ITEM_CATEGORY + " = ?";
String[] selectionArgs = new String[]{String.valueOf(ItemEntry.ITEM_UNKNOWN)};
// This loader will execute the ContentProvider's query method on a background thread
return new CursorLoader(getActivity(), // Parent activity context
ItemEntry.CONTENT_URI, // Provider content URI to query
projection, // Columns to include in the resulting Cursor
selection, // No selection clause
selectionArgs, // No selection arguments
null); // Default sort order
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
// Update {@link ItemCursorAdapter} with this new cursor containing updated item data
mCursorAdapter.swapCursor(data);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
// Callback called when the data needs to be deleted
mCursorAdapter.swapCursor(null);
}
}
| [
"abhishektupudana@gmail.com"
] | abhishektupudana@gmail.com |
39fab975cdf56032839f1e19b356ce916d1e1fc1 | 258de8e8d556901959831bbdc3878af2d8933997 | /utopia-service/utopia-mizar/utopia-mizar-api/src/main/java/com/voxlearning/utopia/service/mizar/consumer/loader/MizarUserLoaderClient.java | c217e8881bf3bc97bab8dfc384627a805efd332a | [] | no_license | Explorer1092/vox | d40168b44ccd523748647742ec376fdc2b22160f | 701160b0417e5a3f1b942269b0e7e2fd768f4b8e | refs/heads/master | 2020-05-14T20:13:02.531549 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | null | UTF-8 | Java | false | false | 9,764 | java | package com.voxlearning.utopia.service.mizar.consumer.loader;
import com.voxlearning.alps.annotation.remote.ImportService;
import com.voxlearning.alps.core.util.CollectionUtils;
import com.voxlearning.alps.core.util.MobileRule;
import com.voxlearning.alps.core.util.StringUtils;
import com.voxlearning.utopia.service.mizar.api.constants.MizarUserRoleType;
import com.voxlearning.utopia.service.mizar.api.entity.user.*;
import com.voxlearning.utopia.service.mizar.api.loader.MizarUserLoader;
import lombok.Getter;
import java.util.*;
import java.util.stream.Collectors;
/**
* Mizar User Loader Client
* Created by alex on 2016/8/16.
*/
public class MizarUserLoaderClient {
@Getter
@ImportService(interfaceClass = MizarUserLoader.class)
private MizarUserLoader remoteReference;
public List<MizarUser> loadAllUsers() {
return loadAllUsers(null, null);
}
public List<MizarUser> loadByShopId(final String shopId) {
if (StringUtils.isBlank(shopId)) {
return Collections.emptyList();
}
return remoteReference.loadByShopId(shopId);
}
public List<MizarUser> loadAllUsers(String userName) {
return loadAllUsers(userName, null);
}
public List<MizarUser> loadAllUsers(String userName, Integer userStatus) {
List<MizarUser> allUsers = remoteReference.loadAllUsers();
if (StringUtils.isNoneBlank(userName)) {
allUsers = allUsers.stream().filter(p -> p.getAccountName().contains(userName)).collect(Collectors.toList());
}
if (userStatus != null && userStatus >= 0) {
allUsers = allUsers.stream().filter(p -> Objects.equals(p.getStatus(), userStatus)).collect(Collectors.toList());
}
return allUsers;
}
public List<MizarUser> loadAllUsersWithGroup(String userName, Integer userStatus) {
List<MizarUser> allUsers = loadAllUsers(userName, userStatus);
for (MizarUser user : allUsers) {
user.setDepartments(loadUserDepartments(user.getId()));
}
return allUsers;
}
public List<MizarUser> loadSameDepartmentUser(String userId, MizarUserRoleType role) {
if (StringUtils.isBlank(userId)) {
return Collections.emptyList();
}
return remoteReference.loadSameDepartmentUsers(userId, role);
}
public MizarUser loadUser(String userId) {
if (StringUtils.isBlank(userId)) {
return null;
}
return remoteReference.loadUser(userId);
}
public Map<String, MizarUser> loadUsers(Collection<String> userIds) {
if (CollectionUtils.isEmpty(userIds)) {
return Collections.emptyMap();
}
return remoteReference.loadUsers(userIds);
}
public MizarUser loadUserIncludesDisabled(String userId) {
if (StringUtils.isBlank(userId)) {
return null;
}
List<MizarUser> allUsers = loadAllUsers();
return allUsers.stream().filter(p -> Objects.equals(userId, p.getId())).findFirst().orElse(null);
}
public List<String> loadUserShopId(String userId) {
if (StringUtils.isBlank(userId)) {
return Collections.emptyList();
}
return remoteReference.loadUserShopId(userId)
.stream()
.map(MizarUserShop::getShopId)
.collect(Collectors.toList());
}
public List<MizarUserOfficialAccounts> loadUserOfficialAccounts(String userId) {
if (StringUtils.isBlank(userId)) {
return Collections.emptyList();
}
return remoteReference.loadUserOfficialAccounts(userId);
}
public MizarUser loadUserByToken(String token) {
if (StringUtils.isBlank(token)) {
return null;
}
if (MobileRule.isMobile(token)) {
return remoteReference.loadUserByMobile(token);
}
return remoteReference.loadUserByAccount(token);
}
public boolean checkAccountAndMobile(String account, String mobile, String ignoreId) {
List<MizarUser> allUsers = loadAllUsers();
boolean ignored = StringUtils.isBlank(ignoreId);
return allUsers.stream()
.filter(p -> StringUtils.equals(account, p.getAccountName()) || StringUtils.equals(mobile, p.getMobile()))
.anyMatch(p -> ignored || !Objects.equals(ignoreId, p.getId()));
}
public List<MizarDepartment> loadAllDepartments() {
return remoteReference.loadAllDepartments();
}
public List<MizarDepartment> loadAllDepartments(String name, int status) {
return loadAllDepartments().stream()
.filter(d -> StringUtils.isEmpty(name) || d.getDepartmentName().contains(name))
.filter(d -> {
if (status == -1)
return true;
else if (status == 1)
return !d.getDisabled();
else if (status == 0)
return d.getDisabled();
else
return false;
})
.collect(Collectors.toList());
}
public boolean checkDepartmentName(String name, String excludeId) {
List<MizarDepartment> allDepartments = loadAllDepartments();
return allDepartments.stream()
.filter(d -> Objects.equals(d.getDepartmentName(), name))
.filter(d -> !Objects.equals(d.getId(), excludeId))
.count() > 0;
}
public MizarDepartment loadDepartment(String departmentId) {
return remoteReference.loadDepartment(departmentId);
}
public List<MizarUser> loadDepartmentUsers(String departmentId) {
return remoteReference.loadDepartmentUsers(departmentId);
}
public Map<String, List<MizarUser>> loadDepartmentUsers(Collection<String> departmentIds) {
return remoteReference.loadDepartmentUsers(departmentIds);
}
public List<MizarDepartment> loadUserDepartments(String userId) {
return loadUserDepartments(userId, null);
}
public List<MizarDepartment> loadUserDepartments(String userId, MizarUserRoleType role) {
return remoteReference.loadUserDepartments(userId, role);
}
public List<Map<String, Object>> buildRoleTree(List<String> roleCheckList, List<Integer> userRoleTypes) {
boolean isInfantOp = userRoleTypes.contains(MizarUserRoleType.INFANT_OP.getId());
boolean isInfantSchool = userRoleTypes.contains(MizarUserRoleType.INFANT_SCHOOL.getId());
boolean isNotAdmin = !userRoleTypes.contains(MizarUserRoleType.MizarAdmin.getId());
// 加载有效部门
return loadAllDepartments(null, 1)
.stream()
.filter(p -> {
boolean hasInfantSchool = CollectionUtils.isNotEmpty(p.getOwnRoles()) && p.getOwnRoles().contains(MizarUserRoleType.INFANT_SCHOOL.getId());
if ((isInfantOp || isInfantSchool)) {
// 学前运行和学前学校 不能有学前运行角色
p.getOwnRoles().remove(MizarUserRoleType.INFANT_OP.getId());
return hasInfantSchool;
} else
return !isNotAdmin || !hasInfantSchool;
})
.map(d -> createDNode(d, roleCheckList))
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
private Map<String, Object> createDNode(MizarDepartment d, List<String> roleCheckList) {
Map<String, Object> dNode = new HashMap<>();
dNode.put("title", d.getDepartmentName());
dNode.put("key", d.getId());
dNode.put("hideCheckbox", true);
dNode.put("type", "group");
if (CollectionUtils.isEmpty(d.getOwnRoles()))
return null;
dNode.put("children", d.getOwnRoles().stream().map(a -> {
MizarUserRoleType roleType = MizarUserRoleType.of(a);
if (roleType == null)
return null;
String groupRoleId = d.getId() + "-" + roleType.getId();
Map<String, Object> roleNode = new HashMap<>();
roleNode.put("title", roleType.getDesc());
roleNode.put("key", groupRoleId);
if (roleCheckList.contains(groupRoleId)) {
roleNode.put("selected", true);
// 有一个子结点被选中的话,父结点就展开
dNode.put("expanded", true);
}
roleNode.put("type", "role");
return roleNode;
}).filter(Objects::nonNull).collect(Collectors.toList()));
return dNode;
}
/**
* 获得用户在所有组下面的角色列表,id格式是“部门id-角色数字”
*
* @param userId
* @return
*/
public List<String> loadUserRolesInAllDepartments(String userId) {
return remoteReference.loadUserRolesInAllDepartments(userId);
}
public List<MizarUserDepartment> loadDepartmentByUserId(String userId) {
return remoteReference.loadDepartmentByUserId(userId);
}
public List<Integer> loadUserRoleByUserId(String userId) {
List<Integer> roles = new ArrayList<>();
remoteReference.loadDepartmentByUserId(userId).forEach(p -> {
if (CollectionUtils.isNotEmpty(p.getRoles())) {
roles.addAll(p.getRoles());
}
});
return roles;
}
public MizarUser loadUserByMobile(String mobile){
return remoteReference.loadUserByMobile(mobile);
}
public List<MizarUserDepartment> loadUserByDepartmentId(String departmentId){
return remoteReference.loadUserByDepartmentId(departmentId);
}
}
| [
"wangahai@300.cn"
] | wangahai@300.cn |
06ce1a7f50fea82fe92545873a9eeb689d84eddd | 2663337e8b03b06bf894da973b038bbb20f90168 | /final-project/src/test/java/com/privalia/finalproject/config/RepositoryConfiguration.java | d2def6fce1bc290ae2a0662190be6d3cf9cd18e5 | [] | no_license | jmvargas/spring-cloud-zuul-example | 10e57d002c4f60cc91c34551c7c38f16e1e83b9f | 1008a33c94a3eeedee922922c6553f87eb08ffcd | refs/heads/master | 2021-04-09T10:32:37.135003 | 2018-03-15T17:23:10 | 2018-03-15T17:23:10 | 125,399,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.privalia.finalproject.config;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableAutoConfiguration
@EntityScan(basePackages = {"com.privalia.finalproject.domain"})
@EnableJpaRepositories(basePackages = {"com.privalia.finalproject.repository"} )
@EnableTransactionManagement
public class RepositoryConfiguration {
} | [
"jvargas@ximdex.com"
] | jvargas@ximdex.com |
2352ecfe791d303438ef29495eec1a17fc6ea725 | 0a06b9fa9d3f6460fb432fe0a2365aa549e4f3dc | /core/src/com/openthid/util/FontService.java | a0ae5427ae9ba00ca40616f7e8df00f04284f57c | [
"LicenseRef-scancode-public-domain"
] | permissive | sramsay64/Space-Penguins | 6b43c63bdc96d25c5746a972229fc629a3951fc8 | ee1823756c9ec4fc13690f02bf801f5a6c86fb44 | refs/heads/master | 2021-01-19T08:54:47.646612 | 2016-11-09T06:14:22 | 2016-11-09T06:14:22 | 47,063,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,264 | java | package com.openthid.util;
import java.util.HashMap;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
/**
* A lazy font system
*/
public class FontService {
/**
* The Ubuntu Medium font
*/
public static final FontService ubuntuMedium = new FontService("ubuntu-font-family/Ubuntu-M.ttf", "ubuntuMedium");
private String name;
private FreeTypeFontGenerator generator;
private HashMap<Integer, BitmapFont> cache;
private FontService(String filename, String name) {
generator = new FreeTypeFontGenerator(Gdx.files.internal(filename));
this.name = name;
cache = new HashMap<>();
Gdx.app.log("LAZY", "Loaded new font '" + name + "'");
}
/**
* Lazily generates a bitmap font
* @param size The size to render the font at
*/
public BitmapFont getFont(int size) {
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = size;
if (!cache.containsKey(size)) {
cache.put(size, generator.generateFont(parameter));
Gdx.app.log("LAZY", "Generated font '" + name + "' at size " + size);
}
return cache.get(size);
}
} | [
"scottramsay64@gmail.com"
] | scottramsay64@gmail.com |
942c45936b789566a1c17899800a3efb7711d348 | 4cd99c11e722adeee607ab1cfbaf977975c7f0ac | /Android/app/src/main/java/com/example/donyoo/smarthome/SplashActivity.java | 9a6fcf455bdb74e6df334294646de50089472c38 | [] | no_license | DonYoo/SmartHome | d54005871e2e58ba3a9bfe4439eaa9f672b9c40e | 6daaf1af08dd9da7cf5b0da26ee811d9e9cb108a | refs/heads/master | 2021-01-23T01:08:25.671327 | 2018-02-04T21:17:03 | 2018-02-04T21:17:03 | 85,879,799 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,782 | java | package com.example.donyoo.smarthome;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
public class SplashActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 3000;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
context = this;
/*
final String userParam = SharedPreferencesHandler.getString(this, "username");
final String passParam = SharedPreferencesHandler.getString(this, "password");
*/
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
/*
if (SharedPreferencesHandler.getBoolean(context, "rememberMe") == true) {
RequestParams params = new RequestParams();
params.put("username", userParam);
params.put("password", passParam);
AsyncClient.post("/login", params, new mJsonHttpResponseHandler(context) {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
if (response.getInt(context.getString(R.string.server_response)) == 1) {
Toast.makeText(context, response.getString(context.getString(R.string.server_message)), Toast.LENGTH_SHORT).show();
Intent i = new Intent(context, BaseActivity.class);
startActivity(i);
finish();
} else if (response.getInt(context.getString(R.string.server_response)) == 0) {
Toast.makeText(context, response.getString(context.getString(R.string.server_message)), Toast.LENGTH_SHORT).show();
Intent i = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(i);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
else {
}
*/
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
finish();
}
}, SPLASH_TIME_OUT);
}
}
| [
"dyoo@semigear.com"
] | dyoo@semigear.com |
fc70ae7d5d365914bd4289600d9d7dc51deafd54 | 06a0e85e54e8d1f084b6cd58089ec31c98b49029 | /src/main/java/vn/rin/blog/service/impl/UserEventServiceImpl.java | eb60c997a3e56ccdadee520322d015740b710551 | [] | no_license | mindol1004/rblog | ba0d81a8911d3e4f7587f19bfab8f24ce6892c84 | 3b3a59b6a706a67b34eec95d91627d81d411a27d | refs/heads/master | 2022-11-13T20:33:40.464263 | 2020-07-01T05:03:42 | 2020-07-01T05:03:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package vn.rin.blog.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vn.rin.blog.common.Constants;
import vn.rin.blog.repositories.UserRepo;
import vn.rin.blog.service.UserEventService;
import java.util.Collections;
import java.util.Set;
/**
* @author Rin
*/
@Service
@Transactional
public class UserEventServiceImpl implements UserEventService {
@Autowired
private UserRepo userRepository;
@Override
public void identityPost(Long userId, boolean plus) {
userRepository.updatePosts(userId, (plus) ? Constants.IDENTITY_STEP : Constants.DECREASE_STEP);
}
@Override
public void identityComment(Long userId, boolean plus) {
userRepository.updateComments(Collections.singleton(userId), (plus) ? Constants.IDENTITY_STEP : Constants.DECREASE_STEP);
}
@Override
public void identityComment(Set<Long> userIds, boolean plus) {
userRepository.updateComments(userIds, (plus) ? Constants.IDENTITY_STEP : Constants.DECREASE_STEP);
}
}
| [
"ducnv521@wru.vn"
] | ducnv521@wru.vn |
0f32f8b04fb81a6249f76bb1dd4babefaf0ef341 | f0714ff1178a6324884a6fb2207ab38f5a197d8d | /com/ocaj/exam/chapter5/ParentClass.java | 66a655fe13ecd94655748bd5d8a9587b52fdc57d | [] | no_license | tim-marwa/Java9 | 93b7b68e7fdd8aec4061b56096541f4393f606c9 | 74e1f66f9ba2e42e7aeee2dbaa55e27ae50d7ad2 | refs/heads/main | 2023-09-05T17:53:56.598233 | 2021-11-15T11:57:37 | 2021-11-15T11:57:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.ocaj.exam.chapter5;
public class ParentClass {
//Constructors. One with parameter. One with none
public ParentClass(){
System.out.println("ParentClass Constructor");
}
public ParentClass(String s){
System.out.println("ParentClass Constructor:" + s);
}
//Method
public String className(){
return " ParentClass ";
}
}
| [
"timmwita@gmail.com"
] | timmwita@gmail.com |
e8253ecfb4b3be63da944ab146c02c90b9e78cfe | 711cedfa3914440620aed9ba8832e35cc2c045a7 | /src/BankApp/BankCustomer/Customer.java | c76b4583b274617d156d6e62e80d46922ba7d811 | [] | no_license | ShathaMAbdo/BankApplication | 8fc12288377deca99a02fffe283d9ce7f7d7316c | 4b60b94d48a13798870202b87dcf288956f85142 | refs/heads/master | 2020-04-29T11:24:42.608257 | 2019-03-17T12:19:50 | 2019-03-17T12:19:50 | 176,096,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,039 | java | package BankApp.BankCustomer;
import BankApp.Exceptions.NotValidation;
import BankApp.Exceptions.uncorrectPassword;
public abstract class Customer {
// Data fields
private long personId;
private String fname;
private String lname;
private String address;
private String phone;
private CustomerType type;
private String password;
private static long count;
//Chain constractuer
public Customer(String fname, String lname, String password) {
count++;
this.personId = count;
this.fname = fname;
this.lname = lname;
this.password = password;
}
public Customer(String fname, String lname, String password, String address, String phone) {
this(fname, lname, password);
this.address = address;
this.phone = phone;
}
//getPersonId method returns person id
public long getPersonId() {
return personId;
}
//getFname method returns First name
public String getFname() {
return fname;
}
//setFname method sets First name
public void setFname(String fname) {
this.fname = fname;
}
//getLname method returns Last name
public String getLname() {
return lname;
}
//setLname method sets Lname
public void setLname(String lname) {
this.lname = lname;
}
//getAddress method returns getAddress
public String getAddress() {
return address;
}
//setAddress method sets Address
public void setAddress(String address) {
this.address = address;
}
//getPhone method returns Phone
public String getPhone() {
return phone;
}
//setPhone method sets Phone
public void setPhone(String phone) {
this.phone = phone;
}
//getType method returns Customer Type
public CustomerType getType() {
return type;
}
//setType method sets Type
public void setType(CustomerType type) {
this.type = type;
}
//getPassword method returns Password
public String getPassword() {
return password;
}
//setPassword method sets Password
public void setPassword(String password) {
this.password = password;
}
//changePassword method sets new Password
public boolean changePassword(String newPass) {
if (!newPass.equals(null))
if (!password.equals(newPass)) {
this.password = newPass;
return true;
} else try {
throw new uncorrectPassword("You must not enter the same password");
} catch (uncorrectPassword e) {
System.out.println(e.getMessage());
}
else try {
throw new uncorrectPassword("You must not enter empty password");
} catch (uncorrectPassword e) {
System.out.println(e.getMessage());
}return false;
}
//logIn method returns true if password matched or false if did not
public boolean logIn(String password) {
if (password.equals(this.password))
return true;
else try {
throw new NotValidation();
} catch (NotValidation e) {
System.out.println(e.getMessage());
}
return false;
}
//uppdate method sets new data till exist customer
public void uppdate(String type, String fname, String lname, String address, String phon) {
this.setAddress(address);
this.setFname(fname);
this.setLname(lname);
this.setPhone(phon);
this.setType(CustomerType.valueOf(type));
}
@Override //toString method returns String of customers data
public String toString() {
return
" personId=" + personId +
", fname='" + fname + '\'' +
", lname='" + lname + '\'' +
", address='" + address + '\'' +
", phone='" + phone + '\'' +
'}';
}
}
| [
"shatha.m.abdo@gmail.com"
] | shatha.m.abdo@gmail.com |
a6ef82d2ff6ee1c712e2c8011a00c1d0d60ce867 | c84230f41ed9303afed15f7f63930462850d74cd | /day7/BFSTest_Mirro.java | 63edc9073328619c6f2094829eb3cc85e6db3275 | [] | no_license | sangyoungahn/work_algo | e613f102ee811d5fd38d9f4d3026332840637faf | d4e6fb31acd79999b8b6ac84bc1befe42e88302d | refs/heads/master | 2020-06-20T03:41:49.869392 | 2019-09-15T14:28:18 | 2019-09-15T14:28:18 | 196,979,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | import java.util.LinkedList;
import java.util.Queue;
public class BFSTest_Mirro {
static int[][] map;
public static void main(String[] args) {
map = new int[][]{ {0,0,1,1,1,1,1,1},
{1,0,0,0,0,0,0,1},
{1,1,1,0,1,1,1,1},
{1,1,1,0,1,1,1,1},
{1,0,0,0,0,0,0,1},
{1,0,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,0}
};
boolean[][] visited = new boolean[map.length][map.length]; //방문했던 곳은 다시 못가도록 하는 것
bfs(0,0,visited,0);
System.out.println(flag?"1":"-1");
System.out.println(min == 999999999 ? "-1":min);
}
static int min=999999999;
static boolean flag = false;
static int[] dx = {0,0,-1,1};
static int [] dy = {-1,1, 0,0};
static class Point {
int x;
int y;
int cnt; //값을 계속 사용해야 된다고 하면 멤버변수에 넣으면 됨
Point(int x, int y, int cnt) { //값을 편하게 넣기 위해 생성자 만들어줌
this.x = x;
this.y = y;
this.cnt = cnt;
}
}
static void bfs(int x, int y, boolean[][] visited, int cnt) {
// 큐 활용
Point p = new Point(x, y, 0);
Queue<Point> q = new LinkedList<>(); //계속적으로 접근할 것을 큐에 넣는다
q.offer(p);
while(!q.isEmpty()) {
Point tp = q.poll();
// 종료기준
if(tp.x == map.length-1 && tp.y == map.length-1) {
System.out.println("도착" + tp.cnt);
if(min > tp.cnt) {
min = tp.cnt;
}
// flag = true; //여기왔다는 것은 도착한 적이 있다는 것
continue;
}
visited[tp.y][tp.x] = true;
// 4방향 탐색
int tx, ty;
for(int i=0; i<4; i++) {
tx = tp.x + dx[i];
ty = tp.y + dy[i];
//맵을 벗어나면 빼주면 됨
if(tx <0 || tx >= map.length || ty < 0 || ty >= map.length) {
continue;
}
//방문된적이 없고, 이동한 자리가 0이면 가기
if(visited[ty][tx] && map[tx][ty] == 0) {
Point tp1 = new Point(tx, ty, tp.cnt+1); //지금 해야될 일을 집어넣는것
q.offer(tp1);
// visited[ty][tx] = true;
}
}
}
}
}
| [
"tkddud1237@gmail.com"
] | tkddud1237@gmail.com |
6e51ac86ac76d2c62b7e8609b78fdf95076167b8 | 61bbbf3fb5a241778db9237a6d6caa8a1a7de9f9 | /src/main/java/com/example/banking/bank_app/model/Config.java | 992a8e4d3cbd2234fa3d771b72623a06b8802f54 | [] | no_license | prakash-sivakumar/secure-bank-system | 41df6e2b0e05475fc0e1f4f0985aa034a15b5420 | c48884aea093c57dc41883366b69370e06c3d0a3 | refs/heads/main | 2023-01-01T21:57:56.042336 | 2020-10-25T06:58:15 | 2020-10-25T06:58:15 | 307,042,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,413 | java | package com.example.banking.bank_app.model;
/**
* Application constants.
*/
public final class Config {
//Status fields
public static final int PENDING = 0;
public static final int APPROVED = 1;
public static final int DECLINED = 2;
//Transaction fields
public static final int DEBIT = 1;
public static final int CREDIT = 2;
//Transaction limit
public static final float LIMIT = 1000;
//Transfer type
public static final String ACCOUNT = "account";
public static final String EMAIL = "email";
public static final String PHONE = "phone";
//Request type
public static final int TRANSFER = 1;
public static final int DEPOSIT = 2;
public static final int WITHDRAW = 3;
public static final int CHECKINGS = 1;
public static final int SAVINGS = 2;
public static final int CREDITCARD = 3;
public static final int ACCOUNT_TYPE = 1;
public static final int USER_TYPE = 2;
public static final int EMPLOYEE_TYPE = 3;
public static final float DEFAULT_INTEREST = 5;
public static final float DEFAULT_CREDIT_LIMIT = 1000;
public static final int CRITICAL_YES = 1;
public static final int CRITICAL_NO = 0;
public static final int ADMIN = 1;
public static final int TIER1 = 2;
public static final int TIER2 = 3;
public static final int USER = 4;
public static final int MERCHANT = 5;
}
| [
"dsivaku2@asu.edu"
] | dsivaku2@asu.edu |
e5e6f6ea59442e06d26a8664a8442a595b06cd6d | 4e89d371a5f8cca3c5c7e426af1bcb7f1fc4dda3 | /java/data_structure/Stack/Symmetry.java | f6087fd4a741d11c0b2f597fbd7dd56d219ca765 | [] | no_license | bodii/test-code | f2a99450dd3230db2633a554fddc5b8ee04afd0b | 4103c80d6efde949a4d707283d692db9ffac4546 | refs/heads/master | 2023-04-27T16:37:36.685521 | 2023-03-02T08:38:43 | 2023-03-02T08:38:43 | 63,114,995 | 4 | 1 | null | 2023-04-17T08:28:35 | 2016-07-12T01:29:24 | Go | UTF-8 | Java | false | false | 640 | java | /**
* 验证符号是否平衡对称
*/
public class Symmetry {
private static SequenceStack ifSymmetry(String args) {
SequenceStack ts = new SequenceStack(10);
int size = args.length();
for (int i = 0; i < size; i++) {
char charset = args.charAt(i);
switch (charset) {
case '(':
case '[':
case '{':
ts.push(charset);
break;
case ')':
case ']':
case '}':
ts.pop();
break;
default:
continue;
}
}
return ts;
}
public static void main(String[] args) {
String arg = "(aa[bb{cc}])";
SequenceStack st = ifSymmetry(arg);
System.out.println("size is: " + st.size());
}
}
| [
"1401097251@qq.com"
] | 1401097251@qq.com |
2ff53c90dd54933373f20b522453fb6676c84040 | d41b890984cff94203858df8fa87f48ba73f341c | /src/main/java/com/eu/habbo/habbohotel/commands/CommandsCommand.java | 7670c42cd8701504a4bb305832888f716c5b5b4b | [] | no_license | Porcellacion/generaalinsoossi | 005d90206b6960bfe559d057d82d0500a0b18af2 | bf88ccab2af6e65b7c5d9ffde5d3cca3861d110c | refs/heads/master | 2021-08-19T14:14:48.039587 | 2017-11-26T15:51:33 | 2017-11-26T15:51:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
import java.util.List;
public class CommandsCommand extends Command
{
public CommandsCommand()
{
super("cmd_commands", Emulator.getTexts().getValue("commands.keys.cmd_commands").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
String message = "Your Commands";
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
message += "(" + commands.size() + "):\r\n";
for(Command c : commands)
{
message += Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission) + "\r";
}
gameClient.getHabbo().alert(new String[]{message});
return true;
}
}
| [
"pullaboe@gmail.com"
] | pullaboe@gmail.com |
317f8b6da73cc7277037fad82fea953ffd0c90f2 | f4971fcc72ab7cac487675dbd41dc919fa07d3ad | /app/src/main/java/com/takenzero/sbs/model/UserDetail.java | 5b3a80e3da56bc0917c57ad5506797a358ebdde6 | [
"MIT"
] | permissive | takenzero/sbs-clientandroid | e9d3fb3335c9fc12e44e02ab203336392f6167ae | 8d24d00d34bf9bf0646c87e4057021d688c61f38 | refs/heads/master | 2020-03-25T18:07:37.574502 | 2018-08-12T08:39:16 | 2018-08-12T08:39:16 | 144,013,880 | 0 | 0 | MIT | 2018-08-12T08:39:17 | 2018-08-08T12:57:28 | Java | UTF-8 | Java | false | false | 1,130 | java | package com.takenzero.sbs.model;
import com.google.gson.annotations.SerializedName;
public class UserDetail {
@SerializedName("id_user")
private String idUser;
@SerializedName("name")
private String fullName;
@SerializedName("level_code")
private Integer levelCode;
@SerializedName("id_upline")
private String idUpline;
public UserDetail(){
this.idUser = idUser;
this.fullName = fullName;
this.levelCode = levelCode;
this.idUpline = idUpline;
}
public String getIdUser(){
return idUser;
}
public void setIdUser(String idUser){
this.idUser = idUser;
}
public String getFullName(){
return fullName;
}
public void setFullName(String fullName){
this.fullName = fullName;
}
public Integer getLevelCode() {
return levelCode;
}
public void setLevelCode(Integer levelCode){
this.levelCode = levelCode;
}
public String getIdUpline(){
return idUpline;
}
public void setIdUpline(String idUpline){
this.idUpline = idUpline;
}
}
| [
"mtahir@xl.co.id"
] | mtahir@xl.co.id |
06ea025a304ef16f5cd0cf0a8b437541a6a19808 | 3bcf1fe16c257ebe1f56dd01d56218a9133d251a | /android/Reader/src/main/java/com/agcy/reader/Helpers/ExpandCollapse.java | 04baba5da7185a083b899a510943e2719685e48d | [] | no_license | kioltk/RssReaderAndroid | fca362f021072d3bf662bfdf34af986e8dbc5062 | 8917a816820019aecd07c377057e40ea796d923d | refs/heads/master | 2021-01-18T07:47:10.026335 | 2013-12-21T13:11:09 | 2013-12-21T13:11:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,649 | java | package com.agcy.reader.Helpers;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by kiolt_000 on 10.12.13.
*/
public class ExpandCollapse {
public static ValueAnimator createWidthAnimator(final View view, int start, int end) {
ValueAnimator animator = ValueAnimator.ofInt(start, end);
int size = ( start > end ? start : end );
animator.setDuration( size );
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int value = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
layoutParams.width = value;
view.setLayoutParams(layoutParams);
}
});
return animator;
}
public static ValueAnimator createHeightAnimator(final View view, int start, int end) {
ValueAnimator animator = ValueAnimator.ofInt(start, end);
int size = ( start > end ? start : end );
animator.setDuration( size );
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int value = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
layoutParams.height = value;
view.setLayoutParams(layoutParams);
}
});
return animator;
}
public static void expandHorizontal(View view) {
view.setVisibility(View.VISIBLE);
final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(widthSpec, heightSpec);
int measuredWidth = view.getMeasuredWidth();
int height = view.getHeight();
ValueAnimator animator = createWidthAnimator(view, 0, height);
animator.start();
}
public static void expandVertical(View view) {
view.setVisibility(View.VISIBLE);
final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(widthSpec, heightSpec);
int measuredHeight = view.getMeasuredHeight();
ValueAnimator animator = createHeightAnimator(view, 0, measuredHeight );
animator.start();
}
public static void collapseHorizontal(final View view){
final int origWidth = view.getWidth();
ValueAnimator animator = createWidthAnimator(view, origWidth, 0);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
view.setVisibility(View.GONE);
}
});
animator.start();
}
public static void collapseVertical(final View view) {
final int origHeight = view.getHeight();
ValueAnimator animator = createHeightAnimator(view, origHeight, 0);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
view.setVisibility(View.GONE);
}
});
animator.start();
}
}
| [
"kioltk@gmail.com"
] | kioltk@gmail.com |
92c99b5af7ac38df2499d3e87beef7e3ab5400f2 | ac00f9bd1322dc3f226b4ff2ac15f495f745d52a | /app/src/main/java/com/ezparking/com/customview/views/SpiderRadar.java | 2c594e3aa55b6ead3ea2a196bb44d639489a2c2b | [] | no_license | PeanutZhang/CustomView | aedf70ba14fd607429859fb988a37f6c385c66e2 | 931e80bb126baf931c6b97798d54682ee33d1ce6 | refs/heads/master | 2020-03-26T23:21:34.325369 | 2018-10-12T10:08:25 | 2018-10-12T10:08:25 | 145,534,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,347 | java | package com.ezparking.com.customview.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import com.ezparking.com.customview.Utils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by zyh
*/
public class SpiderRadar extends View {
// 自己尝试画多边形雷达图
private Paint mPaint,mTextPaint,mOverPaint;
private int mWidth,mHeight;
private Path mPath;
private int mpolyCount = 6;
private String[] titles = {
"阿根廷","葡萄牙","法国","比利时","英格兰","乌拉圭"
};
private int duration = 500;
private Handler mHandler;
private ExecutorService executorService;
private boolean isAnimation;
public SpiderRadar(Context context) {
this(context,null);
}
public SpiderRadar(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
private void init(Context context) {
mPaint = new Paint();
mPaint.setColor(Utils.randomColor());
mPaint.setStrokeWidth(3);
mPaint.setStyle(Paint.Style.STROKE);
mPath = new Path();
mTextPaint = new Paint();
mTextPaint.setTextSize(16);
mTextPaint.setTextAlign(Paint.Align.CENTER);
mTextPaint.setColor(Color.RED);
mOverPaint = new Paint();
mOverPaint.setColor(Utils.randomColor());
mTextPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mTextPaint.setAlpha(165);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
postInvalidate();
mHandler.sendEmptyMessageDelayed(501,duration);
}
};
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mWidth = w;
mHeight = h;
}
public void startAnimation(){
// executorService = Executors.newSingleThreadExecutor();
// executorService.submit(new Runnable() {
// @Override
// public void run() {
//
// }
// });
if(isAnimation) return;
boolean b = mHandler.sendEmptyMessageDelayed(501, duration);
isAnimation = b;
}
public void stopAnimation(){
mHandler.removeMessages(501);
isAnimation = false;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.translate(mWidth/2,mHeight/2);
canvas.drawPoint(0,0,mPaint);
int r = Math.min(mWidth/2,mHeight/2); double angle = 360/ mpolyCount;
int mradius = r -50;
//绘制六边形和连线-----------------------------
for (int j = 0; j < 5; j++) {
int currentR = mradius/5 * (j+1);
Path polygonPath = new Path();
for (int i = 0; i < mpolyCount; i++) {
double currentAngle = angle* i;
double rad = currentAngle * Math.PI / 180;//需要把角度转换为弧度,不然结果不对,因为角度为60进制, 弧度为10进制
double cos = Math.cos(rad);
double sin = Math.sin(rad);
float x = (float) (cos* currentR);
float y = (float) (sin *currentR);
if(i == 0){
polygonPath.moveTo(x,y);
}
polygonPath.lineTo(x,y);
}
polygonPath.close();
mPath.addPath(polygonPath);
}
//往Path 里添加6条线 和文字绘制
for (int i = 0; i < 6; i++) {
double cos = Math.cos(angle * i *Math.PI / 180);
double sin = Math.sin(angle* i*Math.PI/180);
float x = (float) (cos * mradius);
float y = (float) (sin*mradius);
Path linePath = new Path();
linePath.lineTo(x,y);
mPath.addPath(linePath);
float textX = (float) (cos * (mradius + 20));
float textY = (float) (sin * (mradius +20));
canvas.drawText(titles[i],textX,textY,mTextPaint);
}
canvas.drawPath(mPath,mPaint);
// 绘制覆盖区, 随机生成一块区域
Path polygonPath = new Path();
for (int i = 0; i < mpolyCount; i++) {
double valueRate = Math.random();//模拟一个条目的占比, 实际项目根据需求定义
double cos = Math.cos(angle * i *Math.PI / 180);
double sin = Math.sin(angle* i*Math.PI/180);
float x = (float) (cos * mradius * valueRate );
float y = (float) (sin*mradius * valueRate );
if(i == 0){
polygonPath.moveTo(x,y);
}else {
polygonPath.lineTo(x,y);
}
//绘制小圆点
canvas.drawPoint(x,y,mOverPaint);
}
mOverPaint.setColor(Utils.randomColor());
canvas.drawPath(polygonPath,mOverPaint);
}
}
| [
"245502345@qq.com"
] | 245502345@qq.com |
78843480e33c6b9ed5dd51215f012943d8f7ebed | 64f0a73f1f35078d94b1bc229c1ce6e6de565a5f | /dataset/Top APKs Java Files/com.changdu.spainreader-com-changdu-zone-sessionmanage-UserLoginActivity.java | 52228facb529bf3d91a952771fcaf0a3bc7a9b36 | [
"MIT"
] | permissive | S2-group/mobilesoft-2020-iam-replication-package | 40d466184b995d7d0a9ae6e238f35ecfb249ccf0 | 600d790aaea7f1ca663d9c187df3c8760c63eacd | refs/heads/master | 2021-02-15T21:04:20.350121 | 2020-10-05T12:48:52 | 2020-10-05T12:48:52 | 244,930,541 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 15,953 | java | package com.changdu.zone.sessionmanage;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.changdu.BaseActivity;
import com.changdu.BaseActivity.a;
import com.changdu.common.Wait;
import com.changdu.common.bk;
import com.changdu.common.view.NavigationBar;
import com.changdu.realvoice.receiver.RequestPlayStateReceiver;
import com.changdu.skin.SkinManager;
import com.changdu.u.a.g;
import com.changdu.util.z;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class UserLoginActivity
extends BaseActivity
implements a
{
private static final int D = 1000;
public static final String a = "is_from_person";
public static final String b = "GetResult";
public static final String c = "GetPassword";
public static final String d = "operateStoreName";
public static final int e = 0;
public static final int f = 1;
public static final int g = -1;
public static final int h = 1;
public static final int i = 59768;
public static final int[] n = { 1, 2, 3, 901, 902, 905, 903 };
public static final int[] o = { 1, 2, 3, 4, 5, 6, 7 };
private FrameLayout A;
private RelativeLayout B;
private View.OnClickListener C = new s(this);
private Handler E = new t(this);
private TextView.OnEditorActionListener F = new u(this);
private View.OnClickListener G = new v(this);
private View.OnClickListener H = new w(this);
private View.OnClickListener I = new k(this);
private int J;
private Map<String, String> K;
NavigationBar j;
com.changdu.share.k k;
ab l;
com.changdu.share.b m = new l(this);
private Context p;
private TextView q;
private TextView r;
private TextView s;
private AutoCompleteTextView t;
private EditText u;
private TextView v;
private TextView w;
private Button x;
private boolean y = false;
private boolean z = false;
public UserLoginActivity() {}
public static int a(int paramInt)
{
int i2 = n.length;
int i1 = 0;
while (i1 < i2)
{
if (n[i1] == paramInt) {
return o[i1];
}
i1 += 1;
}
return 0;
}
private void a()
{
this.j = ((NavigationBar)findViewById(2131231857));
this.j.setTitle(getString(2131559538));
this.j.setUpLeftListener(this.C);
if (getResources().getBoolean(2130968595))
{
this.j.setUpRightView(null, getString(2131559919), getResources().getDrawable(2131165501), 2131034192, new r(this));
this.j.setUpRightViewBg(SkinManager.getInstance().getDrawable("btn_topbar_edge_selector"));
this.j.setUpRightViewTextColor(SkinManager.getInstance().getColorStateList("btn_topbar_text_selector"));
}
}
private void a(int paramInt, com.changdu.share.b paramB)
{
this.k.b(this, paramInt, paramB);
}
private void a(Map<String, String> paramMap)
{
String str2 = (String)paramMap.get("openid");
String str1 = (String)paramMap.get("accessToken");
if (com.changdu.changdulib.e.k.a(str1)) {
paramMap = (String)paramMap.get("access_token");
} else {
paramMap = str1;
}
new com.changdu.zone.sessionmanage.a.j(this, true, 3, str2, paramMap, true, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]);
}
private boolean a(Context paramContext, String paramString)
{
paramContext = paramContext.getPackageManager();
int i1 = 0;
paramContext = paramContext.getInstalledPackages(0);
ArrayList localArrayList = new ArrayList();
if (paramContext != null) {
while (i1 < paramContext.size())
{
localArrayList.add(((PackageInfo)paramContext.get(i1)).packageName);
i1 += 1;
}
}
return localArrayList.contains(paramString);
}
private boolean a(String paramString)
{
return (paramString.contains("@")) && (paramString.contains("."));
}
private void b(int paramInt, Map<String, String> paramMap)
{
this.J = paramInt;
this.K = paramMap;
if (paramInt != 903)
{
switch (paramInt)
{
default:
break;
case 3:
a(paramMap);
return;
case 2:
c(paramMap);
return;
case 1:
b(paramMap);
return;
}
}
else
{
String str1 = (String)paramMap.get("access_token");
String str2 = (String)paramMap.get("access_token_secret");
try
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append(str1);
localStringBuilder.append("|");
localStringBuilder.append(str2);
paramMap.put("access_token", com.changdu.changdulib.e.m.a(localStringBuilder.toString(), "UTF-8"));
}
catch (UnsupportedEncodingException localUnsupportedEncodingException)
{
localUnsupportedEncodingException.printStackTrace();
}
}
a(paramInt, paramMap);
}
private void b(ab paramAb)
{
new m(this, this, new Intent(), paramAb.m(), paramAb.e(), paramAb.g(), paramAb.x(), paramAb.w(), paramAb.v(), paramAb.y(), false, paramAb).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
}
private void b(Map<String, String> paramMap)
{
String str2 = (String)paramMap.get("uid");
String str1 = (String)paramMap.get("accessToken");
if (com.changdu.changdulib.e.k.a(str1)) {
paramMap = (String)paramMap.get("access_token");
} else {
paramMap = str1;
}
new com.changdu.zone.sessionmanage.a.j(this, true, 1, str2, paramMap, true, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]);
}
private boolean b()
{
Intent localIntent = getIntent();
boolean bool = false;
if (localIntent != null) {
bool = localIntent.getBooleanExtra("is_from_person", false);
}
return bool;
}
private void c()
{
Object localObject = new LinearLayout(this);
((LinearLayout)localObject).setOrientation(1);
((LinearLayout)localObject).setGravity(17);
((LinearLayout)localObject).setPadding(z.a(5.0F), z.a(10.0F), z.a(5.0F), z.a(10.0F));
EditText localEditText = new EditText(this);
localEditText.setBackgroundResource(2131166684);
localEditText.setText("");
localEditText.setInputType(32);
localEditText.setMaxLines(1);
localEditText.setTextColor(getResources().getColor(2131034246));
localEditText.setTextSize(18.0F);
localEditText.setGravity(17);
localEditText.requestFocus();
LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -2);
localLayoutParams.setMargins(10, 20, 10, 20);
localEditText.setLayoutParams(localLayoutParams);
((LinearLayout)localObject).addView(localEditText);
localObject = new g(this, 2131560460, (View)localObject, 2131558566, 2131558696);
((g)localObject).show();
((g)localObject).a(new n(this, localEditText, (g)localObject));
((g)localObject).setCanceledOnTouchOutside(true);
z.b(localEditText, 0L);
}
private void c(Map<String, String> paramMap)
{
String str2 = (String)paramMap.get("uid");
String str1 = (String)paramMap.get("accessToken");
if (com.changdu.changdulib.e.k.a(str1)) {
paramMap = (String)paramMap.get("access_token");
} else {
paramMap = str1;
}
new com.changdu.zone.sessionmanage.a.j(this, true, a(2), str2, paramMap, true, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]);
}
public void a(int paramInt, Map<String, String> paramMap)
{
String str2 = (String)paramMap.get("uid");
String str1 = (String)paramMap.get("accessToken");
if (com.changdu.changdulib.e.k.a(str1)) {
paramMap = (String)paramMap.get("access_token");
} else {
paramMap = str1;
}
new com.changdu.zone.sessionmanage.a.j(this, true, a(paramInt), str2, paramMap, true, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]);
}
public void a(ab paramAb)
{
if (this.J != 0) {
if ((this.K != null) && (paramAb != null))
{
int i1 = this.J;
if (i1 != 905)
{
switch (i1)
{
default:
switch (i1)
{
default:
break;
case 903:
paramAb.e((String)this.K.get("iconurl"));
paramAb.b((String)this.K.get("username"));
break;
case 901:
case 902:
paramAb.e((String)this.K.get("iconurl"));
paramAb.b((String)this.K.get("name"));
}
break;
case 3:
String str2 = (String)this.K.get("iconurl");
String str1 = str2;
if (com.changdu.changdulib.e.k.a(str2)) {
str1 = (String)this.K.get("profile_image_url");
}
paramAb.e(str1);
str2 = (String)this.K.get("name");
str1 = str2;
if (com.changdu.changdulib.e.k.a(str2)) {
str1 = (String)this.K.get("screen_name");
}
paramAb.b(str1);
paramAb.k((String)this.K.get("city"));
paramAb.l((String)this.K.get("province"));
paramAb.m((String)this.K.get("conntry"));
break;
case 2:
paramAb.e((String)this.K.get("iconurl"));
paramAb.b((String)this.K.get("name"));
paramAb.k((String)this.K.get("location"));
break;
case 1:
paramAb.e((String)this.K.get("iconurl"));
paramAb.b((String)this.K.get("name"));
paramAb.k((String)this.K.get("city"));
paramAb.l((String)this.K.get("province"));
break;
}
}
else
{
paramAb.e((String)this.K.get("iconurl"));
paramAb.b((String)this.K.get("name"));
}
}
else
{
bk.b(getString(2131559541));
return;
}
}
this.J = 0;
this.K = null;
b(paramAb);
}
protected boolean finishSpecify()
{
z.a(this.u);
if (this.E != null) {
this.E.sendEmptyMessageDelayed(1000, 150L);
}
return true;
}
public BaseActivity.a getActivityType()
{
return BaseActivity.a.G;
}
protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
super.onActivityResult(paramInt1, paramInt2, paramIntent);
if (this.k != null) {
this.k.a(paramInt1, paramInt2, paramIntent);
}
if (paramInt1 == 1)
{
if (paramInt2 == -1)
{
if (this.t != null) {
this.t.setText(paramIntent.getStringExtra("GetResult"));
}
if (this.u != null) {
this.u.setText(paramIntent.getStringExtra("GetPassword"));
}
if (this.x != null) {
this.y = true;
}
}
if (paramInt2 == 21842)
{
setResult(0, paramIntent);
finish();
}
}
Wait.b();
}
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
this.l = ae.c(this);
int i3 = 0;
this.y = false;
setContentView(2131362165);
this.k = com.changdu.share.q.a(this);
this.z = b();
this.p = getBaseContext();
paramBundle = new ArrayAdapter(this, 17367050, ae.a(this.p));
a();
this.t = ((AutoCompleteTextView)findViewById(2131231555));
this.t.setAdapter(paramBundle);
this.t.setThreshold(0);
this.t.setOnEditorActionListener(this.F);
this.u = ((EditText)findViewById(2131231554));
this.v = ((TextView)findViewById(2131232199));
this.w = ((TextView)findViewById(2131230810));
boolean bool = getResources().getBoolean(2130968599);
paramBundle = this.w;
int i1;
if (bool) {
i1 = 0;
} else {
i1 = 8;
}
paramBundle.setVisibility(i1);
this.w.setOnClickListener(new j(this));
this.v.setOnClickListener(new p(this));
this.x = ((Button)findViewById(2131231762));
this.x.setOnClickListener(this.H);
this.B = ((RelativeLayout)findViewById(2131232600));
this.A = ((FrameLayout)findViewById(2131232599));
this.k.a(this.A, new q(this));
if ((getResources().getBoolean(2130968601)) && (com.changdu.share.q.a())) {
i1 = 1;
} else {
i1 = 0;
}
paramBundle = this.B;
int i2;
if (i1 != 0) {
i2 = 0;
} else {
i2 = 8;
}
paramBundle.setVisibility(i2);
paramBundle = this.A;
if (i1 != 0) {
i1 = i3;
} else {
i1 = 8;
}
paramBundle.setVisibility(i1);
z.c(this);
}
protected void onDestroy()
{
ab localAb = ae.c(this);
if ((this.l != null) && (localAb != null) && (localAb.l() != this.l.l()))
{
RequestPlayStateReceiver.a(this, "");
com.changdu.util.b.a();
}
super.onDestroy();
}
public boolean onFlingExitExcute()
{
z.a(this.u);
return super.onFlingExitExcute();
}
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
{
throw new Runtime("d2j fail translate: java.lang.RuntimeException: can not merge I and Z\n\tat com.googlecode.dex2jar.ir.TypeClass.merge(TypeClass.java:100)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeRef.updateTypeClass(TypeTransformer.java:174)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.provideAs(TypeTransformer.java:780)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.e1expr(TypeTransformer.java:496)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:713)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.enexpr(TypeTransformer.java:698)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:719)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.s1stmt(TypeTransformer.java:810)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.sxStmt(TypeTransformer.java:840)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.analyze(TypeTransformer.java:206)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer.transform(TypeTransformer.java:44)\n\tat com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:162)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:414)\n\tat com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:42)\n\tat com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:509)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:406)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)\n\tat com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)\n\tat com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)\n\tat com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)\n");
}
protected void onResume()
{
if (this.y)
{
this.y = false;
this.x.performClick();
}
super.onResume();
}
}
| [
"ibrahimkanj@outlook.com"
] | ibrahimkanj@outlook.com |
a92d20a05dcdb01df74e46819d1791007ab5650e | b34404ddb2c04765eb099c58ad8ac614ab84adca | /src/com/cicro/wcm/template/velocity/impl/VelocitySerContextImp.java | d7013cec515e0325a19107f9054997d4afb90591 | [] | no_license | 373974360/cicroCms | a69f46d0148f948a55c22f4a9b60792b958e5744 | 7cd9b157253811046ab9db6a3c2aa91be5eadc48 | refs/heads/master | 2020-12-30T07:42:35.825771 | 2020-02-07T09:52:20 | 2020-02-07T09:52:20 | 238,906,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,065 | java | /* */ package com.cicro.wcm.template.velocity.impl;
/* */
/* */ import com.cicro.wcm.bean.zwgk.ser.SerCategoryBean;
/* */ import com.cicro.wcm.services.control.site.SiteAppRele;
/* */ import com.cicro.wcm.services.zwgk.ser.SerCategoryManager;
/* */ import com.cicro.wcm.template.velocity.VelocityContextAbstract;
/* */ import java.io.PrintStream;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import org.apache.velocity.VelocityContext;
/* */
/* */ public class VelocitySerContextImp extends VelocityContextAbstract
/* */ {
/* */ public VelocitySerContextImp(HttpServletRequest request)
/* */ {
/* 13 */ super(request);
/* */ }
/* */
/* */ public VelocitySerContextImp()
/* */ {
/* */ }
/* */
/* */ public void vcontextPut(String key, Object o)
/* */ {
/* 22 */ this.vcontext.put(key, o);
/* */ }
/* */
/* */ public void setSerTopicTemplateID(String ser_id, String temp_type)
/* */ {
/* 27 */ this.site_id = SiteAppRele.getSiteIDByAppID("ggfw");
/* 28 */ if ((ser_id != null) && (!"".equals(ser_id)))
/* */ {
/* 30 */ this.vcontext.put("ser_id", ser_id);
/* 31 */ System.out.println("setSerTopicTemplateID--------" + this.vcontext.get("ser_id"));
/* */ try {
/* 33 */ SerCategoryBean scb = SerCategoryManager.getRootSerCategoryBean(Integer.parseInt(ser_id));
/* 34 */ if ("index".equals(temp_type))
/* */ {
/* 36 */ this.template_id = scb.getTemplate_index();
/* */ }
/* 38 */ if ("list".equals(temp_type))
/* */ {
/* 40 */ this.template_id = scb.getTemplate_list();
/* */ }
/* 42 */ if ("content".equals(temp_type))
/* */ {
/* 44 */ this.template_id = scb.getTemplate_content();
/* */ }
/* */ }
/* */ catch (Exception e) {
/* 48 */ e.printStackTrace();
/* 49 */ System.out.println("setSerTopicTemplateID -- SerBean is null id:" + ser_id);
/* */ }
/* */ }
/* */ }
/* */
/* */ public void setSerInfoListTemplateID(String ser_id)
/* */ {
/* 56 */ this.site_id = SiteAppRele.getSiteIDByAppID("ggfw");
/* 57 */ if ((ser_id != null) && (!"".equals(ser_id)))
/* */ {
/* 59 */ this.vcontext.put("ser_id", ser_id);
/* 60 */ this.template_id = SerCategoryManager.getSerTemplateID("list");
/* */ }
/* */ }
/* */
/* */ public static void main(String[] args)
/* */ {
/* 66 */ VelocitySerContextImp s = new VelocitySerContextImp();
/* 67 */ s.template_id = "1122";
/* 68 */ s.site_id = "11111ddd";
/* 69 */ System.out.println(s.parseTemplate("#set($serObject=$SerData.getSerObject(\"25\"))<div>$serObject.cat_name</div>222"));
/* */ }
/* */ }
/* Location: C:\Users\Administrator\Desktop\wcm\shared\classes.zip
* Qualified Name: classes.com.cicro.wcm.template.velocity.impl.VelocitySerContextImp
* JD-Core Version: 0.6.2
*/ | [
"373974360@qq.com"
] | 373974360@qq.com |
d73a94a3911b75daf206f99b37ad2d11dc7bbebe | 7ddffcbd5eb437a45617685195d97fba6d005e41 | /app/src/main/java/android/example/com/courtcounter/ScoreStorage.java | 75ec444c9904146061f5e4f2c360c4c17b457594 | [] | no_license | bytetonight/Basketball-Scorekeeper | daba6fa8018ab10d908549e7fc96eb4e05d0c95f | fb08d0e862aaf6141638e290e36795d2fb6ca67c | refs/heads/master | 2021-01-17T14:21:18.085354 | 2017-05-21T10:32:55 | 2017-05-21T10:32:55 | 83,582,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,601 | java | package android.example.com.courtcounter;
import android.os.Parcel;
import android.os.Parcelable;
/**
* A simple Dataholder-Class offering methods to add and retrieve data from Main Activity
* for the sake of splitting up logic
*/
public class ScoreStorage implements Parcelable{
private String id = null;
private int triples = 0;
private int doubles = 0;
private int singles = 0;
private int fouls = 0;
public ScoreStorage(Parcel in)
{
}
public ScoreStorage(String id)
{
this.id = id;
}
public void reset()
{
triples = 0;
doubles = 0;
singles = 0;
fouls = 0;
}
//region Getters & Setters
public int getScore() {
return (triples * 3) + (doubles * 2) + singles;
}
public void addScore(int num) {
if (num > 0 && num < 4) {
switch (num) {
case 3:
++triples;
break;
case 2:
++doubles;
break;
case 1:
++singles;
}
}
}
public String getId()
{
return this.id;
}
public int getFouls() {
return fouls;
}
public void addFoul() {
++fouls;
}
public int getTriples() {
return triples;
}
public int getDoubles() {
return doubles;
}
public int getSingles() {
return singles;
}
//endregion
//region parcelable implementation
public static final Creator<ScoreStorage> CREATOR = new Creator<ScoreStorage>()
{
@Override
public ScoreStorage createFromParcel(Parcel in)
{
return new ScoreStorage(in);
}
@Override
public ScoreStorage[] newArray(int size)
{
return new ScoreStorage[size];
}
};
/**
* Describe the kinds of special objects contained in this Parcelable's
* marshalled representation.
*
* @return a bitmask indicating the set of special object types marshalled
* by the Parcelable.
*/
@Override
public int describeContents()
{
return 0;
}
/**
* Flatten this object in to a Parcel.
*
* @param dest The Parcel in which the object should be written.
* @param flags Additional flags about how the object should be written.
* May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}.
*/
@Override
public void writeToParcel(Parcel dest, int flags)
{
}
//endregion
}
| [
"isisteam@web.de"
] | isisteam@web.de |
604c9c7b32e4b64ec35c2270f03610624397ac5a | 90d4870d9a2c132b7b10b4ff6f5bf78a18ac994b | /com/shaded/fasterxml/jackson/databind/deser/Deserializers.java | 590a28c1ce456849f9dca46b8b80bbdad2e713db | [
"Apache-2.0",
"MIT"
] | permissive | junpengwang/fire2.5.2 | 399aa13b6c326d97aa2c9c8dd72bef03464ad6cc | f82ed93de0da5f8d454a9b20c08533a916fc0db4 | refs/heads/master | 2016-09-13T16:33:27.944146 | 2016-05-25T12:44:52 | 2016-05-25T12:44:52 | 59,662,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,065 | java | /* */ package com.shaded.fasterxml.jackson.databind.deser;
/* */
/* */ import com.shaded.fasterxml.jackson.databind.BeanDescription;
/* */ import com.shaded.fasterxml.jackson.databind.DeserializationConfig;
/* */ import com.shaded.fasterxml.jackson.databind.JavaType;
/* */ import com.shaded.fasterxml.jackson.databind.JsonDeserializer;
/* */ import com.shaded.fasterxml.jackson.databind.JsonMappingException;
/* */ import com.shaded.fasterxml.jackson.databind.JsonNode;
/* */ import com.shaded.fasterxml.jackson.databind.KeyDeserializer;
/* */ import com.shaded.fasterxml.jackson.databind.jsontype.TypeDeserializer;
/* */ import com.shaded.fasterxml.jackson.databind.type.ArrayType;
/* */ import com.shaded.fasterxml.jackson.databind.type.CollectionLikeType;
/* */ import com.shaded.fasterxml.jackson.databind.type.CollectionType;
/* */ import com.shaded.fasterxml.jackson.databind.type.MapLikeType;
/* */ import com.shaded.fasterxml.jackson.databind.type.MapType;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract interface Deserializers
/* */ {
/* */ public abstract JsonDeserializer<?> findArrayDeserializer(ArrayType paramArrayType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findCollectionDeserializer(CollectionType paramCollectionType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType paramCollectionLikeType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findEnumDeserializer(Class<?> paramClass, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findMapDeserializer(MapType paramMapType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findMapLikeDeserializer(MapLikeType paramMapLikeType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> paramClass, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException;
/* */
/* */ public abstract JsonDeserializer<?> findBeanDeserializer(JavaType paramJavaType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException;
/* */
/* */ public static class Base
/* */ implements Deserializers
/* */ {
/* */ public JsonDeserializer<?> findArrayDeserializer(ArrayType paramArrayType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException
/* */ {
/* 234 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findCollectionDeserializer(CollectionType paramCollectionType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException
/* */ {
/* 243 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType paramCollectionLikeType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException
/* */ {
/* 252 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findMapDeserializer(MapType paramMapType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException
/* */ {
/* 262 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType paramMapLikeType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
/* */ throws JsonMappingException
/* */ {
/* 272 */ return null;
/* */ }
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findEnumDeserializer(Class<?> paramClass, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException
/* */ {
/* 280 */ return null;
/* */ }
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> paramClass, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException
/* */ {
/* 288 */ return null;
/* */ }
/* */
/* */
/* */
/* */ public JsonDeserializer<?> findBeanDeserializer(JavaType paramJavaType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription)
/* */ throws JsonMappingException
/* */ {
/* 296 */ return null;
/* */ }
/* */ }
/* */ }
/* Location: /Users/junpengwang/Downloads/Download/firebase-client-android-2.5.2.jar!/com/shaded/fasterxml/jackson/databind/deser/Deserializers.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"wangjunpeng@wilddog.com"
] | wangjunpeng@wilddog.com |
7ec8d67fccfbb52c4c0333f8fb23cfdcb81c822f | 81ca7d5ca9a812af06c06ba1b9bbf36a4bfebcd7 | /src/dao/package-info.java | d89720855c5436885a1cbe1721dab55ed2b211f5 | [] | no_license | Judiths/ubir2New | 09f54771025dcd519ce5e8632fd6b167e9413534 | 555d1c2e0ed933e2fbe71c799b4b2b73c1ebdfa5 | refs/heads/master | 2016-09-05T19:18:04.763829 | 2015-08-06T04:04:54 | 2015-08-06T04:04:54 | 40,283,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51 | java | /**
*
*/
/**
* @author zer0
*
*/
package dao; | [
"zer0@localhost.localdomain"
] | zer0@localhost.localdomain |
5a8afc85d813732300b07ff5ae104d01d8d28bf5 | 9c7706d94ec96bd7a833d2f47874dd0386aa7c50 | /PsDataStore/dashboard/src/main/java/gov/bnl/racf/ps/dashboard/servlets/PsEditObjectServlet.java | 3f6bf3eb40d1775c5a00a2de16648087646577b4 | [] | no_license | PerfModDash/PerfModDash | dd643a2147f243a159d0dc431500c00099a30967 | 073d6393f3a6b1d66e69d9ec3ae2735626c73b5d | refs/heads/master | 2016-09-05T13:12:02.912937 | 2013-09-30T17:06:12 | 2013-09-30T17:06:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,190 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gov.bnl.racf.ps.dashboard.servlets;
import gov.bnl.racf.ps.dashboard.data_objects.*;
import gov.bnl.racf.ps.dashboard.data_store.PsDataStore;
import gov.bnl.racf.ps.dashboard.object_manipulators.JsonConverter;
import gov.bnl.racf.ps.dashboard.object_manipulators.PsObjectUpdater;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
/**
* Edit object. It takes two parameters: object and json. Object should be:
* host,service,cloud,site,collector,matrix,serviceType,collector. json is a string
* containing json representation of this object.
* The code parses the string, builds a json object and extracts its id.
* Then depending on the object parameter it obtains relevant object from data
* store and modifies it according to json object.
*
* If successful the code returns json representation of the updated object.
* @author tomw
*/
@WebServlet(name = "PsEditObjectServlet", urlPatterns = {"/editObject"})
public class PsEditObjectServlet extends HttpServlet {
/**
* Processes requests for both HTTP
* <code>GET</code> and
* <code>POST</code> methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/*
* TODO output your page here. You may use following sample code.
*/
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet PsEditObjectServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet PsEditObjectServlet at " + request.getContextPath() + "</h1>");
String object = request.getParameter("object");
String jsonString = request.getParameter("json");
if(object!=null && !"".equals(object) && jsonString!=null && !"".equals(jsonString)){
JSONObject json = null;
JSONParser parser = new JSONParser();
try {
//unpack host string and convert it to json
json = (JSONObject) parser.parse(jsonString);
PsDataStore dataStore = PsDataStore.getDataStore();
String id = (String)json.get("id");
if (object.equals("host")) {
PsHost host = dataStore.getHost(id);
PsObjectUpdater.edit(host, json);
JSONObject newJson = JsonConverter.psHost2Json(host);
out.println(newJson.toString());
}
if (object.equals("service")) {
PsService service = dataStore.getService(id);
PsObjectUpdater.edit(service, json);
JSONObject newJson = JsonConverter.toJson(service);
out.println(newJson.toString());
}
if (object.equals("cloud")) {
PsCloud cloud = dataStore.getCloud(id);
PsObjectUpdater.edit(cloud, json);
JSONObject newJson = JsonConverter.toJson(cloud);
out.println(newJson.toString());
}
if (object.equals("collector")) {
PsCollector collector = dataStore.getCollector(id);
PsObjectUpdater.edit(collector, json);
JSONObject newJson = JsonConverter.toJson(collector);
out.println(newJson.toString());
}
if (object.equals("site")) {
PsSite site = dataStore.getSite(id);
PsObjectUpdater.edit(site, json);
JSONObject newJson = JsonConverter.toJson(site);
out.println(newJson.toString());
}
if (object.equals("serviceType")) {
PsServiceType type = dataStore.getServiceType(id);
PsObjectUpdater.edit(type, json);
JSONObject newJson = JsonConverter.toJson(type);
out.println(newJson.toString());
}
if (object.equals("matrix")) {
PsMatrix matrix = dataStore.getMatrix(id);
PsObjectUpdater.edit(matrix, json);
JSONObject newJson = JsonConverter.toJson(matrix);
out.println(newJson.toString());
}
}catch(Exception e){
// parsing host failed, delete the host
//TODO raise error code etc
}
}
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP
* <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP
* <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"tomw@themistocles.racf.bnl.gov"
] | tomw@themistocles.racf.bnl.gov |
feca594976d49c9b4b4e850a4fad318c683b226e | ec5b6eb039d5bedf229a1b01ab98f38922fb1618 | /address-book-web-tests/src/test/java/ru/pft/stqa/addressbook/model/Contacts.java | ac639848dcd1b72ddf37ee01bc1693100914f646 | [
"Apache-2.0"
] | permissive | qslid/SomeProject | 7915c98fd796758f993f75f84836e67909022556 | ded091103647a12af026f6012f735792d76c1e71 | refs/heads/master | 2020-04-20T15:33:18.792651 | 2019-04-12T16:34:49 | 2019-04-12T16:34:49 | 168,933,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package ru.pft.stqa.addressbook.model;
import com.google.common.collect.ForwardingSet;
import java.util.HashSet;
import java.util.Set;
public class Contacts extends ForwardingSet<ContactInfo> {
private Set<ContactInfo> delegate;
public Contacts(Contacts contacts) {
this.delegate = new HashSet<ContactInfo>(contacts.delegate);
}
public Contacts() {
this.delegate = new HashSet<>();
}
@Override
protected Set delegate() {
return delegate;
}
public Contacts withAdded(ContactInfo contact){
Contacts contacts = new Contacts(this);
contacts.add(contact);
return contacts;
}
public Contacts without(ContactInfo contact){
Contacts contacts = new Contacts(this);
contacts.remove(contact);
return contacts;
}
}
| [
"procyonws@gmail.com"
] | procyonws@gmail.com |
20d0dc16c504ac839a625bfed8dc492b91f08545 | 1ac0da334bc05ec6ed2afbc358f12d1a7b3ea7bb | /src/main/java/com/ethical/ms/repository/RestaurantRepository.java | 67880e1cc46eda2ed827f017ba9ea4c307430e50 | [] | no_license | amanhbtu/restaurantapi | 07178cd5f7f118f82c5976284a5e58099dabf142 | 12f0e8718b63e7a11b7c69cc0b85efb80b70dcf0 | refs/heads/master | 2023-05-11T18:09:17.564835 | 2021-06-01T08:00:37 | 2021-06-01T08:00:37 | 372,504,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.ethical.ms.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.ethical.ms.model.Restaurant;
public interface RestaurantRepository extends JpaRepository<Restaurant,Integer> {
Restaurant findByName(String name);
Restaurant findById(int id);
}
| [
"aman.maurya@globallogic.com"
] | aman.maurya@globallogic.com |
d9209d02f8f83d4de8d7a4a12c9e01dffe21d91e | f04f5b3e21e434bfaa7b09b6513cffc9b4a18294 | /Day08/src/com/atguigu/java/BubbleSortTest.java | 8a5e5abd23494432695f8dad89b6e30a7cbe231d | [] | no_license | NeoInHeart/JavaTest | 4934170ba10b5775ae9c539975ae0143ac6a9da8 | 7b72400b15799de5654c8fa35f2659ee99caf3db | refs/heads/master | 2020-11-29T17:29:13.435091 | 2020-01-20T03:16:43 | 2020-01-20T03:16:43 | 230,178,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.atguigu.java;
import java.util.Arrays;
public class BubbleSortTest {
public static void main(String[] args){
int[] arr=new int[]{22,13,21,2,4,67,88,3};
for (int i=0;i<arr.length;i++){
System.out.println(arr[i]);
}
//比较两个数组是否相等
int[] arr1=new int[]{1,2,3,4};
int[] arr2=new int[]{1,3,2,4};
boolean isEquals=Arrays.equals(arr1, arr2);
System.out.println(arr1);
System.out.println(arr2);
System.out.println(isEquals);
//arrays包内的方法测试
//Arrays.sort()使得数列进行排序|Arrays.toString()对数列进行显示
Arrays.sort(arr);//底层使用快速排序的方法。
System.out.println(Arrays.toString(arr));
//二分查找
int index=Arrays.binarySearch(arr, 67);
System.out.println(index);
}
}
| [
"1225375277@qq.com"
] | 1225375277@qq.com |
9a826855dfdd9f362ff5f4da5f3179086f6ea62c | c6859de9a1db20a5ee413c445fc33380958c76a0 | /erp/src/main/java/com/flower/father/controller/RawMaterialController.java | e1d06fcda29b202e2f590f174e385cf8ce460e60 | [] | no_license | wenyiwu/FlowerFatherErp | 5eca4232319bab24dcc2c7fcc7e530910317b7af | b993feb322a8029d7c391f7c98db4841d0c8c3e2 | refs/heads/master | 2022-05-28T19:39:04.399039 | 2020-03-15T13:50:59 | 2020-03-15T13:50:59 | 247,436,124 | 0 | 0 | null | 2022-05-20T21:30:00 | 2020-03-15T09:27:59 | Vue | UTF-8 | Java | false | false | 3,023 | java | package com.flower.father.controller;
import com.flower.father.model.dto.RawMaterialDto;
import com.flower.father.model.param.RawMaterialParam;
import com.flower.father.model.response.RawMaterialResponse;
import com.flower.father.service.RawMaterialCoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author eiven
*/
@CrossOrigin
@Controller
@RequestMapping("/api/v1")
public class RawMaterialController {
@Autowired
private RawMaterialCoreService rawMaterialCoreService;
@PostMapping("/commodity")
@ResponseBody
public ResponseEntity<RawMaterialResponse> createRawMaterial(@RequestBody RawMaterialParam param){
RawMaterialDto dto = buildRawMaterialDto(param);
rawMaterialCoreService.createRawMaterial(dto);
return new ResponseEntity<>(buildRawMaterialResponse(dto), HttpStatus.OK);
}
@RequestMapping("/admin/commodities")
@ResponseBody
public ResponseEntity<List<RawMaterialResponse>> searchRawMaterials(){
List<RawMaterialDto> dtos = rawMaterialCoreService.searchRawMaterials(null);
return new ResponseEntity<>(dtos.stream().map(this::buildRawMaterialResponse).collect(Collectors.toList()), HttpStatus.OK);
}
@RequestMapping("/commodities")
@ResponseBody
public ResponseEntity<List<RawMaterialResponse>> searchInventories(){
List<RawMaterialDto> dtos = rawMaterialCoreService.searchRawMaterials(null);
return new ResponseEntity<>(dtos.stream().map(this::buildRawMaterialResponse).collect(Collectors.toList()), HttpStatus.OK);
}
private RawMaterialResponse buildRawMaterialResponse(RawMaterialDto rawMaterial) {
RawMaterialResponse rawMaterialResponse = new RawMaterialResponse();
rawMaterialResponse.setId(rawMaterial.getId());
rawMaterialResponse.setName(rawMaterial.getName());
rawMaterialResponse.setLevel(rawMaterial.getLevel());
rawMaterialResponse.setClassify(rawMaterial.getClassify());
rawMaterialResponse.setColour(rawMaterial.getColour());
rawMaterialResponse.setNumber(rawMaterial.getNumber());
rawMaterialResponse.setPresellNumber(rawMaterial.getPresellNumber());
rawMaterialResponse.setRealNumber(rawMaterial.getRealNumber());
rawMaterialResponse.setSalesNumber(rawMaterial.getSalesNumber());
return rawMaterialResponse;
}
private RawMaterialDto buildRawMaterialDto(RawMaterialParam param) {
RawMaterialDto rawMaterialDto = new RawMaterialDto();
rawMaterialDto.setName(param.getName());
rawMaterialDto.setLevel(param.getLevel());
rawMaterialDto.setClassify(param.getClassify());
rawMaterialDto.setColour(param.getColour());
return rawMaterialDto;
}
}
| [
"wyw181174@alibaba-inc.com"
] | wyw181174@alibaba-inc.com |
d983822551cd5125d5b731c008bae84d04e80f7d | 12b14b30fcaf3da3f6e9dc3cb3e717346a35870a | /examples/commons-math3/mutations/mutants-BicubicSplineInterpolator/159/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java | 377034a50585ca0215ef8e54424339db61ecd42d | [
"BSD-3-Clause",
"Minpack",
"Apache-2.0"
] | permissive | SmartTests/smartTest | b1de326998857e715dcd5075ee322482e4b34fb6 | b30e8ec7d571e83e9f38cd003476a6842c06ef39 | refs/heads/main | 2023-01-03T01:27:05.262904 | 2020-10-27T20:24:48 | 2020-10-27T20:24:48 | 305,502,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,804 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math3.analysis.interpolation;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.util.MathArrays;
/**
* Generates a bicubic interpolating function.
*
* @version $Id$
* @since 2.2
*/
public class BicubicSplineInterpolator
implements BivariateGridInterpolator {
/**
* {@inheritDoc}
*/
public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
final double[] yval,
final double[][] fval)
throws NoDataException, DimensionMismatchException,
NonMonotonicSequenceException, NumberIsTooSmallException {
if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
throw new NoDataException();
}
if (xval.length != fval.length) {
throw new DimensionMismatchException(xval.length, fval.length);
}
MathArrays.checkOrder(xval);
MathArrays.checkOrder(yval);
final int xLen = xval.length;
final int yLen = yval.length;
// Samples (first index is y-coordinate, i.e. subarray variable is x)
// 0 <= i < xval.length
// 0 <= j < yval.length
// fX[j][i] = f(xval[i], yval[j])
final double[][] fX = new double[yLen][xLen];
for (int i = 0; i < xLen; i++) {
if (fval[i].length != yLen) {
throw new DimensionMismatchException(fval[i].length, yLen);
}
for (int j = 0; j < yLen; j++) {
fX[j][i] = fval[i][j];
}
}
final SplineInterpolator spInterpolator = new SplineInterpolator();
// For each line y[j] (0 <= j < yLen), construct a 1D spline with
// respect to variable x
final PolynomialSplineFunction[] ySplineX = new PolynomialSplineFunction[yLen];
for (int j = 0; j < yLen; j++) {
ySplineX[j] = spInterpolator.interpolate(xval, fX[j]);
}
// For each line x[i] (0 <= i < xLen), construct a 1D spline with
// respect to variable y generated by array fY_1[i]
final PolynomialSplineFunction[] xSplineY = new PolynomialSplineFunction[xLen];
for (int i = 0; i < xLen; i++) {
xSplineY[i] = spInterpolator.interpolate(yval, fval[i]);
}
// Partial derivatives with respect to x at the grid knots
final double[][] dFdX = new double[xLen][yLen];
for (int j = 0; j < yLen; j++) {
final UnivariateFunction f = ySplineX[j].derivative();
for (int i = 0; i < xLen; i++) {
dFdX[i][j] = f.value(xval[i]);
}
}
// Partial derivatives with respect to y at the grid knots
final double[][] dFdY = new double[xLen][yLen];
for (int i = 0; i < xLen; i++) {
final UnivariateFunction f = xSplineY[i].derivative();
for (int j = 0; j < yLen; j++) {
dFdY[i][j] = f.value(yval[j]);
}
}
// Cross partial derivatives
final double[][] d2FdXdY = new double[xLen][yLen];
for (int i = 0; i < xLen ; i++) {
final int nI = nextIndex(i, xLen);
final int pI = previousIndex(i);
for (int j = 0; j < yLen; j++) {
final int nJ = nextIndex(j, yLen);
final int pJ = previousIndex(j);
d2FdXdY[i][j] = (fval[nI][nJ] - fval[nI][pJ] -
fval[pI][nJ] + fval[pI][pJ]) /
((xval[nI] - xval[pI]) * (yval[nJ] - yval[pJ]));
}
}
// Create the interpolating splines
return new BicubicSplineInterpolatingFunction(xval, yval, fval,
dFdX, dFdY, d2FdXdY);
}
/**
* Computes the next index of an array, clipping if necessary.
* It is assumed (but not checked) that {@code i >= 0}.
*
* @param i Index.
* @param max Upper limit of the array.
* @return the next index.
*/
private int nextIndex(int i, int max) {
final int index = i + 1;
return index < max ? index : index - 1;
}
/**
* Computes the previous index of an array, clipping if necessary.
* It is assumed (but not checked) that {@code i} is smaller than the size
* of the array.
*
* @param i Index.
* @return the previous index.
*/
private int previousIndex(int i) {
final int index = i - 1;
return index >= 0 ? index : -1;
}
}
| [
"kesina@Kesinas-MBP.lan"
] | kesina@Kesinas-MBP.lan |
fcd2a6aa9ce68a970686013258f6eafab36bebe4 | 67a09281feaf32a4be68580ce1cd1e2011ba5804 | /Java Fundamental/03. Java-Streams/Java-Streams-Homework/06.Save a Custom Object in a file/src/com/company/Course.java | eec5eb3eb3c1497bed1e35b5153e9f042d06db4d | [] | no_license | IliqnDimitrov/SoftUni-Fundamentals | b73190dfea4a5e2841ba8ca629db18b15f0c60c6 | 61186a36a21a6207a9e7a6bca9ade1f6e598fe1a | refs/heads/master | 2021-01-10T16:29:45.344327 | 2016-04-09T17:45:24 | 2016-04-09T17:45:24 | 54,488,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package com.company;
import java.io.Serializable;
/**
* Created by blade on 21.3.2016 г..
*/
public class Course implements Serializable{
private String courseName;
private int numberOfStudents;
public Course(String courseName, int numberOfStudents) {
this.courseName = courseName;
this.numberOfStudents = numberOfStudents;
}
@Override
public String toString() {
return String.format("Course: %s \nNumbers of students: %d",courseName,numberOfStudents);
}
}
| [
"blader.92@icloud.com"
] | blader.92@icloud.com |
488585c56296803bbcac46de9fb2b2c28e46d0c0 | ca553b102e47b0f96ed8aa005e8c21bf17e56779 | /src/br/com/netflix/model/ComentarioDao.java | bcb2d70f5225d05c156a6df4ce9a362496f86691 | [] | no_license | israelljunnior/atividadeFran | dfdf1c320d812c0ae0bc67ee019096fc02480b76 | 06b0944627423c5f25eb39ba55b214c43bd7f19a | refs/heads/master | 2020-03-20T19:01:10.722595 | 2018-06-23T12:26:59 | 2018-06-23T12:26:59 | 137,617,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package br.com.netflix.model;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class ComentarioDao {
private static final String PERSISTENCE_UNIT = "netflix";
public void salvar(Comentario comentario) {
EntityManagerFactory factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
EntityManager manager = factory.createEntityManager();
manager.getTransaction().begin();
manager.persist(comentario);
manager.getTransaction().commit();
manager.close();
factory.close();
}
public List<Comentario> listar() {
EntityManagerFactory factory =
Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
EntityManager manager = factory.createEntityManager();
List<Comentario> lista = manager.createQuery("FROM Comentario ORDER BY data").getResultList();
manager.close();
factory.close();
return lista;
}
}
| [
"israelljunnior15987426@hotmail.com"
] | israelljunnior15987426@hotmail.com |
f2b591f4b59bea7ed7aa060636c6485b68151b2a | 9dbe16cc81b3b3e9daa48cdf5194e878f941e17f | /bobcat/bb-cumber/src/main/java/com/cognifide/qa/bb/cumber/BobcumberListener.java | 4cc25f1db41c67319d7f9b156f978d0476b54be9 | [
"Apache-2.0"
] | permissive | balakondepudi/bobcat | 49aed5707f78fbd42e7a40706c29de04e77ae586 | 5a085cafa211e1a0c333e5c9fe3cc2bdfc1d2091 | refs/heads/master | 2020-12-24T09:37:48.217673 | 2016-10-25T07:53:48 | 2016-10-25T07:53:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,075 | java | /*-
* #%L
* Bobcat
* %%
* Copyright (C) 2016 Cognifide Ltd.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.cognifide.qa.bb.cumber;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang3.CharEncoding;
import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
class BobcumberListener extends RunListener {
private static final String FEATURE_STATEMENT = "feature";
private static final String SCENARIO_STATEMENT = "Scenario";
private static final String COLON = ":";
private final Bobcumber bobcumber;
private final FeatureMap featureMap;
private final AtomicInteger scenarioCounter;
private final AtomicInteger testFailureCounter;
private boolean alreadyRegistered;
BobcumberListener(Bobcumber bobcumber) {
this.bobcumber = bobcumber;
featureMap = new FeatureMap();
scenarioCounter = new AtomicInteger();
testFailureCounter = new AtomicInteger();
}
@Override
public void testRunFinished(Result result) throws Exception {
try (PrintWriter writer = new PrintWriter(bobcumber.getStatisticsFile(), CharEncoding.UTF_8)) {
writer.println(scenarioCounter.get());
writer.println(testFailureCounter.get());
}
}
@Override
public void testStarted(Description description) throws Exception {
String displayName = description.getDisplayName();
String testStep = displayName.substring(0, displayName.lastIndexOf(COLON));
if (SCENARIO_STATEMENT.equals(testStep)) {
scenarioCounter.incrementAndGet();
alreadyRegistered = false;
}
}
@Override
public void testFailure(Failure failure) throws Exception {
String trace = normalizeTrace(failure.getTrace());
if (trace.contains(FEATURE_STATEMENT)) {
addScenario(trace);
if (!alreadyRegistered) {
testFailureCounter.incrementAndGet();
alreadyRegistered = true;
}
}
}
private String normalizeTrace(String trace) {
return trace.substring(trace.lastIndexOf("(") + 1, trace.lastIndexOf(")"));
}
private synchronized void addScenario(String failedScenario) throws IOException {
try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(bobcumber.getFeatureFile(), false)))) {
featureMap.addFeature(failedScenario);
featureMap.writeFeatures(out);
}
}
}
| [
"nowszy94@gmail.com"
] | nowszy94@gmail.com |
a2beaebb5a7601554ee805c46de735c5246296f3 | 0e62f4a20f1a3c3befa87c578a69defc4fb9dff3 | /src/implementation/UseThreads.java | c551fdcbf0dc031c57d5cc5ec7687dee04814431 | [] | no_license | amidshukurov/ThreadProject | 81ed1b4f5c58763890dfd2e1c4f34e75b6a76a8f | 4103c2ba4649c53f1bda15a2d7d9cd6c2cb92621 | refs/heads/master | 2022-10-28T09:39:49.675423 | 2020-06-17T07:15:08 | 2020-06-17T07:15:08 | 272,904,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package implementation;
public class UseThreads {
public static void main(String[] args) {
System.out.println("My thread is strarting");
MyThread mt = new MyThread("Child# 1");
MyThread mt1 = new MyThread("Child# 2");
MyThread mt2 = new MyThread("Child# 3");
// implementation.MyThread mt1 = new implementation.MyThread("Child# 2");
// implementation.MyThread mt2= new implementation.MyThread("Child# 3");
// implementation.MyThread mt3 = new implementation.MyThread("Child# 4");
// implementation.MyThread mt4 = new implementation.MyThread("Child# 5");
//Thread newThread = new Thread(mt);
// Thread newThread1 = new Thread(mt1);
// Thread newThread2 = new Thread(mt2);
// Thread newThread3 = new Thread(mt3);
// Thread newThread4 = new Thread(mt4);
//newThread.start();
// newThread1.start();
// newThread2.start();
// newThread3.start();
// newThread4.start();
/*
for (int i = 0; i < 50; i++) {
System.out.print("+");
try {
Thread.sleep(100);
} catch (InterruptedException exc) {
System.out.println("Main thread interrupted.");
}
}*/
try {
mt.thrd.join();
System.out.println("Child #1 joined.");
mt1.thrd.join();
System.out.println("Child #2 joined.");
mt2.thrd.join();
System.out.println("Child #3 joined.");
System.out.println(mt.thrd.getPriority());
System.out.println(mt1.thrd.getPriority());
System.out.println(mt2.thrd.getPriority());
} catch (InterruptedException exc) {
System.out.println("Main thread interrupted.");
}
System.out.println("Main thread ending.");
}
}
| [
"it.amid.shukurov@gmail.com"
] | it.amid.shukurov@gmail.com |
9eb719009d08e3cf3d169671a7713bb1e443200b | 699a9ac7ac8996db7a9b5fd57a435d7685b5bf1f | /src/main/java/com/wmtrucking/entity/MaPushNotification.java | 670914f40e6893cde7cd16846073257dcee280d4 | [] | no_license | hetalpatel-technoark/WmTracking_API | 134f10d63a47609839b81368826b936e9bd17d3c | 7043d62bb1d8aeee5515d8a18ca558404988dfd3 | refs/heads/master | 2023-04-11T08:34:25.257418 | 2020-05-07T05:46:46 | 2020-05-07T05:46:46 | 224,832,064 | 0 | 1 | null | 2023-03-27T22:18:39 | 2019-11-29T10:29:37 | Java | UTF-8 | Java | false | false | 3,882 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.wmtrucking.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author Admin
*/
@Entity
@Table(name = "ma_push_notification")
@SequenceGenerator(name = "ma_push_notification_seq", sequenceName = "ma_push_notification_seq", allocationSize = 1)
@NamedQueries({
@NamedQuery(name = "MaPushNotification.findAll", query = "SELECT m FROM MaPushNotification m")})
public class MaPushNotification implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ma_push_notification_seq")
@Column(name = "pushid")
private Long pushid;
@Size(max = 255)
@Column(name = "devicetoken")
private String devicetoken;
@Column(name = "datecreated")
@Temporal(TemporalType.TIMESTAMP)
private Date datecreated;
@Size(max = 50)
@Column(name = "status")
private String status;
@Size(max = 25)
@Column(name = "type")
private String type;
@JoinColumn(name = "driverid", referencedColumnName = "id")
@ManyToOne
private MaDriver driverid;
public MaPushNotification() {
}
public MaPushNotification(Long pushid) {
this.pushid = pushid;
}
public Long getPushid() {
return pushid;
}
public void setPushid(Long pushid) {
this.pushid = pushid;
}
public String getDevicetoken() {
return devicetoken;
}
public void setDevicetoken(String devicetoken) {
this.devicetoken = devicetoken;
}
public Date getDatecreated() {
return datecreated;
}
public void setDatecreated(Date datecreated) {
this.datecreated = datecreated;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MaDriver getDriverid() {
return driverid;
}
public void setDriverid(MaDriver driverid) {
this.driverid = driverid;
}
@Override
public int hashCode() {
int hash = 0;
hash += (pushid != null ? pushid.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof MaPushNotification)) {
return false;
}
MaPushNotification other = (MaPushNotification) object;
if ((this.pushid == null && other.pushid != null) || (this.pushid != null && !this.pushid.equals(other.pushid))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.wmtrucking.entity.MaPushNotification[ pushid=" + pushid + " ]";
}
}
| [
"peter.barrett@gonenotgone.com"
] | peter.barrett@gonenotgone.com |
71efaadb0eac8d037898673c323b5c4c64baa37a | 5bfdd3e3e61e046a56f5e4714bd13e4bf0bf359d | /algorithm/src/boj/RecommendCandidate1713.java | 3d1e5f4f105c70dff992984f88d23eb328ca203a | [
"MIT"
] | permissive | Oraindrop/algorithm | e40b0c36a6728bc3f3599b7769d581cc3e59e9d8 | 7081464a4153c307c5ad6e92523b7d6f74fce332 | refs/heads/master | 2022-01-18T15:11:13.959202 | 2021-12-30T14:39:17 | 2021-12-30T14:39:17 | 146,498,419 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,511 | java | package boj;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
public class RecommendCandidate1713 {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(br.readLine());
int n = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
List<Student> list = new ArrayList<>();
for(int i = 0; i < n; i++) {
int key = Integer.parseInt(st.nextToken());
int index = isContain(key, list);
if(index != -1) {
list.get(index).hit();
eatAges(list);
continue;
}
if(!isFull(size, list)) {
eatAges(list);
list.add(new Student(key));
continue;
}
removeStudent(list);
eatAges(list);
list.add(new Student(key));
}
List<Integer> answers = new ArrayList<>();
for(Student s : list) {
answers.add(s.getKey());
}
Collections.sort(answers);
for(int i = 0; i < answers.size() - 1; i++) {
System.out.print(answers.get(i) + " ");
}
System.out.println(answers.get(answers.size()-1));
}
static void eatAges(List<Student> list) {
for(Student s : list) {
s.eatAge();
}
}
static int isContain(int key, List<Student> list) {
for(int i = 0; i < list.size(); i++) {
if(list.get(i).isStudent(key)) return i;
}
return -1;
}
static boolean isFull(int maxSize, List<Student> list) {
return list.size() == maxSize;
}
static void removeStudent(List<Student> list) {
Collections.sort(list);
list.remove(list.get(0));
}
}
class Student implements Comparable<Student>{
private int key;
private int age;
private int hit;
public Student(int key) {
this.key = key;
this.age = 1;
this.hit = 1;
}
public int getKey() {
return key;
}
public boolean isStudent(int key) {
return key == this.key;
}
public void hit() {
this.hit++;
}
public void eatAge() {
this.age++;
}
@Override
public int compareTo(Student s) {
// TODO Auto-generated method stub
if(this.hit > s.hit) return 1;
if(this.hit < s.hit) return -1;
if(this.age > s.age) return -1;
if(this.age < s.age) return 1;
return 0;
}
@Override
public String toString() {
return "Student [key=" + key + ", age=" + age + ", hit=" + hit + "]";
}
}
| [
"chltmdals115@gmail.com"
] | chltmdals115@gmail.com |
eedd4451ec09851a3f894a47f79575a30319618b | 4a46ff0165eed2360d0b547cff317f13f604862e | /LibraryManagementSystemClient/target/generated-sources/jaxws-wsimport/com/service/DisplayBooks.java | 5af37997ab404c1e4c49f704bd8aa384799924ed | [] | no_license | sarbjotrandhawa/LibraryManagementSystem | 0138fe5da2300e9a511efa34b6dcad7a4f217c7e | 5392646bbe89991fca6fa741f83a92e9219ab5d4 | refs/heads/main | 2023-07-13T20:05:00.528540 | 2021-08-26T01:20:48 | 2021-08-26T01:20:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java |
package com.service;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DisplayBooks complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="DisplayBooks">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DisplayBooks")
public class DisplayBooks {
}
| [
"macbookair@MACBOOKs-MacBook-Air.local"
] | macbookair@MACBOOKs-MacBook-Air.local |
285a37b52bec29cbd17479917ca0f3edbf3489f2 | 6fb4e19b7b085d622aa2292654e332fdbef837ce | /demo/src/main/java/com/tgroy1/demo/StackProjectApplication.java | b76e4e9730f59761d677e1b8a26b8afbef05ab90 | [] | no_license | tgroy1/CustomStackProject | d6f5296a646e8ee2e1cc9184fef9b0c9b2a0f253 | caa304adde5638c698049c7840bcaaa6da0ecd04 | refs/heads/master | 2023-08-04T01:11:43.236920 | 2021-09-19T07:50:14 | 2021-09-19T07:50:14 | 408,065,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.tgroy1.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StackProjectApplication {
public static void main(String[] args) {
SpringApplication.run(StackProjectApplication.class, args);
}
}
| [
"tgroy1@gmail.com"
] | tgroy1@gmail.com |
32eb504847a7e966794591b3205d00da62fe7b32 | be68bcbe1055784dfd723aa47ccca52f310fda5f | /sources/android/support/p007v4/util/LruCache.java | f9ae0eb85ba3d217ab227fbc04f054911659ca42 | [] | no_license | nicholaschum/DecompiledEvoziSmartLED | 02710bc9b7ddb5db2f7fbbcebfe21605f8e889f8 | 42d3df21feac3d039219c3384e12e56e5f587028 | refs/heads/master | 2023-08-18T01:57:52.644220 | 2021-09-17T20:48:43 | 2021-09-17T20:48:43 | 407,675,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,787 | java | package android.support.p007v4.util;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
/* renamed from: android.support.v4.util.LruCache */
public class LruCache<K, V> {
private int createCount;
private int evictionCount;
private int hitCount;
private final LinkedHashMap<K, V> map;
private int maxSize;
private int missCount;
private int putCount;
private int size;
public LruCache(int i) {
if (i > 0) {
this.maxSize = i;
this.map = new LinkedHashMap<>(0, 0.75f, true);
return;
}
throw new IllegalArgumentException("maxSize <= 0");
}
private int safeSizeOf(K k, V v) {
int sizeOf = sizeOf(k, v);
if (sizeOf >= 0) {
return sizeOf;
}
throw new IllegalStateException("Negative size: " + k + "=" + v);
}
/* access modifiers changed from: protected */
public V create(K k) {
return null;
}
public final synchronized int createCount() {
return this.createCount;
}
/* access modifiers changed from: protected */
public void entryRemoved(boolean z, K k, V v, V v2) {
}
public final void evictAll() {
trimToSize(-1);
}
public final synchronized int evictionCount() {
return this.evictionCount;
}
/* JADX WARNING: Code restructure failed: missing block: B:10:0x001a, code lost:
r0 = create(r5);
*/
/* JADX WARNING: Code restructure failed: missing block: B:11:0x001e, code lost:
if (r0 != null) goto L_0x0022;
*/
/* JADX WARNING: Code restructure failed: missing block: B:12:0x0020, code lost:
return null;
*/
/* JADX WARNING: Code restructure failed: missing block: B:13:0x0022, code lost:
monitor-enter(r4);
*/
/* JADX WARNING: Code restructure failed: missing block: B:15:?, code lost:
r4.createCount++;
r1 = r4.map.put(r5, r0);
*/
/* JADX WARNING: Code restructure failed: missing block: B:16:0x002f, code lost:
if (r1 == null) goto L_0x0037;
*/
/* JADX WARNING: Code restructure failed: missing block: B:17:0x0031, code lost:
r4.map.put(r5, r1);
*/
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0037, code lost:
r4.size += safeSizeOf(r5, r0);
*/
/* JADX WARNING: Code restructure failed: missing block: B:19:0x0040, code lost:
monitor-exit(r4);
*/
/* JADX WARNING: Code restructure failed: missing block: B:20:0x0041, code lost:
if (r1 == null) goto L_0x0048;
*/
/* JADX WARNING: Code restructure failed: missing block: B:21:0x0043, code lost:
entryRemoved(false, r5, r0, r1);
*/
/* JADX WARNING: Code restructure failed: missing block: B:22:0x0047, code lost:
return r1;
*/
/* JADX WARNING: Code restructure failed: missing block: B:23:0x0048, code lost:
trimToSize(r4.maxSize);
*/
/* JADX WARNING: Code restructure failed: missing block: B:24:0x004d, code lost:
return r0;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public final V get(K r5) {
/*
r4 = this;
if (r5 == 0) goto L_0x0054
monitor-enter(r4)
java.util.LinkedHashMap<K, V> r0 = r4.map // Catch:{ all -> 0x0051 }
java.lang.Object r0 = r0.get(r5) // Catch:{ all -> 0x0051 }
if (r0 == 0) goto L_0x0013
int r5 = r4.hitCount // Catch:{ all -> 0x0051 }
int r5 = r5 + 1
r4.hitCount = r5 // Catch:{ all -> 0x0051 }
monitor-exit(r4) // Catch:{ all -> 0x0051 }
return r0
L_0x0013:
int r0 = r4.missCount // Catch:{ all -> 0x0051 }
int r0 = r0 + 1
r4.missCount = r0 // Catch:{ all -> 0x0051 }
monitor-exit(r4) // Catch:{ all -> 0x0051 }
java.lang.Object r0 = r4.create(r5)
if (r0 != 0) goto L_0x0022
r5 = 0
return r5
L_0x0022:
monitor-enter(r4)
int r1 = r4.createCount // Catch:{ all -> 0x004e }
int r1 = r1 + 1
r4.createCount = r1 // Catch:{ all -> 0x004e }
java.util.LinkedHashMap<K, V> r1 = r4.map // Catch:{ all -> 0x004e }
java.lang.Object r1 = r1.put(r5, r0) // Catch:{ all -> 0x004e }
if (r1 == 0) goto L_0x0037
java.util.LinkedHashMap<K, V> r2 = r4.map // Catch:{ all -> 0x004e }
r2.put(r5, r1) // Catch:{ all -> 0x004e }
goto L_0x0040
L_0x0037:
int r2 = r4.size // Catch:{ all -> 0x004e }
int r3 = r4.safeSizeOf(r5, r0) // Catch:{ all -> 0x004e }
int r2 = r2 + r3
r4.size = r2 // Catch:{ all -> 0x004e }
L_0x0040:
monitor-exit(r4) // Catch:{ all -> 0x004e }
if (r1 == 0) goto L_0x0048
r2 = 0
r4.entryRemoved(r2, r5, r0, r1)
return r1
L_0x0048:
int r5 = r4.maxSize
r4.trimToSize(r5)
return r0
L_0x004e:
r5 = move-exception
monitor-exit(r4) // Catch:{ all -> 0x004e }
throw r5
L_0x0051:
r5 = move-exception
monitor-exit(r4) // Catch:{ all -> 0x0051 }
throw r5
L_0x0054:
java.lang.NullPointerException r5 = new java.lang.NullPointerException
java.lang.String r0 = "key == null"
r5.<init>(r0)
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: android.support.p007v4.util.LruCache.get(java.lang.Object):java.lang.Object");
}
public final synchronized int hitCount() {
return this.hitCount;
}
public final synchronized int maxSize() {
return this.maxSize;
}
public final synchronized int missCount() {
return this.missCount;
}
public final V put(K k, V v) {
V put;
if (k == null || v == null) {
throw new NullPointerException("key == null || value == null");
}
synchronized (this) {
this.putCount++;
this.size += safeSizeOf(k, v);
put = this.map.put(k, v);
if (put != null) {
this.size -= safeSizeOf(k, put);
}
}
if (put != null) {
entryRemoved(false, k, put, v);
}
trimToSize(this.maxSize);
return put;
}
public final synchronized int putCount() {
return this.putCount;
}
public final V remove(K k) {
V remove;
if (k != null) {
synchronized (this) {
remove = this.map.remove(k);
if (remove != null) {
this.size -= safeSizeOf(k, remove);
}
}
if (remove != null) {
entryRemoved(false, k, remove, (V) null);
}
return remove;
}
throw new NullPointerException("key == null");
}
public void resize(int i) {
if (i > 0) {
synchronized (this) {
this.maxSize = i;
}
trimToSize(i);
return;
}
throw new IllegalArgumentException("maxSize <= 0");
}
public final synchronized int size() {
return this.size;
}
/* access modifiers changed from: protected */
public int sizeOf(K k, V v) {
return 1;
}
public final synchronized Map<K, V> snapshot() {
return new LinkedHashMap(this.map);
}
public final synchronized String toString() {
int i;
i = this.hitCount + this.missCount;
return String.format(Locale.US, "LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]", new Object[]{Integer.valueOf(this.maxSize), Integer.valueOf(this.hitCount), Integer.valueOf(this.missCount), Integer.valueOf(i != 0 ? (this.hitCount * 100) / i : 0)});
}
/* JADX WARNING: Code restructure failed: missing block: B:20:0x0070, code lost:
throw new java.lang.IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public void trimToSize(int r5) {
/*
r4 = this;
L_0x0000:
monitor-enter(r4)
int r0 = r4.size // Catch:{ all -> 0x0071 }
if (r0 < 0) goto L_0x0052
java.util.LinkedHashMap<K, V> r0 = r4.map // Catch:{ all -> 0x0071 }
boolean r0 = r0.isEmpty() // Catch:{ all -> 0x0071 }
if (r0 == 0) goto L_0x0011
int r0 = r4.size // Catch:{ all -> 0x0071 }
if (r0 != 0) goto L_0x0052
L_0x0011:
int r0 = r4.size // Catch:{ all -> 0x0071 }
if (r0 <= r5) goto L_0x0050
java.util.LinkedHashMap<K, V> r0 = r4.map // Catch:{ all -> 0x0071 }
boolean r0 = r0.isEmpty() // Catch:{ all -> 0x0071 }
if (r0 == 0) goto L_0x001e
goto L_0x0050
L_0x001e:
java.util.LinkedHashMap<K, V> r0 = r4.map // Catch:{ all -> 0x0071 }
java.util.Set r0 = r0.entrySet() // Catch:{ all -> 0x0071 }
java.util.Iterator r0 = r0.iterator() // Catch:{ all -> 0x0071 }
java.lang.Object r0 = r0.next() // Catch:{ all -> 0x0071 }
java.util.Map$Entry r0 = (java.util.Map.Entry) r0 // Catch:{ all -> 0x0071 }
java.lang.Object r1 = r0.getKey() // Catch:{ all -> 0x0071 }
java.lang.Object r0 = r0.getValue() // Catch:{ all -> 0x0071 }
java.util.LinkedHashMap<K, V> r2 = r4.map // Catch:{ all -> 0x0071 }
r2.remove(r1) // Catch:{ all -> 0x0071 }
int r2 = r4.size // Catch:{ all -> 0x0071 }
int r3 = r4.safeSizeOf(r1, r0) // Catch:{ all -> 0x0071 }
int r2 = r2 - r3
r4.size = r2 // Catch:{ all -> 0x0071 }
int r2 = r4.evictionCount // Catch:{ all -> 0x0071 }
r3 = 1
int r2 = r2 + r3
r4.evictionCount = r2 // Catch:{ all -> 0x0071 }
monitor-exit(r4) // Catch:{ all -> 0x0071 }
r2 = 0
r4.entryRemoved(r3, r1, r0, r2)
goto L_0x0000
L_0x0050:
monitor-exit(r4) // Catch:{ all -> 0x0071 }
return
L_0x0052:
java.lang.IllegalStateException r5 = new java.lang.IllegalStateException // Catch:{ all -> 0x0071 }
java.lang.StringBuilder r0 = new java.lang.StringBuilder // Catch:{ all -> 0x0071 }
r0.<init>() // Catch:{ all -> 0x0071 }
java.lang.Class r1 = r4.getClass() // Catch:{ all -> 0x0071 }
java.lang.String r1 = r1.getName() // Catch:{ all -> 0x0071 }
r0.append(r1) // Catch:{ all -> 0x0071 }
java.lang.String r1 = ".sizeOf() is reporting inconsistent results!"
r0.append(r1) // Catch:{ all -> 0x0071 }
java.lang.String r0 = r0.toString() // Catch:{ all -> 0x0071 }
r5.<init>(r0) // Catch:{ all -> 0x0071 }
throw r5 // Catch:{ all -> 0x0071 }
L_0x0071:
r5 = move-exception
monitor-exit(r4) // Catch:{ all -> 0x0071 }
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: android.support.p007v4.util.LruCache.trimToSize(int):void");
}
}
| [
"nicholas@prjkt.io"
] | nicholas@prjkt.io |
7254ab6b7d3ec81c555bd1ad7d1a680014fedc7f | 7b82d70ba5fef677d83879dfeab859d17f4809aa | /tmp/sys/user/user-dao/src/main/java/org/konghao/user/dao/IUserDao.java | 97195213df24df723ed5211b87bf1bc9804001ab | [] | no_license | apollowesley/jun_test | fb962a28b6384c4097c7a8087a53878188db2ebc | c7a4600c3f0e1b045280eaf3464b64e908d2f0a2 | refs/heads/main | 2022-12-30T20:47:36.637165 | 2020-10-13T18:10:46 | 2020-10-13T18:10:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package org.konghao.user.dao;
import org.konghao.vo.User;
public interface IUserDao {
public void add(User user);
}
| [
"wujun728@hotmail.com"
] | wujun728@hotmail.com |
cda5d57f6c6404cfb54ccfc8a26f084603ba928a | eeea20427214baafafdeec01a4779c56df3fb902 | /src/main/java/com/waectr/blog/service/impl/TagServiceImpl.java | ebb09dea7db839c65418a6580353f29232e83b75 | [] | no_license | waectr/simblog | e75d7ce6bbf1627eb01fabb221f182ae25365902 | 72f3e184499977b4a9068c2eafd8bf9609cc8bbf | refs/heads/master | 2020-11-27T17:03:09.534655 | 2019-12-22T08:32:50 | 2019-12-22T08:32:50 | 229,538,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,461 | java | package com.waectr.blog.service.impl;
import com.waectr.blog.dao.TagDOMapper;
import com.waectr.blog.dao.TypeDOMapper;
import com.waectr.blog.dataobject.TagDO;
import com.waectr.blog.dataobject.TypeDO;
import com.waectr.blog.service.TagService;
import com.waectr.blog.service.model.Tag;
import com.waectr.blog.service.model.Type;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Service
public class TagServiceImpl implements TagService {
@Autowired
TagDOMapper tagDOMapper;
@Override
@Transactional
public Tag saveTag(Tag tag) {
TagDO tagDO=convertFromModel(tag);
tagDOMapper.insertSelective(tagDO);
int i=tagDO.getId();
TagDO tagDO1 = tagDOMapper.selectByPrimaryKey(i);
Tag tag1 = convertFromDataObject(tagDO1);
return tag1;
}
private TagDO convertFromModel(Tag tag) {
if(tag==null){
return null;
}
TagDO tagDO=new TagDO();
BeanUtils.copyProperties(tag,tagDO);
if(tag.getId()!=null){
tagDO.setId(new Integer(tag.getId().toString()));
}
return tagDO;
}
private Tag convertFromDataObject(TagDO tagDO){
if(tagDO==null){
return null;
}
Tag tag=new Tag();
BeanUtils.copyProperties(tagDO,tag);
tag.setId(new Long(tagDO.getId()));
return tag;
}
@Override
public Tag getTag(Long id) {
TagDO tagDO = tagDOMapper.selectByPrimaryKey(new Integer(id.toString()));
Tag tag = convertFromDataObject(tagDO);
return tag;
}
@Override
public List<Tag> list() {
List<TagDO> tagDOList = tagDOMapper.selectAll();
List<Tag> tagList=convertFromDataObject(tagDOList);
return tagList;
}
private List<Tag> convertFromDataObject(List<TagDO> tagDOList) {
if(tagDOList==null){
return null;
}
List<Tag> list=new ArrayList<>();
for (TagDO tagDO:tagDOList){
Tag t=new Tag();
BeanUtils.copyProperties(tagDO,t);
t.setId(tagDO.getId().longValue());
list.add(t);
}
return list;
}
@Override
@Transactional
public Tag updateTag(Long id, Tag tag) {
return null;
}
@Override
@Transactional
public void delete(Long id) {
tagDOMapper.deleteByPrimaryKey(new Integer(id.toString()));
}
@Override
public List<Tag> ListTag(String ids) {
List<Long> lists = convertToList(ids);
List<Tag> tagList=new ArrayList<>();
for(Long i:lists){
TagDO tagDO = tagDOMapper.selectByPrimaryKey(new Integer(i.toString()));
Tag tag = convertFromDataObject(tagDO);
tagList.add(tag);
}
return tagList;
}
//获得每个标签的序号
private List<Long> convertToList(String ids) {
List<Long> list = new ArrayList<>();
if (!"".equals(ids) && ids != null) {
String[] idarray = ids.split(",");
for (int i=0; i < idarray.length;i++) {
if(idarray[i]!=null) {
list.add(new Long(idarray[i]));
}
}
}
return list;
}
} | [
"945764528@qq.com"
] | 945764528@qq.com |
c070d2496c537d1b4c7f19a995389fb623a6ddb9 | cb0e7d6493b23e870aa625eb362384a10f5ee657 | /solutions/java/0999.java | 3831a784d4d59b4b8f5a94e92c16c7f1d9fd7f4a | [] | no_license | sweetpand/LeetCode-1 | 0acfa603af254a3350d457803449a91322f2d1a7 | 65f4ef26cb8b2db0b4bf8c42bfdc76421b479f94 | refs/heads/master | 2022-11-14T07:01:42.502172 | 2020-07-12T12:25:56 | 2020-07-12T12:25:56 | 279,088,171 | 1 | 0 | null | 2020-07-12T15:03:20 | 2020-07-12T15:03:19 | null | UTF-8 | Java | false | false | 571 | java | class Solution {
public int numRookCaptures(char[][] board) {
int ans = 0;
int i0 = 0;
int j0 = 0;
for (int i = 0; i < 8; ++i)
for (int j = 0; j < 8; ++j)
if (board[i][j] == 'R') {
i0 = i;
j0 = j;
}
for (int[] d : new int[][] { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } })
for (int i = i0 + d[0], j = j0 + d[1]; 0 <= i && i < 8 && 0 <= j && j < 8; i += d[0], j += d[1]) {
if (board[i][j] == 'p')
++ans;
if (board[i][j] != '.')
break;
}
return ans;
}
} | [
"walkccray@gmail.com"
] | walkccray@gmail.com |
537020943c078e263e3836922a96372fd08ef189 | c875b0a6eb9f5e69444f0f19cf43a1b553449219 | /src/main/java/com/example/banque/Controller/CompteController.java | bc3a222f8893e0c40564d4bfb2e6183cb2692a52 | [] | no_license | amalsikali/Springproject | a88d8ffe0fc6ad4c9ac48e91293569cd4c41b398 | e85e71845cfcb7adc59d0e019c1af6c45fcd7cd7 | refs/heads/main | 2023-05-11T13:29:42.726154 | 2021-05-29T09:46:46 | 2021-05-29T09:46:46 | 371,934,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,786 | java | package com.example.banque.Controller;
import com.example.banque.model.Banque;
import com.example.banque.model.Client;
import com.example.banque.model.Compte;
import com.example.banque.services.ClientService;
import com.example.banque.services.CompteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.Collection;
@Controller
public class CompteController {
@Autowired
CompteService compteService;
@Autowired
ClientService clientService;
@PostMapping(path="/addcompte")
String Addcompte(Compte c){
this.compteService.Add(c);
return "redirect:/showcomptes";
}
@GetMapping(path = "/addcompte")
String showformbanque(Model model) {
Compte compte= new Compte();
model.addAttribute("compte",compte);
Collection<Client> clients ;
clients = this.clientService.FindAll();
model.addAttribute("clients",clients);
return "addCompte";
}
@GetMapping(path = "/showcomptes")
String showcomptes(Model model) {
Collection<Compte> comptes ;
comptes = this.compteService.FindAll();
model.addAttribute("comptes",comptes);
return "showComptes";
}
@PostMapping(path="/deletecompte")
String deletecompte(Long id){
this.compteService.Delete(id);
return "redirect:/showcomptes";
}
@GetMapping(path = "/deletecompte")
String formdeletecompte(Model model) {
Compte compte= new Compte();
model.addAttribute("compte",compte);
return "deleteCompte";
}
}
| [
"amalsikali@gmail.com"
] | amalsikali@gmail.com |
f6f059e3e226be82631c0d4d4fc83629bbf6fff3 | c93e909cfa8a5a0b1a4f5b82956a51e4f06c6303 | /Jabref_Beta_2_7_Docear/src/java/net/sf/jabref/PreviewPanel.java | bdd5a7c24f56be1b3fe57c1dcdbed1ebd61e0244 | [] | no_license | gaobrian/Desktop | 71088da71994660a536c2c29d6e1686dfd7f11a1 | 41fdbb021497eeb3bbfb963a9e388a50ee9777ef | refs/heads/master | 2023-01-13T05:13:46.814353 | 2014-10-29T05:54:50 | 2014-10-29T05:54:50 | 25,906,710 | 2 | 0 | null | 2022-12-26T18:11:07 | 2014-10-29T05:56:26 | Java | UTF-8 | Java | false | false | 8,740 | java | package net.sf.jabref;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.print.PrinterException;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.io.IOException;
import java.io.StringReader;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.JobName;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import net.sf.jabref.export.layout.Layout;
import net.sf.jabref.export.layout.LayoutHelper;
import net.sf.jabref.export.ExportFormats;
/**
* Displays an BibtexEntry using the given layout format.
*
* @author $Author: mortenalver $
* @version $Revision: 3152 $ ($Date: 2007-08-01 20:23:38 +0200 (Mi, 01 Aug
* 2007) $)
*
*/
public class PreviewPanel extends JPanel implements VetoableChangeListener {
/**
* The bibtex entry currently shown
*/
BibtexEntry entry;
MetaData metaData;
/**
* If a database is set, the preview will attempt to resolve strings in the
* previewed entry using that database.
*/
BibtexDatabase database;
Layout layout;
String layoutFile;
public JEditorPane previewPane;
JScrollPane scrollPane;
BasePanel panel;
/**
*
* @param database
* (may be null) Optionally used to resolve strings.
* @param entry
* (may be null) If given this entry is shown otherwise you have
* to call setEntry to make something visible.
* @param panel
* (may be null) If not given no toolbar is shown on the right
* hand side.
* @param metaData
* (must be given) Used for resolving pdf directories for links.
* @param layoutFile
* (must be given) Used for layout
*/
public PreviewPanel(BibtexDatabase database, BibtexEntry entry,
BasePanel panel, MetaData metaData, String layoutFile) {
this(panel, metaData, layoutFile);
this.database = database;
setEntry(entry);
}
/**
*
* @param panel
* (may be null) If not given no toolbar is shown on the right
* hand side.
* @param metaData
* (must be given) Used for resolving pdf directories for links.
* @param layoutFile
* (must be given) Used for layout
*/
public PreviewPanel(BasePanel panel, MetaData metaData, String layoutFile) {
super(new BorderLayout(), true);
this.panel = panel;
this.metaData = metaData;
this.layoutFile = layoutFile;
this.previewPane = createPreviewPane();
// Set up scroll pane for preview pane
scrollPane = new JScrollPane(previewPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(null);
/*
* If we have been given a panel and the preference option
* previewPrintButton is set, show the tool bar
*/
if (panel != null
&& JabRefPreferences.getInstance().getBoolean("previewPrintButton")) {
add(createToolBar(), BorderLayout.LINE_START);
}
add(scrollPane, BorderLayout.CENTER);
}
class PrintAction extends AbstractAction {
public PrintAction() {
super(Globals.lang("Print Preview"), GUIGlobals.getImage("psSmall"));
putValue(SHORT_DESCRIPTION, Globals.lang("Print Preview"));
}
//DocumentPrinter printerService;
public void actionPerformed(ActionEvent arg0) {
// Background this, as it takes a while.
new Thread() {
public void run() {
try {
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new JobName(entry.getCiteKey(), null));
previewPane.print(null, null, true, null, pras, false);
} catch (PrinterException e) {
// Inform the user... we don't know what to do.
JOptionPane.showMessageDialog(PreviewPanel.this,
Globals.lang("Could not print preview") + ".\n"
+ e.getMessage(), Globals
.lang("Printing Entry Preview"),
JOptionPane.ERROR_MESSAGE);
}
}
}.start();
}
}
Action printAction;
public Action getPrintAction() {
if (printAction == null)
printAction = new PrintAction();
return printAction;
}
class CloseAction extends AbstractAction {
public CloseAction() {
super(Globals.lang("Close window"), GUIGlobals.getImage("close"));
putValue(SHORT_DESCRIPTION, Globals.lang("Close window"));
}
public void actionPerformed(ActionEvent e) {
panel.hideBottomComponent();
}
}
Action closeAction;
public Action getCloseAction() {
if (closeAction == null)
closeAction = new CloseAction();
return closeAction;
}
JPopupMenu createPopupMenu() {
JPopupMenu menu = new JPopupMenu();
menu.add(getPrintAction());
return menu;
}
JToolBar createToolBar() {
JToolBar tlb = new JToolBar(JToolBar.VERTICAL);
JabRefPreferences prefs = JabRefPreferences.getInstance();
Action printAction = getPrintAction();
Action closeAction = getCloseAction();
tlb.setMargin(new Insets(0, 0, 0, 2));
// The toolbar carries all the key bindings that are valid for the whole
// window.
ActionMap am = tlb.getActionMap();
InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(prefs.getKey("Close entry preview"), "close");
am.put("close", closeAction);
im.put(prefs.getKey("Print entry preview"), "print");
am.put("print", printAction);
tlb.setFloatable(false);
// Add actions (and thus buttons)
tlb.add(closeAction);
tlb.addSeparator();
tlb.add(printAction);
Component[] comps = tlb.getComponents();
for (int i = 0; i < comps.length; i++)
((JComponent) comps[i]).setOpaque(false);
return tlb;
}
JEditorPane createPreviewPane() {
JEditorPane previewPane = new JEditorPane() {
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}
};
previewPane.setMargin(new Insets(3, 3, 3, 3));
previewPane.setComponentPopupMenu(createPopupMenu());
previewPane.setEditable(false);
previewPane.setContentType("text/html");
previewPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
String address = hyperlinkEvent.getURL().toString();
Util.openExternalViewer(PreviewPanel.this.metaData,
address, "url");
} catch (IOException e) {
e.printStackTrace();
}
}
}
});
return previewPane;
}
public void setDatabase(BibtexDatabase db) {
database = db;
}
public void setMetaData(MetaData metaData) {
this.metaData = metaData;
}
public void readLayout(String layoutFormat) throws Exception {
layoutFile = layoutFormat;
readLayout();
}
public void readLayout() throws Exception {
StringReader sr = new StringReader(layoutFile.replaceAll("__NEWLINE__",
"\n"));
layout = new LayoutHelper(sr)
.getLayoutFromText(Globals.FORMATTER_PACKAGE);
}
public void setLayout(Layout layout) {
this.layout = layout;
}
public void setEntry(BibtexEntry newEntry) {
if (newEntry != entry) {
if (entry != null)
entry.removePropertyChangeListener(this);
newEntry.addPropertyChangeListener(this);
}
entry = newEntry;
try {
readLayout();
update();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void update() {
StringBuffer sb = new StringBuffer();
ExportFormats.entryNumber = 1; // Set entry number in case that is included in the preview layout.
if (entry != null)
sb.append(layout.doLayout(entry, database));
previewPane.setText(sb.toString());
previewPane.invalidate();
previewPane.revalidate();
// Scroll to top:
final JScrollBar bar = scrollPane.getVerticalScrollBar();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
bar.setValue(0);
}
});
}
public boolean hasEntry() {
return (entry != null);
}
/**
* The PreviewPanel has registered itself as an event listener with the
* currently displayed BibtexEntry. If the entry changes, an event is
* received here, and we can update the preview immediately.
*/
public void vetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException {
// TODO updating here is not really necessary isn't it?
// Only if we are visible.
update();
}
}
| [
"mueller@docear.org"
] | mueller@docear.org |
138228b1eb1284fb508985e21e9f18d0d6332742 | a24516f09205cda80a48da1faaeb8b63201282f3 | /src/main/java/com/project/stackoverflow/mapper/UserMapper.java | eb8decd9064245755ee7e0ca8ebba3eefc11c7b4 | [] | no_license | teodoranemtanu/stackoverflow-java-spring | 4be70089ce351fa2675f3442dca65d3354689bcc | 6b44cfebe5a4f978cc7708f32c2a9251cbe97625 | refs/heads/master | 2023-02-18T09:48:43.759123 | 2021-01-15T10:03:32 | 2021-01-15T10:03:32 | 329,115,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.project.stackoverflow.mapper;
import com.project.stackoverflow.model.UserModel;
import org.springframework.jdbc.core.RowMapper;
public class UserMapper {
public static final RowMapper<UserModel> userMapper = (resultSet, i) -> new UserModel(resultSet.getString("id"),
resultSet.getString("first_name"),
resultSet.getString("last_name"),
resultSet.getString("email"),
resultSet.getString("description"),
resultSet.getString("profile_picture")
);
public static RowMapper<UserModel> getUserMapper() {
return userMapper;
}
}
| [
"teodoranemtanu@gmail.com"
] | teodoranemtanu@gmail.com |
d518d25fb7e94544d9099d90bb274eb3283f7077 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/alibaba--druid/6277b490bdd4dfb0c444f1619d756eb841a4a34f/before/EqualTest_interval_mysql.java | 064ac6c278ed3e9bbcb1d7521b5c173f87344aaa | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | package com.alibaba.druid.bvt.sql;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlIntervalExpr;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlExprParser;
import com.alibaba.druid.sql.parser.SQLExprParser;
public class EqualTest_interval_mysql extends TestCase {
public void test_exits() throws Exception {
String sql = "INTERVAL 3 YEAR";
String sql_c = "INTERVAL 3 MONTH";
MySqlIntervalExpr exprA, exprB, exprC;
{
SQLExprParser parser = new MySqlExprParser(sql);
exprA = (MySqlIntervalExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql);
exprB = (MySqlIntervalExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql_c);
exprC = (MySqlIntervalExpr) parser.expr();
}
Assert.assertEquals(exprA, exprB);
Assert.assertNotEquals(exprA, exprC);
Assert.assertTrue(exprA.equals(exprA));
Assert.assertFalse(exprA.equals(new Object()));
Assert.assertEquals(exprA.hashCode(), exprB.hashCode());
Assert.assertEquals(new MySqlIntervalExpr(), new MySqlIntervalExpr());
Assert.assertEquals(new MySqlIntervalExpr().hashCode(), new MySqlIntervalExpr().hashCode());
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
1086750f0c2cce430ad156ed039720e68dbec62e | 691fec6b1fb0623654452f3f4ca3fad87c0ba8ea | /ScriptCollector/src/com/demo/scriptcollector/model/ScriptCollectorModel.java | 1491d693a86ec9ee8ca58473f507f3ddafefe7bb | [] | no_license | tamal2401/Script-Collector | 5ae42d97a7d1fd0577b9f48389458b251a750a87 | 91d702be2ac53fcdb54022f901ee8828f784e294 | refs/heads/master | 2020-06-16T12:12:16.098608 | 2018-12-23T12:40:16 | 2018-12-23T12:40:16 | 195,568,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package com.demo.scriptcollector.model;
/**
* @author TAPU
*
*/
public class ScriptCollectorModel extends DomainModel{
public ScriptCollectorModel(String storyNumber) {
super(storyNumber);
}
}
| [
"onlyjohn98@gmail.com"
] | onlyjohn98@gmail.com |
f97983097694f27d490f8c84928d1cae66123644 | 63fc677e33f4485c912b2b3cd24e2700016b8fec | /3.JavaMultithreading/src/com/javarush/task/task24/task2412/Solution.java | d5e76e6997e6fc0813de284039ebe625dc33bd18 | [] | no_license | Buratinka/JavaRushTasks | 91be275f1255f8a23bd1d1ba4814f091793e65cd | 2adf050ed9f9b5aa36fb7061faafd4b2b1897706 | refs/heads/master | 2020-03-14T10:29:08.146188 | 2018-08-30T08:43:49 | 2018-08-30T08:43:49 | 131,439,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,977 | java | package com.javarush.task.task24.task2412;
import java.text.ChoiceFormat;
import java.text.Format;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/*
Знания - сила!
*/
public class Solution {
public static void main(String[] args) {
List<Stock> stocks = getStocks();
sort(stocks);
Date actualDate = new Date();
printStocks(stocks, actualDate);
}
public static void printStocks(List<Stock> stocks, Date actualDate) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
double[] filelimits = {0d, actualDate.getTime()};
String[] filepart = {"closed {4}", "open {2} and last {3}"};
ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
Format[] testFormats = {null, null, dateFormat, fileform};
MessageFormat pattform = new MessageFormat("{0} {1} | {5} {6}");
pattform.setFormats(testFormats);
for (Stock stock : stocks) {
String name = ((String) stock.get("name"));
String symbol = (String) stock.get("symbol");
double open = !stock.containsKey("open") ? 0 : ((double) stock.get("open"));
double last = !stock.containsKey("last") ? 0 : ((double) stock.get("last"));
double change = !stock.containsKey("change") ? 0 : ((double) stock.get("change"));
Date date = (Date) stock.get("date");
Object[] testArgs = {name, symbol, open, last, change, date, date.getTime()};
System.out.println(pattform.format(testArgs));
}
}
public static void sort(List<Stock> list) {
Collections.sort(list, new Comparator<Stock>() {
public int compare(Stock stock1, Stock stock2)
{
String name1 = (String) stock1.get("name");
String name2 = (String) stock2.get("name");
int result = name1.compareTo(name2);
if(result != 0)
{
return result;
}
else
{
Date date1 = (Date) stock1.get("date");
Date date2 = (Date) stock2.get("date");
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
result = 0;
result = df.format(date1).compareTo(df.format(date2));
if(result != 0){
return result;
}
else
{
double open;
double last;
double profit1;
double profit2;
if (stock1.containsKey("open")) {
open = ((double) stock1.get("open"));
last = ((double) stock1.get("last"));
profit1 = last - open;
} else {
profit1 = ((double) stock1.get("change"));
}
if (stock2.containsKey("open")) {
open = ((double) stock2.get("open"));
last = ((double) stock2.get("last"));
profit2 = last - open;
} else {
profit2 = ((double) stock2.get("change"));
}
return (-Double.compare(profit1, profit2));
}
}
}
});
}
public static class Stock extends HashMap {
public Stock(String name, String symbol, double open, double last) {
put("name", name);
put("symbol", symbol);
put("open", open);
put("last", last);
put("date", getRandomDate(2020));
}
public Stock(String name, String symbol, double change, Date date) {
put("name", name);
put("symbol", symbol);
put("date", date);
put("change", change);
}
}
public static List<Stock> getStocks() {
List<Stock> stocks = new ArrayList();
stocks.add(new Stock("Fake Apple Inc.", "AAPL", 125.64, 123.43));
stocks.add(new Stock("Fake Cisco Systems, Inc.", "CSCO", 25.84, 26.3));
stocks.add(new Stock("Fake Google Inc.", "GOOG", 516.2, 512.6));
stocks.add(new Stock("Fake Intel Corporation", "INTC", 21.36, 21.53));
stocks.add(new Stock("Fake Level 3 Communications, Inc.", "LVLT", 5.55, 5.54));
stocks.add(new Stock("Fake Microsoft Corporation", "MSFT", 29.56, 29.72));
stocks.add(new Stock("Fake Nokia Corporation (ADR)", "NOK", .1, getRandomDate()));
stocks.add(new Stock("Fake Oracle Corporation", "ORCL", .15, getRandomDate()));
stocks.add(new Stock("Fake Starbucks Corporation", "SBUX", .03, getRandomDate()));
stocks.add(new Stock("Fake Yahoo! Inc.", "YHOO", .32, getRandomDate()));
stocks.add(new Stock("Fake Applied Materials, Inc.", "AMAT", .26, getRandomDate()));
stocks.add(new Stock("Fake Comcast Corporation", "CMCSA", .5, getRandomDate()));
stocks.add(new Stock("Fake Sirius Satellite", "SIRI", -.03, getRandomDate()));
return stocks;
}
public static Date getRandomDate() {
return getRandomDate(1970);
}
public static Date getRandomDate(int startYear) {
int year = startYear + (int) (Math.random() * 30);
int month = (int) (Math.random() * 12);
int day = (int) (Math.random() * 28);
GregorianCalendar calendar = new GregorianCalendar(year, month, day);
return calendar.getTime();
}
}
| [
"“oleg.shved.shvets@gmail.com”"
] | “oleg.shved.shvets@gmail.com” |
cdc6ff393677ff5bc7df5c2c9bd644b77a4342b4 | b13888027d371521f4d31ed15d8a1096627d19fe | /core/OntGDA/src/gda/planner/PlanPositionAttackAirSneak.java | 71dd367ccd8493cea425dcc0050b06be935bb446 | [
"MIT"
] | permissive | dtdannen/LUiGi-hierarchical-GDA | f6256eb4adcdc62edb4d4c9a32da1a61a0276f3a | 6e31f7178a48ffb886475fc59d6469d8262874c9 | refs/heads/master | 2021-03-30T17:09:48.668396 | 2019-05-22T14:32:02 | 2019-05-22T14:32:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,006 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gda.planner;
import common.Pair;
import gda.GlobalInfo;
import gda.GoalType;
import gda.components.Expectation;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import ontology.OntologyInfo;
/**
*
* @author Dustin Dannenhauer
* @email dtd212@lehigh.edu
* @date Aug 12, 2013
*/
public class PlanPositionAttackAirSneak implements Plan{
private Plan plan;
private Plan parentPlan;
private int tarRegion = -1;
private ArrayList<PlanStep> planSteps = new ArrayList<>();
private GoalType goalType = GoalType.ATTACK_POSITION_AIR_SNEAK;
private ArrayList<Pair<String, Integer>> unitTypeCounts;
private int currentPlanStepIndex = -1;
private int ID;
private int myStartingRegion = GlobalInfo.getStartingRegionID();
private boolean isReadyToMoveToNextPlanStep = false;
private ArrayList<Integer> nextStepUnitIds = new ArrayList<Integer>();
private boolean finished = false;
public PlanPositionAttackAirSneak() {
PlanStep step = null;
unitTypeCounts = new ArrayList<Pair<String, Integer>>();
unitTypeCounts.add(new Pair<String, Integer>("Terran_Wraith", 3));
////// Step 1 - Acquire Units //////
ArrayList<Expectation> step1PreExpectations = new ArrayList<Expectation>();
ArrayList<Expectation> step1PostExpectations = new ArrayList<Expectation>();
// pre expectations
step1PreExpectations.add(new Expectation(Expectation.ExpectationName.CONTROL_REGION).setRegionId(myStartingRegion));
// post expectations
for (Pair<String, Integer> unitTypeCount : unitTypeCounts) {
step1PostExpectations.add(new Expectation(Expectation.ExpectationName.HAVE_UNITS).addUnitCountPair(unitTypeCount));
}
step = new PlanStep(PlanStepType.PRODUCE_UNITS, goalType, step1PreExpectations, step1PostExpectations, this);
for (Pair<String, Integer> unitTypeCount : unitTypeCounts) {
step.addUnitTypeCount(unitTypeCount); // only needed for acquire unit plan step
}
this.planSteps.add(step);
////// Step 2 - Move Units //////
ArrayList<Expectation> step2PreExpectations = new ArrayList<Expectation>();
ArrayList<Expectation> step2PostExpectations = new ArrayList<Expectation>();
// pre expectations
step2PreExpectations.add(new Expectation(Expectation.ExpectationName.CONTROL_REGION).setRegionId(myStartingRegion));
for (Pair<String, Integer> unitTypeCount : unitTypeCounts) {
step2PreExpectations.add(new Expectation(Expectation.ExpectationName.HAVE_UNITS).addUnitCountPair(unitTypeCount));
}
// post expectations:
//step2PostExpectations.add(new Expectation(Expectation.ExpectationName.UNITS_IN_REGION).setRegionId());
step = new PlanStep(PlanStepType.CORNER_MOVE_UNITS, goalType, step2PreExpectations, step2PostExpectations, this);
// unique part of this plan
step.setDestination(GlobalInfo.getNearestMapCorner(OntologyInfo.getInstance().getRegionCenterPosition(GlobalInfo.getEnemyStartingRegionID())));
//step.setDestRegionId(GlobalInfo.getEnemyStartingRegionID());
this.planSteps.add(step);
////// Step 3 - Attack //////
// ArrayList<Expectation> step3PreExpectations = new ArrayList<Expectation>();
// ArrayList<Expectation> step3PostExpectations = new ArrayList<Expectation>();
//
// step3PostExpectations.add(new Expectation(Expectation.ExpectationName.CONTROL_REGION).setRegionId(GlobalInfo.getEnemyStartingRegionID()));
// step = new PlanStep(PlanStepType.ATTACK_WORKERS, goalType, step3PreExpectations, step3PostExpectations, this);
// step.setDestination(OntologyInfo.getInstance().getRegionCenterPosition(GlobalInfo.getEnemyStartingRegionID()));
// this.planSteps.add(step);
}
/**
* Assumed target region is enemy starting region, but does not produce units, instead uses given units
*/
public PlanPositionAttackAirSneak(ArrayList<Integer> unitIds) {
//ArrayList<Pair<String, Integer>> unitTypeCounts = new ArrayList<Pair<String, Integer>>();
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Marine", 10));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Siege_Tank_Tank_Mode", 5));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Firebat", 6));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Medic", 3));
this.plan = new PlanAttackDirect(GoalType.ATTACK_AIR_DIRECT, unitIds, true);
}
/**
* Constructs a plan with the given target region
* @param targetRegion
*/
public PlanPositionAttackAirSneak(int targetRegion) {
ArrayList<Pair<String, Integer>> unitTypeCounts = new ArrayList<Pair<String, Integer>>();
unitTypeCounts.add(new Pair<String, Integer>("Terran_Wraith", 2));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Siege_Tank_Tank_Mode", 5));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Firebat", 6));
//unitTypeCounts.add(new Pair<String, Integer>("Terran_Medic", 3));
this.plan = new PlanAttackDirect(GoalType.ATTACK_AIR_DIRECT, unitTypeCounts, targetRegion);
tarRegion = targetRegion;
}
public boolean moveToNextPlanSteps() {
if(this.isPlanOnLastStep()) return false;
this.currentPlanStepIndex++;
// update unit ids for the expectations
// pre expectations
for (Expectation e : this.planSteps.get(currentPlanStepIndex).getPreExpectations()) {
e.setUnitIDs(this.nextStepUnitIds);
}
// post expectations
for (Expectation e : this.planSteps.get(currentPlanStepIndex).getPostExpectations()) {
e.setUnitIDs(this.nextStepUnitIds);
}
// reset isReadyToMoveToNextPlanStep
this.isReadyToMoveToNextPlanStep = false;
return true;
}
public ArrayList<PlanStep> getCurrentPlanSteps() {
ArrayList<PlanStep> steps = new ArrayList<PlanStep>();
steps.add(this.planSteps.get(currentPlanStepIndex));
return steps;
}
public boolean isPlanOnLastStep() {
return this.currentPlanStepIndex >= this.planSteps.size()-1;
}
public int getID() {
return this.ID;
}
@Override
public void reset() {
this.currentPlanStepIndex = -1;
}
@Override
public void setID(int ID) {
this.ID = ID;
}
@Override
public void setReadyToMoveToNextPlanStep(ArrayList<Integer> unitIds) {
this.isReadyToMoveToNextPlanStep = true;
this.nextStepUnitIds = unitIds;
}
@Override
public boolean isReadyToMoveToNextPlanStep() {
return this.isReadyToMoveToNextPlanStep;
}
@Override
public Plan getParentPlan() {
return this.parentPlan;
}
@Override
public void setParentPlan(Plan p) {
this.parentPlan = p;
}
@Override
public boolean isPrimitive() {
return true;
}
@Override
public ArrayList<Plan> getPrimitivePlans() {
JOptionPane.showMessageDialog(null, "Calling getPrimitivePlans() on a non-primitive plan, with plan id <may be null>");
return null;
}
@Override
public ArrayList<Integer> getNextStepUnitIds() {
return this.nextStepUnitIds;
}
@Override
public void setUnitIds(ArrayList<Integer> unitIds) {
this.nextStepUnitIds = unitIds;
}
@Override
public boolean isFinished() {
return this.finished;
}
@Override
public void setFinished() {
// TODO Auto-generated method stub
this.finished = true;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return "Position Attack Air Sneak";
}
@Override
public GoalType getGoalType() {
return this.goalType;
}
@Override
public void removeAbortedSubPlan(Plan failedPlan) {
// TODO Auto-generated method stub
}
}
| [
"xig514@lehigh.edu"
] | xig514@lehigh.edu |
9c4a91f48df469af988f08d62ce475dee67b8e92 | 5b8c2dd9fcd176f5c77b959c8357402e7ce0474d | /lambda-core/src/main/java/com/yatop/lambda/core/enums/SystemParameterEnum.java | 3256d668a1c29f0ff8df9ff2aa12f34bf7db226c | [] | no_license | ruhengChen/lambda-mls | 6cbfc5804193f68bbc98a5900d7e3fa91cf6ef00 | 2450c25c25c91bb3af1946fbf21206a6636d71d0 | refs/heads/master | 2020-04-20T05:45:30.853959 | 2019-02-13T02:36:57 | 2019-02-13T02:36:57 | 168,664,310 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,171 | java | package com.yatop.lambda.core.enums;
public enum SystemParameterEnum {
PR_CACHE_DATA_EXPIRE_DAYS( "PR_CACHE_DATA_EXPIRE_DAYS", "项目管理 | 临时缓存数据表过期天数","21"),
WK_FLOW_MAX_NODES( "WK_FLOW_MAX_NODES", "工作流引擎 | 工作流正常节点最大数量","512"),
WK_FLOW_SCHEMA_MAX_FIELDS( "WK_FLOW_SCHEMA_MAX_FIELDS", "工作流引擎 | 工作流数据表最大字段数量","1024"),
WK_FLOW_MAX_GLOBAL_PARAMETERS( "WK_FLOW_MAX_GLOBAL_PARAMETERS", "工作流引擎 | 工作流最大全局参数数量","16"),
CF_HDFS_SITE_defaultFS( "CF_HDFS_SITE_defaultFS", "计算框架 | HDFS默认文件系统", "hdfs://127.0.0.1:9000"),
CF_HDFS_WORK_ROOT( "CF_HDFS_WORK_ROOT", "计算框架 | HDFS工作根目录","/user/lambda_mls"),
CF_LOCAL_WORK_ROOT( "CF_LOCAL_WORK_ROOT", "计算框架 | 本地工作根目录","/opt/lambda_mls"),
CF_JOB_FILE_DIR_NAME( "CF_JOB_FILE_DIR_NAME", "计算框架 | 作业文件存放目录名","proc"),
CF_DATA_FILE_DIR_NAME( "CF_DATA_FILE_DIR_NAME", "计算框架 | 数据文件存放目录名","dw_data"),
CF_MODEL_FILE_DIR_NAME( "CF_MODEL_FILE_DIR_NAME", "计算框架 | 模型文件存放目录名","mw_data"),
CF_FLOW_FILE_DIR_NAME( "CF_FLOW_FILE_DIR_NAME", "计算框架 | 工作流文件存放目录名","flow_data"),
CF_LIB_FILE_DIR_NAME( "CF_LIB_FILE_DIR_NAME", "计算框架 | 库文件存放目录名","lib"),
CF_HDFS_COMPONENT_JAR_DIR( "CF_HDFS_COMPONENT_JAR_DIR", "计算框架 | hdfs scala组件jar包目录","/user/lambda_mls/lib/spark"),
CF_HDFS_COMPONENTT_JAR_FILE( "CF_HDFS_COMPONENTT_JAR_FILE", "计算框架 | hdfs scala组件jar包文件名","lambda-component-1.0.0.jar"),
CF_SPARK_EXECUTOR_NUMBER( "CF_SPARK_EXECUTOR_NUMBER", "计算框架 | spark executor数量","2"),
CF_SPARK_EXECUTOR_CORES( "CF_SPARK_EXECUTOR_CORES", "计算框架 | spark executor线程数量","8"),
CF_SPARK_EXECUTOR_MEMORY( "CF_SPARK_EXECUTOR_MEMORY", "计算框架 | spark executor内存大小","2048"),
CF_SPARK_DRIVER_CORES( "CF_SPARK_DRIVER_CORES", "计算框架 | spark driver线程数量","8"),
CF_SPARK_DRIVER_MEMORY( "CF_SPARK_DRIVER_MEMORY", "计算框架 | spark driver内存大小","2048");
private String paramCode;
private String paramName;
private String paramDefaultValue;
public String getParamCode() {
return paramCode;
}
public String getParamName() {
return paramName;
}
public String getParamDefaultValue() {
return paramDefaultValue;
}
SystemParameterEnum(String paramCode, String paramName, String paramDefaultValue) {
this.paramCode = paramCode;
this.paramName = paramName;
this.paramDefaultValue = paramDefaultValue;
}
}
| [
"tomlee714@126.com"
] | tomlee714@126.com |
de60dcbe04381b74cee9dd296c023d78739b87ba | c05d7c4fb73f555c6b22428fc751947b981f13db | /app/src/main/java/com/techjini/udacityapp/utility/AppLogger.java | 0f13e6d9e062638bbd96a042fe9bf72073cee4c5 | [] | no_license | shweta-techjini/udacityProject | 576ebb486d681cf15392067ca4aaaf2e6d8a0b30 | b61e485f1702121f6b920bd3fc89b570de524d62 | refs/heads/master | 2021-01-21T13:18:19.249730 | 2016-05-13T15:06:37 | 2016-05-13T15:06:37 | 52,960,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,476 | java | package com.techjini.udacityapp.utility;
import android.util.Log;
/**
* Created by Shweta on 2/27/16.
*/
public class AppLogger {
private static String TAG = "Udacity";
private static final boolean LOG_ENABLE = true;
private AppLogger() {
}
public static void v(final Object object, final String message) {
if (LOG_ENABLE) {
Log.v(TAG, object.getClass().getSimpleName() + "::" + message);
}
}
public static void i(final Object object, final String message) {
if (LOG_ENABLE) {
Log.i(TAG, object.getClass().getSimpleName() + "::" + message);
}
}
public static void d(final Object object, final String message) {
if (LOG_ENABLE) {
Log.d(TAG, object.getClass().getSimpleName() + "::" + message);
}
}
public static void w(final Object object, final String message) {
if (LOG_ENABLE) {
Log.w(TAG, object.getClass().getSimpleName() + "::" + message);
}
}
public static void e(final Object object, final String message) {
if (LOG_ENABLE) {
Log.e(TAG, object.getClass().getSimpleName() + "::" + message);
}
}
public static void e(Object object, final String message,
final Throwable throwable) {
if (LOG_ENABLE) {
Log.e(TAG, object.getClass().getSimpleName() + "::" + message,
throwable);
}
}
}
| [
"shweta@techjini.com"
] | shweta@techjini.com |
d40d20a70f1315248fe967b313101ced68467e6b | 0a4a1d5a7f190cb904d3b0c96bc5202d4f431fcc | /aidan-design-pattern-04-singleton/src/main/java/org/aidan/properties/Client.java | 1f7f137368f30cf55287608da7c6a2962151ed33 | [] | no_license | huxiaoning/aidan-code | 02f7ee0250474f5d9acaa84b1aba492138ae8ee5 | 8f6a0bcc40412e86d56fd7477a0a764f1670580b | refs/heads/master | 2020-03-27T09:03:05.222778 | 2018-12-24T05:44:16 | 2018-12-24T05:44:16 | 146,309,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package org.aidan.properties;
public class Client {
public static void main(String[] args) {
AppConfig appConfig = AppConfig.getInstance();
String driver = appConfig.getProperty("driver");
String url = appConfig.getProperty("url");
String user = appConfig.getProperty("user");
String password = appConfig.getProperty("password");
System.out.println(driver);
System.out.println(url);
System.out.println(user);
System.out.println(password);
}
}
| [
"huxiaoningsworld@sina.com"
] | huxiaoningsworld@sina.com |
502ea83d40afd7ca483039cd07b4913258a88c77 | d0d7b939b4c8bd712ba5523fd715bd91ddbdc87c | /AutoUHCHub/src/mc/autouhc/hub/menu/MatchCreatorSetSlotsMenu.java | 34db93e898e56202d522fc47e6e1c142df43861b | [] | no_license | xMakerx/GitHubPortfolio | 3ce8178352c66985a22fc1abb065b5287b1c265e | 3d85ff6e2a0baa8a894833d3a42e2d8492146677 | refs/heads/master | 2023-02-07T19:29:57.160253 | 2023-01-27T00:15:53 | 2023-01-27T00:15:53 | 189,980,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package mc.autouhc.hub.menu;
import mc.autouhc.hub.AutoUHCHub;
import mc.autouhc.hub.creator.MatchCreator;
import mc.autouhc.hub.util.ConfigUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
public class MatchCreatorSetSlotsMenu extends MatchCreatorMenu {
public MatchCreatorSetSlotsMenu(AutoUHCHub instance, Player player, MatchCreator matchCreator) {
super(instance, generateTitle(instance.getMessages(), "setSlots"), player, matchCreator);
}
public void show() {
super.show();
final ItemStack decreaseItem = ConfigUtils.nameItem(settings.getBackPageItem(),
msgs.getColoredString("decreaseSlots"));
ui.setItem(12, decreaseItem);
final ItemStack infoItem = ConfigUtils.nameItem(settings.getTeamItem(),
msgs.color(String.format("&b&lSlots: %d", matchCreator.getSlots())));
ui.setItem(13, infoItem);
final ItemStack increaseItem = ConfigUtils.nameItem(settings.getNextPageItem(),
msgs.getColoredString("increaseSlots"));
ui.setItem(14, increaseItem);
final ItemStack headerItem = ConfigUtils.nameItem(settings.getSlotsItem(),
msgs.getColoredString("slots"));
ui.setItem(4, headerItem);
super.openIfNeeded();
}
@Override
public void clickPerformed(InventoryClickEvent evt) {
int clickedSlot = evt.getSlot();
if(clickedSlot == 12) {
matchCreator.setSlots(matchCreator.getSlots() - 1);
show();
}else if(clickedSlot == 14) {
matchCreator.setSlots(matchCreator.getSlots() + 1);
show();
}else if(clickedSlot == 18) {
MatchCreatorMenu menu = new MatchCreatorSelectScenariosMenu(main, viewer, matchCreator);
menu.show();
main.getMenuEventsListener().setMenu(viewer.getUniqueId(), menu);
}else if(clickedSlot == 26) {
MatchCreatorConfirmationMenu confirmationMenu = new MatchCreatorConfirmationMenu(main, viewer, matchCreator);
confirmationMenu.show();
main.getMenuEventsListener().setMenu(viewer.getUniqueId(), confirmationMenu);
}
}
}
| [
"maverick.liberty29@gmail.com"
] | maverick.liberty29@gmail.com |
b1461c50d3311942ebfc813d97023775a1520ade | 67310b5d7500649b9d53cf62226ec2d23468413c | /trunk/modules/testcase-generator-intents/src/Mapping.java | f6c0c63e689ac273e51ef4ec6a4760b3fc4397c0 | [] | no_license | csnowleopard/guitar | e09cb77b2fe8b7e38d471be99b79eb7a66a5eb02 | 1fa5243fcf4de80286d26057db142b5b2357f614 | refs/heads/master | 2021-01-19T07:53:57.863136 | 2013-06-06T15:26:25 | 2013-06-06T15:26:25 | 10,353,457 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,680 | java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class Mapping {
static HashMap<String, HashSet<Intent>> temp = new HashMap<String, HashSet<Intent>>();
static HashSet<HashMap<Integer, String>> completePath = new HashSet<HashMap<Integer,String>>();
public static void main(String args[]){
Intent ia = new Intent(); ia.activity = "baba.b";
Intent ib = new Intent(); ib.activity = "caca.c";
Intent ic = new Intent(); ic.activity = "aba.a";
Intent id = new Intent(); id.activity = "aba.a";
HashSet<Intent> ha = new HashSet<Intent>(); ha.add(ia);
HashSet<Intent> hb = new HashSet<Intent>(); hb.add(ib);
HashSet<Intent> hc = new HashSet<Intent>(); hc.add(ic);
HashSet<Intent> hd = new HashSet<Intent>(); hd.add(id);
temp.put("aba.a", ha); temp.put("baba.b", hb); temp.put("caca.c", hc);
temp.put("d", hd);
for(String src: temp.keySet()){
HashMap<Integer,String> path = new HashMap<Integer,String>();
path.put(1,src);
Boolean bla = iterate(path, src);
}
for(HashMap<Integer, String> h: completePath){
for(int i = 1; i < h.size(); i++)
System.out.print(h.get(i) + " -> ");
System.out.println();
}
}
public static boolean iterate(HashMap<Integer,String> path, String curAct){
if(!temp.containsKey(curAct)){
completePath.add(path);
return true;
}
for(Intent targetIntent: temp.get(curAct)){
String act = targetIntent.activity;
if(path.values().contains(act)){
completePath.add(path);
} else {
int i = path.size()+1;
path.put(i, act);
Boolean bla = iterate(path, act);
}
}
return true;
}
}
| [
"csnowleopard@gmail.com"
] | csnowleopard@gmail.com |
e35987d0a500f3e6525a2b4c4f858ec59d6e4186 | 781e2692049e87a4256320c76e82a19be257a05d | /assignments/java/lab02/full_src/67/DateConverter.java | 81df66d9679a3e8fa8dba24a292ed6f4d97faa47 | [] | no_license | itsolutionscorp/AutoStyle-Clustering | 54bde86fe6dbad35b568b38cfcb14c5ffaab51b0 | be0e2f635a7558f56c61bc0b36c6146b01d1e6e6 | refs/heads/master | 2020-12-11T07:27:19.291038 | 2016-03-16T03:18:00 | 2016-03-16T03:18:42 | 59,454,921 | 4 | 0 | null | 2016-05-23T05:40:56 | 2016-05-23T05:40:56 | null | UTF-8 | Java | false | false | 1,278 | java | import java.io.*;
public class DateConverter {
// Given a day number in 2008, an integer between 1 and 366,
// as a command-line argument, prints the date in month/day format.
// Example: java DateConverter 365
// should print 12/30
// The code is missing two assignment statements.
public static void main (String[] args) {
int dayOfYear = 0;
try {
dayOfYear = Integer.parseInt (args[0]);
} catch (NumberFormatException e) {
e.printStackTrace();
}
int month, dateInMonth, daysInMonth;
month = 1;
daysInMonth = 31;
while (dayOfYear > daysInMonth) {
// *** Here is one possible place to put assignment statements.
month = month + 1;
dayOfYear = dayOfYear - daysInMonth;
if (month == 2) {
daysInMonth = 29;
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
daysInMonth = 30;
} else {
daysInMonth = 31;
}
// *** Here is another possible place to put assignment statements.
}
dateInMonth = dayOfYear;
System.out.println (month + "/" + dateInMonth);
}
}
| [
"moghadam.joseph@gmail.com"
] | moghadam.joseph@gmail.com |
9331b939bbfbd9f5a75bedeb2fbab33da88a06b8 | 465adc207b742df720bf4d61f6be59a4c6a3571a | /src/main/java/com/upgrad/Eshop/controllers/ProductController.java | f807d2c0ccd1bab598795db44d951720069fd059 | [] | no_license | ajayajju2412/capstone-backend | 77ad6d434adaac28d6a28bea9b87559a0e76b57b | af0fed71682f2edbcb5bf52bd27fb811efe38a53 | refs/heads/master | 2022-12-26T14:26:26.600085 | 2020-10-06T15:48:59 | 2020-10-06T15:48:59 | 300,173,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,726 | java | package com.upgrad.Eshop.controllers;
import com.upgrad.Eshop.dtos.ProductDTO;
import com.upgrad.Eshop.entities.Product;
import com.upgrad.Eshop.entities.Users;
import com.upgrad.Eshop.exceptions.ProductNotFoundException;
import com.upgrad.Eshop.exceptions.UserDetailsNotFoundException;
import com.upgrad.Eshop.exceptions.UserRoleDetailsNotFoundException;
import com.upgrad.Eshop.security.jwt.JwtTokenProvider;
import com.upgrad.Eshop.services.ProductService;
import com.upgrad.Eshop.services.UserService;
import com.upgrad.Eshop.utils.DTOEntityConverter;
import com.upgrad.Eshop.utils.EntityDTOConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@RestController
public class ProductController {
@Autowired
private ProductService productService;
@Autowired
private UserService userService;
@Autowired
EntityDTOConverter entityDTOConverter;
@Autowired
DTOEntityConverter dtoEntityConverter;
@Autowired
JwtTokenProvider jwtTokenProvider;
//work2
@PostMapping(value="/products")
public ResponseEntity addProduct(@RequestBody ProductDTO productDTO, @RequestHeader(value = "X-ACCESS-TOKEN") String jwtToken) throws UserRoleDetailsNotFoundException, UserDetailsNotFoundException {
System.out.println("entered addProduct");
String username = jwtTokenProvider.getUsername(jwtToken);
if(userService.getUserByUsername(username) == null){
ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Please Login first to access this endpoint!");
}
if(!userService.getUserByUsername(username).getRole().equalsIgnoreCase("ADMIN")){
ResponseEntity.status(HttpStatus.FORBIDDEN).body("You are not authorized to access this endpoint!");
}
Product newProduct = dtoEntityConverter.convertToProductEntity(productDTO);
newProduct.setCreated(new Date(System.currentTimeMillis()));
newProduct.setUpdated(new Date(System.currentTimeMillis()));
Product savedProduct = productService.saveProduct(newProduct);
ProductDTO savedProductDTO = entityDTOConverter.convertToProductDTO(savedProduct);
System.out.println("addProduct successful");
return ResponseEntity.status(HttpStatus.MULTI_STATUS.OK).body(savedProductDTO);
}
//work1
@GetMapping(value="/products/{id}")
public ResponseEntity fetchProduct(@PathVariable int id) throws ProductNotFoundException {
System.out.println("entered fetchProduct in ProductController");
Product responseProduct = productService.getProduct(id);
if(responseProduct == null){
//return ResponseEntity.status(HttpStatus.).body(user);
//return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(model);
System.out.println("No product");
}
ProductDTO responseProductDTO = entityDTOConverter.convertToProductDTO(responseProduct);
//logger.debug("Get movie details :" + responseMovieDTO);
System.out.println("successfull product fetch");
return ResponseEntity.status(HttpStatus.OK).body(responseProduct);
//return productService.getProduct(id).orElse(null);
}
@PutMapping("/products/{id}")
public Product modifyProduct(@PathVariable int id, @RequestBody Product product) throws ProductNotFoundException {
return productService.updateProduct(id,product);
}
@DeleteMapping("/products/{id}")
public String removeProduct(@PathVariable int id){
return productService.deleteProduct(id);
}
}
| [
"ajayajju2412@github.com"
] | ajayajju2412@github.com |
808c30f9486f49f71de912f958845410fd7dc8b7 | 9aa8546eb6f738d03916428c4343b8b8537b9ff1 | /enki-core/src/main/java/com/github/stcarolas/enki/core/RepoHandler.java | e71fab8d54e6832e0028cd7d62cc2b6295118b0f | [
"Apache-2.0"
] | permissive | DNAlchemist/Enki | f04dbec77435219a3df2efe7da50d8ebd916905b | fe01035c6a106bbcc44c19153beb21b00de06f6c | refs/heads/master | 2020-12-22T04:11:15.304938 | 2019-12-10T10:47:27 | 2019-12-10T10:47:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | package com.github.stcarolas.enki.core;
public interface RepoHandler {
void analyze(Repo repo);
}
| [
"stcarolas@gmail.com"
] | stcarolas@gmail.com |
b6c504d7abaef55c2a8324ffde8ab16e98bcf41e | b2e156ad1a66da5d24170a7eb849f97ec1f03030 | /src/java/Model/Materials.java | 117a6d47cce6723600c7658aa6e3a59a961cf9f8 | [] | no_license | lanwar-prog/Manufacturing_execution_system | 839bf6102912b10539ef05d708b85175045a8c10 | 5c8c5ab439a0db155750eac3112aad8331496f62 | refs/heads/master | 2023-01-10T22:30:27.155212 | 2020-11-08T05:52:04 | 2020-11-08T05:52:04 | 310,892,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Model;
public class Materials {
private Integer id_material;
private String name;
private Integer number;
private Integer ed_id;
private Integer supplier_id;
private String ed_name;
private String s_name;
private String s_city;
public Integer getId_material() {
return id_material;
}
public void setId_material(Integer id_material) {
this.id_material = id_material;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Integer getEd_id() {
return ed_id;
}
public void setEd_id(Integer ed_id) {
this.ed_id = ed_id;
}
public Integer getSupplier_id() {
return supplier_id;
}
public void setSupplier_id(Integer supplier_id) {
this.supplier_id = supplier_id;
}
public String getEd_name() {
return ed_name;
}
public void setEd_name(String ed_name) {
this.ed_name = ed_name;
}
public String getS_name() {
return s_name;
}
public void setS_name(String s_name) {
this.s_name = s_name;
}
public String getS_city() {
return s_city;
}
public void setS_city(String s_city) {
this.s_city = s_city;
}
@Override
public String toString() {
return "Materials{" + "id_material=" + id_material + ", name=" + name + ", number=" + number + ", ed_id=" + ed_id + ", supplier_id=" + supplier_id + ", ed_name=" + ed_name + ", s_name=" + s_name + ", s_city=" + s_city + '}';
}
}
| [
"lanwar@mail.ru"
] | lanwar@mail.ru |
cffcab779a6349273fdc490eab6ff7ca31ff4df1 | 8d9c24439f31fe0eb2e70326ceb3a3bdd136713d | /airports/AirportData/AirportDataProto.java | 1a2c4266ec1ce29893e4772fc52a8af9e45b3d7c | [] | no_license | 901/protocol-buffers | d794a28c6b2e120bad0ad501504b08f885bc77ae | 24790eff6b94db14fd91e79473874d8b6be9ce2e | refs/heads/master | 2021-01-19T04:43:08.470652 | 2017-04-06T05:01:05 | 2017-04-06T05:01:05 | 87,387,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 57,075 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: airportdata.proto
package AirportData;
public final class AirportDataProto {
private AirportDataProto() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface AirportOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required string state = 1;
/**
* <code>required string state = 1;</code>
*/
boolean hasState();
/**
* <code>required string state = 1;</code>
*/
java.lang.String getState();
/**
* <code>required string state = 1;</code>
*/
com.google.protobuf.ByteString
getStateBytes();
// required string name = 2;
/**
* <code>required string name = 2;</code>
*/
boolean hasName();
/**
* <code>required string name = 2;</code>
*/
java.lang.String getName();
/**
* <code>required string name = 2;</code>
*/
com.google.protobuf.ByteString
getNameBytes();
// required string code = 3;
/**
* <code>required string code = 3;</code>
*/
boolean hasCode();
/**
* <code>required string code = 3;</code>
*/
java.lang.String getCode();
/**
* <code>required string code = 3;</code>
*/
com.google.protobuf.ByteString
getCodeBytes();
// required double lat = 4;
/**
* <code>required double lat = 4;</code>
*/
boolean hasLat();
/**
* <code>required double lat = 4;</code>
*/
double getLat();
// required double lon = 5;
/**
* <code>required double lon = 5;</code>
*/
boolean hasLon();
/**
* <code>required double lon = 5;</code>
*/
double getLon();
}
/**
* Protobuf type {@code airportdata.Airport}
*/
public static final class Airport extends
com.google.protobuf.GeneratedMessage
implements AirportOrBuilder {
// Use Airport.newBuilder() to construct.
private Airport(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Airport(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Airport defaultInstance;
public static Airport getDefaultInstance() {
return defaultInstance;
}
public Airport getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Airport(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
state_ = input.readBytes();
break;
}
case 18: {
bitField0_ |= 0x00000002;
name_ = input.readBytes();
break;
}
case 26: {
bitField0_ |= 0x00000004;
code_ = input.readBytes();
break;
}
case 33: {
bitField0_ |= 0x00000008;
lat_ = input.readDouble();
break;
}
case 41: {
bitField0_ |= 0x00000010;
lon_ = input.readDouble();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return AirportData.AirportDataProto.internal_static_airportdata_Airport_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return AirportData.AirportDataProto.internal_static_airportdata_Airport_fieldAccessorTable
.ensureFieldAccessorsInitialized(
AirportData.AirportDataProto.Airport.class, AirportData.AirportDataProto.Airport.Builder.class);
}
public static com.google.protobuf.Parser<Airport> PARSER =
new com.google.protobuf.AbstractParser<Airport>() {
public Airport parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Airport(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Airport> getParserForType() {
return PARSER;
}
private int bitField0_;
// required string state = 1;
public static final int STATE_FIELD_NUMBER = 1;
private java.lang.Object state_;
/**
* <code>required string state = 1;</code>
*/
public boolean hasState() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string state = 1;</code>
*/
public java.lang.String getState() {
java.lang.Object ref = state_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
state_ = s;
}
return s;
}
}
/**
* <code>required string state = 1;</code>
*/
public com.google.protobuf.ByteString
getStateBytes() {
java.lang.Object ref = state_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
state_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required string name = 2;
public static final int NAME_FIELD_NUMBER = 2;
private java.lang.Object name_;
/**
* <code>required string name = 2;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string name = 2;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
* <code>required string name = 2;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required string code = 3;
public static final int CODE_FIELD_NUMBER = 3;
private java.lang.Object code_;
/**
* <code>required string code = 3;</code>
*/
public boolean hasCode() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string code = 3;</code>
*/
public java.lang.String getCode() {
java.lang.Object ref = code_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
code_ = s;
}
return s;
}
}
/**
* <code>required string code = 3;</code>
*/
public com.google.protobuf.ByteString
getCodeBytes() {
java.lang.Object ref = code_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
code_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required double lat = 4;
public static final int LAT_FIELD_NUMBER = 4;
private double lat_;
/**
* <code>required double lat = 4;</code>
*/
public boolean hasLat() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required double lat = 4;</code>
*/
public double getLat() {
return lat_;
}
// required double lon = 5;
public static final int LON_FIELD_NUMBER = 5;
private double lon_;
/**
* <code>required double lon = 5;</code>
*/
public boolean hasLon() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required double lon = 5;</code>
*/
public double getLon() {
return lon_;
}
private void initFields() {
state_ = "";
name_ = "";
code_ = "";
lat_ = 0D;
lon_ = 0D;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasState()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasCode()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasLat()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasLon()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getStateBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getNameBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getCodeBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeDouble(4, lat_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeDouble(5, lon_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getStateBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getNameBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getCodeBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeDoubleSize(4, lat_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream
.computeDoubleSize(5, lon_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static AirportData.AirportDataProto.Airport parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static AirportData.AirportDataProto.Airport parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static AirportData.AirportDataProto.Airport parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static AirportData.AirportDataProto.Airport parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static AirportData.AirportDataProto.Airport parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static AirportData.AirportDataProto.Airport parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static AirportData.AirportDataProto.Airport parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static AirportData.AirportDataProto.Airport parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static AirportData.AirportDataProto.Airport parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static AirportData.AirportDataProto.Airport parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(AirportData.AirportDataProto.Airport prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code airportdata.Airport}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements AirportData.AirportDataProto.AirportOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return AirportData.AirportDataProto.internal_static_airportdata_Airport_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return AirportData.AirportDataProto.internal_static_airportdata_Airport_fieldAccessorTable
.ensureFieldAccessorsInitialized(
AirportData.AirportDataProto.Airport.class, AirportData.AirportDataProto.Airport.Builder.class);
}
// Construct using AirportData.AirportDataProto.Airport.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
state_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
name_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
code_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
lat_ = 0D;
bitField0_ = (bitField0_ & ~0x00000008);
lon_ = 0D;
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return AirportData.AirportDataProto.internal_static_airportdata_Airport_descriptor;
}
public AirportData.AirportDataProto.Airport getDefaultInstanceForType() {
return AirportData.AirportDataProto.Airport.getDefaultInstance();
}
public AirportData.AirportDataProto.Airport build() {
AirportData.AirportDataProto.Airport result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public AirportData.AirportDataProto.Airport buildPartial() {
AirportData.AirportDataProto.Airport result = new AirportData.AirportDataProto.Airport(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.state_ = state_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.code_ = code_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.lat_ = lat_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
result.lon_ = lon_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof AirportData.AirportDataProto.Airport) {
return mergeFrom((AirportData.AirportDataProto.Airport)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(AirportData.AirportDataProto.Airport other) {
if (other == AirportData.AirportDataProto.Airport.getDefaultInstance()) return this;
if (other.hasState()) {
bitField0_ |= 0x00000001;
state_ = other.state_;
onChanged();
}
if (other.hasName()) {
bitField0_ |= 0x00000002;
name_ = other.name_;
onChanged();
}
if (other.hasCode()) {
bitField0_ |= 0x00000004;
code_ = other.code_;
onChanged();
}
if (other.hasLat()) {
setLat(other.getLat());
}
if (other.hasLon()) {
setLon(other.getLon());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasState()) {
return false;
}
if (!hasName()) {
return false;
}
if (!hasCode()) {
return false;
}
if (!hasLat()) {
return false;
}
if (!hasLon()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
AirportData.AirportDataProto.Airport parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (AirportData.AirportDataProto.Airport) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required string state = 1;
private java.lang.Object state_ = "";
/**
* <code>required string state = 1;</code>
*/
public boolean hasState() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string state = 1;</code>
*/
public java.lang.String getState() {
java.lang.Object ref = state_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
state_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string state = 1;</code>
*/
public com.google.protobuf.ByteString
getStateBytes() {
java.lang.Object ref = state_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
state_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string state = 1;</code>
*/
public Builder setState(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
state_ = value;
onChanged();
return this;
}
/**
* <code>required string state = 1;</code>
*/
public Builder clearState() {
bitField0_ = (bitField0_ & ~0x00000001);
state_ = getDefaultInstance().getState();
onChanged();
return this;
}
/**
* <code>required string state = 1;</code>
*/
public Builder setStateBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
state_ = value;
onChanged();
return this;
}
// required string name = 2;
private java.lang.Object name_ = "";
/**
* <code>required string name = 2;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string name = 2;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string name = 2;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string name = 2;</code>
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
name_ = value;
onChanged();
return this;
}
/**
* <code>required string name = 2;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000002);
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <code>required string name = 2;</code>
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
name_ = value;
onChanged();
return this;
}
// required string code = 3;
private java.lang.Object code_ = "";
/**
* <code>required string code = 3;</code>
*/
public boolean hasCode() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string code = 3;</code>
*/
public java.lang.String getCode() {
java.lang.Object ref = code_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
code_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string code = 3;</code>
*/
public com.google.protobuf.ByteString
getCodeBytes() {
java.lang.Object ref = code_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
code_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string code = 3;</code>
*/
public Builder setCode(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
code_ = value;
onChanged();
return this;
}
/**
* <code>required string code = 3;</code>
*/
public Builder clearCode() {
bitField0_ = (bitField0_ & ~0x00000004);
code_ = getDefaultInstance().getCode();
onChanged();
return this;
}
/**
* <code>required string code = 3;</code>
*/
public Builder setCodeBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
code_ = value;
onChanged();
return this;
}
// required double lat = 4;
private double lat_ ;
/**
* <code>required double lat = 4;</code>
*/
public boolean hasLat() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required double lat = 4;</code>
*/
public double getLat() {
return lat_;
}
/**
* <code>required double lat = 4;</code>
*/
public Builder setLat(double value) {
bitField0_ |= 0x00000008;
lat_ = value;
onChanged();
return this;
}
/**
* <code>required double lat = 4;</code>
*/
public Builder clearLat() {
bitField0_ = (bitField0_ & ~0x00000008);
lat_ = 0D;
onChanged();
return this;
}
// required double lon = 5;
private double lon_ ;
/**
* <code>required double lon = 5;</code>
*/
public boolean hasLon() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required double lon = 5;</code>
*/
public double getLon() {
return lon_;
}
/**
* <code>required double lon = 5;</code>
*/
public Builder setLon(double value) {
bitField0_ |= 0x00000010;
lon_ = value;
onChanged();
return this;
}
/**
* <code>required double lon = 5;</code>
*/
public Builder clearLon() {
bitField0_ = (bitField0_ & ~0x00000010);
lon_ = 0D;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:airportdata.Airport)
}
static {
defaultInstance = new Airport(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:airportdata.Airport)
}
public interface AirportListOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// repeated .airportdata.Airport airport = 1;
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
java.util.List<AirportData.AirportDataProto.Airport>
getAirportList();
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
AirportData.AirportDataProto.Airport getAirport(int index);
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
int getAirportCount();
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
java.util.List<? extends AirportData.AirportDataProto.AirportOrBuilder>
getAirportOrBuilderList();
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
AirportData.AirportDataProto.AirportOrBuilder getAirportOrBuilder(
int index);
}
/**
* Protobuf type {@code airportdata.AirportList}
*/
public static final class AirportList extends
com.google.protobuf.GeneratedMessage
implements AirportListOrBuilder {
// Use AirportList.newBuilder() to construct.
private AirportList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private AirportList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final AirportList defaultInstance;
public static AirportList getDefaultInstance() {
return defaultInstance;
}
public AirportList getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private AirportList(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
airport_ = new java.util.ArrayList<AirportData.AirportDataProto.Airport>();
mutable_bitField0_ |= 0x00000001;
}
airport_.add(input.readMessage(AirportData.AirportDataProto.Airport.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
airport_ = java.util.Collections.unmodifiableList(airport_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return AirportData.AirportDataProto.internal_static_airportdata_AirportList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return AirportData.AirportDataProto.internal_static_airportdata_AirportList_fieldAccessorTable
.ensureFieldAccessorsInitialized(
AirportData.AirportDataProto.AirportList.class, AirportData.AirportDataProto.AirportList.Builder.class);
}
public static com.google.protobuf.Parser<AirportList> PARSER =
new com.google.protobuf.AbstractParser<AirportList>() {
public AirportList parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new AirportList(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<AirportList> getParserForType() {
return PARSER;
}
// repeated .airportdata.Airport airport = 1;
public static final int AIRPORT_FIELD_NUMBER = 1;
private java.util.List<AirportData.AirportDataProto.Airport> airport_;
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public java.util.List<AirportData.AirportDataProto.Airport> getAirportList() {
return airport_;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public java.util.List<? extends AirportData.AirportDataProto.AirportOrBuilder>
getAirportOrBuilderList() {
return airport_;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public int getAirportCount() {
return airport_.size();
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.Airport getAirport(int index) {
return airport_.get(index);
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.AirportOrBuilder getAirportOrBuilder(
int index) {
return airport_.get(index);
}
private void initFields() {
airport_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
for (int i = 0; i < getAirportCount(); i++) {
if (!getAirport(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < airport_.size(); i++) {
output.writeMessage(1, airport_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < airport_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, airport_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static AirportData.AirportDataProto.AirportList parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static AirportData.AirportDataProto.AirportList parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static AirportData.AirportDataProto.AirportList parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static AirportData.AirportDataProto.AirportList parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static AirportData.AirportDataProto.AirportList parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static AirportData.AirportDataProto.AirportList parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static AirportData.AirportDataProto.AirportList parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static AirportData.AirportDataProto.AirportList parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static AirportData.AirportDataProto.AirportList parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static AirportData.AirportDataProto.AirportList parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(AirportData.AirportDataProto.AirportList prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code airportdata.AirportList}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements AirportData.AirportDataProto.AirportListOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return AirportData.AirportDataProto.internal_static_airportdata_AirportList_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return AirportData.AirportDataProto.internal_static_airportdata_AirportList_fieldAccessorTable
.ensureFieldAccessorsInitialized(
AirportData.AirportDataProto.AirportList.class, AirportData.AirportDataProto.AirportList.Builder.class);
}
// Construct using AirportData.AirportDataProto.AirportList.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getAirportFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (airportBuilder_ == null) {
airport_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
airportBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return AirportData.AirportDataProto.internal_static_airportdata_AirportList_descriptor;
}
public AirportData.AirportDataProto.AirportList getDefaultInstanceForType() {
return AirportData.AirportDataProto.AirportList.getDefaultInstance();
}
public AirportData.AirportDataProto.AirportList build() {
AirportData.AirportDataProto.AirportList result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public AirportData.AirportDataProto.AirportList buildPartial() {
AirportData.AirportDataProto.AirportList result = new AirportData.AirportDataProto.AirportList(this);
int from_bitField0_ = bitField0_;
if (airportBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
airport_ = java.util.Collections.unmodifiableList(airport_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.airport_ = airport_;
} else {
result.airport_ = airportBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof AirportData.AirportDataProto.AirportList) {
return mergeFrom((AirportData.AirportDataProto.AirportList)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(AirportData.AirportDataProto.AirportList other) {
if (other == AirportData.AirportDataProto.AirportList.getDefaultInstance()) return this;
if (airportBuilder_ == null) {
if (!other.airport_.isEmpty()) {
if (airport_.isEmpty()) {
airport_ = other.airport_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAirportIsMutable();
airport_.addAll(other.airport_);
}
onChanged();
}
} else {
if (!other.airport_.isEmpty()) {
if (airportBuilder_.isEmpty()) {
airportBuilder_.dispose();
airportBuilder_ = null;
airport_ = other.airport_;
bitField0_ = (bitField0_ & ~0x00000001);
airportBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getAirportFieldBuilder() : null;
} else {
airportBuilder_.addAllMessages(other.airport_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getAirportCount(); i++) {
if (!getAirport(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
AirportData.AirportDataProto.AirportList parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (AirportData.AirportDataProto.AirportList) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// repeated .airportdata.Airport airport = 1;
private java.util.List<AirportData.AirportDataProto.Airport> airport_ =
java.util.Collections.emptyList();
private void ensureAirportIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
airport_ = new java.util.ArrayList<AirportData.AirportDataProto.Airport>(airport_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
AirportData.AirportDataProto.Airport, AirportData.AirportDataProto.Airport.Builder, AirportData.AirportDataProto.AirportOrBuilder> airportBuilder_;
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public java.util.List<AirportData.AirportDataProto.Airport> getAirportList() {
if (airportBuilder_ == null) {
return java.util.Collections.unmodifiableList(airport_);
} else {
return airportBuilder_.getMessageList();
}
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public int getAirportCount() {
if (airportBuilder_ == null) {
return airport_.size();
} else {
return airportBuilder_.getCount();
}
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.Airport getAirport(int index) {
if (airportBuilder_ == null) {
return airport_.get(index);
} else {
return airportBuilder_.getMessage(index);
}
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder setAirport(
int index, AirportData.AirportDataProto.Airport value) {
if (airportBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAirportIsMutable();
airport_.set(index, value);
onChanged();
} else {
airportBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder setAirport(
int index, AirportData.AirportDataProto.Airport.Builder builderForValue) {
if (airportBuilder_ == null) {
ensureAirportIsMutable();
airport_.set(index, builderForValue.build());
onChanged();
} else {
airportBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder addAirport(AirportData.AirportDataProto.Airport value) {
if (airportBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAirportIsMutable();
airport_.add(value);
onChanged();
} else {
airportBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder addAirport(
int index, AirportData.AirportDataProto.Airport value) {
if (airportBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAirportIsMutable();
airport_.add(index, value);
onChanged();
} else {
airportBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder addAirport(
AirportData.AirportDataProto.Airport.Builder builderForValue) {
if (airportBuilder_ == null) {
ensureAirportIsMutable();
airport_.add(builderForValue.build());
onChanged();
} else {
airportBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder addAirport(
int index, AirportData.AirportDataProto.Airport.Builder builderForValue) {
if (airportBuilder_ == null) {
ensureAirportIsMutable();
airport_.add(index, builderForValue.build());
onChanged();
} else {
airportBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder addAllAirport(
java.lang.Iterable<? extends AirportData.AirportDataProto.Airport> values) {
if (airportBuilder_ == null) {
ensureAirportIsMutable();
super.addAll(values, airport_);
onChanged();
} else {
airportBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder clearAirport() {
if (airportBuilder_ == null) {
airport_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
airportBuilder_.clear();
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public Builder removeAirport(int index) {
if (airportBuilder_ == null) {
ensureAirportIsMutable();
airport_.remove(index);
onChanged();
} else {
airportBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.Airport.Builder getAirportBuilder(
int index) {
return getAirportFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.AirportOrBuilder getAirportOrBuilder(
int index) {
if (airportBuilder_ == null) {
return airport_.get(index); } else {
return airportBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public java.util.List<? extends AirportData.AirportDataProto.AirportOrBuilder>
getAirportOrBuilderList() {
if (airportBuilder_ != null) {
return airportBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(airport_);
}
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.Airport.Builder addAirportBuilder() {
return getAirportFieldBuilder().addBuilder(
AirportData.AirportDataProto.Airport.getDefaultInstance());
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public AirportData.AirportDataProto.Airport.Builder addAirportBuilder(
int index) {
return getAirportFieldBuilder().addBuilder(
index, AirportData.AirportDataProto.Airport.getDefaultInstance());
}
/**
* <code>repeated .airportdata.Airport airport = 1;</code>
*/
public java.util.List<AirportData.AirportDataProto.Airport.Builder>
getAirportBuilderList() {
return getAirportFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
AirportData.AirportDataProto.Airport, AirportData.AirportDataProto.Airport.Builder, AirportData.AirportDataProto.AirportOrBuilder>
getAirportFieldBuilder() {
if (airportBuilder_ == null) {
airportBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
AirportData.AirportDataProto.Airport, AirportData.AirportDataProto.Airport.Builder, AirportData.AirportDataProto.AirportOrBuilder>(
airport_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
airport_ = null;
}
return airportBuilder_;
}
// @@protoc_insertion_point(builder_scope:airportdata.AirportList)
}
static {
defaultInstance = new AirportList(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:airportdata.AirportList)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_airportdata_Airport_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_airportdata_Airport_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
internal_static_airportdata_AirportList_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_airportdata_AirportList_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021airportdata.proto\022\013airportdata\"N\n\007Airp" +
"ort\022\r\n\005state\030\001 \002(\t\022\014\n\004name\030\002 \002(\t\022\014\n\004code" +
"\030\003 \002(\t\022\013\n\003lat\030\004 \002(\001\022\013\n\003lon\030\005 \002(\001\"4\n\013Airp" +
"ortList\022%\n\007airport\030\001 \003(\0132\024.airportdata.A" +
"irportB\037\n\013AirportDataB\020AirportDataProto"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_airportdata_Airport_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_airportdata_Airport_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_airportdata_Airport_descriptor,
new java.lang.String[] { "State", "Name", "Code", "Lat", "Lon", });
internal_static_airportdata_AirportList_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_airportdata_AirportList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_airportdata_AirportList_descriptor,
new java.lang.String[] { "Airport", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}
| [
"adgeria@gmail.com"
] | adgeria@gmail.com |
ad25e2649bc9020fae8867cb38a19a75db60de33 | 5b9732ef5cb32bcbb853ff82c19be77fd938573a | /app/src/main/java/com/udacity/bakingapp/data/RecipeAdapter.java | db4fa06a1c6e2229b00a01496f1f93a687d034c8 | [] | no_license | jerielng/baking-app | 1e070623f4020918e840651c1654ac13a03a19cd | e8061c9e47b09d7f12faaf59ce63fcd9f9a20987 | refs/heads/master | 2020-03-16T17:55:17.692477 | 2018-05-21T03:37:03 | 2018-05-21T03:37:03 | 132,852,235 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,300 | java | package com.udacity.bakingapp.data;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.udacity.bakingapp.DetailActivity;
import com.udacity.bakingapp.R;
import com.udacity.bakingapp.RecipeWidgetProvider;
import com.udacity.bakingapp.model.Ingredient;
import com.udacity.bakingapp.model.Recipe;
import com.udacity.bakingapp.model.RecipeStep;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class RecipeAdapter extends RecyclerView.Adapter<RecipeAdapter.RecipeAdapterViewHolder> {
public Context mContext;
private ArrayList<Recipe> mRecipeList;
public class RecipeAdapterViewHolder extends RecyclerView.ViewHolder {
public LinearLayout mViewContainer;
public ImageView mImageView;
public TextView mTitleView;
public RecipeAdapterViewHolder(LinearLayout view) {
super(view);
mViewContainer = view;
mTitleView = new TextView(mContext);
mImageView = new ImageView(mContext);
mViewContainer.addView(mImageView);
mViewContainer.addView(mTitleView);
}
}
public RecipeAdapter(Context context, String jsonString) {
mContext = context;
mRecipeList = new ArrayList<>();
extractRecipes(jsonString);
}
@NonNull
@Override
public RecipeAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LinearLayout recipeViewContainer = new LinearLayout(mContext);
LinearLayout.LayoutParams cardParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
cardParams.setMargins(20, 20, 20, 20);
recipeViewContainer.setLayoutParams(cardParams);
recipeViewContainer.setPadding(0, 50, 0, 50);
recipeViewContainer.setBackgroundResource(R.color.cardBack);
RecipeAdapterViewHolder recipeCard = new RecipeAdapterViewHolder(recipeViewContainer);
return recipeCard;
}
@Override
public void onBindViewHolder(@NonNull RecipeAdapterViewHolder holder, final int position) {
final Recipe recipeAt = mRecipeList.get(position);
/*Image loading */
LinearLayout.LayoutParams imageParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
imageParams.weight = 1f;
imageParams.gravity = Gravity.CENTER;
holder.mImageView.setLayoutParams(imageParams);
Picasso.get()
.load(Uri.parse(recipeAt.getmImageUrl()))
.placeholder(R.drawable.default_icon)
.error(R.drawable.default_icon)
.into(holder.mImageView);
/* Recipe text loading */
LinearLayout.LayoutParams textParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
textParams.weight = 2f;
textParams.gravity = Gravity.CENTER;
holder.mTitleView.setLayoutParams(textParams);
holder.mTitleView.setText(recipeAt.getmRecipeName());
holder.mTitleView.
append("\n" + Integer.toString(recipeAt.getmServingSize()) + " servings");
holder.mTitleView.setTextAppearance(mContext, R.style.RecipeCardText);
holder.mTitleView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
/* Setting click listeners */
holder.mViewContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent widgetIntent = new Intent(mContext, RecipeWidgetProvider.class);
widgetIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
widgetIntent.putExtra
(mContext.getString(R.string.recipe_name), recipeAt.getmRecipeName());
widgetIntent.putExtra
(mContext.getString
(R.string.ingredients_text), recipeAt.getmIngredientsList());
Intent detailIntent = new Intent(mContext, DetailActivity.class);
detailIntent.putExtra
(mContext.getString(R.string.recipe_object), recipeAt);
mContext.sendBroadcast(widgetIntent);
mContext.startActivity(detailIntent);
}
});
}
@Override
public int getItemCount() {
return mRecipeList.size();
}
public void extractRecipes(String jsonResponse) {
try {
JSONArray recipeJson = new JSONArray(jsonResponse);
for (int i = 0; i < recipeJson.length(); i++) {
String newRecipeName = recipeJson.getJSONObject(i)
.getString(mContext.getString(R.string.name_param));
int newServingSize = recipeJson.getJSONObject(i)
.getInt(mContext.getString(R.string.servings_param));
JSONArray ingredientsJson
= recipeJson.getJSONObject(i)
.getJSONArray(mContext.getString(R.string.ingredients_param));
JSONArray recipeStepsJson
= recipeJson.getJSONObject(i)
.getJSONArray(mContext.getString(R.string.steps_param));
ArrayList<Ingredient> mIngredientList = new ArrayList<>();
ArrayList<RecipeStep> mRecipeStepList = new ArrayList<>();
for (int j = 0; j < ingredientsJson.length(); j++) {
JSONObject objectAt = ingredientsJson.getJSONObject(j);
double newQuantity =
objectAt.getDouble(mContext.getString(R.string.quantity_param));
String newMeasure =
objectAt.getString(mContext.getString(R.string.measure_param));
String newIngredientName =
objectAt.getString(mContext.getString(R.string.ingredient_param));
Ingredient newIngredient
= new Ingredient(newQuantity, newMeasure, newIngredientName);
mIngredientList.add(newIngredient);
}
for (int k = 0; k < recipeStepsJson.length(); k++) {
JSONObject objectAt = recipeStepsJson.getJSONObject(k);
int newId =
objectAt.getInt(mContext.getString(R.string.id_param));
String newShortDescription =
objectAt.getString
(mContext.getString(R.string.short_description_param));
String newDescription =
objectAt.getString(mContext.getString(R.string.description_param));
String newVideoUrl =
objectAt.getString(mContext.getString(R.string.video_param));
String newThumbnailUrl =
objectAt.getString(mContext.getString(R.string.thumbnail_param));
RecipeStep newRecipeStep
= new RecipeStep(newId, newShortDescription,
newDescription, newVideoUrl, newThumbnailUrl);
mRecipeStepList.add(newRecipeStep);
}
String newImageUrl = recipeJson.getJSONObject(i)
.getString(mContext.getString(R.string.image_param));
mRecipeList.add(new Recipe
(newRecipeName, newServingSize,
mIngredientList, mRecipeStepList, newImageUrl));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
| [
"jeriel.ng@gmail.com"
] | jeriel.ng@gmail.com |
6da9767b85e455400816fc543f37085522465435 | 0134a8c3dc1264fe71384801194f53d8b3f16383 | /src/java/umg/analisisdesistemas1/com/controlador/ControladorCuentasActivo.java | b9400083e7b20707e0a1da63ad206a8066b4e0ea | [] | no_license | amenpunk/COOPO | 6f54ce54c9ee05c73444ebb2ac45a338bd79bef8 | 4e6b9d48fb2ca15516a812bb0a984f7961334710 | refs/heads/master | 2020-05-29T12:04:43.947966 | 2019-06-03T15:43:41 | 2019-06-03T15:43:41 | 189,123,968 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,421 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package umg.analisisdesistemas1.com.controlador;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.io.PrintWriter;
import static java.lang.System.out;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import umg.analisisdesistemas1.com.modelo.ModeloCuentaContable;
import umg.analisisdesistemas1.com.modelo.ModeloMenu;
import umg.analisisdesistemas1.com.modelo.ModeloUsuario;
import umg.analisisdesistemas1.com.objeto.Conexion;
import umg.analisisdesistemas1.com.objeto.CuentaContable;
/**
*
* @author DELLMAYORGA
*/
public class ControladorCuentasActivo extends HttpServlet {
private Conexion con = new Conexion();
private ModeloCuentaContable modeloCuentaContable = null;
//@javax.annotation.Resource(name = "pool_conexiones")
private DataSource ds;
private String mensaje = "";
@Override
public void init() throws ServletException {
super.init(); //To change body of generated methods, choose Tools | Templates.
try {
modeloCuentaContable = new ModeloCuentaContable();
} catch (Exception ex) {
throw new ServletException(ex);
}
}
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//processRequest(request, response);
int tipo_cuenta = 0; //1. activos, 2. pasivos, 3. gastos
String listaActivos = "";
try {
tipo_cuenta = Integer.valueOf(request.getParameter("tipo_cuenta"));
PrintWriter out = response.getWriter();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
//Hago una eleccion de lo que va a enviar el controlador al javascript
if (tipo_cuenta == 1) { //si el tipo de cuenta es activo
ArrayList<CuentaContable> listaCuentaActivos = new ArrayList<CuentaContable>();
listaCuentaActivos = modeloCuentaContable.obtenerListaCuentaContable(tipo_cuenta); //obtengo la lista de cuenta de activos
Gson gsonActivos = new Gson();
listaActivos = gsonActivos.toJson(listaCuentaActivos);
response.getWriter().write(listaActivos);
}
} catch (Exception e) {
} finally {
out.flush();
}
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"ondasycircuitos@gmail.com"
] | ondasycircuitos@gmail.com |
d0feaebbefaf10a4512d88f52e5db812f004af7a | 55e976c31e2270234a8dd3d6aba61f32e3b2c0da | /src/com/practice/TriangleProblem.java | 0347c449cab8dbc79c2aca140e7336915377c9c2 | [] | no_license | patnav33/PracticeLI | 235fad8a892b4bdb75eae6f8dd00e23f546a328c | 1bc514458c3e9f5b4c8b0398d5df27621bf4e72a | refs/heads/master | 2021-01-20T00:39:46.992196 | 2017-04-23T19:02:06 | 2017-04-23T19:02:06 | 89,165,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | package com.practice;
import java.util.Arrays;
public class TriangleProblem {
public static void main(String args[]){
// int [] array = {1,2,3,4,5,6,7,8,9,10};
int[] array = {10, 5, 3, 7, 4, 1};
getTriangleSides(array);
}
public static int[] getTriangleSides(int[] array){
int[] validSides = new int[array.length];
Arrays.sort(array);
int length = array.length;
for(int k= length - 1; k >2 ;k--){
if( array[k-2] + array[k-1] > array[k] && array[k] + array[k-1] > array[k-2] && array[k-2] + array[k] > array[k-1] ){
validSides[0] = array[k-2];
validSides[1] = array[k-1];
validSides[2] = array[k];
System.out.println("a:" + validSides[0] + " b:" + validSides[1] + " c:" + validSides[2]);
}
}
return validSides;
}
}
| [
"patilnavin33@gmail.com"
] | patilnavin33@gmail.com |
bc1eb4b7197c68931f8f1b7ecd199b0f0f866d03 | fc865501bf4a35a6276c2e8f467f5f96f836912c | /system/src/main/java/com/ssm/extensible/base/IServiceListener.java | b7fe92cf2ad40c6920258bef7c4568142f0c51df | [] | no_license | meixl528/Project | a8f1298dda50977d8f3074aef1de688a532e5926 | 12ec0ace43503ffb951206e69fcf01a1cae69054 | refs/heads/master | 2020-04-05T14:39:00.982290 | 2017-08-31T02:31:07 | 2017-08-31T02:31:07 | 94,721,781 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | package com.ssm.extensible.base;
import com.ssm.core.request.IRequest;
/**
*/
public interface IServiceListener<T> {
void beforeInsert(IRequest request, T record, ServiceListenerChain<T> chain);
void afterInsert(IRequest request, T record, ServiceListenerChain<T> chain);
void beforeUpdate(IRequest request, T record, ServiceListenerChain<T> chain);
void afterUpdate(IRequest request, T record, ServiceListenerChain<T> chain);
void beforeDelete(IRequest request, T record, ServiceListenerChain<T> chain);
void afterDelete(IRequest request, T record, ServiceListenerChain<T> chain);
}
| [
"meixl@sunshinepaper.com.cn"
] | meixl@sunshinepaper.com.cn |
1e8688a615ee7cc3b8d1daa8ef678b160d33e9d7 | 9f9e16053b72d9f490fa1bafcb406cdce1122d3d | /zjb-common/src/main/java/com/zjb/common/po/OrderItem.java | a3fa68ff07192f74ccbbd46e38bd40ec209801fb | [] | no_license | hbxiaobai/ZJB | 7f9291abdfe44361eb7077eb8135b26161242263 | e629c73683fa9b4a72772689eaae6a3b06f81fc3 | refs/heads/master | 2020-04-04T19:56:00.180217 | 2018-11-05T13:59:45 | 2018-11-05T13:59:45 | 156,226,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package com.zjb.common.po;
import java.util.Date;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name="tb_order_item")
public class OrderItem {
@Id
private String itemId; //通过itemId和OrderId表示订单商品
@Id
private String orderId;
private Integer num;
private String title;
private Long price;
private Long totalFee;
private String picPath;
private Date created;
private Date updated;
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getPrice() {
return price;
}
public void setPrice(Long price) {
this.price = price;
}
public Long getTotalFee() {
return totalFee;
}
public void setTotalFee(Long totalFee) {
this.totalFee = totalFee;
}
public String getPicPath() {
return picPath;
}
public void setPicPath(String picPath) {
this.picPath = picPath;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
} | [
"hbxbai@163.com"
] | hbxbai@163.com |
95f3f4b4c6681b9c605a459693217fffdbade9ab | b35191cc9ef19ec6cfbff0ab3639864001680bf5 | /Discrete math/2 module/Modules.java | e417a1baf170a83dc1eb47e79adab5f6ec6f83bd | [] | no_license | vlad333rrty/BMSTU | 81a1ee2bafe21ab02399910ed8f996697a92bc6d | f323d02bcc9a46fec669d32e033752d5feaf586b | refs/heads/master | 2023-08-14T21:04:13.893303 | 2021-09-10T18:32:45 | 2021-09-10T18:32:45 | 273,018,174 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,652 | java | import java.util.*;
public class Modules {
private static Vertex[] vertex = new Vertex[500];
private static int ind;
private static int time = 1;
private static int count = 1;
private static ArrayList<Function> funcs = new ArrayList<>();
private static ArrayList<String> list;
private static int curlex;
private static Function currentFunc;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
scan.useDelimiter("\\Z");
String input = scan.next();
list = lexer(input);
if (!parse()) {
System.out.println("error");
return;
}
Tarjan();
System.out.println(count - 1);
}
private static ArrayList<String> lexer(String input) {
ArrayList<String> list = new ArrayList<>();
int n = input.length();
boolean flag = true;
String cur = "";
for (int i = 0; i < n; ) {
if (Character.isWhitespace(input.charAt(i))) {
i++;
continue;
}
if (Character.isDigit(input.charAt(i))) {
StringBuilder temp = new StringBuilder();
while (i < n && Character.isDigit(input.charAt(i)))
temp.append(input.charAt(i++));
list.add(temp.toString());
continue;
}
if (Character.isLetter(input.charAt(i))) {
StringBuilder temp = new StringBuilder();
while (i < n && (Character.isLetter(input.charAt(i)) || Character.isDigit(input.charAt(i))))
temp.append(input.charAt(i++));
if (i < n && input.charAt(i) == '(') {
int k=i;
String name=temp.toString();
if (lookup(temp.toString()) == null) {
vertex[ind] = new Vertex(name, ind++);
}
char delimiter;
if (flag) {
cur = temp.toString();
delimiter = ':';
} else {
vertex[lookup(cur).getNumber()].getList().add(lookup(name).getNumber());
delimiter = ';';
}
int a=0;
ArrayList<String> args=new ArrayList<>();
while (i < n && input.charAt(i) != delimiter && input.charAt(i) != ':') {
char c=input.charAt(i);
if (c==',')
a++;
if (Character.isLetter(c))
args.add(c+"");
i++;
}
if (args.isEmpty())
a=-1;
if (flag){
Function f=new Function(name,a+1);
f.setArgList(args);
funcs.add(f);
}
flag=false;
i=k;
}
list.add(temp.toString());
} else {
if (input.charAt(i) == ':' && input.charAt(i + 1) == '=') {
list.add(input.charAt(i) + "" + input.charAt(++i));
i++;
continue;
}
if (input.charAt(i) == ';') {
flag = true;
list.add(input.charAt(i++) + "");
} else {
if (comps(input.charAt(i)) && comps(input.charAt(i + 1))) {
list.add(input.charAt(i) + "" + input.charAt(++i));
i++;
continue;
}
list.add(input.charAt(i++) + "");
}
}
}
return list;
}
private static Vertex lookup(String name) {
for (int i = 0; i < ind; i++)
if (vertex[i].getName().equals(name))
return vertex[i];
return null;
}
private static void Tarjan() {
Stack<Vertex> s = new Stack<>();
for (int i = 0; i < ind; i++) {
if (vertex[i].getT1() == 0)
visitVertex(vertex[i], s);
}
}
private static void visitVertex(Vertex v, Stack<Vertex> stack) {
v.setT1(time);
v.setLow(time++);
stack.push(v);
for (int i = 0; i < v.getList().size(); i++) {
Vertex u = vertex[v.getList().get(i)];
if (u.getT1() == 0)
visitVertex(u, stack);
if (u.getComp() == 0 && v.getLow() > u.getLow())
v.setLow(u.getLow());
}
if (v.getT1() == v.getLow()) {
Vertex u;
do {
u = stack.pop();
u.setComp(count);
} while (u != v);
count++;
}
}
private static boolean comps(char c) {
return c == '<' || c == '>' || c == '=';
}
private static boolean comparison(String s) {
return s.equals(">") || s.equals("<") || s.equals(">=") || s.equals("<=") || s.equals("<>") || s.equals("=");
}
private static Function has(String name) {
for (Function f : funcs) {
if (f.getName().equals(name))
return f;
}
return null;
}
private static boolean parse(){
while (curlex<list.size()){
String name=list.get(curlex++);
if ((currentFunc=has(name))==null)
return false;
if (!parseAr())
return false;
if (!parseExpr())
return false;
if (!list.get(curlex++).equals(";"))
return false;
}
return true;
}
private static boolean parseAr(){
return list.get(curlex++).equals("(")
&& parsePrn(currentFunc)
&& list.get(curlex++).equals(")")
&& list.get(curlex++).equals(":=");
}
private static boolean parsePrn(Function f){
if (list.get(curlex).equals(")"))
return true;
boolean a=parseExpr();
int args=0;
while (a && list.get(curlex).equals(",")){
curlex++;
args++;
if (args+1>f.getArgs())
return false;
a=parseExpr();
}
return a;
}
private static boolean parseExpr(){
boolean a=parseC();
if (!a)
return false;
if (list.get(curlex).equals("?")){
curlex++;
return parseC() && list.get(curlex++).equals(":") && parseExpr();
}
return true;
}
private static boolean parseC(){
boolean a=parseArth();
if (a && comparison(list.get(curlex))){
curlex++;
a=parseArth();
}
return a;
}
private static boolean parseArth(){
boolean a=parseT();
while (a && (list.get(curlex).equals("+") || list.get(curlex).equals("-"))){
curlex++;
a=parseT();
}
return a;
}
private static boolean parseT(){
boolean a=parseF();
while (a && curlex<list.size() && (list.get(curlex).equals("*") || list.get(curlex).equals("/"))){
curlex++;
a=parseF();
}
return a && curlex<list.size();
}
private static boolean parseF(){
boolean res;
Function f;
if (curlex>=list.size())
return false;
if (list.get(curlex).equals("-")){
curlex++;
res=parseF();
}else {
if (Character.isDigit(list.get(curlex).charAt(0))
|| currentFunc.getArgList().contains(list.get(curlex))) {
curlex++;
return true;
}
if ((f = has(list.get(curlex))) != null) {
curlex++;
return list.get(curlex++).equals("(")
&& parsePrn(f)
&& list.get(curlex++).equals(")");
}
if (list.get(curlex).equals("(")) {
curlex++;
res = parseExpr();
if (curlex < list.size() && list.get(curlex).equals(")"))
curlex++;
else
return false;
} else
return false;
}
return res;
}
}
class Vertex{
private String name;
private ArrayList<Integer> list;
private int number;
private int low,t1,comp;
Vertex(String n,int num){
name=n;
number=num;
low=t1=comp=0;
list=new ArrayList<>();
}
ArrayList<Integer> getList(){
return list;
}
String getName(){
return name;
}
int getNumber(){
return number;
}
int getLow(){
return low;
}
int getT1(){
return t1;
}
void setLow(int l){
low=l;
}
void setT1(int t){
t1=t;
}
void setComp(int comp) {
this.comp = comp;
}
int getComp() {
return comp;
}
}
class Function{
private int args;
private String name;
private ArrayList<String> argList;
Function(String x,int y){
name=x;
args=y;
argList=new ArrayList<>();
}
int getArgs() {
return args;
}
String getName(){
return name;
}
ArrayList<String> getArgList(){
return argList;
}
void setArgList(ArrayList<String> argList) {
this.argList = argList;
}
}
| [
"vlad333rrty90@mail.ru"
] | vlad333rrty90@mail.ru |
87fac41b6322a501413e1df6fd3a5d1cc8bebbc6 | c444c305864c67fb5bac894da4e54c186c045cbe | /src/leetcode/easy/no26.java | a51da5c6e1946f35dd9b057aeede5cc7ae69c814 | [] | no_license | AaronX123/mashibing | fe0beb37f473c7f73489b9beb9ba25ce3d15879b | 31981705746fbb18b0a004ccb0cd30fcf52eaabe | refs/heads/master | 2023-04-14T07:52:18.198816 | 2021-04-18T14:15:26 | 2021-04-18T14:15:26 | 299,470,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | package leetcode.easy;
public class no26 {
public int removeDuplicates(int[] nums) {
int count = 1;
for (int i = 0; i < nums.length; ++i) {
// 找到后面第一个不同的位置
int j = i + 1;
for (; j < nums.length; j++) {
if (nums[i] == nums[j]) {
continue;
}
break;
}
// 将第一个不同的位置元素放到i后面,然后i变成第一不同位置后
if (count < nums.length && j < nums.length) {
nums[count] = nums[j];
i = j - 1;
count++;
}
}
return count;
}
public static void main(String[] args) {
System.out.println(new no26().removeDuplicates(new int[] {1,1,1,2,2,2,2,2,3,3,3,4}));
}
}
| [
"739243573@qq.com"
] | 739243573@qq.com |
217e112ddbd4bb454f06e53b16e5796c7d4d4952 | f6bd4e0c99e78215176ad3d399c96a24a8a8bb7b | /BookPrograms/src/bookprograms/GridLabApplet.java | 273a4963c45af233922fde502021353cd747e9b7 | [] | no_license | imehsans/OOPPractice | d90f9533da9db40dc8a93bc470d4c4149374cb85 | d644607891f4e21e25acf54cd74fe5ac2cc281f6 | refs/heads/master | 2023-01-22T10:07:42.733279 | 2020-11-22T06:17:53 | 2020-11-22T06:17:53 | 303,298,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package bookprograms;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author Ehsan Jadoon
*/
public class GridLabApplet extends Applet {
@Override
public void init(){
ButtonPanel buttonPanel=new ButtonPanel(this);
Picker picker=new Picker(buttonPanel);
setLayout(new Boardlayout());
add(new Box(picker, "Grid layout Settings"), "North")
add(buttonPanel, "Center");
}
}
| [
"mehsanjadoon786@gmail.com"
] | mehsanjadoon786@gmail.com |
2b2253fcc5824af9618f975b230ec9daa8bb5c5d | ba8d156d1cabebcaa923c817489f75776d398e9d | /src/test/java/org/punit/framework/domain/PunitTestCaseTest.java | 5d8fbbfaf43f219bbc4f95877e437ab512b37ac6 | [] | no_license | athulrajeev/punit | 2cb39d81c7e9a85034e64b2f9b72b9e34fbffc9b | fff130b0a8715dceaf8375a1e39a8f44409ea04d | refs/heads/master | 2021-01-12T09:31:43.242971 | 2016-12-13T02:23:40 | 2016-12-13T02:23:40 | 76,180,705 | 0 | 0 | null | 2016-12-13T02:23:41 | 2016-12-11T14:52:07 | Java | UTF-8 | Java | false | false | 836 | java | package org.punit.framework.domain;
import static org.junit.Assert.*;
import org.junit.Test;
import org.punit.impl.sample.testcase.SampleTestCase6;
import punit.framework.domain.PunitTestCase;
public class PunitTestCaseTest {
@Test
public void test_loadTestScenarios_given_junit_test_case_object_then_success() {
// Arrange
final SampleTestCase6 junitTestCase = new SampleTestCase6();
final int threadCount = 100;
// Act
PunitTestCase testCase = new PunitTestCase(junitTestCase, threadCount);
// Assert
assertEquals("The number of junit test case should be as expected", 2, testCase.getTestScenarioList().size());
assertEquals("The test case should be as expected", junitTestCase, testCase.getTestCase());
assertEquals("The thread count should be as expected", threadCount, testCase.getThreadCount());
}
}
| [
"athul.rajeev@emc.com"
] | athul.rajeev@emc.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.